Skip to content

Commit 206eb4b

Browse files
committed
#81 added support CAA type record
1 parent 44d9f6a commit 206eb4b

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* The MIT License
3+
*
4+
* Copyright (c) 2013-2018 Jeevanandam M. (myjeeva.com)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
7+
* associated documentation files (the "Software"), to deal in the Software without restriction,
8+
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
9+
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all copies or
13+
* substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
16+
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
*/
21+
22+
package com.myjeeva.digitalocean.common;
23+
24+
import org.apache.commons.lang3.StringUtils;
25+
26+
import com.google.gson.annotations.SerializedName;
27+
28+
/**
29+
* <p>
30+
* Enumeration of DigitalOcean CAA Tag Types. Valid values are "issue", "issuewild", or "iodef".
31+
* </p>
32+
*
33+
* <p>
34+
* More info: https://developers.digitalocean.com/documentation/v2/#domain-records/
35+
* </p>
36+
*
37+
* @author Jeevanandam M. (jeeva@myjeeva.com)
38+
*
39+
* @since v2.15
40+
*/
41+
public enum CaaTagType {
42+
43+
@SerializedName("issue")
44+
ISSUE("issue"),
45+
46+
@SerializedName("issuewild")
47+
ISSUE_WILD("issuewild"),
48+
49+
@SerializedName("iodef")
50+
IODEF("iodef");
51+
52+
private String value;
53+
54+
private CaaTagType(String value) {
55+
this.value = value;
56+
}
57+
58+
@Override
59+
public String toString() {
60+
return this.value;
61+
}
62+
63+
public static CaaTagType fromValue(String value) {
64+
if (StringUtils.isBlank(value)) {
65+
throw new IllegalArgumentException("Value cannot be null or empty!");
66+
}
67+
68+
for (CaaTagType rt : CaaTagType.values()) {
69+
if (value.equalsIgnoreCase(rt.value)) {
70+
return rt;
71+
}
72+
}
73+
74+
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
75+
}
76+
}

src/main/java/com/myjeeva/digitalocean/pojo/DomainRecord.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
2525

2626
import com.google.gson.annotations.Expose;
27+
import com.myjeeva.digitalocean.common.CaaTagType;
2728

2829
/**
2930
* Represents DomainRecord (TLD) Record attributes of DigitalOcean DNS. Revised as per v2 API data
@@ -57,6 +58,12 @@ public class DomainRecord extends RateLimitBase {
5758

5859
@Expose
5960
private Integer ttl;
61+
62+
@Expose
63+
private Integer flags;
64+
65+
@Expose
66+
private CaaTagType tag;
6067

6168
public DomainRecord() {
6269
// Default Constructor
@@ -204,4 +211,33 @@ public Integer getTtl() {
204211
public void setTtl(Integer ttl) {
205212
this.ttl = ttl;
206213
}
214+
215+
/**
216+
* @return the flags
217+
*/
218+
public Integer getFlags() {
219+
return flags;
220+
}
221+
222+
/**
223+
* @param flags the flags to set
224+
*/
225+
public void setFlags(Integer flags) {
226+
this.flags = flags;
227+
}
228+
229+
/**
230+
* @return the tag
231+
*/
232+
public CaaTagType getTag() {
233+
return tag;
234+
}
235+
236+
/**
237+
* @param tag the tag to set
238+
*/
239+
public void setTag(CaaTagType tag) {
240+
this.tag = tag;
241+
}
242+
207243
}

0 commit comments

Comments
 (0)