// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.admin.monitoring; import java.util.Optional; /** * Helper object for CloudWatch configuration. * * @author gjoranv */ public class CloudWatch { private final String region; private final String namespace; private final MetricsConsumer consumer; private HostedAuth hostedAuth; private SharedCredentials sharedCredentials; public CloudWatch(String region, String namespace, MetricsConsumer consumer) { this.region = region; this.namespace = namespace; this.consumer = consumer; } public String region() { return region; } public String namespace() { return namespace; } public String consumer() { return consumer.id(); } public Optional hostedAuth() {return Optional.ofNullable(hostedAuth); } public Optional sharedCredentials() {return Optional.ofNullable(sharedCredentials); } public void setHostedAuth(String accessKeyName, String secretKeyName) { hostedAuth = new HostedAuth(accessKeyName, secretKeyName); } public void setSharedCredentials(String file, Optional profile) { sharedCredentials = new SharedCredentials(file, profile); } public static class HostedAuth { public final String accessKeyName; public final String secretKeyName; HostedAuth(String accessKeyName, String secretKeyName) { this.accessKeyName = accessKeyName; this.secretKeyName = secretKeyName; } } public static class SharedCredentials { public final String file; public final Optional profile; SharedCredentials(String file, Optional profile) { this.file = file; this.profile = profile; } } }