Example usage for com.amazonaws.services.autoscaling.model PutScalingPolicyRequest withPolicyName

List of usage examples for com.amazonaws.services.autoscaling.model PutScalingPolicyRequest withPolicyName

Introduction

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

Prototype


public PutScalingPolicyRequest withPolicyName(String policyName) 

Source Link

Document

The name of the policy.

Usage

From source file:virtualIT.java

License:Open Source License

private static void createScalingPolicy(int userId) {
    System.out.println("Creating Scalling Policy");
    PutScalingPolicyRequest putScalingUpPolicyRequest = new PutScalingPolicyRequest();
    putScalingUpPolicyRequest.withPolicyName(SCALE_UP_POLICY_NAME)
            .withAutoScalingGroupName(virtualIT.autoScalingGroupName).withScalingAdjustment(1)
            .withAdjustmentType("ChangeInCapacity").withCooldown(COOL_DOWN_DURATION);

    PutScalingPolicyRequest putScalingDownPolicyRequest = new PutScalingPolicyRequest();
    putScalingDownPolicyRequest.withPolicyName(SCALE_DOWN_POLICY_NAME)
            .withAutoScalingGroupName(virtualIT.autoScalingGroupName).withScalingAdjustment(-1)
            .withAdjustmentType("ChangeInCapacity").withCooldown(COOL_DOWN_DURATION);

    PutScalingPolicyResult scalingupResult = autoScaleClient.putScalingPolicy(putScalingUpPolicyRequest);
    PutScalingPolicyResult scalingdownResult = autoScaleClient.putScalingPolicy(putScalingDownPolicyRequest);

    SCALE_UP_POLICY_ARN = scalingupResult.getPolicyARN();
    SCALE_DOWN_POLICY_ARN = scalingdownResult.getPolicyARN();
}