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

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yahoo.security.Pkcs10Csr;
import com.yahoo.security.Pkcs10CsrUtils;
import com.yahoo.vespa.athenz.api.AthenzIdentity;

/**
 * Used for serializing request to ZTS
 *
 * @author mortent
 * @author bjorncs
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class InstanceRegisterInformation {
    @JsonProperty("provider")
    private final String provider;
    @JsonProperty("domain")
    private final String domain;
    @JsonProperty("service")
    private final String service;
    @JsonProperty("attestationData")
    private final String attestationData;
    @JsonProperty("csr")
    private final String csr;

    public InstanceRegisterInformation(AthenzIdentity providerIdentity,
                                       AthenzIdentity instanceIdentity,
                                       String attestationData,
                                       Pkcs10Csr csr) {
        this.provider = providerIdentity.getFullName();
        this.domain = instanceIdentity.getDomain().getName();
        this.service = instanceIdentity.getName();
        this.attestationData = attestationData;
        this.csr = Pkcs10CsrUtils.toPem(csr);
    }
}