diff options
author | Bjørn Christian Seime <bjorncs@oath.com> | 2018-05-24 13:20:21 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@oath.com> | 2018-05-24 13:20:21 +0200 |
commit | 762cc80910eb731df15111faa5536dc22c830f6c (patch) | |
tree | cec8116da84d2766284fd6dec3dc96a1d2958ad7 /vespa-athenz | |
parent | d3417a2cc400c0d64b71e1cc91fcc032bb8fb3a9 (diff) |
Add AthenzService constructor taking full name as input
Diffstat (limited to 'vespa-athenz')
-rw-r--r-- | vespa-athenz/src/main/java/com/yahoo/vespa/athenz/api/AthenzService.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/api/AthenzService.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/api/AthenzService.java index c566d4fe4af..1cf19151b2e 100644 --- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/api/AthenzService.java +++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/api/AthenzService.java @@ -1,6 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.athenz.api; +import com.yahoo.vespa.athenz.utils.AthenzIdentities; + import java.util.Objects; /** @@ -20,6 +22,15 @@ public class AthenzService implements AthenzIdentity { this(new AthenzDomain(domain), serviceName); } + public AthenzService(String fullName) { + AthenzIdentity identity = AthenzIdentities.from(fullName); + if (!(identity instanceof AthenzService)) { + throw new IllegalArgumentException(String.format("'%s' is not an Athenz service", fullName)); + } + AthenzService service = (AthenzService) identity; + this.domain = service.getDomain(); + this.serviceName = service.serviceName; + } @Override public AthenzDomain getDomain() { |