From 0338ead2661b9099da81adb11ebb6e18553ef2e4 Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Wed, 3 Feb 2016 09:01:39 -0800 Subject: [PATCH 1/4] Completes DnsRpc interface by adding methods and doc. Closes #594. --- .../java/com/google/gcloud/spi/DnsRpc.java | 117 +++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java index f6a0f330a327..9c0f7f3809df 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java @@ -16,6 +16,12 @@ package com.google.gcloud.spi; +import com.google.api.services.dns.model.Change; +import com.google.api.services.dns.model.ManagedZone; +import com.google.api.services.dns.model.Project; +import com.google.api.services.dns.model.ResourceRecordSet; +import com.google.gcloud.dns.DnsException; + import java.util.Map; public interface DnsRpc { @@ -52,5 +58,114 @@ Integer getInt(Map options) { } } - //TODO(mderka) add supported operations. Created issue #594. + class Tuple { + + private final X x; + private final Y y; + + private Tuple(X x, Y y) { + this.x = x; + this.y = y; + } + + public static Tuple of(X x, Y y) { + return new Tuple<>(x, y); + } + + public X x() { + return x; + } + + public Y y() { + return y; + } + } + + /** + * Creates a new zone. + * + * @param zone a zone to be created + * @return Updated {@link ManagedZone} object + * @throws DnsException upon failure + */ + ManagedZone create(ManagedZone zone) throws DnsException; + + /** + * Retrieves and returns an existing zone. + * + * @param zoneName name of the zone to be returned + * @param options a map of options for the service call + * @return a zone or {@code null} if not found + * @throws DnsException upon failure + */ + ManagedZone getZone(String zoneName, Map options) throws DnsException; + + /** + * Lists the zones that exist within the project. + * + * @param options a map of options for the service call + * @throws DnsException upon failure + */ + Tuple> listZones(Map options) throws DnsException; + + /** + * Deletes the zone identified by the name. + * + * @return {@code true} if the zone was deleted and {@code false} otherwise + * @throws DnsException upon failure + */ + boolean deleteZone(String zoneName) throws DnsException; + + /** + * Lists DNS records for a given zone. + * + * @param zoneName name of the zone to be listed + * @param options a map of options for the service call + * @throws DnsException upon failure or if zone not found + */ + Tuple> listDnsRecords(String zoneName, + Map options) throws DnsException; + + /** + * Returns information about the current project. + * + * @param options a map of options for the service call + * @return up-to-date project information + * @throws DnsException upon failure + */ + Project getProject(Map options) throws DnsException; + + /** + * Applies change request to a zone. + * + * @param zoneName the name of a zone to which the {@link Change} should be applied + * @param changeRequest change to be applied + * @param options a map of options for the service call + * @return updated change object with server-assigned ID + * @throws DnsException upon failure or if zone not found + */ + Change applyChangeRequest(String zoneName, Change changeRequest, Map options) + throws DnsException; + + /** + * Returns an existing change request. + * + * @param zoneName the name of a zone to which the {@link Change} was be applied + * @param changeRequestId the unique id assigned to the change by the server + * @param options a map of options for the service call + * @return up-to-date change object + * @throws DnsException upon failure or if zone not found + */ + Change getChangeRequest(String zoneName, String changeRequestId, Map options) + throws DnsException; + + /** + * List an existing change requests for a zone. + * + * @param zoneName the name of a zone to which the {@link Change}s were be applied + * @param options a map of options for the service call + * @throws DnsException upon failure or if zone not found + */ + Tuple> listChangeRequests(String zoneName, Map options) + throws DnsException; } From bc4b8204093d92782d04319c8efda9aae424b9cc Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Wed, 3 Feb 2016 10:46:44 -0800 Subject: [PATCH 2/4] Implements DefaultDnsRpc. Progress in #595. --- .../com/google/gcloud/dns/DnsException.java | 4 +- .../com/google/gcloud/dns/DnsOptions.java | 6 +- .../com/google/gcloud/spi/DefaultDnsRpc.java | 178 ++++++++++++++++++ 3 files changed, 183 insertions(+), 5 deletions(-) create mode 100644 gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsException.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsException.java index d18f6163a881..73c546759260 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsException.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsException.java @@ -27,8 +27,8 @@ public class DnsException extends BaseServiceException { private static final long serialVersionUID = 490302380416260252L; - public DnsException(IOException exception, boolean idempotent) { - super(exception, idempotent); + public DnsException(IOException exception) { + super(exception, true); } //TODO(mderka) Add translation and retry functionality. Created issue #593. diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsOptions.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsOptions.java index 1845467c2537..248fd164a55f 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsOptions.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsOptions.java @@ -18,6 +18,7 @@ import com.google.common.collect.ImmutableSet; import com.google.gcloud.ServiceOptions; +import com.google.gcloud.spi.DefaultDnsRpc; import com.google.gcloud.spi.DnsRpc; import com.google.gcloud.spi.DnsRpcFactory; @@ -46,8 +47,7 @@ public static class DefaultDnsRpcFactory implements DnsRpcFactory { @Override public DnsRpc create(DnsOptions options) { - // TODO(mderka) Implement when DefaultDnsRpc is available. Created issue #595. - return null; + return new DefaultDnsRpc(options); } } @@ -80,7 +80,7 @@ protected DnsFactory defaultServiceFactory() { @SuppressWarnings("unchecked") @Override protected DnsRpcFactory defaultRpcFactory() { - return null; + return DefaultDnsRpcFactory.INSTANCE; } @Override diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java new file mode 100644 index 000000000000..77eb36e3b5ed --- /dev/null +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java @@ -0,0 +1,178 @@ +package com.google.gcloud.spi; + +import static com.google.gcloud.spi.DnsRpc.Option.DNS_NAME; +import static com.google.gcloud.spi.DnsRpc.Option.DNS_TYPE; +import static com.google.gcloud.spi.DnsRpc.Option.FIELDS; +import static com.google.gcloud.spi.DnsRpc.Option.PAGE_SIZE; +import static com.google.gcloud.spi.DnsRpc.Option.PAGE_TOKEN; +import static com.google.gcloud.spi.DnsRpc.Option.SORTING_ORDER; +import static java.net.HttpURLConnection.HTTP_NOT_FOUND; + +import com.google.api.client.http.HttpRequestInitializer; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.json.jackson.JacksonFactory; +import com.google.api.services.dns.Dns; +import com.google.api.services.dns.model.Change; +import com.google.api.services.dns.model.ChangesListResponse; +import com.google.api.services.dns.model.ManagedZone; +import com.google.api.services.dns.model.ManagedZonesListResponse; +import com.google.api.services.dns.model.Project; +import com.google.api.services.dns.model.ResourceRecordSet; +import com.google.api.services.dns.model.ResourceRecordSetsListResponse; +import com.google.gcloud.dns.DnsException; +import com.google.gcloud.dns.DnsOptions; + +import java.io.IOException; +import java.util.Map; + +/** + * A default implementation of the DnsRpc interface. + */ +public class DefaultDnsRpc implements DnsRpc { + + private final Dns dns; + private final DnsOptions options; + + private static DnsException translate(IOException exception) { + return new DnsException(exception); + } + + /** + * Constructs an instance of this rpc client with provided {@link DnsOptions}. + */ + public DefaultDnsRpc(DnsOptions options) { + HttpTransport transport = options.httpTransportFactory().create(); + HttpRequestInitializer initializer = options.httpRequestInitializer(); + this.dns = new Dns.Builder(transport, new JacksonFactory(), initializer) + .setRootUrl(options.host()) + .setApplicationName(options.applicationName()) + .build(); + this.options = options; + } + + @Override + public ManagedZone create(ManagedZone zone) throws DnsException { + try { + return dns.managedZones().create(this.options.projectId(), zone).execute(); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public ManagedZone getZone(String zoneName, Map options) throws DnsException { + // just fields option + try { + return dns.managedZones().get(this.options.projectId(), zoneName) + .setFields(FIELDS.getString(options)).execute(); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public Tuple> listZones(Map options) + throws DnsException { + // fields, page token, page size + try { + ManagedZonesListResponse zoneList = dns.managedZones().list(this.options.projectId()) + .setFields(FIELDS.getString(options)) + .setMaxResults(PAGE_SIZE.getInt(options)) + .setPageToken(PAGE_TOKEN.getString(options)) + .execute(); + return Tuple.>of(zoneList.getNextPageToken(), + zoneList.getManagedZones()); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public boolean deleteZone(String zoneName) throws DnsException { + try { + dns.managedZones().delete(this.options.projectId(), zoneName).execute(); + return true; + } catch (IOException ex) { + DnsException serviceException = translate(ex); + if (serviceException.code() == HTTP_NOT_FOUND) { + return false; + } + throw serviceException; + } + } + + @Override + public Tuple> listDnsRecords(String zoneName, + Map options) throws DnsException { + // options are fields, page token, dns name, type + try { + ResourceRecordSetsListResponse response = dns.resourceRecordSets() + .list(this.options.projectId(), zoneName) + .setFields(FIELDS.getString(options)) + .setPageToken(PAGE_TOKEN.getString(options)) + .setMaxResults(PAGE_SIZE.getInt(options)) + .setName(DNS_NAME.getString(options)) + .setType(DNS_TYPE.getString(options)) + .execute(); + return Tuple.>of(response.getNextPageToken(), + response.getRrsets()); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public Project getProject(Map options) throws DnsException { + try { + return dns.projects().get(this.options.projectId()) + .setFields(FIELDS.getString(options)).execute(); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public Change applyChangeRequest(String zoneName, Change changeRequest, Map options) + throws DnsException { + try { + return dns.changes().create(this.options.projectId(), zoneName, changeRequest) + .setFields(FIELDS.getString(options)) + .execute(); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public Change getChangeRequest(String zoneName, String changeRequestId, Map options) + throws DnsException { + try { + return dns.changes().get(this.options.projectId(), zoneName, changeRequestId) + .setFields(FIELDS.getString(options)) + .execute(); + } catch (IOException ex) { + throw translate(ex); + } + } + + @Override + public Tuple> listChangeRequests(String zoneName, Map options) + throws DnsException { + // options are fields, page token, page size, sort order + try { + Dns.Changes.List request = dns.changes().list(this.options.projectId(), zoneName) + .setFields(FIELDS.getString(options)) + .setMaxResults(PAGE_SIZE.getInt(options)) + .setPageToken(PAGE_TOKEN.getString(options)); + if (SORTING_ORDER.getString(options) != null) { + // this needs to be checked and changed if more sorting options are implemented, issue #604 + String key = "changeSequence"; + request = request.setSortBy(key).setSortOrder(SORTING_ORDER.getString(options)); + } + ChangesListResponse response = request.execute(); + return Tuple.>of(response.getNextPageToken(), response.getChanges()); + } catch (IOException ex) { + throw translate(ex); + } + } +} From 896de75d1cad86e1b2cc2e82bb20700c240fd4ec Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Wed, 3 Feb 2016 14:34:38 -0800 Subject: [PATCH 3/4] Fixed documentation and null returns from rpc. --- .../com/google/gcloud/spi/DefaultDnsRpc.java | 26 ++++++++++++++----- .../java/com/google/gcloud/spi/DnsRpc.java | 22 ++++++++-------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java index 77eb36e3b5ed..85783d0fdcb6 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java @@ -30,6 +30,7 @@ */ public class DefaultDnsRpc implements DnsRpc { + private static final String SORTING_KEY = "changeSequence"; private final Dns dns; private final DnsOptions options; @@ -64,9 +65,14 @@ public ManagedZone getZone(String zoneName, Map options) throws DnsEx // just fields option try { return dns.managedZones().get(this.options.projectId(), zoneName) - .setFields(FIELDS.getString(options)).execute(); + .setFields(FIELDS.getString(options)) + .execute(); } catch (IOException ex) { - throw translate(ex); + DnsException serviceException = translate(ex); + if (serviceException.code() == HTTP_NOT_FOUND) { + return null; + } + throw serviceException; } } @@ -151,7 +157,16 @@ public Change getChangeRequest(String zoneName, String changeRequestId, Map> listChangeRequests(String zoneName, Map>of(response.getNextPageToken(), response.getChanges()); diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java index 9c0f7f3809df..bff396dedfab 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java @@ -85,7 +85,7 @@ public Y y() { * Creates a new zone. * * @param zone a zone to be created - * @return Updated {@link ManagedZone} object + * @return Updated {@code ManagedZone} object * @throws DnsException upon failure */ ManagedZone create(ManagedZone zone) throws DnsException; @@ -121,7 +121,7 @@ public Y y() { * * @param zoneName name of the zone to be listed * @param options a map of options for the service call - * @throws DnsException upon failure or if zone not found + * @throws DnsException upon failure or if zone was not found */ Tuple> listDnsRecords(String zoneName, Map options) throws DnsException; @@ -131,18 +131,18 @@ Tuple> listDnsRecords(String zoneName, * * @param options a map of options for the service call * @return up-to-date project information - * @throws DnsException upon failure + * @throws DnsException upon failure or if the project is not found */ Project getProject(Map options) throws DnsException; /** * Applies change request to a zone. * - * @param zoneName the name of a zone to which the {@link Change} should be applied + * @param zoneName the name of a zone to which the {@code Change} should be applied * @param changeRequest change to be applied * @param options a map of options for the service call * @return updated change object with server-assigned ID - * @throws DnsException upon failure or if zone not found + * @throws DnsException upon failure or if zone was not found */ Change applyChangeRequest(String zoneName, Change changeRequest, Map options) throws DnsException; @@ -150,21 +150,21 @@ Change applyChangeRequest(String zoneName, Change changeRequest, Map /** * Returns an existing change request. * - * @param zoneName the name of a zone to which the {@link Change} was be applied + * @param zoneName the name of a zone to which the {@code Change} was be applied * @param changeRequestId the unique id assigned to the change by the server * @param options a map of options for the service call - * @return up-to-date change object - * @throws DnsException upon failure or if zone not found + * @return up-to-date change object or {@code null} if change was not found + * @throws DnsException upon failure or if zone was not found */ Change getChangeRequest(String zoneName, String changeRequestId, Map options) throws DnsException; /** - * List an existing change requests for a zone. + * List existing change requests for a zone. * - * @param zoneName the name of a zone to which the {@link Change}s were be applied + * @param zoneName the name of a zone to which the {@code Change}s were be applied * @param options a map of options for the service call - * @throws DnsException upon failure or if zone not found + * @throws DnsException upon failure or if zone was not found */ Tuple> listChangeRequests(String zoneName, Map options) throws DnsException; From 3ae0f215d990f21b0c95fa1da07bbd8f8594fe1b Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Thu, 4 Feb 2016 09:11:09 -0800 Subject: [PATCH 4/4] Change Tuple into ListResult, added NAME option. --- .../main/java/com/google/gcloud/dns/Dns.java | 2 +- .../com/google/gcloud/spi/DefaultDnsRpc.java | 29 ++++++------ .../java/com/google/gcloud/spi/DnsRpc.java | 44 ++++++++++--------- .../java/com/google/gcloud/dns/DnsTest.java | 2 +- 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java index 644814fa201b..1227a9e3b323 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java @@ -230,7 +230,7 @@ public static DnsRecordListOption pageSize(int pageSize) { * Restricts the list to only DNS records with this fully qualified domain name. */ public static DnsRecordListOption dnsName(String dnsName) { - return new DnsRecordListOption(DnsRpc.Option.DNS_NAME, dnsName); + return new DnsRecordListOption(DnsRpc.Option.NAME, dnsName); } /** diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java index 85783d0fdcb6..73e6ab4036ec 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java @@ -1,6 +1,8 @@ package com.google.gcloud.spi; +import static com.google.gcloud.spi.DnsRpc.ListResult.of; import static com.google.gcloud.spi.DnsRpc.Option.DNS_NAME; +import static com.google.gcloud.spi.DnsRpc.Option.NAME; import static com.google.gcloud.spi.DnsRpc.Option.DNS_TYPE; import static com.google.gcloud.spi.DnsRpc.Option.FIELDS; import static com.google.gcloud.spi.DnsRpc.Option.PAGE_SIZE; @@ -30,7 +32,7 @@ */ public class DefaultDnsRpc implements DnsRpc { - private static final String SORTING_KEY = "changeSequence"; + private static final String SORT_BY = "changeSequence"; private final Dns dns; private final DnsOptions options; @@ -77,17 +79,16 @@ public ManagedZone getZone(String zoneName, Map options) throws DnsEx } @Override - public Tuple> listZones(Map options) - throws DnsException { + public ListResult listZones(Map options) throws DnsException { // fields, page token, page size try { ManagedZonesListResponse zoneList = dns.managedZones().list(this.options.projectId()) .setFields(FIELDS.getString(options)) .setMaxResults(PAGE_SIZE.getInt(options)) + .setDnsName(DNS_NAME.getString(options)) .setPageToken(PAGE_TOKEN.getString(options)) .execute(); - return Tuple.>of(zoneList.getNextPageToken(), - zoneList.getManagedZones()); + return of(zoneList.getNextPageToken(), zoneList.getManagedZones()); } catch (IOException ex) { throw translate(ex); } @@ -108,8 +109,8 @@ public boolean deleteZone(String zoneName) throws DnsException { } @Override - public Tuple> listDnsRecords(String zoneName, - Map options) throws DnsException { + public ListResult listDnsRecords(String zoneName, Map options) + throws DnsException { // options are fields, page token, dns name, type try { ResourceRecordSetsListResponse response = dns.resourceRecordSets() @@ -117,11 +118,10 @@ public Tuple> listDnsRecords(String zoneName .setFields(FIELDS.getString(options)) .setPageToken(PAGE_TOKEN.getString(options)) .setMaxResults(PAGE_SIZE.getInt(options)) - .setName(DNS_NAME.getString(options)) + .setName(NAME.getString(options)) .setType(DNS_TYPE.getString(options)) .execute(); - return Tuple.>of(response.getNextPageToken(), - response.getRrsets()); + return of(response.getNextPageToken(), response.getRrsets()); } catch (IOException ex) { throw translate(ex); } @@ -159,8 +159,7 @@ public Change getChangeRequest(String zoneName, String changeRequestId, Map> listChangeRequests(String zoneName, Map options) + public ListResult listChangeRequests(String zoneName, Map options) throws DnsException { // options are fields, page token, page size, sort order try { @@ -181,10 +180,10 @@ public Tuple> listChangeRequests(String zoneName, Map>of(response.getNextPageToken(), response.getChanges()); + return ListResult.of(response.getNextPageToken(), response.getChanges()); } catch (IOException ex) { throw translate(ex); } diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java index bff396dedfab..c3cd3c690177 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java @@ -20,6 +20,7 @@ import com.google.api.services.dns.model.ManagedZone; import com.google.api.services.dns.model.Project; import com.google.api.services.dns.model.ResourceRecordSet; +import com.google.common.collect.ImmutableList; import com.google.gcloud.dns.DnsException; import java.util.Map; @@ -28,9 +29,10 @@ public interface DnsRpc { enum Option { FIELDS("fields"), - PAGE_SIZE("maxSize"), + PAGE_SIZE("maxResults"), PAGE_TOKEN("pageToken"), DNS_NAME("dnsName"), + NAME("name"), DNS_TYPE("type"), SORTING_ORDER("sortOrder"); @@ -58,26 +60,26 @@ Integer getInt(Map options) { } } - class Tuple { + class ListResult { - private final X x; - private final Y y; + private final Iterable results; + private final String pageToken; - private Tuple(X x, Y y) { - this.x = x; - this.y = y; + public ListResult(String pageToken, Iterable results) { + this.results = ImmutableList.copyOf(results); + this.pageToken = pageToken; } - public static Tuple of(X x, Y y) { - return new Tuple<>(x, y); + public static ListResult of(String pageToken, Iterable list) { + return new ListResult<>(pageToken, list); } - public X x() { - return x; + public Iterable results() { + return results; } - public Y y() { - return y; + public String pageToken() { + return pageToken; } } @@ -106,7 +108,7 @@ public Y y() { * @param options a map of options for the service call * @throws DnsException upon failure */ - Tuple> listZones(Map options) throws DnsException; + ListResult listZones(Map options) throws DnsException; /** * Deletes the zone identified by the name. @@ -123,12 +125,12 @@ public Y y() { * @param options a map of options for the service call * @throws DnsException upon failure or if zone was not found */ - Tuple> listDnsRecords(String zoneName, - Map options) throws DnsException; + ListResult listDnsRecords(String zoneName, Map options) + throws DnsException; /** * Returns information about the current project. - * + * * @param options a map of options for the service call * @return up-to-date project information * @throws DnsException upon failure or if the project is not found @@ -136,7 +138,7 @@ Tuple> listDnsRecords(String zoneName, Project getProject(Map options) throws DnsException; /** - * Applies change request to a zone. + * Applies change request to a zone. * * @param zoneName the name of a zone to which the {@code Change} should be applied * @param changeRequest change to be applied @@ -144,7 +146,7 @@ Tuple> listDnsRecords(String zoneName, * @return updated change object with server-assigned ID * @throws DnsException upon failure or if zone was not found */ - Change applyChangeRequest(String zoneName, Change changeRequest, Map options) + Change applyChangeRequest(String zoneName, Change changeRequest, Map options) throws DnsException; /** @@ -156,7 +158,7 @@ Change applyChangeRequest(String zoneName, Change changeRequest, Map * @return up-to-date change object or {@code null} if change was not found * @throws DnsException upon failure or if zone was not found */ - Change getChangeRequest(String zoneName, String changeRequestId, Map options) + Change getChangeRequest(String zoneName, String changeRequestId, Map options) throws DnsException; /** @@ -166,6 +168,6 @@ Change getChangeRequest(String zoneName, String changeRequestId, Map * @param options a map of options for the service call * @throws DnsException upon failure or if zone was not found */ - Tuple> listChangeRequests(String zoneName, Map options) + ListResult listChangeRequests(String zoneName, Map options) throws DnsException; } diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsTest.java b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsTest.java index a60cae1d1793..c2be251cea9e 100644 --- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsTest.java +++ b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsTest.java @@ -34,7 +34,7 @@ public void testDnsRecordListOption() { String dnsName = "some name"; Dns.DnsRecordListOption dnsRecordListOption = Dns.DnsRecordListOption.dnsName(dnsName); assertEquals(dnsName, dnsRecordListOption.value()); - assertEquals(DnsRpc.Option.DNS_NAME, dnsRecordListOption.rpcOption()); + assertEquals(DnsRpc.Option.NAME, dnsRecordListOption.rpcOption()); // page token dnsRecordListOption = Dns.DnsRecordListOption.pageToken(PAGE_TOKEN); assertEquals(PAGE_TOKEN, dnsRecordListOption.value());