aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/identityprovider/api/bindings/LegacySignedIdentityDocumentEntity.java
blob: 9bf91eff60afe2c8d3d7649f7f17526444802e6d (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
// 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
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public record LegacySignedIdentityDocumentEntity (
        String signature, int signingKeyVersion, String providerUniqueId, String providerService, int documentVersion,
        String configServerHostname, String instanceHostname, Instant createdAt, Set<String> ipAddresses,
        String identityType, String clusterType, URI ztsUrl, String serviceIdentity, Map<String, Object> unknownAttributes)  implements SignedIdentityDocumentEntity {

    @JsonCreator
    public LegacySignedIdentityDocumentEntity(@JsonProperty("signature") String signature,
                                        @JsonProperty("signing-key-version") int signingKeyVersion,
                                        @JsonProperty("provider-unique-id") String providerUniqueId,
                                        @JsonProperty("provider-service") String providerService,
                                        @JsonProperty("document-version") int documentVersion,
                                        @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(signature, signingKeyVersion, providerUniqueId, providerService, documentVersion, configServerHostname,
             instanceHostname, createdAt, ipAddresses, identityType, clusterType, URI.create(ztsUrl), serviceIdentity, new HashMap<>());
    }

    @JsonProperty("signature") @Override public String signature() { return signature; }
    @JsonProperty("signing-key-version") @Override public int signingKeyVersion() { return signingKeyVersion; }
    @JsonProperty("provider-unique-id") @Override public String providerUniqueId() { return providerUniqueId; }
    @JsonProperty("provider-service") @Override public String providerService() { return providerService; }
    @JsonProperty("document-version") @Override public int documentVersion() { return documentVersion; }
    @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); }
}