Skip to content

Commit 3183f4a

Browse files
committed
Added field options for zone create method.
1 parent 71f5ae2 commit 3183f4a

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,14 +421,15 @@ public static ChangeRequestListOption sortOrder(SortingOrder order) {
421421
*
422422
* <p>Returns {@link ZoneInfo} object representing the new zone's information. In addition to the
423423
* name, dns name and description (supplied by the user within the {@code zoneInfo} parameter),
424-
* the returned object will include the following read-only fields supplied by the server:
425-
* creation time, id, and list of name servers.
424+
* the returned object can include the following read-only fields supplied by the server: creation
425+
* time, id, and list of name servers. The returned fields can be optionally restricted by
426+
* specifying {@link ZoneOption}s.
426427
*
427428
* @throws DnsException upon failure
428429
* @see <a href="https://cloud.google.com/dns/api/v1/managedZones/create">Cloud DNS Managed Zones:
429430
* create</a>
430431
*/
431-
ZoneInfo create(ZoneInfo zoneInfo);
432+
ZoneInfo create(ZoneInfo zoneInfo, ZoneOption... options);
432433

433434
/**
434435
* Returns the zone by the specified zone name. Returns {@code null} if the zone is not found. The

gcloud-java-dns/src/main/java/com/google/gcloud/spi/DefaultDnsRpc.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ public DefaultDnsRpc(DnsOptions options) {
5454
}
5555

5656
@Override
57-
public ManagedZone create(ManagedZone zone) throws DnsException {
57+
public ManagedZone create(ManagedZone zone, Map<Option, ?> options) throws DnsException {
5858
try {
59-
return dns.managedZones().create(this.options.projectId(), zone).execute();
59+
return dns.managedZones()
60+
.create(this.options.projectId(), zone)
61+
.setFields(FIELDS.getString(options))
62+
.execute();
6063
} catch (IOException ex) {
6164
throw translate(ex);
6265
}

gcloud-java-dns/src/main/java/com/google/gcloud/spi/DnsRpc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ public String pageToken() {
8787
* Creates a new zone.
8888
*
8989
* @param zone a zone to be created
90+
* @param options a map of options for the service call
9091
* @return Updated {@code ManagedZone} object
9192
* @throws DnsException upon failure
9293
*/
93-
ManagedZone create(ManagedZone zone) throws DnsException;
94+
ManagedZone create(ManagedZone zone, Map<Option, ?> options) throws DnsException;
9495

9596
/**
9697
* Retrieves and returns an existing zone.

0 commit comments

Comments
 (0)