Skip to content

Commit 4057dcd

Browse files
committed
Fixed doc after refactoring. Made zone name mandatory in fields.
1 parent 3183f4a commit 4057dcd

4 files changed

Lines changed: 10 additions & 22 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static String selector(ProjectField... fields) {
6868
* The fields of a zone.
6969
*
7070
* <p>These values can be used to specify the fields to include in a partial response when calling
71-
* {@link Dns#getZone(String, ZoneOption...)}. The ID is always returned, even if not specified.
71+
* {@link Dns#getZone(String, ZoneOption...)}. The name is always returned, even if not specified.
7272
*/
7373
enum ZoneField {
7474
CREATION_TIME("creationTime"),
@@ -91,7 +91,7 @@ String selector() {
9191

9292
static String selector(ZoneField... fields) {
9393
Set<String> fieldStrings = Sets.newHashSetWithExpectedSize(fields.length + 1);
94-
fieldStrings.add(ZONE_ID.selector());
94+
fieldStrings.add(NAME.selector());
9595
for (ZoneField field : fields) {
9696
fieldStrings.add(field.selector());
9797
}

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public Zone reload(Dns.ZoneOption... options) {
7878
}
7979

8080
/**
81-
* Deletes the zone. The method first deletes the zone by name which must always be initialized.
81+
* Deletes the zone. The method deletes the zone by name.
8282
*
8383
* @return {@code true} is zone was found and deleted and {@code false} otherwise
8484
* @throws DnsException upon failure
@@ -88,8 +88,7 @@ public boolean delete() {
8888
}
8989

9090
/**
91-
* Lists all {@link DnsRecord}s associated with this zone. The method searches for zone by name
92-
* which must always be initialized.
91+
* Lists all {@link DnsRecord}s associated with this zone. The method searches for zone by name.
9392
*
9493
* @param options optional restriction on listing and fields of {@link DnsRecord}s returned
9594
* @return a page of DNS records
@@ -115,14 +114,13 @@ public ChangeRequest applyChangeRequest(ChangeRequest changeRequest,
115114

116115
/**
117116
* Retrieves an updated information about a change request previously submitted to be applied to
118-
* this zone. The method searches for zone by name which must always be initialized. Returns a
119-
* {@link ChangeRequest} if and {@code null} if the change request was not found. Throws {@link
120-
* DnsException} if the zone is not found.
117+
* this zone. Returns a {@link ChangeRequest} or {@code null} if the change request was not
118+
* found. Throws {@link DnsException} if the zone is not found.
121119
*
122120
* @param options optional restriction on what fields of {@link ChangeRequest} should be returned
123121
* @return updated ChangeRequest
124122
* @throws DnsException upon failure or if the zone is not found
125-
* @throws NullPointerException if the change request does not have initialized id
123+
* @throws NullPointerException if {@code changeRequestId} is null
126124
*/
127125
public ChangeRequest getChangeRequest(String changeRequestId,
128126
Dns.ChangeRequestOption... options) {
@@ -132,8 +130,7 @@ public ChangeRequest getChangeRequest(String changeRequestId,
132130

133131
/**
134132
* Retrieves all change requests for this zone. The method searches for zone by name which must
135-
* always be initialized. Returns a page of {@link ChangeRequest}s. Throws a {@link DnsException}
136-
* if the zone is not found.
133+
* always be initialized. Returns a page of {@link ChangeRequest}s.
137134
*
138135
* @param options optional restriction on listing and fields to be returned
139136
* @return a page of change requests

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ public static class Builder {
6060
private String nameServerSet;
6161
private List<String> nameServers = new LinkedList<>();
6262

63-
/**
64-
* Returns an empty builder for {@code ZoneInfo}. We use it internally in {@code toPb()}.
65-
*/
66-
private Builder() {
67-
}
68-
6963
private Builder(String name) {
7064
this.name = checkNotNull(name);
7165
}
@@ -246,7 +240,7 @@ com.google.api.services.dns.model.ManagedZone toPb() {
246240
}
247241

248242
static ZoneInfo fromPb(com.google.api.services.dns.model.ManagedZone pb) {
249-
Builder builder = new Builder();
243+
Builder builder = new Builder(pb.getName());
250244
if (pb.getDescription() != null) {
251245
builder.description(pb.getDescription());
252246
}
@@ -256,9 +250,6 @@ static ZoneInfo fromPb(com.google.api.services.dns.model.ManagedZone pb) {
256250
if (pb.getId() != null) {
257251
builder.id(pb.getId().toString());
258252
}
259-
if (pb.getName() != null) {
260-
builder.name(pb.getName());
261-
}
262253
if (pb.getNameServers() != null) {
263254
builder.nameServers(pb.getNameServers());
264255
}

gcloud-java-dns/src/test/java/com/google/gcloud/dns/DnsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void testZoneList() {
8080
assertTrue(fields.value() instanceof String);
8181
assertTrue(((String) fields.value()).contains(Dns.ZoneField.CREATION_TIME.selector()));
8282
assertTrue(((String) fields.value()).contains(Dns.ZoneField.DESCRIPTION.selector()));
83-
assertTrue(((String) fields.value()).contains(Dns.ZoneField.ZONE_ID.selector()));
83+
assertTrue(((String) fields.value()).contains(Dns.ZoneField.NAME.selector()));
8484
// page token
8585
Dns.ZoneListOption option = Dns.ZoneListOption.pageToken(PAGE_TOKEN);
8686
assertEquals(PAGE_TOKEN, option.value());

0 commit comments

Comments
 (0)