1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.dns.dnsme.model;
17
18 import org.kuali.common.core.build.ValidatingBuilder;
19 import org.kuali.common.core.json.jackson.DecryptingDeserializer;
20 import org.kuali.common.core.json.jackson.EncryptingSerializer;
21 import org.kuali.common.core.validate.annotation.IdiotProofImmutable;
22
23 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
24 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
25
26 @IdiotProofImmutable
27 @JsonDeserialize(builder = DNSMadeEasyCredentials.Builder.class)
28 public final class DNSMadeEasyCredentials {
29
30 @JsonSerialize(using = EncryptingSerializer.class)
31 private final String apiKey;
32
33 @JsonSerialize(using = EncryptingSerializer.class)
34 private final String secretKey;
35
36 private DNSMadeEasyCredentials(Builder builder) {
37 this.apiKey = builder.apiKey;
38 this.secretKey = builder.secretKey;
39 }
40
41 public static Builder builder() {
42 return new Builder();
43 }
44
45 public static class Builder extends ValidatingBuilder<DNSMadeEasyCredentials> {
46
47 @JsonDeserialize(using = DecryptingDeserializer.class)
48 private String apiKey;
49
50 @JsonDeserialize(using = DecryptingDeserializer.class)
51 private String secretKey;
52
53 public Builder withApiKey(String apiKey) {
54 this.apiKey = apiKey;
55 return this;
56 }
57
58 public Builder withSecretKey(String secretKey) {
59 this.secretKey = secretKey;
60 return this;
61 }
62
63 @Override
64 public DNSMadeEasyCredentials build() {
65 return validate(new DNSMadeEasyCredentials(this));
66 }
67
68 public String getApiKey() {
69 return apiKey;
70 }
71
72 public String getSecretKey() {
73 return secretKey;
74 }
75
76 }
77
78 public String getApiKey() {
79 return apiKey;
80 }
81
82 public String getSecretKey() {
83 return secretKey;
84 }
85
86 }