aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2019-05-14 13:35:23 +0200
committerGitHub <noreply@github.com>2019-05-14 13:35:23 +0200
commit3830d8e3ddfb430d09b2ee188a7325b57d11832a (patch)
treeca5f745a7a425223e01bee20e997185d243501c5
parentd96591996962bd34b8075888386042c01a686346 (diff)
parenta5b19a3b72e40b1d5af0d8ff9edcae7c3336e9e6 (diff)
Merge pull request #9398 from vespa-engine/bjorncs/add-application-id-to-node-identity
Add ApplicationId to NodeIdentity
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/security/NodeIdentity.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/security/NodeIdentity.java b/config-provisioning/src/main/java/com/yahoo/config/provision/security/NodeIdentity.java
index ea78caaeba7..d323214297f 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/security/NodeIdentity.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/security/NodeIdentity.java
@@ -1,6 +1,7 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision.security;
+import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.NodeType;
@@ -17,11 +18,13 @@ public class NodeIdentity {
private final NodeType nodeType;
private final String identityName;
private final HostName hostname;
+ private final ApplicationId applicationId;
- private NodeIdentity(NodeType nodeType, String identityName, HostName hostname) {
+ private NodeIdentity(NodeType nodeType, String identityName, HostName hostname, ApplicationId applicationId) {
this.nodeType = nodeType;
this.identityName = identityName;
this.hostname = hostname;
+ this.applicationId = applicationId;
}
public NodeType nodeType() {
@@ -37,6 +40,10 @@ public class NodeIdentity {
return Optional.ofNullable(hostname);
}
+ public Optional<ApplicationId> applicationId() {
+ return Optional.ofNullable(applicationId);
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -44,12 +51,13 @@ public class NodeIdentity {
NodeIdentity that = (NodeIdentity) o;
return nodeType == that.nodeType &&
Objects.equals(identityName, that.identityName) &&
- Objects.equals(hostname, that.hostname);
+ Objects.equals(hostname, that.hostname) &&
+ Objects.equals(applicationId, that.applicationId);
}
@Override
public int hashCode() {
- return Objects.hash(nodeType, identityName, hostname);
+ return Objects.hash(nodeType, identityName, hostname, applicationId);
}
@Override
@@ -58,6 +66,7 @@ public class NodeIdentity {
"nodeType=" + nodeType +
", identityName='" + identityName + '\'' +
", hostname=" + hostname +
+ ", applicationId=" + applicationId +
'}';
}
@@ -65,6 +74,7 @@ public class NodeIdentity {
private final NodeType nodeType;
private String identityName;
private HostName hostname;
+ private ApplicationId applicationId;
public Builder(NodeType nodeType) {
this.nodeType = nodeType;
@@ -80,8 +90,13 @@ public class NodeIdentity {
return this;
}
+ public Builder applicationId(ApplicationId applicationId) {
+ this.applicationId = applicationId;
+ return this;
+ }
+
public NodeIdentity build() {
- return new NodeIdentity(nodeType, identityName, hostname);
+ return new NodeIdentity(nodeType, identityName, hostname, applicationId);
}
}
}