blob: d41b08cda5a926363eaf989fcb759c35c60ad0a5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright Verizon Media. 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> hostedAuth() {return Optional.ofNullable(hostedAuth); }
public Optional<SharedCredentials> sharedCredentials() {return Optional.ofNullable(sharedCredentials); }
public void setHostedAuth(String accessKeyName, String secretKeyName) {
hostedAuth = new HostedAuth(accessKeyName, secretKeyName);
}
public void setSharedCredentials(String file, Optional<String> 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<String> profile;
SharedCredentials(String file, Optional<String> profile) {
this.file = file;
this.profile = profile;
}
}
}
|