Example usage for com.amazonaws.services.autoscaling.model PutNotificationConfigurationRequest setNotificationTypes

List of usage examples for com.amazonaws.services.autoscaling.model PutNotificationConfigurationRequest setNotificationTypes

Introduction

In this page you can find the example usage for com.amazonaws.services.autoscaling.model PutNotificationConfigurationRequest setNotificationTypes.

Prototype


public void setNotificationTypes(java.util.Collection<String> notificationTypes) 

Source Link

Document

The type of event that causes the notification to be sent.

Usage

From source file:com.pinterest.arcee.autoscaling.AwsAutoScaleGroupManager.java

License:Apache License

@Override
public void createAutoScalingGroup(String ConfigId, AutoScalingRequestBean request, String subnets)
        throws Exception {
    CreateAutoScalingGroupRequest autoScalingGroupRequest = new CreateAutoScalingGroupRequest();
    autoScalingGroupRequest.setAutoScalingGroupName(request.getGroupName());
    autoScalingGroupRequest.setVPCZoneIdentifier(subnets);
    autoScalingGroupRequest.withMinSize(request.getMinSize()).withMaxSize(request.getMaxSize());
    autoScalingGroupRequest.setLaunchConfigurationName(ConfigId);
    autoScalingGroupRequest.setTerminationPolicies(Arrays.asList(request.getTerminationPolicy()));
    aasClient.createAutoScalingGroup(autoScalingGroupRequest);

    SuspendProcessesRequest suspendProcessesRequest = new SuspendProcessesRequest();
    suspendProcessesRequest.setScalingProcesses(Arrays.asList(PROCESS_AZREBALANCE));
    suspendProcessesRequest.setAutoScalingGroupName(request.getGroupName());
    aasClient.suspendProcesses(suspendProcessesRequest);

    // setup notificaiton
    if (!StringUtils.isEmpty(SNS_TOPIC_ARN)) {
        PutNotificationConfigurationRequest notifRequest = new PutNotificationConfigurationRequest();
        notifRequest.setAutoScalingGroupName(request.getGroupName());
        notifRequest.setTopicARN(SNS_TOPIC_ARN);
        notifRequest.setNotificationTypes(Arrays.asList(NOTIFICATION_TYPE));
        aasClient.putNotificationConfiguration(notifRequest);
    }/*from  w  ww .  j a  v  a 2 s  . c o m*/
}

From source file:com.pinterest.arcee.autoscaling.AwsAutoScalingManager.java

License:Apache License

@Override
public void createAutoScalingGroup(String groupName, AwsVmBean request) throws Exception {
    CreateAutoScalingGroupRequest autoScalingGroupRequest = new CreateAutoScalingGroupRequest();
    autoScalingGroupRequest.setAutoScalingGroupName(groupName);
    autoScalingGroupRequest.setVPCZoneIdentifier(request.getSubnet());
    autoScalingGroupRequest.withMinSize(request.getMinSize()).withMaxSize(request.getMaxSize());
    autoScalingGroupRequest.setLaunchConfigurationName(request.getLaunchConfigId());
    autoScalingGroupRequest.setTerminationPolicies(Arrays.asList(request.getTerminationPolicy()));
    aasClient.createAutoScalingGroup(autoScalingGroupRequest);

    LOG.info(String.format("Creating auto scaling group: %s, with min size: %d, max size: %d", groupName,
            request.getMinSize(), request.getMaxSize()));
    disableAutoScalingActions(groupName, Collections.singletonList(PROCESS_AZREBALANCE));

    // setup notificaiton
    if (!StringUtils.isEmpty(snsArn)) {
        PutNotificationConfigurationRequest notifRequest = new PutNotificationConfigurationRequest();
        notifRequest.setAutoScalingGroupName(groupName);
        notifRequest.setTopicARN(snsArn);
        notifRequest.setNotificationTypes(Arrays.asList(NOTIFICATION_TYPE));
        aasClient.putNotificationConfiguration(notifRequest);
    }/* ww w  .  j av a 2  s .c om*/
}

From source file:com.pinterest.clusterservice.cm.AwsVmManager.java

License:Apache License

@Override
public void createCluster(String clusterName, AwsVmBean bean) throws Exception {
    bean.setLaunchConfigId(createLaunchConfig(clusterName, bean));
    createAutoScalingGroup(clusterName, bean);

    SuspendProcessesRequest suspendProcessesRequest = new SuspendProcessesRequest();
    suspendProcessesRequest.setAutoScalingGroupName(clusterName);
    suspendProcessesRequest.setScalingProcesses(Arrays.asList(PROCESS_AZREBALANCE));

    if (!StringUtils.isEmpty(snsArn)) {
        PutNotificationConfigurationRequest notifRequest = new PutNotificationConfigurationRequest();
        notifRequest.setAutoScalingGroupName(clusterName);
        notifRequest.setTopicARN(snsArn);
        notifRequest.setNotificationTypes(Arrays.asList(NOTIFICATION_TYPE));
        aasClient.putNotificationConfiguration(notifRequest);
    }/*from  w ww.  j a v a 2 s.  c  o m*/
}