text:
<!DOCTYPE html>

  {% set site_title = getSetting('site_name')%}
  {% set site_description = getSetting('site_description')%}
  {% set analytics_id = getSetting('analytics_id')%}

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>{% block title %}{{ site_title }}{% endblock %}</title>
    <meta name="description" content="{% block description %}{{ site_description }}{% endblock %}">
    <meta name="viewport" content="width=device-width">

    <link rel="shortcut icon" href="/static/images/favicon.png">
    <link rel="apple-touch-icon" href="/static/images/touch-icon.png">

    <link rel="stylesheet" href="/static/css/main.css"/>

    {# Useful block for loading outside scripts in other pages. #}
    {% block head_extra %}{% endblock %}

    {% block body %}

      {% block header %}
        {% include "templates/partials/header.html" %}
      {% endblock %}

      {# By default, your inner pages will load into this block. #}
      {% block content %}{% endblock %}

      {% block footer %}
        {% include "templates/partials/footer.html" %}
      {% endblock %}

      {% block scripts_extra %}{% endblock %}

      {# Google Analytics code. Feel free to remove. #}

    {% endblock %}


text:
// Originally submitted to OSEHRA 2/21/2017 by DSS, Inc.
// Authored by DSS, Inc. 2014-2017

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VA.Gov.Artemis.UI.Data.Models.Patient;

namespace VA.Gov.Artemis.UI.Data.Models.Education
{
    public class PatientEducationItemDetail: PatientRelatedModel
    {
        public PatientEducationItem Item { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
//common useful functions

var utils = {}

utils.encodeCSV = function(txt){
    return txt.replace(/,/g, "¸").replace(/(\r\n|\n|\r)/gm," ");
}

utils.exportCSV = function(csv, title){

    var link = $("#export_link");
    if(link.length==0){
    	$("body").append('');
    	setTimeout(function(){utils.exportCSV(csv);},100);
    	return;
    }
	link.attr("download", title+".csv");

	link.attr("href", 'data:text/csv;charset=utf-8,' + encodeURIComponent(csv));
	setTimeout(function(){
	    link[0].click();
	    link.attr("href","");
	},100);
}

utils.weeklyReload = function(){
	//weekly reload minimizes memory leaks
    setTimeout(function(){
      location.reload();
    }, 7*24*60*60*1000);
}

/*to use:
1. include jquery-ui
2. add class="hidden" to dialog
*/
function dialog(params){

    //jquery-ui dialog
    //to use: dialog{title:... , message:...}

    var id = params.id || "dialog";

    if(id==="dialog"){
        $("#"+id).html(params.message);
    }

    if($("#"+id).length==0){
        $("body").append('

');
        setTimeout(function(){dialog(params);},100);
        return;
    }

    var buttons = {};

    if(params.buttons != null){
        buttons = {
            Cancel: function() {
                $(this).dialog("close");
            }
        }
        $.extend(buttons, params.buttons);
    }

    var di = $("#"+id).dialog({
        show: { effect: "fade", duration: 500 },
        hide: { effect: "fade", duration: 500 },
        title: params.title,
        width:  params.width || 'auto',
        dialogClass: params.class || '',
        buttons : buttons,
        closeOnEscape: true,
        modal:true,
        open: function(){
            $('.ui-widget-overlay').bind('click',function(){
                $("#"+id).dialog('close');
            });

            $(document).trigger( "dialogOpen", id);
        }
    });

    //add css
    di = di.parent();
    di.addClass("box");
    di.find(".ui-dialog-titlebar-close, button").addClass("minor_button");
    if(di.find('.ui-dialog-buttonset button').length>1){
        di.find(".ui-dialog-buttonset button:last-child").removeClass("minor_button").addClass("major_button");
    }
};

function message(str, cls){
    //show message tooltip
    //to use: need div class="top" on top of page

    $(".top").attr("title","").tooltip({
        content: str,
        tooltipClass: cls || "message"
    }).tooltip("open");

    $(".ui-tooltip").bind('click', function(){
        $(".top").tooltip("close");
    });

    setTimeout(function(){
        $(".top").tooltip({content: ''}).tooltip( "close" );
    },5000);
};

function error(str){
    message(str, "error");
}

function displayDate(ts, timezone){

    if(undefined == timezone){
        timezone = -1*(new Date()).getTimezoneOffset()*60*1000;
    }

    var display = new Date( Date.parse(ts) + (1*timezone));
    display = display.toUTCString();
    //Mon, 19 Jan 2015 13:30:00 GMT

    var time = display.substring(display.indexOf(":")-2, display.lastIndexOf(":"));

    //19 Jan 13:30
    var date = display.substring(display.indexOf(",")+2, display.indexOf(":"));
    date=date.substring(0,date.lastIndexOf(" "));
    date=date.substring(0,date.lastIndexOf(" "));

    return date+" "+time;
}


text:
---
layout: post
title:  "Android Verification Code View"
date:   2016-12-22 15:07
categories: Android
comments: true
description: Android Verification Code View
---

* content
{:toc}

## 本文

[http://afra55.github.io/2016/12/22/verification_code_view/](http://afra55.github.io/2016/12/22/verification_code_view/)

## 图示

![](https://raw.githubusercontent.com/Afra55/Afra55.github.io/master/blog_picture/view/VerificationCodeView.png)

![](https://raw.githubusercontent.com/Afra55/Afra55.github.io/master/blog_picture/view/VerificationCodeViewTesting.gif)

## 前情提要

思路是用一个横向的 LinearLayout 包 TextView 展示的。

使用手机自带的键盘,监听按键。

## Code

### Attrs - vcode_attrs.xml

	<?xml version="1.0" encoding="utf-8"?>
	<resources>
	    <declare-styleable name="VerificationCodeView">
	        <attr name="vcodeTextSize" format="dimension" />
	        <attr name="vcodeTextColor" format="color" />
	        <attr name="vcodeBottomIcon" format="reference" />
	        <attr name="vcodeViewCount" format="integer" />
	        <attr name="vcodeItemSpaceSize" format="dimension" />
	    </declare-styleable>
	</resources>

### resources - vcode_default.xml

	<resources>
	    <dimen name="default_text_size" >18sp</dimen>
	    <dimen name="vcode_text_size" >18sp</dimen>
	    <dimen name="vcode_bottom_icon_height">6dp</dimen>
	    <dimen name="vcode_bottom_icon_width">48dp</dimen>
	    <dimen name="vcode_item_space_size">19dp</dimen>

		<color name="vcode_bottom_icon_bg">#f6a500</color>
    	<color name="vcode_bottom_error_icon_bg">#e84849</color>
    	<color name="vcode_text_color">#000000</color>
	</resources>

### drawable - icon_vcode_bottom.xml

	<?xml version="1.0" encoding="utf-8"?>
	<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
	    <corners android:radius="90dp" />
	    <solid android:color="@color/vcode_bottom_icon_bg" />
	    <size
	        android:height="@dimen/vcode_bottom_icon_height"
	        android:width="@dimen/vcode_bottom_icon_width" />
	</shape>

### drawable - icon_vcode_err_bottom.xml

	<?xml version="1.0" encoding="utf-8"?>
	<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
	    <corners android:radius="90dp" />
	    <solid android:color="@color/vcode_bottom_error_icon_bg" />
	    <size
	        android:height="@dimen/vcode_bottom_icon_height"
	        android:width="@dimen/vcode_bottom_icon_width" />
	</shape>

### Utils - TextViewUtils.java

	import android.graphics.drawable.Drawable;
	import android.widget.EditText;
	import android.widget.TextView;

	/**
	 * Created by Victor Yang on 2016/12/15 0015.
	 * TextViewUtils.
	 */

	public class TextViewUtils {

	    public static void addTextViewLeftIcon(
	            EditText editText
	            , Drawable drawable
	            , int imgSize) {

	        if (editText == null || drawable == null || imgSize <= 0) {
	            return;
	        }

	        drawable.setBounds(0, 0
	                , imgSize
	                , imgSize);

	        editText.setCompoundDrawables(
	                drawable
	                , null
	                , null
	                , null);
	    }

	    public static void addTextViewBottomIcon(
	            TextView textView
	            , Drawable drawable
	            , int imgWidth
	            , int imgHeight) {

	        if (textView == null || drawable == null || imgWidth <= 0) {
	            return;
	        }

	        drawable.setBounds(0, 0
	                , imgWidth
	                , imgHeight);

	        textView.setCompoundDrawables(
	                null
	                , null
	                , null
	                , drawable);
	    }
	}

### Code - VerificationCodeView.java

	import android.content.Context;
	import android.content.res.TypedArray;
	import android.graphics.drawable.Drawable;
	import android.text.InputType;
	import android.util.AttributeSet;
	import android.view.Gravity;
	import android.view.KeyEvent;
	import android.view.MotionEvent;
	import android.view.inputmethod.BaseInputConnection;
	import android.view.inputmethod.EditorInfo;
	import android.view.inputmethod.InputConnection;
	import android.view.inputmethod.InputMethodManager;
	import android.widget.LinearLayout;
	import android.widget.TextView;

	import java.util.ArrayList;
	import java.util.List;

	/**
	 * Created by Victor Yang on 2016/12/19 0019.
	 * 验证码 view
	 */

	public class VerificationCodeView extends LinearLayout {

	    public interface CodeCompleteListener{
	        void complete(boolean complete);
	    }

	    // 验证码 text size
	    private float mVCodeTextSize;

	    // 验证码 text color
	    private int mVCodeTextColor;

	    // 验证码 底部 icon
	    private Drawable mVCodeBottomIcon;
	    private Drawable mVCodeBottomErrorIcon;

	    // 验证码 item 之间的空隙
	    private int mVCodeItemCenterSpaceSize;

	    // 存储键盘的输入数字
	    private StringBuilder mCodeStringBuilder;

	    // 存储 验证码 item
	    private List<TextView> mCodeViewList;

	    // 验证码 输入完成 的监听
	    private CodeCompleteListener mCodeCompleteListener;

	    public VerificationCodeView(Context context) {
	        this(context, null);
	    }

	    public VerificationCodeView(Context context, AttributeSet attrs) {
	        this(context, attrs, 0);
	    }

	    public VerificationCodeView(Context context, AttributeSet attrs, int defStyleAttr) {
	        super(context, attrs, defStyleAttr);
	        init(attrs, defStyleAttr);
	    }

	    private void init(AttributeSet attrs, int defStyle) {
	        TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.VerificationCodeView, defStyle, 0);
	        mVCodeTextSize = typedArray.getDimensionPixelSize(
	                R.styleable.VerificationCodeView_vcodeTextSize
	                , getResources().getDimensionPixelSize(R.dimen.vcode_text_size));
	        mVCodeTextColor = typedArray.getColor(
	                R.styleable.VerificationCodeView_vcodeTextColor,
	                getResources().getColor(R.color.vcode_text_color));
	        mVCodeBottomIcon = typedArray.getDrawable(R.styleable.VerificationCodeView_vcodeBottomIcon);
	        if (mVCodeBottomIcon == null) {
	            mVCodeBottomIcon = getResources().getDrawable(R.drawable.icon_vcode_bottom);
	        }
	        mVCodeBottomErrorIcon = typedArray.getDrawable(R.styleable.VerificationCodeView_vcodeBottomIcon);
	        if (mVCodeBottomErrorIcon == null) {
	            mVCodeBottomErrorIcon = getResources().getDrawable(R.drawable.icon_vcode_error_bottom);
	        }
	        int mVCodeViewCount = typedArray.getInt(R.styleable.VerificationCodeView_vcodeViewCount, 4);
	        mVCodeItemCenterSpaceSize = typedArray.getDimensionPixelSize(
	                R.styleable.VerificationCodeView_vcodeItemSpaceSize,
	                getResources().getDimensionPixelSize(R.dimen.vcode_item_space_size));
	        typedArray.recycle();

	        setOrientation(HORIZONTAL);
	        setGravity(Gravity.CENTER);

	        // 获取触摸时焦点
	        setFocusableInTouchMode(true);

	        if (mCodeStringBuilder == null) mCodeStringBuilder = new StringBuilder();
	        mCodeViewList = new ArrayList<>();

	        // 初始化验证码 item
	        for (int i = 0; i < mVCodeViewCount; i++) {
	            TextView underLineCodeView = getUnderLineCodeView();
	            mCodeViewList.add(underLineCodeView);
	            addView(underLineCodeView);
	        }
	    }

	    public void setCodeCompleteListener(CodeCompleteListener listener) {
	        mCodeCompleteListener = listener;
	    }

	    private TextView getUnderLineCodeView() {
	        TextView textView = new TextView(getContext());
	        textView.setTextSize(mVCodeTextSize);
	        textView.setTextColor(mVCodeTextColor);
	        textView.setGravity(Gravity.CENTER);
	        int padding = mVCodeItemCenterSpaceSize / 2;
	        textView.setPadding(
	                padding
	                , 0
	                , padding
	                , 0);
	        int bottomIconWidth = (int) getResources().getDimension(R.dimen.vcode_bottom_icon_width);
	        int bottomIconHeight = (int) getResources().getDimension(R.dimen.vcode_bottom_icon_height);
	        TextViewUtils.addTextViewBottomIcon(textView, mVCodeBottomIcon, bottomIconWidth, bottomIconHeight);
	        return textView;
	    }

	    @Override
	    public boolean onTouchEvent(MotionEvent event) {
	        requestFocusFromTouch();
	        requestFocus();

	        // 触摸控件时显示 键盘
	        if (event.getAction() == MotionEvent.ACTION_DOWN) {
	            InputMethodManager imm = (InputMethodManager) getContext()
	                    .getSystemService(Context.INPUT_METHOD_SERVICE);
	            imm.showSoftInput(this, InputMethodManager.SHOW_FORCED);
	        }
	        return true;
	    }

	    @Override
	    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
	        // 声明一个数字数字键盘
	        BaseInputConnection fic = new BaseInputConnection(this, false);
	        outAttrs.actionLabel = null;
	        outAttrs.inputType = InputType.TYPE_CLASS_NUMBER;
	        outAttrs.imeOptions = EditorInfo.IME_ACTION_NONE;
	        return fic;
	    }

	    @Override
	    public boolean onKeyDown(int keyCode, KeyEvent event) {
	        if (mCodeStringBuilder == null) mCodeStringBuilder = new StringBuilder();
	        // keyCode = 67 是回退,keyCode = 【7,16】 是数字 【0,9】
	        if (keyCode == 67 && mCodeStringBuilder.length() > 0) {
	            mCodeStringBuilder.deleteCharAt(mCodeStringBuilder.length() - 1);
	            resetCodeShowView();
	        } else if (keyCode >= 7
	                && keyCode <= 16
	                && mCodeStringBuilder.length() < mCodeViewList.size()) {
	            mCodeStringBuilder.append(keyCode - 7);
	            resetCodeShowView();
	        }
	        if (mCodeStringBuilder.length() >= mCodeViewList.size() || keyCode == 66) {
	            InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
	            imm.hideSoftInputFromWindow(getWindowToken(), 0);
	        }
	        return super.onKeyDown(keyCode, event);
	    }

	    private void resetCodeShowView() {
	        if (mCodeStringBuilder == null || mCodeViewList == null || mCodeViewList.size() <= 0) {
	            return;
	        }

	        for (int i = 0 ; i< mCodeViewList.size(); i++) {
	            mCodeViewList.get(i).setText("");
	            if (i < mCodeStringBuilder.length()) {
	                mCodeViewList.get(i).setText(String.valueOf(mCodeStringBuilder.charAt(i)));
	            }
	        }

	        if (mCodeCompleteListener != null) {
	            if (mCodeStringBuilder.length() == mCodeViewList.size()) {
	                mCodeCompleteListener.complete(true);
	            } else {
	                mCodeCompleteListener.complete(false);
	            }
	        }
	    }

	    public void setCodeItemLineDrawable(Drawable drawable) {
	        for (TextView textView : mCodeViewList) {
	            int bottomIconWidth = (int) getResources().getDimension(R.dimen.vcode_bottom_icon_width);
	            int bottomIconHeight = (int) getResources().getDimension(R.dimen.vcode_bottom_icon_height);
	            TextViewUtils.addTextViewBottomIcon(textView, drawable, bottomIconWidth, bottomIconHeight);
	        }
	    }

	    public void resetCodeItemLineDrawable() {
	        setCodeItemLineDrawable(mVCodeBottomIcon);
	    }

	    public void setCodeItemErrorLineDrawable() {
	        for (TextView textView : mCodeViewList) {
	            int bottomIconWidth = (int) getResources().getDimension(R.dimen.vcode_bottom_icon_width);
	            int bottomIconHeight = (int) getResources().getDimension(R.dimen.vcode_bottom_icon_height);
	            TextViewUtils.addTextViewBottomIcon(textView, mVCodeBottomErrorIcon, bottomIconWidth, bottomIconHeight);
	        }
	    }

	    public String getTextString() {
	        return mCodeStringBuilder == null ? "" : mCodeStringBuilder.toString();
	    }
	}


text:
from typing import Any, Dict, Optional

from django.conf import settings
from django.contrib.auth.signals import user_logged_in
from django.dispatch import receiver
from django.template import loader
from django.utils.timezone import \
    get_current_timezone_name as timezone_get_current_timezone_name
from django.utils.timezone import now as timezone_now

from zerver.lib.send_email import FromAddress, send_email
from zerver.models import UserProfile

def get_device_browser(user_agent: str) -> Optional[str]:
    user_agent = user_agent.lower()
    if "zulip" in user_agent:
        return "Zulip"
    elif "edge" in user_agent:
        return "Edge"
    elif "opera" in user_agent or "opr/" in user_agent:
        return "Opera"
    elif ("chrome" in user_agent or "crios" in user_agent) and "chromium" not in user_agent:
        return 'Chrome'
    elif "firefox" in user_agent and "seamonkey" not in user_agent and "chrome" not in user_agent:
        return "Firefox"
    elif "chromium" in user_agent:
        return "Chromium"
    elif "safari" in user_agent and "chrome" not in user_agent and "chromium" not in user_agent:
        return "Safari"
    elif "msie" in user_agent or "trident" in user_agent:
        return "Internet Explorer"
    else:
        return None

def get_device_os(user_agent: str) -> Optional[str]:
    user_agent = user_agent.lower()
    if "windows" in user_agent:
        return "Windows"
    elif "macintosh" in user_agent:
        return "macOS"
    elif "linux" in user_agent and "android" not in user_agent:
        return "Linux"
    elif "android" in user_agent:
        return "Android"
    elif "ios" in user_agent:
        return "iOS"
    elif "like mac os x" in user_agent:
        return "iOS"
    else:
        return None

@receiver(user_logged_in, dispatch_uid="only_on_login")
def email_on_new_login(sender: Any, user: UserProfile, request: Any, **kwargs: Any) -> None:
    # We import here to minimize the dependencies of this module,
    # since it runs as part of `manage.py` initialization
    from zerver.context_processors import common_context

    if not settings.SEND_LOGIN_EMAILS:
        return

    if request:
        # If the user's account was just created, avoid sending an email.
        if getattr(user, "just_registered", False):
            return

        login_time = timezone_now().strftime('%A, %B %d, %Y at %I:%M%p ') + \
            timezone_get_current_timezone_name()
        user_agent = request.META.get('HTTP_USER_AGENT', "").lower()
        device_browser = get_device_browser(user_agent)
        device_os = get_device_os(user_agent)
        device_ip = request.META.get('REMOTE_ADDR') or "Uknown IP address"
        device_info = {"device_browser": device_browser,
                       "device_os": device_os,
                       "device_ip": device_ip,
                       "login_time": login_time
                       }

        context = common_context(user)
        context['device_info'] = device_info
        context['user'] = user

        send_email('zerver/emails/notify_new_login', to_user_id=user.id,
                   from_name='Zulip Account Security', from_address=FromAddress.NOREPLY,
                   context=context)


text:
package blogspot.software_and_algorithms.stern_library.data_structure;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

/**
 * A static interval tree is a balanced binary search tree which is
 * built to store a pre-specified set of intervals so that both point queries
 * (queries that return intervals from the set which contain a query point) and
 * overlapping interval queries (queries that return intervals from the set
 * which overlap a query interval) can be completed in time O(log(n)+k), where n
 * is the size of the pre-specified set of intervals and k is the size of the
 * result set from the query.
 *

 * While this implementation of a static interval tree is built to support a
 * pre-specified set of intervals, intervals from this set may be added to and
 * removed from the tree at will, giving a semi-static nature to the tree. The
 * construction process completes in time O(n*log(n)) where n is the size of the
 * set of intervals with which the tree is built.
 *

 * Insertion and deletion of intervals to and from a constructed tree completes
 * in time O(log(n)) where n is the size of the set of intervals with which the
 * tree was built.
 *

 * A constructed tree consumes linear space in the size of the set of intervals
 * with which the tree was built.
 *

 * Note that this implementation supports all three closed, open and half-open
 * intervals.
 *
 * @author Kevin L. Stern
 */
public class StaticIntervalTree<U extends Comparable, T extends Interval> {
  private Node root;
  private int size;

  /**
   * Default constructor.
   */
  public StaticIntervalTree() {
    size = 0;
  }

  /**
   * Internal helper method to construct a subtree structure capable of holding
   * the elements of the specified portion of the specified list of intervals.
   *
   * @param intervalList
   *          the list of intervals with which to build the subtree; must be
   *          ordered by low endpoint.
   * @param low
   *          the low index of the portion of intervalList to consider,
   *          inclusive.
   * @param high
   *          the high index of the portion of intervalList to consider,
   *          exclusive.
   */
  private Node buildSubtree(List<T> intervalList, int low, int high) {
    U point = intervalList.get((low + high) >>> 1).getLow();
    Node result = new Node(point);

    int lowPointer = low;
    int highPointer = high;
    for (int j = low; j < highPointer; j++) {
      T next = intervalList.get(j);
      if (next.getHigh().compareTo(point) < 0) {
        Collections.swap(intervalList, lowPointer++, j);
      } else if (next.getLow().compareTo(point) > 0) {
        highPointer = j;
      }
    }
    if (low < lowPointer) {
      result.setLeft(buildSubtree(intervalList, low, lowPointer));
    }
    if (highPointer < high) {
      result.setRight(buildSubtree(intervalList, highPointer, high));
    }

    return result;
  }

  /**
   * Build the interval tree to support the elements of the specified set of
   * intervals. Note that this method does not insert intervals into the tree
   * (this must be done via {@link #insert(Interval)} after the tree is built).
   *
   * @param intervals
   *          the set of intervals for which the tree is to be built.
   */
  public void buildTree(Set<T> intervals) {
    List<T> intervalList = new ArrayList<T>(intervals);
    Collections.sort(intervalList, new Comparator<T>() {
      @Override
      public int compare(T o1, T o2) {
        return o1.getLow().compareTo(o2.getLow());
      }
    });
    root = buildSubtree(intervalList, 0, intervals.size());
    size = 0;
  }

  /**
   * Clear the contents of the tree, leaving the tree structure intact.
   */
  public void clear() {
    if (root != null) {
      List<Node> stack = new ArrayList<Node>();
      stack.add(root);
      while (!stack.isEmpty()) {
        Node next = stack.remove(stack.size() - 1);
        next.clear();
        Node temp;
        if ((temp = next.getLeft()) != null) {
          stack.add(temp);
        }
        if ((temp = next.getRight()) != null) {
          stack.add(temp);
        }
      }
    }
    size = 0;
  }

  /**
   * Delete the specified interval from this tree.
   *
   * @param interval
   *          the interval to delete.
   * @return true if an element was deleted as a result of this call, false
   *         otherwise.
   */
  public boolean delete(T interval) {
    if (interval == null) {
      return false;
    }
    Node node = root;
    while (node != null) {
      U temp = node.getPoint();
      if (interval.getLow().compareTo(temp) <= 0
          && temp.compareTo(interval.getHigh()) <= 0) {
        if (node.delete(interval)) {
          size -= 1;
          return true;
        }
      } else if (interval.getHigh().compareTo(temp) < 0) {
        node = node.getLeft();
      } else {
        node = node.getRight();
      }
    }
    return false;
  }

  /**
   * Fetch intervals containing the specified point.
   *
   * @param target
   *          the target Collection into which to place the desired intervals.
   * @param queryPoint
   *          the query point.
   * @return the target Collection.
   */
  public <V extends Collection<T>> V fetchContainingIntervals(V target,
                                                              U queryPoint) {
    if (target == null) {
      throw new NullPointerException("target is null");
    }
    if (queryPoint == null) {
      throw new NullPointerException("queryPoint is null");
    }
    Node node = root;
    while (node != null) {
      U temp = node.getPoint();
      if (queryPoint.equals(temp)) {
        node.fetchIntervalsContainingNodePoint(target);
        node = null;
      } else if (queryPoint.compareTo(temp) < 0) {
        node.fetchIntervalsContainingPointLow(target, queryPoint, true);
        node = node.getLeft();
      } else {
        node.fetchIntervalsContainingPointHigh(target, queryPoint, true);
        node = node.getRight();
      }
    }
    return target;
  }

  /**
   * Fetch intervals overlapping the specified interval.
   *
   * @param target
   *          the target Collection into which to place the desired intervals.
   * @param queryInterval
   *          the query interval.
   * @return the target Collection.
   */
  public <V extends Collection<T>> V fetchOverlappingIntervals(V target,
                                                               T queryInterval) {
    if (target == null) {
      throw new NullPointerException("target is null");
    }
    if (queryInterval == null) {
      throw new NullPointerException("queryInterval is null");
    }
    List<Node> stack = new ArrayList<Node>();
    if (root != null) {
      stack.add(root);
    }
    while (!stack.isEmpty()) {
      Node node = stack.remove(stack.size() - 1);
      U temp = node.getPoint();
      if (queryInterval.getLow().compareTo(temp) <= 0
          && temp.compareTo(queryInterval.getHigh()) <= 0) {
        node.fetchOverlappingIntervals(target, queryInterval);
        if (node.getLeft() != null) {
          stack.add(node.getLeft());
        }
        if (node.getRight() != null) {
          stack.add(node.getRight());
        }
      } else if (queryInterval.getHigh().compareTo(temp) < 0) {
        node.fetchIntervalsContainingPointLow(target, queryInterval.getHigh(),
                                              queryInterval.isClosedOnHigh());
        if (node.getLeft() != null) {
          stack.add(node.getLeft());
        }
      } else {
        node.fetchIntervalsContainingPointHigh(target, queryInterval.getLow(),
                                               queryInterval.isClosedOnLow());
        if (node.getRight() != null) {
          stack.add(node.getRight());
        }
      }
    }
    return target;
  }

  /**
   * Get the number of intervals being stored in the tree.
   *
   * @return the number of intervals being stored in the tree.
   */
  public int getSize() {
    return size;
  }

  /**
   * Insert the specified interval into this tree. Behavior is undefined when
   * the interval was not included in the set of intervals presented at the most
   * recent call to {@link #buildTree(Set)}.
   *
   * @param interval
   *          the interval to insert.
   * @return true if an element was inserted as a result of this call, false
   *         otherwise.
   */
  public boolean insert(T interval) {
    Node node = root;
    while (node != null) {
      U temp = node.getPoint();
      if (interval.getLow().compareTo(temp) <= 0
          && temp.compareTo(interval.getHigh()) <= 0) {
        if (node.insert(interval)) {
          size++;
          return true;
        }
      } else if (interval.getHigh().compareTo(temp) < 0) {
        node = node.getLeft();
      } else {
        node = node.getRight();
      }
    }
    return false;
  }

  /**
   * A node for a static interval tree is a binary tree node augmented
   * with an associated point value and the ability to store intervals.
   *

   * Intervals that are stored within this node either contain the node's point
   * value or are open at an endpoint that equals the node's point value.
   * Intervals are stored so that these two cases are easily distinguished from
   * one another: Each such class of interval is stored in two structures, one
   * is a tree sorted by low endpoint and the other is a tree sorted by high
   * endpoint. This enables efficient point queries as well as insertions and
   * deletions from the node.
   */
  protected static class Node<U extends Comparable, T extends Interval> {
    private RedBlackTree<T> highOrderedContainingIntervals = new OrderLinkedRedBlackTree<T>(
        new Comparator<T>() {
          @Override
          public int compare(T o1, T o2) {
            int result = o1.getHigh().compareTo(o2.getHigh());
            if (result == 0) {
              if (o1.isClosedOnHigh() != o2.isClosedOnHigh()) {
                result = o1.isClosedOnHigh() ? 1 : -1;
              } else {
                result = o1.compareTo(o2);
              }
            }
            return result > 0 ? -1 : result < 0 ? 1 : 0;
          }
        });
    private RedBlackTree<T> lowOrderedContainingIntervals = new OrderLinkedRedBlackTree<T>(
        new Comparator<T>() {
          @Override
          public int compare(T o1, T o2) {
            int result = o1.getLow().compareTo(o2.getLow());
            if (result == 0) {
              result = o1.compareTo(o2);
            }
            return result > 0 ? 1 : result < 0 ? -1 : 0;
          }
        });
    private RedBlackTree<T> highOrderedExcludingIntervals = new OrderLinkedRedBlackTree<T>(
        new Comparator<T>() {
          @Override
          public int compare(T o1, T o2) {
            int result = o1.getHigh().compareTo(o2.getHigh());
            if (result == 0) {
              if (o1.isClosedOnHigh() != o2.isClosedOnHigh()) {
                result = o1.isClosedOnHigh() ? 1 : -1;
              } else {
                result = o1.compareTo(o2);
              }
            }
            return result > 0 ? -1 : result < 0 ? 1 : 0;
          }
        });
    private RedBlackTree<T> lowOrderedExcludingIntervals = new OrderLinkedRedBlackTree<T>(
        new Comparator<T>() {
          @Override
          public int compare(T o1, T o2) {
            int result = o1.getLow().compareTo(o2.getLow());
            if (result == 0) {
              result = o1.compareTo(o2);
            }
            return result > 0 ? 1 : result < 0 ? -1 : 0;
          }
        });
    private Node left, right;
    private U point;

    /**
     * Construct a new node associated with the specified point.
     *
     * @param point
     *          the point with which this node is associated.
     */
    public Node(U point) {
      if (point == null) {
        throw new NullPointerException("point is null");
      }
      this.point = point;
    }

    /**
     * Clear the elements of this node.
     */
    public void clear() {
      lowOrderedContainingIntervals.clear();
      highOrderedContainingIntervals.clear();
      lowOrderedExcludingIntervals.clear();
      highOrderedExcludingIntervals.clear();
    }

    /**
     * Delete the specified interval from this node.
     *
     * @param interval
     *          the interval to delete.
     * @return true if an element was deleted as a result of this call, false
     *         otherwise.
     */
    public boolean delete(T interval) {
      if (interval.contains(point)) {
        if (lowOrderedContainingIntervals.delete(interval) == null) {
          return false;
        }
        highOrderedContainingIntervals.delete(interval);
      } else {
        if (lowOrderedExcludingIntervals.delete(interval) == null) {
          return false;
        }
        highOrderedExcludingIntervals.delete(interval);
      }
      return true;
    }

    /**
     * Fetch all intervals from this node that contain the node's point.
     *
     * @param target
     *          the target Collection into which to place the desired intervals.
     */
    public void fetchIntervalsContainingNodePoint(Collection<T> target) {
      if (highOrderedContainingIntervals.getSize() > 0) {
        RedBlackTree.Node<T> temp = highOrderedContainingIntervals
            .getFirstNode();
        while (temp != null) {
          target.add(temp.getValue());
          temp = highOrderedContainingIntervals.getSuccessor(temp);
        }
      }
    }

    /**
     * Fetch intervals containing the specified value. This method is called
     * when the specified value is greater than this node's point.
     *
     * @param target
     *          the target Collection into which to place the desired intervals.
     * @param queryPoint
     *          the query value.
     * @param isClosedOnValue
     *          true if the search is inclusive of the specified value, false
     *          otherwise.
     */
    public void fetchIntervalsContainingPointHigh(Collection<T> target,
                                                  U queryPoint,
                                                  boolean isClosedOnValue) {
      for (Iterator<T> i = highOrderedContainingIntervals.iterator(); i
          .hasNext();) {
        T next = i.next();
        int cmp = next.getHigh().compareTo(queryPoint);
        if (cmp < 0 || cmp == 0 && (!isClosedOnValue || !next.isClosedOnHigh())) {
          break;
        }
        target.add(next);
      }
      for (Iterator<T> i = highOrderedExcludingIntervals.iterator(); i
          .hasNext();) {
        T next = i.next();
        int cmp = next.getHigh().compareTo(queryPoint);
        if (cmp < 0 || cmp == 0 && (!isClosedOnValue || !next.isClosedOnHigh())) {
          break;
        }
        target.add(next);
      }
    }

    /**
     * Fetch intervals containing the specified value. This method is called
     * when the specified value is less than this node's point.
     *
     * @param target
     *          the target Collection into which to place the desired intervals.
     * @param queryPoint
     *          the query value.
     * @param isClosedOnValue
     *          true if the search is inclusive of the specified value, false
     *          otherwise.
     */
    public void fetchIntervalsContainingPointLow(Collection<T> target,
                                                 U queryPoint,
                                                 boolean isClosedOnValue) {
      for (Iterator<T> i = lowOrderedContainingIntervals.iterator(); i
          .hasNext();) {
        T next = i.next();
        int cmp = next.getLow().compareTo(queryPoint);
        if (cmp > 0 || cmp == 0 && (!isClosedOnValue || !next.isClosedOnLow()))
          break;
        target.add(next);
      }
      for (Iterator<T> i = lowOrderedExcludingIntervals.iterator(); i.hasNext();) {
        T next = i.next();
        int cmp = next.getLow().compareTo(queryPoint);
        if (cmp > 0 || cmp == 0 && (!isClosedOnValue || !next.isClosedOnLow()))
          break;
        target.add(next);
      }
    }

    /**
     * Fetch all intervals from this node which overlap the specified interval.
     * By contract, the interval must be such that {@link Interval#getLow()}
     * ≤ {@link Node#getPoint()} ≤
     * {@link Interval#getHigh()}.
     *
     * @param target
     *          the target Collection into which to place the desired intervals.
     * @param queryInterval
     *          the query interval.
     */
    public void fetchOverlappingIntervals(Collection<T> target,
                                          Interval queryInterval) {
      if (queryInterval.getLow().compareTo(point) == 0) {
        fetchIntervalsContainingPointHigh(target, queryInterval.getLow(),
                                          queryInterval.isClosedOnLow());
      } else if (queryInterval.getHigh().compareTo(point) == 0) {
        fetchIntervalsContainingPointLow(target, queryInterval.getHigh(),
                                         queryInterval.isClosedOnHigh());
      } else {
        fetchIntervalsContainingNodePoint(target);
        if (highOrderedExcludingIntervals.getSize() > 0) {
          RedBlackTree.Node<T> temp = highOrderedExcludingIntervals
              .getFirstNode();
          while (temp != null) {
            target.add(temp.getValue());
            temp = highOrderedExcludingIntervals.getSuccessor(temp);
          }
        }
      }
    }

    /**
     * Get the left child.
     *
     * @return the left child, null if none exists.
     */
    public Node getLeft() {
      return left;
    }

    /**
     * Get the point associated with this node.
     *
     * @return the point associated with this node.
     */
    public U getPoint() {
      return point;
    }

    /**
     * Get the right child.
     *
     * @return the right child, null if none exists.
     */
    public Node getRight() {
      return right;
    }

    /**
     * Insert the specified interval into this node. By contract, the interval
     * must be such that {@link Interval#getLow()} <=
     * {@link Node#getPoint()} <= {@link Interval#getHigh()}.
     *
     * @param interval
     *          the interval to insert.
     * @return true if an element was inserted as a result of this call, false
     *         otherwise.
     */
    private boolean insert(T interval) {
      if (interval.contains(point)) {
        if (lowOrderedContainingIntervals.insert(interval) == null) {
          return false;
        }
        highOrderedContainingIntervals.insert(interval);
      } else {
        if (lowOrderedExcludingIntervals.insert(interval) == null) {
          return false;
        }
        highOrderedExcludingIntervals.insert(interval);
      }
      return true;
    }

    /**
     * Set the left child to the specified node.
     *
     * @param node
     *          the left child.
     */
    private void setLeft(Node node) {
      left = node;
    }

    /**
     * Set the right child to the specified node.
     *
     * @param node
     *          the right child.
     */
    private void setRight(Node node) {
      right = node;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
      StringBuilder builder = new StringBuilder("{");
      for (Iterator<T> i = lowOrderedContainingIntervals.iterator();;) {
        builder.append(i.next().toString());
        if (i.hasNext()) {
          builder.append(", ");
        } else {
          break;
        }
      }
      for (Iterator<T> i = lowOrderedExcludingIntervals.iterator(); i.hasNext();) {
        builder.append(", ").append(i.next().toString());
      }
      builder.append("}");
      return builder.toString();
    }
  }
}


text:
layout: pattern
title: Aggregator Microservices
folder: aggregator-microservices
permalink: /patterns/aggregator-microservices/
categories: Architectural
tags:
- Cloud distributed
---

## Intent

The user makes a single call to the Aggregator, and the aggregator then calls each relevant microservice and collects
the data, apply business logic to it, and further publish is as a REST Endpoint.
More variations of the aggregator are:
- Proxy Microservice Design Pattern: A different microservice is called upon the business need.
- Chained Microservice Design Pattern: In this case each microservice is dependent/ chained to a series
of other microservices.

## Class diagram

![alt text](./etc/aggregator-microservice.png "Aggregator Microservice")

## Applicability

Use the Aggregator Microservices pattern when you need a unified API for various microservices, regardless the client device.

## Credits

* [Microservice Design Patterns](http://web.archive.org/web/20190705163602/http://blog.arungupta.me/microservice-design-patterns/)


text:
package com.netsteadfast.pine.sys;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;

import com.netsteadfast.base.exception.ServiceException;
import com.netsteadfast.base.model.DefaultResult;
import com.netsteadfast.pine.service.IAccountService;
import com.netsteadfast.po.TbAccount;
import com.netsteadfast.vo.AccountVO;

public class GreenStepBaseAuthorizingRealm extends AuthorizingRealm {
	private IAccountService<AccountVO, TbAccount, String> accountService;
	/*
	private IUserRoleService<UserRoleVO, TbUserRole, String> userRoleService;
	private IRolePermissionService<RolePermissionVO, TbRolePermission, String> rolePermissionService;
	*/

	public GreenStepBaseAuthorizingRealm() {
		super();
	}

	public IAccountService<AccountVO, TbAccount, String> getAccountService() {
		return accountService;
	}

	@Autowired
	@Resource(name="pine.service.AccountService")
	@Required
	public void setAccountService(IAccountService<AccountVO, TbAccount, String> accountService) {
		this.accountService = accountService;
	}

	/*
	public IUserRoleService<UserRoleVO, TbUserRole, String> getUserRoleService() {
		return userRoleService;
	}

	@Autowired
	@Resource(name="core.service.UserRoleService")
	@Required
	public void setUserRoleService(
			IUserRoleService<UserRoleVO, TbUserRole, String> userRoleService) {
		this.userRoleService = userRoleService;
	}

	public IRolePermissionService<RolePermissionVO, TbRolePermission, String> getRolePermissionService() {
		return rolePermissionService;
	}

	@Autowired
	@Resource(name="core.service.RolePermissionService")
	@Required
	public void setRolePermissionService(
			IRolePermissionService<RolePermissionVO, TbRolePermission, String> rolePermissionService) {
		this.rolePermissionService = rolePermissionService;
	}
	*/

	private SimpleAuthorizationInfo getSimpleAuthorizationInfo(String username) throws Exception {
		/*
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("account", username);
		List<TbUserRole> roleList = userRoleService.findListByParams(params);
		if (roleList==null) {
			return null;
		}
		SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
		for (TbUserRole userRole : roleList) {
			info.addRole(userRole.getRole());
			params.clear();
			params.put("role", userRole.getRole());
			List<TbRolePermission> rolePermissionList = rolePermissionService.findListByParams(params);
			if (rolePermissionList==null) {
				continue;
			}
			for (TbRolePermission rolePermission : rolePermissionList) {
				info.addStringPermission(rolePermission.getPermission());
			}
		}
		return info;
		*/
		SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
		info.addStringPermission("*");
		return info; // pine 不需要
	}

	/**
	 * 授權
	 */
	@Override
	protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
		String username = (String)principals.fromRealm(this.getName()).iterator().next();
		if (username==null || StringUtils.isBlank(username)) {
			return null;
		}
		try {
			return this.getSimpleAuthorizationInfo(username);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	/**
	 * 認證
	 */
	@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
		GreenStepBaseUsernamePasswordToken token = (GreenStepBaseUsernamePasswordToken)authenticationToken;
		String account = token.getUsername();
		AccountVO accountObj = new AccountVO();
		accountObj.setAccount(account);
		try {
			DefaultResult<AccountVO> result = accountService.findByUK(accountObj);
			if (result.getValue()==null) {
				return null;
			}
			accountObj = result.getValue();
			return new SimpleAuthenticationInfo(
					accountObj.getAccount(), accountObj.getPassword(), this.getName());
		} catch (ServiceException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}


text:
package com.proofpoint.jmx;

import com.google.common.collect.ImmutableMap;
import org.testng.annotations.Test;

import java.util.Map;

import static com.proofpoint.configuration.testing.ConfigAssertions.assertFullMapping;
import static com.proofpoint.configuration.testing.ConfigAssertions.assertLegacyEquivalence;
import static com.proofpoint.configuration.testing.ConfigAssertions.assertRecordedDefaults;
import static com.proofpoint.configuration.testing.ConfigAssertions.recordDefaults;

public class TestJmxConfig
{
    @Test
    public void testDefaults()
    {
        assertRecordedDefaults(recordDefaults(JmxConfig.class)
                .setEnabled(false)
                .setRmiRegistryPort(null)
                .setRmiServerPort(null));
    }

    @Test
    public void testExplicitPropertyMappings()
    {
        Map<String, String> properties = new ImmutableMap.Builder<String, String>()
                .put("jmx.enabled", "true")
                .put("jmx.rmiregistry.port", "1")
                .put("jmx.rmiserver.port", "2")
                .build();

        JmxConfig expected = new JmxConfig()
                .setEnabled(true)
                .setRmiRegistryPort(1)
                .setRmiServerPort(2);

        assertFullMapping(properties, expected);
    }

    @Test
    public void testLegacyEquivalence()
    {
        assertLegacyEquivalence(JmxConfig.class, ImmutableMap.of());
    }

}


text:
#pragma once
#include <aws/elasticache/ElastiCache_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/DateTime.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/elasticache/model/RecurringCharge.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Xml
{
  class XmlNode;
} // namespace Xml
} // namespace Utils
namespace ElastiCache
{
namespace Model
{

  /**
   *
Represents the output of a PurchaseReservedCacheNodesOffering
   * operation.

See Also:
   AWS
   * API Reference

   */
  class AWS_ELASTICACHE_API ReservedCacheNode
  {
  public:
    ReservedCacheNode();
    ReservedCacheNode(const Aws::Utils::Xml::XmlNode& xmlNode);
    ReservedCacheNode& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);

    void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const;
    void OutputToStream(Aws::OStream& oStream, const char* location) const;

    /**
     *
The unique identifier for the reservation.

     */
    inline const Aws::String& GetReservedCacheNodeId() const{ return m_reservedCacheNodeId; }

    /**
     *
The unique identifier for the reservation.

     */
    inline bool ReservedCacheNodeIdHasBeenSet() const { return m_reservedCacheNodeIdHasBeenSet; }

    /**
     *
The unique identifier for the reservation.

     */
    inline void SetReservedCacheNodeId(const Aws::String& value) { m_reservedCacheNodeIdHasBeenSet = true; m_reservedCacheNodeId = value; }

    /**
     *
The unique identifier for the reservation.

     */
    inline void SetReservedCacheNodeId(Aws::String&& value) { m_reservedCacheNodeIdHasBeenSet = true; m_reservedCacheNodeId = std::move(value); }

    /**
     *
The unique identifier for the reservation.

     */
    inline void SetReservedCacheNodeId(const char* value) { m_reservedCacheNodeIdHasBeenSet = true; m_reservedCacheNodeId.assign(value); }

    /**
     *
The unique identifier for the reservation.

     */
    inline ReservedCacheNode& WithReservedCacheNodeId(const Aws::String& value) { SetReservedCacheNodeId(value); return *this;}

    /**
     *
The unique identifier for the reservation.

     */
    inline ReservedCacheNode& WithReservedCacheNodeId(Aws::String&& value) { SetReservedCacheNodeId(std::move(value)); return *this;}

    /**
     *
The unique identifier for the reservation.

     */
    inline ReservedCacheNode& WithReservedCacheNodeId(const char* value) { SetReservedCacheNodeId(value); return *this;}

    /**
     *
The offering identifier.

     */
    inline const Aws::String& GetReservedCacheNodesOfferingId() const{ return m_reservedCacheNodesOfferingId; }

    /**
     *
The offering identifier.

     */
    inline bool ReservedCacheNodesOfferingIdHasBeenSet() const { return m_reservedCacheNodesOfferingIdHasBeenSet; }

    /**
     *
The offering identifier.

     */
    inline void SetReservedCacheNodesOfferingId(const Aws::String& value) { m_reservedCacheNodesOfferingIdHasBeenSet = true; m_reservedCacheNodesOfferingId = value; }

    /**
     *
The offering identifier.

     */
    inline void SetReservedCacheNodesOfferingId(Aws::String&& value) { m_reservedCacheNodesOfferingIdHasBeenSet = true; m_reservedCacheNodesOfferingId = std::move(value); }

    /**
     *
The offering identifier.

     */
    inline void SetReservedCacheNodesOfferingId(const char* value) { m_reservedCacheNodesOfferingIdHasBeenSet = true; m_reservedCacheNodesOfferingId.assign(value); }

    /**
     *
The offering identifier.

     */
    inline ReservedCacheNode& WithReservedCacheNodesOfferingId(const Aws::String& value) { SetReservedCacheNodesOfferingId(value); return *this;}

    /**
     *
The offering identifier.

     */
    inline ReservedCacheNode& WithReservedCacheNodesOfferingId(Aws::String&& value) { SetReservedCacheNodesOfferingId(std::move(value)); return *this;}

    /**
     *
The offering identifier.

     */
    inline ReservedCacheNode& WithReservedCacheNodesOfferingId(const char* value) { SetReservedCacheNodesOfferingId(value); return *this;}

    /**
     *
The cache node type for the reserved cache nodes.

The following node
     * types are supported by ElastiCache. Generally speaking, the current generation
     * types provide more memory and computational power at lower cost when compared to
     * their equivalent previous generation counterparts.

General
     * purpose:

Current generation:

 M6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward): cache.m6g.large,
     * cache.m6g.xlarge, cache.m6g.2xlarge,
     * cache.m6g.4xlarge, cache.m6g.8xlarge,
     * cache.m6g.12xlarge, cache.m6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 M5 node types:
     * cache.m5.large, cache.m5.xlarge,
     * cache.m5.2xlarge, cache.m5.4xlarge,
     * cache.m5.12xlarge, cache.m5.24xlarge

 M4
     * node types: cache.m4.large, cache.m4.xlarge,
     * cache.m4.2xlarge, cache.m4.4xlarge,
     * cache.m4.10xlarge

 T4g node types (available only
     * for Redis engine version 5.0.6 onward and Memcached engine version 1.5.16
     * onward): cache.t4g.micro, cache.t4g.small,
     * cache.t4g.medium

 T3 node types:
     * cache.t3.micro, cache.t3.small,
     * cache.t3.medium

 T2 node types:
     * cache.t2.micro, cache.t2.small,
     * cache.t2.medium

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 T1 node types:
     * cache.t1.micro

 M1 node types:
     * cache.m1.small, cache.m1.medium,
     * cache.m1.large, cache.m1.xlarge

 M3 node
     * types: cache.m3.medium, cache.m3.large,
     * cache.m3.xlarge, cache.m3.2xlarge

     *

Compute optimized:

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 C1 node types:
     * cache.c1.xlarge

Memory
     * optimized:

Current generation:

 R6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward).

 cache.r6g.large,
     * cache.r6g.xlarge, cache.r6g.2xlarge,
     * cache.r6g.4xlarge, cache.r6g.8xlarge,
     * cache.r6g.12xlarge, cache.r6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 R5 node types:
     * cache.r5.large, cache.r5.xlarge,
     * cache.r5.2xlarge, cache.r5.4xlarge,
     * cache.r5.12xlarge, cache.r5.24xlarge

 R4
     * node types: cache.r4.large, cache.r4.xlarge,
     * cache.r4.2xlarge, cache.r4.4xlarge,
     * cache.r4.8xlarge, cache.r4.16xlarge

     *
Previous generation: (not recommended. Existing clusters are still supported
     * but creation of new clusters is not supported for these types.)

 M2
     * node types: cache.m2.xlarge, cache.m2.2xlarge,
     * cache.m2.4xlarge

 R3 node types:
     * cache.r3.large, cache.r3.xlarge,
     * cache.r3.2xlarge, cache.r3.4xlarge,
     * cache.r3.8xlarge

 Additional
     * node type info

All current generation instance types are
     * created in Amazon VPC by default.

Redis append-only files
     * (AOF) are not supported for T1 or T2 instances.

Redis Multi-AZ
     * with automatic failover is not supported on T1 instances.

     *
Redis configuration variables appendonly and
     * appendfsync are not supported on Redis version 2.8.22 and
     * later.

     */
    inline const Aws::String& GetCacheNodeType() const{ return m_cacheNodeType; }

    /**
     *
The cache node type for the reserved cache nodes.

The following node
     * types are supported by ElastiCache. Generally speaking, the current generation
     * types provide more memory and computational power at lower cost when compared to
     * their equivalent previous generation counterparts.

General
     * purpose:

Current generation:

 M6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward): cache.m6g.large,
     * cache.m6g.xlarge, cache.m6g.2xlarge,
     * cache.m6g.4xlarge, cache.m6g.8xlarge,
     * cache.m6g.12xlarge, cache.m6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 M5 node types:
     * cache.m5.large, cache.m5.xlarge,
     * cache.m5.2xlarge, cache.m5.4xlarge,
     * cache.m5.12xlarge, cache.m5.24xlarge

 M4
     * node types: cache.m4.large, cache.m4.xlarge,
     * cache.m4.2xlarge, cache.m4.4xlarge,
     * cache.m4.10xlarge

 T4g node types (available only
     * for Redis engine version 5.0.6 onward and Memcached engine version 1.5.16
     * onward): cache.t4g.micro, cache.t4g.small,
     * cache.t4g.medium

 T3 node types:
     * cache.t3.micro, cache.t3.small,
     * cache.t3.medium

 T2 node types:
     * cache.t2.micro, cache.t2.small,
     * cache.t2.medium

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 T1 node types:
     * cache.t1.micro

 M1 node types:
     * cache.m1.small, cache.m1.medium,
     * cache.m1.large, cache.m1.xlarge

 M3 node
     * types: cache.m3.medium, cache.m3.large,
     * cache.m3.xlarge, cache.m3.2xlarge

     *

Compute optimized:

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 C1 node types:
     * cache.c1.xlarge

Memory
     * optimized:

Current generation:

 R6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward).

 cache.r6g.large,
     * cache.r6g.xlarge, cache.r6g.2xlarge,
     * cache.r6g.4xlarge, cache.r6g.8xlarge,
     * cache.r6g.12xlarge, cache.r6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 R5 node types:
     * cache.r5.large, cache.r5.xlarge,
     * cache.r5.2xlarge, cache.r5.4xlarge,
     * cache.r5.12xlarge, cache.r5.24xlarge

 R4
     * node types: cache.r4.large, cache.r4.xlarge,
     * cache.r4.2xlarge, cache.r4.4xlarge,
     * cache.r4.8xlarge, cache.r4.16xlarge

     *
Previous generation: (not recommended. Existing clusters are still supported
     * but creation of new clusters is not supported for these types.)

 M2
     * node types: cache.m2.xlarge, cache.m2.2xlarge,
     * cache.m2.4xlarge

 R3 node types:
     * cache.r3.large, cache.r3.xlarge,
     * cache.r3.2xlarge, cache.r3.4xlarge,
     * cache.r3.8xlarge

 Additional
     * node type info

All current generation instance types are
     * created in Amazon VPC by default.

Redis append-only files
     * (AOF) are not supported for T1 or T2 instances.

Redis Multi-AZ
     * with automatic failover is not supported on T1 instances.

     *
Redis configuration variables appendonly and
     * appendfsync are not supported on Redis version 2.8.22 and
     * later.

     */
    inline bool CacheNodeTypeHasBeenSet() const { return m_cacheNodeTypeHasBeenSet; }

    /**
     *
The cache node type for the reserved cache nodes.

The following node
     * types are supported by ElastiCache. Generally speaking, the current generation
     * types provide more memory and computational power at lower cost when compared to
     * their equivalent previous generation counterparts.

General
     * purpose:

Current generation:

 M6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward): cache.m6g.large,
     * cache.m6g.xlarge, cache.m6g.2xlarge,
     * cache.m6g.4xlarge, cache.m6g.8xlarge,
     * cache.m6g.12xlarge, cache.m6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 M5 node types:
     * cache.m5.large, cache.m5.xlarge,
     * cache.m5.2xlarge, cache.m5.4xlarge,
     * cache.m5.12xlarge, cache.m5.24xlarge

 M4
     * node types: cache.m4.large, cache.m4.xlarge,
     * cache.m4.2xlarge, cache.m4.4xlarge,
     * cache.m4.10xlarge

 T4g node types (available only
     * for Redis engine version 5.0.6 onward and Memcached engine version 1.5.16
     * onward): cache.t4g.micro, cache.t4g.small,
     * cache.t4g.medium

 T3 node types:
     * cache.t3.micro, cache.t3.small,
     * cache.t3.medium

 T2 node types:
     * cache.t2.micro, cache.t2.small,
     * cache.t2.medium

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 T1 node types:
     * cache.t1.micro

 M1 node types:
     * cache.m1.small, cache.m1.medium,
     * cache.m1.large, cache.m1.xlarge

 M3 node
     * types: cache.m3.medium, cache.m3.large,
     * cache.m3.xlarge, cache.m3.2xlarge

     *

Compute optimized:

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 C1 node types:
     * cache.c1.xlarge

Memory
     * optimized:

Current generation:

 R6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward).

 cache.r6g.large,
     * cache.r6g.xlarge, cache.r6g.2xlarge,
     * cache.r6g.4xlarge, cache.r6g.8xlarge,
     * cache.r6g.12xlarge, cache.r6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 R5 node types:
     * cache.r5.large, cache.r5.xlarge,
     * cache.r5.2xlarge, cache.r5.4xlarge,
     * cache.r5.12xlarge, cache.r5.24xlarge

 R4
     * node types: cache.r4.large, cache.r4.xlarge,
     * cache.r4.2xlarge, cache.r4.4xlarge,
     * cache.r4.8xlarge, cache.r4.16xlarge

     *
Previous generation: (not recommended. Existing clusters are still supported
     * but creation of new clusters is not supported for these types.)

 M2
     * node types: cache.m2.xlarge, cache.m2.2xlarge,
     * cache.m2.4xlarge

 R3 node types:
     * cache.r3.large, cache.r3.xlarge,
     * cache.r3.2xlarge, cache.r3.4xlarge,
     * cache.r3.8xlarge

 Additional
     * node type info

All current generation instance types are
     * created in Amazon VPC by default.

Redis append-only files
     * (AOF) are not supported for T1 or T2 instances.

Redis Multi-AZ
     * with automatic failover is not supported on T1 instances.

     *
Redis configuration variables appendonly and
     * appendfsync are not supported on Redis version 2.8.22 and
     * later.

     */
    inline void SetCacheNodeType(const Aws::String& value) { m_cacheNodeTypeHasBeenSet = true; m_cacheNodeType = value; }

    /**
     *
The cache node type for the reserved cache nodes.

The following node
     * types are supported by ElastiCache. Generally speaking, the current generation
     * types provide more memory and computational power at lower cost when compared to
     * their equivalent previous generation counterparts.

General
     * purpose:

Current generation:

 M6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward): cache.m6g.large,
     * cache.m6g.xlarge, cache.m6g.2xlarge,
     * cache.m6g.4xlarge, cache.m6g.8xlarge,
     * cache.m6g.12xlarge, cache.m6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 M5 node types:
     * cache.m5.large, cache.m5.xlarge,
     * cache.m5.2xlarge, cache.m5.4xlarge,
     * cache.m5.12xlarge, cache.m5.24xlarge

 M4
     * node types: cache.m4.large, cache.m4.xlarge,
     * cache.m4.2xlarge, cache.m4.4xlarge,
     * cache.m4.10xlarge

 T4g node types (available only
     * for Redis engine version 5.0.6 onward and Memcached engine version 1.5.16
     * onward): cache.t4g.micro, cache.t4g.small,
     * cache.t4g.medium

 T3 node types:
     * cache.t3.micro, cache.t3.small,
     * cache.t3.medium

 T2 node types:
     * cache.t2.micro, cache.t2.small,
     * cache.t2.medium

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 T1 node types:
     * cache.t1.micro

 M1 node types:
     * cache.m1.small, cache.m1.medium,
     * cache.m1.large, cache.m1.xlarge

 M3 node
     * types: cache.m3.medium, cache.m3.large,
     * cache.m3.xlarge, cache.m3.2xlarge

     *

Compute optimized:

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 C1 node types:
     * cache.c1.xlarge

Memory
     * optimized:

Current generation:

 R6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward).

 cache.r6g.large,
     * cache.r6g.xlarge, cache.r6g.2xlarge,
     * cache.r6g.4xlarge, cache.r6g.8xlarge,
     * cache.r6g.12xlarge, cache.r6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 R5 node types:
     * cache.r5.large, cache.r5.xlarge,
     * cache.r5.2xlarge, cache.r5.4xlarge,
     * cache.r5.12xlarge, cache.r5.24xlarge

 R4
     * node types: cache.r4.large, cache.r4.xlarge,
     * cache.r4.2xlarge, cache.r4.4xlarge,
     * cache.r4.8xlarge, cache.r4.16xlarge

     *
Previous generation: (not recommended. Existing clusters are still supported
     * but creation of new clusters is not supported for these types.)

 M2
     * node types: cache.m2.xlarge, cache.m2.2xlarge,
     * cache.m2.4xlarge

 R3 node types:
     * cache.r3.large, cache.r3.xlarge,
     * cache.r3.2xlarge, cache.r3.4xlarge,
     * cache.r3.8xlarge

 Additional
     * node type info

All current generation instance types are
     * created in Amazon VPC by default.

Redis append-only files
     * (AOF) are not supported for T1 or T2 instances.

Redis Multi-AZ
     * with automatic failover is not supported on T1 instances.

     *
Redis configuration variables appendonly and
     * appendfsync are not supported on Redis version 2.8.22 and
     * later.

     */
    inline void SetCacheNodeType(Aws::String&& value) { m_cacheNodeTypeHasBeenSet = true; m_cacheNodeType = std::move(value); }

    /**
     *
The cache node type for the reserved cache nodes.

The following node
     * types are supported by ElastiCache. Generally speaking, the current generation
     * types provide more memory and computational power at lower cost when compared to
     * their equivalent previous generation counterparts.

General
     * purpose:

Current generation:

 M6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward): cache.m6g.large,
     * cache.m6g.xlarge, cache.m6g.2xlarge,
     * cache.m6g.4xlarge, cache.m6g.8xlarge,
     * cache.m6g.12xlarge, cache.m6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 M5 node types:
     * cache.m5.large, cache.m5.xlarge,
     * cache.m5.2xlarge, cache.m5.4xlarge,
     * cache.m5.12xlarge, cache.m5.24xlarge

 M4
     * node types: cache.m4.large, cache.m4.xlarge,
     * cache.m4.2xlarge, cache.m4.4xlarge,
     * cache.m4.10xlarge

 T4g node types (available only
     * for Redis engine version 5.0.6 onward and Memcached engine version 1.5.16
     * onward): cache.t4g.micro, cache.t4g.small,
     * cache.t4g.medium

 T3 node types:
     * cache.t3.micro, cache.t3.small,
     * cache.t3.medium

 T2 node types:
     * cache.t2.micro, cache.t2.small,
     * cache.t2.medium

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 T1 node types:
     * cache.t1.micro

 M1 node types:
     * cache.m1.small, cache.m1.medium,
     * cache.m1.large, cache.m1.xlarge

 M3 node
     * types: cache.m3.medium, cache.m3.large,
     * cache.m3.xlarge, cache.m3.2xlarge

     *

Compute optimized:

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 C1 node types:
     * cache.c1.xlarge

Memory
     * optimized:

Current generation:

 R6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward).

 cache.r6g.large,
     * cache.r6g.xlarge, cache.r6g.2xlarge,
     * cache.r6g.4xlarge, cache.r6g.8xlarge,
     * cache.r6g.12xlarge, cache.r6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 R5 node types:
     * cache.r5.large, cache.r5.xlarge,
     * cache.r5.2xlarge, cache.r5.4xlarge,
     * cache.r5.12xlarge, cache.r5.24xlarge

 R4
     * node types: cache.r4.large, cache.r4.xlarge,
     * cache.r4.2xlarge, cache.r4.4xlarge,
     * cache.r4.8xlarge, cache.r4.16xlarge

     *
Previous generation: (not recommended. Existing clusters are still supported
     * but creation of new clusters is not supported for these types.)

 M2
     * node types: cache.m2.xlarge, cache.m2.2xlarge,
     * cache.m2.4xlarge

 R3 node types:
     * cache.r3.large, cache.r3.xlarge,
     * cache.r3.2xlarge, cache.r3.4xlarge,
     * cache.r3.8xlarge

 Additional
     * node type info

All current generation instance types are
     * created in Amazon VPC by default.

Redis append-only files
     * (AOF) are not supported for T1 or T2 instances.

Redis Multi-AZ
     * with automatic failover is not supported on T1 instances.

     *
Redis configuration variables appendonly and
     * appendfsync are not supported on Redis version 2.8.22 and
     * later.

     */
    inline void SetCacheNodeType(const char* value) { m_cacheNodeTypeHasBeenSet = true; m_cacheNodeType.assign(value); }

    /**
     *
The cache node type for the reserved cache nodes.

The following node
     * types are supported by ElastiCache. Generally speaking, the current generation
     * types provide more memory and computational power at lower cost when compared to
     * their equivalent previous generation counterparts.

General
     * purpose:

Current generation:

 M6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward): cache.m6g.large,
     * cache.m6g.xlarge, cache.m6g.2xlarge,
     * cache.m6g.4xlarge, cache.m6g.8xlarge,
     * cache.m6g.12xlarge, cache.m6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 M5 node types:
     * cache.m5.large, cache.m5.xlarge,
     * cache.m5.2xlarge, cache.m5.4xlarge,
     * cache.m5.12xlarge, cache.m5.24xlarge

 M4
     * node types: cache.m4.large, cache.m4.xlarge,
     * cache.m4.2xlarge, cache.m4.4xlarge,
     * cache.m4.10xlarge

 T4g node types (available only
     * for Redis engine version 5.0.6 onward and Memcached engine version 1.5.16
     * onward): cache.t4g.micro, cache.t4g.small,
     * cache.t4g.medium

 T3 node types:
     * cache.t3.micro, cache.t3.small,
     * cache.t3.medium

 T2 node types:
     * cache.t2.micro, cache.t2.small,
     * cache.t2.medium

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 T1 node types:
     * cache.t1.micro

 M1 node types:
     * cache.m1.small, cache.m1.medium,
     * cache.m1.large, cache.m1.xlarge

 M3 node
     * types: cache.m3.medium, cache.m3.large,
     * cache.m3.xlarge, cache.m3.2xlarge

     *

Compute optimized:

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 C1 node types:
     * cache.c1.xlarge

Memory
     * optimized:

Current generation:

 R6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward).

 cache.r6g.large,
     * cache.r6g.xlarge, cache.r6g.2xlarge,
     * cache.r6g.4xlarge, cache.r6g.8xlarge,
     * cache.r6g.12xlarge, cache.r6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 R5 node types:
     * cache.r5.large, cache.r5.xlarge,
     * cache.r5.2xlarge, cache.r5.4xlarge,
     * cache.r5.12xlarge, cache.r5.24xlarge

 R4
     * node types: cache.r4.large, cache.r4.xlarge,
     * cache.r4.2xlarge, cache.r4.4xlarge,
     * cache.r4.8xlarge, cache.r4.16xlarge

     *
Previous generation: (not recommended. Existing clusters are still supported
     * but creation of new clusters is not supported for these types.)

 M2
     * node types: cache.m2.xlarge, cache.m2.2xlarge,
     * cache.m2.4xlarge

 R3 node types:
     * cache.r3.large, cache.r3.xlarge,
     * cache.r3.2xlarge, cache.r3.4xlarge,
     * cache.r3.8xlarge

 Additional
     * node type info

All current generation instance types are
     * created in Amazon VPC by default.

Redis append-only files
     * (AOF) are not supported for T1 or T2 instances.

Redis Multi-AZ
     * with automatic failover is not supported on T1 instances.

     *
Redis configuration variables appendonly and
     * appendfsync are not supported on Redis version 2.8.22 and
     * later.

     */
    inline ReservedCacheNode& WithCacheNodeType(const Aws::String& value) { SetCacheNodeType(value); return *this;}

    /**
     *
The cache node type for the reserved cache nodes.

The following node
     * types are supported by ElastiCache. Generally speaking, the current generation
     * types provide more memory and computational power at lower cost when compared to
     * their equivalent previous generation counterparts.

General
     * purpose:

Current generation:

 M6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward): cache.m6g.large,
     * cache.m6g.xlarge, cache.m6g.2xlarge,
     * cache.m6g.4xlarge, cache.m6g.8xlarge,
     * cache.m6g.12xlarge, cache.m6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 M5 node types:
     * cache.m5.large, cache.m5.xlarge,
     * cache.m5.2xlarge, cache.m5.4xlarge,
     * cache.m5.12xlarge, cache.m5.24xlarge

 M4
     * node types: cache.m4.large, cache.m4.xlarge,
     * cache.m4.2xlarge, cache.m4.4xlarge,
     * cache.m4.10xlarge

 T4g node types (available only
     * for Redis engine version 5.0.6 onward and Memcached engine version 1.5.16
     * onward): cache.t4g.micro, cache.t4g.small,
     * cache.t4g.medium

 T3 node types:
     * cache.t3.micro, cache.t3.small,
     * cache.t3.medium

 T2 node types:
     * cache.t2.micro, cache.t2.small,
     * cache.t2.medium

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 T1 node types:
     * cache.t1.micro

 M1 node types:
     * cache.m1.small, cache.m1.medium,
     * cache.m1.large, cache.m1.xlarge

 M3 node
     * types: cache.m3.medium, cache.m3.large,
     * cache.m3.xlarge, cache.m3.2xlarge

     *

Compute optimized:

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 C1 node types:
     * cache.c1.xlarge

Memory
     * optimized:

Current generation:

 R6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward).

 cache.r6g.large,
     * cache.r6g.xlarge, cache.r6g.2xlarge,
     * cache.r6g.4xlarge, cache.r6g.8xlarge,
     * cache.r6g.12xlarge, cache.r6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 R5 node types:
     * cache.r5.large, cache.r5.xlarge,
     * cache.r5.2xlarge, cache.r5.4xlarge,
     * cache.r5.12xlarge, cache.r5.24xlarge

 R4
     * node types: cache.r4.large, cache.r4.xlarge,
     * cache.r4.2xlarge, cache.r4.4xlarge,
     * cache.r4.8xlarge, cache.r4.16xlarge

     *
Previous generation: (not recommended. Existing clusters are still supported
     * but creation of new clusters is not supported for these types.)

 M2
     * node types: cache.m2.xlarge, cache.m2.2xlarge,
     * cache.m2.4xlarge

 R3 node types:
     * cache.r3.large, cache.r3.xlarge,
     * cache.r3.2xlarge, cache.r3.4xlarge,
     * cache.r3.8xlarge

 Additional
     * node type info

All current generation instance types are
     * created in Amazon VPC by default.

Redis append-only files
     * (AOF) are not supported for T1 or T2 instances.

Redis Multi-AZ
     * with automatic failover is not supported on T1 instances.

     *
Redis configuration variables appendonly and
     * appendfsync are not supported on Redis version 2.8.22 and
     * later.

     */
    inline ReservedCacheNode& WithCacheNodeType(Aws::String&& value) { SetCacheNodeType(std::move(value)); return *this;}

    /**
     *
The cache node type for the reserved cache nodes.

The following node
     * types are supported by ElastiCache. Generally speaking, the current generation
     * types provide more memory and computational power at lower cost when compared to
     * their equivalent previous generation counterparts.

General
     * purpose:

Current generation:

 M6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward): cache.m6g.large,
     * cache.m6g.xlarge, cache.m6g.2xlarge,
     * cache.m6g.4xlarge, cache.m6g.8xlarge,
     * cache.m6g.12xlarge, cache.m6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 M5 node types:
     * cache.m5.large, cache.m5.xlarge,
     * cache.m5.2xlarge, cache.m5.4xlarge,
     * cache.m5.12xlarge, cache.m5.24xlarge

 M4
     * node types: cache.m4.large, cache.m4.xlarge,
     * cache.m4.2xlarge, cache.m4.4xlarge,
     * cache.m4.10xlarge

 T4g node types (available only
     * for Redis engine version 5.0.6 onward and Memcached engine version 1.5.16
     * onward): cache.t4g.micro, cache.t4g.small,
     * cache.t4g.medium

 T3 node types:
     * cache.t3.micro, cache.t3.small,
     * cache.t3.medium

 T2 node types:
     * cache.t2.micro, cache.t2.small,
     * cache.t2.medium

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 T1 node types:
     * cache.t1.micro

 M1 node types:
     * cache.m1.small, cache.m1.medium,
     * cache.m1.large, cache.m1.xlarge

 M3 node
     * types: cache.m3.medium, cache.m3.large,
     * cache.m3.xlarge, cache.m3.2xlarge

     *

Compute optimized:

Previous generation: (not
     * recommended. Existing clusters are still supported but creation of new clusters
     * is not supported for these types.)

 C1 node types:
     * cache.c1.xlarge

Memory
     * optimized:

Current generation:

 R6g node types
     * (available only for Redis engine version 5.0.6 onward and for Memcached engine
     * version 1.5.16 onward).

 cache.r6g.large,
     * cache.r6g.xlarge, cache.r6g.2xlarge,
     * cache.r6g.4xlarge, cache.r6g.8xlarge,
     * cache.r6g.12xlarge, cache.r6g.16xlarge

     *
For region availability, see Supported
     * Node Types

 R5 node types:
     * cache.r5.large, cache.r5.xlarge,
     * cache.r5.2xlarge, cache.r5.4xlarge,
     * cache.r5.12xlarge, cache.r5.24xlarge

 R4
     * node types: cache.r4.large, cache.r4.xlarge,
     * cache.r4.2xlarge, cache.r4.4xlarge,
     * cache.r4.8xlarge, cache.r4.16xlarge

     *
Previous generation: (not recommended. Existing clusters are still supported
     * but creation of new clusters is not supported for these types.)

 M2
     * node types: cache.m2.xlarge, cache.m2.2xlarge,
     * cache.m2.4xlarge

 R3 node types:
     * cache.r3.large, cache.r3.xlarge,
     * cache.r3.2xlarge, cache.r3.4xlarge,
     * cache.r3.8xlarge

 Additional
     * node type info

All current generation instance types are
     * created in Amazon VPC by default.

Redis append-only files
     * (AOF) are not supported for T1 or T2 instances.

Redis Multi-AZ
     * with automatic failover is not supported on T1 instances.

     *
Redis configuration variables appendonly and
     * appendfsync are not supported on Redis version 2.8.22 and
     * later.

     */
    inline ReservedCacheNode& WithCacheNodeType(const char* value) { SetCacheNodeType(value); return *this;}

    /**
     *
The time the reservation started.

     */
    inline const Aws::Utils::DateTime& GetStartTime() const{ return m_startTime; }

    /**
     *
The time the reservation started.

     */
    inline bool StartTimeHasBeenSet() const { return m_startTimeHasBeenSet; }

    /**
     *
The time the reservation started.

     */
    inline void SetStartTime(const Aws::Utils::DateTime& value) { m_startTimeHasBeenSet = true; m_startTime = value; }

    /**
     *
The time the reservation started.

     */
    inline void SetStartTime(Aws::Utils::DateTime&& value) { m_startTimeHasBeenSet = true; m_startTime = std::move(value); }

    /**
     *
The time the reservation started.

     */
    inline ReservedCacheNode& WithStartTime(const Aws::Utils::DateTime& value) { SetStartTime(value); return *this;}

    /**
     *
The time the reservation started.

     */
    inline ReservedCacheNode& WithStartTime(Aws::Utils::DateTime&& value) { SetStartTime(std::move(value)); return *this;}

    /**
     *
The duration of the reservation in seconds.

     */
    inline int GetDuration() const{ return m_duration; }

    /**
     *
The duration of the reservation in seconds.

     */
    inline bool DurationHasBeenSet() const { return m_durationHasBeenSet; }

    /**
     *
The duration of the reservation in seconds.

     */
    inline void SetDuration(int value) { m_durationHasBeenSet = true; m_duration = value; }

    /**
     *
The duration of the reservation in seconds.

     */
    inline ReservedCacheNode& WithDuration(int value) { SetDuration(value); return *this;}

    /**
     *
The fixed price charged for this reserved cache node.

     */
    inline double GetFixedPrice() const{ return m_fixedPrice; }

    /**
     *
The fixed price charged for this reserved cache node.

     */
    inline bool FixedPriceHasBeenSet() const { return m_fixedPriceHasBeenSet; }

    /**
     *
The fixed price charged for this reserved cache node.

     */
    inline void SetFixedPrice(double value) { m_fixedPriceHasBeenSet = true; m_fixedPrice = value; }

    /**
     *
The fixed price charged for this reserved cache node.

     */
    inline ReservedCacheNode& WithFixedPrice(double value) { SetFixedPrice(value); return *this;}

    /**
     *
The hourly price charged for this reserved cache node.

     */
    inline double GetUsagePrice() const{ return m_usagePrice; }

    /**
     *
The hourly price charged for this reserved cache node.

     */
    inline bool UsagePriceHasBeenSet() const { return m_usagePriceHasBeenSet; }

    /**
     *
The hourly price charged for this reserved cache node.

     */
    inline void SetUsagePrice(double value) { m_usagePriceHasBeenSet = true; m_usagePrice = value; }

    /**
     *
The hourly price charged for this reserved cache node.

     */
    inline ReservedCacheNode& WithUsagePrice(double value) { SetUsagePrice(value); return *this;}

    /**
     *
The number of cache nodes that have been reserved.

     */
    inline int GetCacheNodeCount() const{ return m_cacheNodeCount; }

    /**
     *
The number of cache nodes that have been reserved.

     */
    inline bool CacheNodeCountHasBeenSet() const { return m_cacheNodeCountHasBeenSet; }

    /**
     *
The number of cache nodes that have been reserved.

     */
    inline void SetCacheNodeCount(int value) { m_cacheNodeCountHasBeenSet = true; m_cacheNodeCount = value; }

    /**
     *
The number of cache nodes that have been reserved.

     */
    inline ReservedCacheNode& WithCacheNodeCount(int value) { SetCacheNodeCount(value); return *this;}

    /**
     *
The description of the reserved cache node.

     */
    inline const Aws::String& GetProductDescription() const{ return m_productDescription; }

    /**
     *
The description of the reserved cache node.

     */
    inline bool ProductDescriptionHasBeenSet() const { return m_productDescriptionHasBeenSet; }

    /**
     *
The description of the reserved cache node.

     */
    inline void SetProductDescription(const Aws::String& value) { m_productDescriptionHasBeenSet = true; m_productDescription = value; }

    /**
     *
The description of the reserved cache node.

     */
    inline void SetProductDescription(Aws::String&& value) { m_productDescriptionHasBeenSet = true; m_productDescription = std::move(value); }

    /**
     *
The description of the reserved cache node.

     */
    inline void SetProductDescription(const char* value) { m_productDescriptionHasBeenSet = true; m_productDescription.assign(value); }

    /**
     *
The description of the reserved cache node.

     */
    inline ReservedCacheNode& WithProductDescription(const Aws::String& value) { SetProductDescription(value); return *this;}

    /**
     *
The description of the reserved cache node.

     */
    inline ReservedCacheNode& WithProductDescription(Aws::String&& value) { SetProductDescription(std::move(value)); return *this;}

    /**
     *
The description of the reserved cache node.

     */
    inline ReservedCacheNode& WithProductDescription(const char* value) { SetProductDescription(value); return *this;}

    /**
     *
The offering type of this reserved cache node.

     */
    inline const Aws::String& GetOfferingType() const{ return m_offeringType; }

    /**
     *
The offering type of this reserved cache node.

     */
    inline bool OfferingTypeHasBeenSet() const { return m_offeringTypeHasBeenSet; }

    /**
     *
The offering type of this reserved cache node.

     */
    inline void SetOfferingType(const Aws::String& value) { m_offeringTypeHasBeenSet = true; m_offeringType = value; }

    /**
     *
The offering type of this reserved cache node.

     */
    inline void SetOfferingType(Aws::String&& value) { m_offeringTypeHasBeenSet = true; m_offeringType = std::move(value); }

    /**
     *
The offering type of this reserved cache node.

     */
    inline void SetOfferingType(const char* value) { m_offeringTypeHasBeenSet = true; m_offeringType.assign(value); }

    /**
     *
The offering type of this reserved cache node.

     */
    inline ReservedCacheNode& WithOfferingType(const Aws::String& value) { SetOfferingType(value); return *this;}

    /**
     *
The offering type of this reserved cache node.

     */
    inline ReservedCacheNode& WithOfferingType(Aws::String&& value) { SetOfferingType(std::move(value)); return *this;}

    /**
     *
The offering type of this reserved cache node.

     */
    inline ReservedCacheNode& WithOfferingType(const char* value) { SetOfferingType(value); return *this;}

    /**
     *
The state of the reserved cache node.

     */
    inline const Aws::String& GetState() const{ return m_state; }

    /**
     *
The state of the reserved cache node.

     */
    inline bool StateHasBeenSet() const { return m_stateHasBeenSet; }

    /**
     *
The state of the reserved cache node.

     */
    inline void SetState(const Aws::String& value) { m_stateHasBeenSet = true; m_state = value; }

    /**
     *
The state of the reserved cache node.

     */
    inline void SetState(Aws::String&& value) { m_stateHasBeenSet = true; m_state = std::move(value); }

    /**
     *
The state of the reserved cache node.

     */
    inline void SetState(const char* value) { m_stateHasBeenSet = true; m_state.assign(value); }

    /**
     *
The state of the reserved cache node.

     */
    inline ReservedCacheNode& WithState(const Aws::String& value) { SetState(value); return *this;}

    /**
     *
The state of the reserved cache node.

     */
    inline ReservedCacheNode& WithState(Aws::String&& value) { SetState(std::move(value)); return *this;}

    /**
     *
The state of the reserved cache node.

     */
    inline ReservedCacheNode& WithState(const char* value) { SetState(value); return *this;}

    /**
     *
The recurring price charged to run this reserved cache node.

     */
    inline const Aws::Vector<RecurringCharge>& GetRecurringCharges() const{ return m_recurringCharges; }

    /**
     *
The recurring price charged to run this reserved cache node.

     */
    inline bool RecurringChargesHasBeenSet() const { return m_recurringChargesHasBeenSet; }

    /**
     *
The recurring price charged to run this reserved cache node.

     */
    inline void SetRecurringCharges(const Aws::Vector<RecurringCharge>& value) { m_recurringChargesHasBeenSet = true; m_recurringCharges = value; }

    /**
     *
The recurring price charged to run this reserved cache node.

     */
    inline void SetRecurringCharges(Aws::Vector<RecurringCharge>&& value) { m_recurringChargesHasBeenSet = true; m_recurringCharges = std::move(value); }

    /**
     *
The recurring price charged to run this reserved cache node.

     */
    inline ReservedCacheNode& WithRecurringCharges(const Aws::Vector<RecurringCharge>& value) { SetRecurringCharges(value); return *this;}

    /**
     *
The recurring price charged to run this reserved cache node.

     */
    inline ReservedCacheNode& WithRecurringCharges(Aws::Vector<RecurringCharge>&& value) { SetRecurringCharges(std::move(value)); return *this;}

    /**
     *
The recurring price charged to run this reserved cache node.

     */
    inline ReservedCacheNode& AddRecurringCharges(const RecurringCharge& value) { m_recurringChargesHasBeenSet = true; m_recurringCharges.push_back(value); return *this; }

    /**
     *
The recurring price charged to run this reserved cache node.

     */
    inline ReservedCacheNode& AddRecurringCharges(RecurringCharge&& value) { m_recurringChargesHasBeenSet = true; m_recurringCharges.push_back(std::move(value)); return *this; }

    /**
     *
The Amazon Resource Name (ARN) of the reserved cache node.

Example:
     * arn:aws:elasticache:us-east-1:123456789012:reserved-instance:ri-2017-03-27-08-33-25-582
     *

     */
    inline const Aws::String& GetReservationARN() const{ return m_reservationARN; }

    /**
     *
The Amazon Resource Name (ARN) of the reserved cache node.

Example:
     * arn:aws:elasticache:us-east-1:123456789012:reserved-instance:ri-2017-03-27-08-33-25-582
     *

     */
    inline bool ReservationARNHasBeenSet() const { return m_reservationARNHasBeenSet; }

    /**
     *
The Amazon Resource Name (ARN) of the reserved cache node.

Example:
     * arn:aws:elasticache:us-east-1:123456789012:reserved-instance:ri-2017-03-27-08-33-25-582
     *

     */
    inline void SetReservationARN(const Aws::String& value) { m_reservationARNHasBeenSet = true; m_reservationARN = value; }

    /**
     *
The Amazon Resource Name (ARN) of the reserved cache node.

Example:
     * arn:aws:elasticache:us-east-1:123456789012:reserved-instance:ri-2017-03-27-08-33-25-582
     *

     */
    inline void SetReservationARN(Aws::String&& value) { m_reservationARNHasBeenSet = true; m_reservationARN = std::move(value); }

    /**
     *
The Amazon Resource Name (ARN) of the reserved cache node.

Example:
     * arn:aws:elasticache:us-east-1:123456789012:reserved-instance:ri-2017-03-27-08-33-25-582
     *

     */
    inline void SetReservationARN(const char* value) { m_reservationARNHasBeenSet = true; m_reservationARN.assign(value); }

    /**
     *
The Amazon Resource Name (ARN) of the reserved cache node.

Example:
     * arn:aws:elasticache:us-east-1:123456789012:reserved-instance:ri-2017-03-27-08-33-25-582
     *

     */
    inline ReservedCacheNode& WithReservationARN(const Aws::String& value) { SetReservationARN(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the reserved cache node.

Example:
     * arn:aws:elasticache:us-east-1:123456789012:reserved-instance:ri-2017-03-27-08-33-25-582
     *

     */
    inline ReservedCacheNode& WithReservationARN(Aws::String&& value) { SetReservationARN(std::move(value)); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the reserved cache node.

Example:
     * arn:aws:elasticache:us-east-1:123456789012:reserved-instance:ri-2017-03-27-08-33-25-582
     *

     */
    inline ReservedCacheNode& WithReservationARN(const char* value) { SetReservationARN(value); return *this;}

  private:

    Aws::String m_reservedCacheNodeId;
    bool m_reservedCacheNodeIdHasBeenSet = false;

    Aws::String m_reservedCacheNodesOfferingId;
    bool m_reservedCacheNodesOfferingIdHasBeenSet = false;

    Aws::String m_cacheNodeType;
    bool m_cacheNodeTypeHasBeenSet = false;

    Aws::Utils::DateTime m_startTime;
    bool m_startTimeHasBeenSet = false;

    int m_duration;
    bool m_durationHasBeenSet = false;

    double m_fixedPrice;
    bool m_fixedPriceHasBeenSet = false;

    double m_usagePrice;
    bool m_usagePriceHasBeenSet = false;

    int m_cacheNodeCount;
    bool m_cacheNodeCountHasBeenSet = false;

    Aws::String m_productDescription;
    bool m_productDescriptionHasBeenSet = false;

    Aws::String m_offeringType;
    bool m_offeringTypeHasBeenSet = false;

    Aws::String m_state;
    bool m_stateHasBeenSet = false;

    Aws::Vector<RecurringCharge> m_recurringCharges;
    bool m_recurringChargesHasBeenSet = false;

    Aws::String m_reservationARN;
    bool m_reservationARNHasBeenSet = false;
  };

} // namespace Model
} // namespace ElastiCache
} // namespace Aws


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>net.yahoo.fireeagle.location - Fire Eagle API AS3 library</title>
<base target="classFrame">
<link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../../print.css" type="text/css" media="print">

Package net.yahoo.fireeagle.location

Classes

BoundingBox

LatLon


text:
select count(*) as CountryCode from Countries as c
left join MountainsCountries as mc
on c.CountryCode = mc.CountryCode
where mc.MountainId is null


text:
'use strict';

angular.module('users').controller('SettingsController', ['$scope', '$http', '$location', 'Users', 'Authentication','CollegeService', 'Upload', '$timeout',
	function($scope, $http, $location, Users, Authentication, CollegeService , Upload, $timeout) {
		$scope.user = Authentication.user;
		$scope.userColleges = [];
		$scope.college = {};
		// If user is not signed in then redirect back home
		if (!$scope.user) $location.path('/');

		// Check if there are additional accounts
		$scope.hasConnectedAdditionalSocialAccounts = function(provider) {
			for (var i in $scope.user.additionalProvidersData) {
				return true;
			}
			return false;
		};

		// Check if provider is already in use with current user
		$scope.isConnectedSocialAccount = function(provider) {
			return $scope.user.provider === provider || ($scope.user.additionalProvidersData && $scope.user.additionalProvidersData[provider]);
		};

		$scope.userProfileInitData = function() {
               CollegeService.query({'userid' : $scope.user._id}, function(resp){
               		$scope.userColleges = resp;
               		console.log(resp);
               });

        };

		// Remove a user social account
		$scope.removeUserSocialAccount = function(provider) {
			$scope.success = $scope.error = null;

			$http.delete('/users/accounts', {
				params: {
					provider: provider
				}
			}).success(function(response) {
				// If successful show success message and clear form
				$scope.success = true;
				$scope.user = Authentication.user = response;
			}).error(function(response) {
				$scope.error = response.message;
			});
		};

		$scope.removeCollege = function(college){
			if (college) {
				college.$remove();
                for (var i in $scope.userColleges) {
                    if ($scope.userColleges [i] === college) {
                             $scope.userColleges.splice(i, 1);
                    }
                }
            }
		};
		// Update a user profile
		$scope.updateUserProfile = function(isValid) {
			if (isValid) {
				$scope.success = $scope.error = null;
				var user = new Users($scope.user);

				user.$update(function(response) {
					$scope.profileSuccess = true;
					Authentication.user = response;
				}, function(response) {
					$scope.profileError = response.data.message;
				});
			} else {
				$scope.submitted = true;
			}
		};

		$scope.updateUserCollege = function(isValid){
			if (isValid) {
				$scope.success = $scope.error = null;
                   var college = new CollegeService ({
                            name: $scope.college.name,
                            department: $scope.college.department,
                            fromDate : $scope.college.fromDate,
                            toDate : $scope.college.toDate,
                            userid : $scope.user._id
                   });
                 college.$save(function(response) {
                       $scope.collegeSuccess = true;
                       $scope.userColleges.push(response);
                       $scope.college = {};
                 }, function(errorResponse) {
                       $scope.collegeError = errorResponse.data.message;
                 });
             } else {
            		$scope.submitted = true;
             }
		};
		// Change user password
		$scope.changeUserPassword = function() {
			$scope.success = $scope.error = null;

			$http.post('/users/password', $scope.passwordDetails).success(function(response) {
				// If successful show success message and clear form
				$scope.success = true;
				$scope.passwordDetails = null;
			}).error(function(response) {
				$scope.error = response.message;
			});
		};

        $scope.uploadFiles = function(file, errFiles) {
            $scope.f = file;
            $scope.errFile = errFiles && errFiles[0];
            if (file) {
                file.upload = Upload.upload({
                    url: 'https://angular-file-upload-cors-srv.appspot.com/upload',
                    data: {file: file}
                });

                file.upload.then(function (response) {
                    $timeout(function () {
                        file.result = response.data;
                    });
                }, function (response) {
                    if (response.status > 0)
                        $scope.errorMsg = response.status + ': ' + response.data;
                }, function (evt) {
                    file.progress = Math.min(100, parseInt(100.0 *
                    evt.loaded / evt.total));
                });
            }
        };

		  var tabClasses;

          function initTabs() {
            tabClasses = ['','','',''];
          }

          $scope.getTabClass = function (tabNum) {
            return tabClasses[tabNum];
          };

          $scope.getTabPaneClass = function (tabNum) {
            return 'tab-pane' + tabClasses[tabNum];
          };

          $scope.setActiveTab = function (tabNum) {
            initTabs();
            tabClasses[tabNum] = 'active';
          };

          initTabs();
          $scope.setActiveTab(1);
	}
]);