Example usage for com.amazonaws.services.autoscaling.model DescribePoliciesRequest getAutoScalingGroupName

List of usage examples for com.amazonaws.services.autoscaling.model DescribePoliciesRequest getAutoScalingGroupName

Introduction

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

Prototype


public String getAutoScalingGroupName() 

Source Link

Document

The name of the Auto Scaling group.

Usage

From source file:com.netflix.edda.EddaAutoScalingClient.java

License:Apache License

public DescribePoliciesResult describePolicies(DescribePoliciesRequest request) {
    TypeReference<List<ScalingPolicy>> ref = new TypeReference<List<ScalingPolicy>>() {
    };//from ww  w  . j  av  a  2  s .  c o  m
    String url = config.url() + "/api/v2/aws/scalingPolicies;_expand";
    try {
        List<ScalingPolicy> scalingPolicies = parse(ref, doGet(url));

        String asg = request.getAutoScalingGroupName();
        List<String> names = request.getPolicyNames();
        if (shouldFilter(asg) || shouldFilter(names)) {
            List<ScalingPolicy> sps = new ArrayList<ScalingPolicy>();
            for (ScalingPolicy sp : scalingPolicies) {
                if (matches(asg, sp.getAutoScalingGroupName()) && matches(names, sp.getPolicyName()))
                    sps.add(sp);
            }
            scalingPolicies = sps;
        }

        return new DescribePoliciesResult().withScalingPolicies(scalingPolicies);
    } catch (IOException e) {
        throw new AmazonClientException("Faled to parse " + url, e);
    }
}