aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/IdentityDocumentEntity.java
blob: 8970a74934a5664f067fe8a0e4b4e436a31a1d9f (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.athenz.identityprovider.api.bindings;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.net.URI;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author bjorncs
 * @author mortent
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public record IdentityDocumentEntity(String providerUniqueId, String providerService,
        String configServerHostname, String instanceHostname, Instant createdAt, Set<String> ipAddresses,
        String identityType, String clusterType, URI ztsUrl, String serviceIdentity, Map<String, Object> unknownAttributes) {

    @JsonCreator
    public IdentityDocumentEntity(@JsonProperty("provider-unique-id") String providerUniqueId,
                                  @JsonProperty("provider-service") String providerService,
                                  @JsonProperty("configserver-hostname") String configServerHostname,
                                  @JsonProperty("instance-hostname") String instanceHostname,
                                  @JsonProperty("created-at") Instant createdAt,
                                  @JsonProperty("ip-addresses") Set<String> ipAddresses,
                                  @JsonProperty("identity-type") String identityType,
                                  @JsonProperty("cluster-type") String clusterType,
                                  @JsonProperty("zts-url") String ztsUrl,
                                  @JsonProperty("service-identity") String serviceIdentity) {
        this(providerUniqueId, providerService, configServerHostname,
             instanceHostname, createdAt, ipAddresses, identityType, clusterType, URI.create(ztsUrl), serviceIdentity, new HashMap<>());
    }

    @JsonProperty("provider-unique-id") @Override public String providerUniqueId() { return providerUniqueId; }
    @JsonProperty("provider-service") @Override public String providerService() { return providerService; }
    @JsonProperty("configserver-hostname") @Override public String configServerHostname() { return configServerHostname; }
    @JsonProperty("instance-hostname") @Override public String instanceHostname() { return instanceHostname; }
    @JsonProperty("created-at") @Override public Instant createdAt() { return createdAt; }
    @JsonProperty("ip-addresses") @Override public Set<String> ipAddresses() { return ipAddresses; }
    @JsonProperty("identity-type") @Override public String identityType() { return identityType; }
    @JsonProperty("cluster-type") @Override public String clusterType() { return clusterType; }
    @JsonProperty("zts-url") @Override public URI ztsUrl() { return ztsUrl; }
    @JsonProperty("service-identity") @Override public String serviceIdentity() { return serviceIdentity; }
    @JsonAnyGetter @Override public Map<String, Object> unknownAttributes() { return unknownAttributes; }
    @JsonAnySetter public void set(String name, Object value) { unknownAttributes.put(name, value); }
}