Example usage for com.amazonaws.services.cloudwatch.model MetricAlarm getAlarmArn

List of usage examples for com.amazonaws.services.cloudwatch.model MetricAlarm getAlarmArn

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudwatch.model MetricAlarm getAlarmArn.

Prototype


public String getAlarmArn() 

Source Link

Document

The Amazon Resource Name (ARN) of the alarm.

Usage

From source file:com.netflix.spinnaker.clouddriver.ecs.provider.agent.EcsCloudMetricAlarmCachingAgent.java

License:Apache License

public static Map<String, Object> convertMetricAlarmToAttributes(MetricAlarm metricAlarm, String accountName,
        String region) {/*from  ww w  .  j a v a 2s.  c om*/
    Map<String, Object> attributes = new HashMap<>();
    attributes.put("alarmArn", metricAlarm.getAlarmArn());
    attributes.put("alarmName", metricAlarm.getAlarmName());
    attributes.put("alarmActions", metricAlarm.getAlarmActions());
    attributes.put("okActions", metricAlarm.getOKActions());
    attributes.put("insufficientDataActions", metricAlarm.getInsufficientDataActions());
    attributes.put("accountName", accountName);
    attributes.put("region", region);
    return attributes;
}

From source file:com.netflix.spinnaker.clouddriver.ecs.provider.agent.EcsCloudMetricAlarmCachingAgent.java

License:Apache License

Map<String, Collection<CacheData>> generateFreshData(Set<MetricAlarm> cacheableMetricAlarm) {
    Collection<CacheData> dataPoints = new HashSet<>();
    Map<String, Collection<CacheData>> newDataMap = new HashMap<>();

    for (MetricAlarm metricAlarm : cacheableMetricAlarm) {
        String key = Keys.getAlarmKey(accountName, region, metricAlarm.getAlarmArn());
        Map<String, Object> attributes = convertMetricAlarmToAttributes(metricAlarm, accountName, region);

        CacheData data = new DefaultCacheData(key, attributes, Collections.emptyMap());
        dataPoints.add(data);/*w  w w.jav a  2s .co m*/
    }

    log.info("Caching " + dataPoints.size() + " cloud metrics alarms in " + getAgentType());
    newDataMap.put(ALARMS.toString(), dataPoints);
    return newDataMap;
}