List of usage examples for com.amazonaws.services.autoscaling.model DescribePoliciesRequest DescribePoliciesRequest
DescribePoliciesRequest
From source file:com.netflix.edda.EddaAutoScalingClient.java
License:Apache License
public DescribePoliciesResult describePolicies() { return describePolicies(new DescribePoliciesRequest()); }
From source file:com.pinterest.arcee.autoscaling.AwsAutoScaleGroupManager.java
License:Apache License
@Override public Map<String, ScalingPolicyBean> getScalingPoliciesForGroup(String groupName) throws Exception { Map<String, ScalingPolicyBean> policyBeans = new HashMap<>(); try {// w w w . ja v a 2s . co m DescribePoliciesRequest request = new DescribePoliciesRequest(); request.setAutoScalingGroupName(groupName); DescribePoliciesResult result = aasClient.describePolicies(request); List<ScalingPolicy> policySet = result.getScalingPolicies(); for (ScalingPolicy policy : policySet) { ScalingPolicyBean bean = new ScalingPolicyBean(); bean.setCoolDownTime(policy.getCooldown() / 60); bean.setScalingType(policy.getAdjustmentType()); bean.setPolicyName(policy.getPolicyName()); bean.setScaleSize(policy.getScalingAdjustment()); bean.setARN(policy.getPolicyARN()); policyBeans.put(bean.getPolicyName(), bean); } return policyBeans; } catch (com.amazonaws.AmazonServiceException e) { return policyBeans; } }
From source file:com.pinterest.arcee.autoscaling.AwsAutoScalingManager.java
License:Apache License
@Override public Map<String, ScalingPolicyBean> getScalingPoliciesForGroup(String groupName) throws Exception { Map<String, ScalingPolicyBean> policyBeans = new HashMap<>(); try {/*from w w w.j ava 2 s.c om*/ DescribePoliciesRequest request = new DescribePoliciesRequest(); request.setAutoScalingGroupName(groupName); DescribePoliciesResult result = aasClient.describePolicies(request); List<ScalingPolicy> policySet = result.getScalingPolicies(); for (ScalingPolicy policy : policySet) { ScalingPolicyBean bean = new ScalingPolicyBean(); bean.setCoolDownTime(policy.getCooldown() / 60); bean.setScalingType(policy.getAdjustmentType()); bean.setScaleSize(policy.getScalingAdjustment()); if (policy.getScalingAdjustment() > 0) { bean.setPolicyType(PolicyType.SCALEUP.toString()); } else { bean.setPolicyType(PolicyType.SCALEDOWN.toString()); } bean.setARN(policy.getPolicyARN()); policyBeans.put(bean.getPolicyType(), bean); } return policyBeans; } catch (com.amazonaws.AmazonServiceException e) { return policyBeans; } }