1 package org.kuali.common.deploy.dns.model;
2
3 import org.kuali.common.util.Assert;
4
5 public class DnsmeContext {
6
7 private final int ttl;
8 private final String recordName;
9 private final String domainName;
10 private final RecordType recordType;
11 private final DnsmeCredentials credentials;
12
13 public static class Builder {
14
15
16 private final DnsmeCredentials credentials;
17 private final String recordName;
18 private final String domainName;
19
20
21 private int ttl = 60;
22 private RecordType recordType = RecordType.CNAME;
23
24 public Builder(DnsmeCredentials credentials, String recordName, String domainName) {
25 this.credentials = credentials;
26 this.recordName = recordName;
27 this.domainName = domainName;
28 }
29
30 public Builder ttl(int ttl) {
31 this.ttl = ttl;
32 return this;
33 }
34
35 public Builder recordType(RecordType recordType) {
36 this.recordType = recordType;
37 return this;
38 }
39
40 public DnsmeContext build() {
41 Assert.noBlanks(recordName, domainName);
42 Assert.noNulls(credentials, recordType);
43 return new DnsmeContext(this);
44 }
45
46 }
47
48 private DnsmeContext(Builder builder) {
49 this.credentials = builder.credentials;
50 this.recordName = builder.recordName;
51 this.ttl = builder.ttl;
52 this.recordType = builder.recordType;
53 this.domainName = builder.domainName;
54 }
55
56 public int getTtl() {
57 return ttl;
58 }
59
60 public String getRecordName() {
61 return recordName;
62 }
63
64 public String getDomainName() {
65 return domainName;
66 }
67
68 public RecordType getRecordType() {
69 return recordType;
70 }
71
72 public DnsmeCredentials getCredentials() {
73 return credentials;
74 }
75
76 }