diff --git a/google-cloud-dns/src/main/java/com/google/cloud/dns/ChangeRequestInfo.java b/google-cloud-dns/src/main/java/com/google/cloud/dns/ChangeRequestInfo.java
index 85306e2fa4f7..0b13d3f327eb 100644
--- a/google-cloud-dns/src/main/java/com/google/cloud/dns/ChangeRequestInfo.java
+++ b/google-cloud-dns/src/main/java/com/google/cloud/dns/ChangeRequestInfo.java
@@ -18,20 +18,23 @@
import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.api.core.ApiFunction;
import com.google.api.services.dns.model.Change;
+import com.google.cloud.StringEnumType;
+import com.google.cloud.StringEnumValue;
import com.google.common.base.Function;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
-import org.joda.time.DateTime;
-import org.joda.time.format.ISODateTimeFormat;
-
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
+import org.joda.time.DateTime;
+import org.joda.time.format.ISODateTimeFormat;
+
/**
* A class representing an atomic update to a collection of {@link RecordSet}s within a {@code
* Zone}.
@@ -60,9 +63,49 @@ public ChangeRequestInfo apply(Change pb) {
* @see Google Cloud DNS
* documentation
*/
- public enum Status {
- PENDING,
- DONE
+ public static final class Status extends StringEnumValue {
+ private static final long serialVersionUID = -294992980062438246L;
+
+ private static final ApiFunction CONSTRUCTOR =
+ new ApiFunction() {
+ @Override
+ public Status apply(String constant) {
+ return new Status(constant);
+ }
+ };
+
+ private static final StringEnumType type = new StringEnumType(
+ Status.class,
+ CONSTRUCTOR);
+
+ public static final Status PENDING = type.createAndRegister("PENDING");
+ public static final Status DONE = type.createAndRegister("DONE");
+
+ private Status(String constant) {
+ super(constant);
+ }
+
+ /**
+ * Get the Status for the given String constant, and throw an exception if the constant is
+ * not recognized.
+ */
+ public static Status valueOfStrict(String constant) {
+ return type.valueOfStrict(constant);
+ }
+
+ /**
+ * Get the Status for the given String constant, and allow unrecognized values.
+ */
+ public static Status valueOf(String constant) {
+ return type.valueOf(constant);
+ }
+
+ /**
+ * Return the known values for Status.
+ */
+ public static Status[] values() {
+ return type.values();
+ }
}
/**
diff --git a/google-cloud-dns/src/main/java/com/google/cloud/dns/RecordSet.java b/google-cloud-dns/src/main/java/com/google/cloud/dns/RecordSet.java
index cc82d9f52e83..86024d56e2f0 100644
--- a/google-cloud-dns/src/main/java/com/google/cloud/dns/RecordSet.java
+++ b/google-cloud-dns/src/main/java/com/google/cloud/dns/RecordSet.java
@@ -19,7 +19,10 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.api.core.ApiFunction;
import com.google.api.services.dns.model.ResourceRecordSet;
+import com.google.cloud.StringEnumType;
+import com.google.cloud.StringEnumValue;
import com.google.common.base.Function;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
@@ -74,53 +77,93 @@ public ResourceRecordSet apply(RecordSet recordSet) {
* @see Cloud DNS
* supported record types
*/
- public enum Type {
+ public static final class Type extends StringEnumValue {
+ private static final long serialVersionUID = -2217433987664635241L;
+
+ private static final ApiFunction CONSTRUCTOR =
+ new ApiFunction() {
+ @Override
+ public Type apply(String constant) {
+ return new Type(constant);
+ }
+ };
+
+ private static final StringEnumType type = new StringEnumType(
+ Type.class,
+ CONSTRUCTOR);
+
/**
* Address record, which is used to map host names to their IPv4 address.
*/
- A,
+ public static final Type A = type.createAndRegister("A");
/**
* IPv6 Address record, which is used to map host names to their IPv6 address.
*/
- AAAA,
+ public static final Type AAAA = type.createAndRegister("AAAA");
/**
* Canonical name record, which is used to alias names.
*/
- CNAME,
+ public static final Type CNAME = type.createAndRegister("CNAME");
/**
* Mail exchange record, which is used in routing requests to mail servers.
*/
- MX,
+ public static final Type MX = type.createAndRegister("MX");
/**
* Naming authority pointer record, defined by RFC3403.
*/
- NAPTR,
+ public static final Type NAPTR = type.createAndRegister("NAPTR");
/**
* Name server record, which delegates a DNS zone to an authoritative server.
*/
- NS,
+ public static final Type NS = type.createAndRegister("NS");
/**
* Pointer record, which is often used for reverse DNS lookups.
*/
- PTR,
+ public static final Type PTR = type.createAndRegister("PTR");
/**
* Start of authority record, which specifies authoritative information about a DNS zone.
*/
- SOA,
+ public static final Type SOA = type.createAndRegister("SOA");
/**
* Sender policy framework record, which is used in email validation systems.
*/
- SPF,
+ public static final Type SPF = type.createAndRegister("SPF");
/**
* Service locator record, which is used by some voice over IP, instant messaging protocols and
* other applications.
*/
- SRV,
+ public static final Type SRV = type.createAndRegister("SRV");
/**
* Text record, which can contain arbitrary text and can also be used to define machine readable
* data such as security or abuse prevention information.
*/
- TXT
+ public static final Type TXT = type.createAndRegister("TXT");
+
+ private Type(String constant) {
+ super(constant);
+ }
+
+ /**
+ * Get the Type for the given String constant, and throw an exception if the constant is
+ * not recognized.
+ */
+ public static Type valueOfStrict(String constant) {
+ return type.valueOfStrict(constant);
+ }
+
+ /**
+ * Get the Type for the given String constant, and allow unrecognized values.
+ */
+ public static Type valueOf(String constant) {
+ return type.valueOf(constant);
+ }
+
+ /**
+ * Return the known values for Type.
+ */
+ public static Type[] values() {
+ return type.values();
+ }
}
/**