Example usage for com.amazonaws.services.applicationautoscaling.model RegisterScalableTargetRequest getResourceId

List of usage examples for com.amazonaws.services.applicationautoscaling.model RegisterScalableTargetRequest getResourceId

Introduction

In this page you can find the example usage for com.amazonaws.services.applicationautoscaling.model RegisterScalableTargetRequest getResourceId.

Prototype


public String getResourceId() 

Source Link

Document

The identifier of the resource that is associated with the scalable target.

Usage

From source file:com.netflix.spinnaker.clouddriver.ecs.deploy.ops.CreateServerGroupAtomicOperation.java

License:Apache License

private String registerAutoScalingGroup(AmazonCredentials credentials, Service service) {

    AWSApplicationAutoScaling autoScalingClient = getAmazonApplicationAutoScalingClient();
    String assumedRoleArn = inferAssumedRoleArn(credentials);

    RegisterScalableTargetRequest request = new RegisterScalableTargetRequest()
            .withServiceNamespace(ServiceNamespace.Ecs)
            .withScalableDimension(ScalableDimension.EcsServiceDesiredCount)
            .withResourceId(/*from   w w  w.  ja  v a  2  s .com*/
                    String.format("service/%s/%s", description.getEcsClusterName(), service.getServiceName()))
            .withRoleARN(assumedRoleArn).withMinCapacity(description.getCapacity().getMin())
            .withMaxCapacity(description.getCapacity().getMax());

    updateTaskStatus("Creating Amazon Application Auto Scaling Scalable Target Definition...");
    autoScalingClient.registerScalableTarget(request);
    updateTaskStatus("Done creating Amazon Application Auto Scaling Scalable Target Definition.");

    return request.getResourceId();
}