@@ -125,7 +125,7 @@ ZoneInfo zoneInfo = ZoneInfo.of(zoneName, domainName, description);
125125
126126// Create zone in Google Cloud DNS
127127Zone zone = dns. create(zoneInfo);
128- System . out. printf(" Zone was created and assigned ID %s.%n" , zone. generatedId ());
128+ System . out. printf(" Zone was created and assigned ID %s.%n" , zone. getGeneratedId ());
129129```
130130
131131You now have an empty zone hosted in Google Cloud DNS which is ready to be populated with
@@ -142,7 +142,7 @@ and then add
142142
143143``` java
144144// Print assigned name servers
145- List<String > nameServers = zone. nameServers ();
145+ List<String > nameServers = zone. getNameServers ();
146146for (String nameServer : nameServers) {
147147 System . out. println(nameServer);
148148}
@@ -170,13 +170,13 @@ and proceed with:
170170``` java
171171// Prepare a www.someexampledomain.com. type A record set with ttl of 24 hours
172172String ip = " 12.13.14.15" ;
173- RecordSet toCreate = RecordSet . builder (" www." + zone. dnsName(), RecordSet . Type . A )
174- .ttl (24 , TimeUnit . HOURS )
173+ RecordSet toCreate = RecordSet . newBuilder (" www." + zone. dnsName(), RecordSet . Type . A )
174+ .setTtl (24 , TimeUnit . HOURS )
175175 .addRecord(ip)
176176 .build();
177177
178178// Make a change
179- ChangeRequestInfo changeRequest = ChangeRequestInfo . builder (). add(toCreate). build();
179+ ChangeRequestInfo changeRequest = ChangeRequestInfo . newBuilder (). add(toCreate). build();
180180
181181// Build and apply the change request to our zone
182182changeRequest = zone. applyChangeRequest(changeRequest);
@@ -205,7 +205,8 @@ ChangeRequestInfo.Builder changeBuilder = ChangeRequestInfo.builder().add(toCrea
205205Iterator<RecordSet > recordSetIterator = zone. listRecordSets(). iterateAll();
206206while (recordSetIterator. hasNext()) {
207207 RecordSet current = recordSetIterator. next();
208- if (toCreate. name(). equals(current. name()) && toCreate. type(). equals(current. type())) {
208+ if (toCreate. getName(). equals(current. getName())
209+ && toCreate. getType(). equals(current. getType())) {
209210 changeBuilder. delete(current);
210211 }
211212}
@@ -255,7 +256,7 @@ while (zoneIterator.hasNext()) {
255256
256257// List the record sets in a particular zone
257258recordSetIterator = zone. listRecordSets(). iterateAll();
258- System . out. println(String . format(" Record sets inside %s:" , zone. name ()));
259+ System . out. println(String . format(" Record sets inside %s:" , zone. getName ()));
259260while (recordSetIterator. hasNext()) {
260261 System . out. println(recordSetIterator. next());
261262}
@@ -274,7 +275,7 @@ and then:
274275
275276// List the change requests applied to a particular zone
276277Iterator<ChangeRequest > changeIterator = zone. listChangeRequests(). iterateAll();
277- System . out. println(String . format(" The history of changes in %s:" , zone. name ()));
278+ System . out. println(String . format(" The history of changes in %s:" , zone. getName ()));
278279while (changeIterator. hasNext()) {
279280 System . out. println(changeIterator. next());
280281}
@@ -287,18 +288,19 @@ First, you need to empty the zone by deleting all its records except for the def
287288
288289``` java
289290// Make a change for deleting the record sets
290- changeBuilder = ChangeRequestInfo . builder ();
291+ changeBuilder = ChangeRequestInfo . newBuilder ();
291292while (recordIterator. hasNext()) {
292293 RecordSet current = recordIterator. next();
293294 // SOA and NS records cannot be deleted
294- if (! RecordSet . Type . SOA. equals(current. type()) && ! RecordSet . Type . NS. equals(current. type())) {
295+ if (! RecordSet . Type . SOA. equals(current. getType())
296+ && ! RecordSet . Type . NS. equals(current. getType())) {
295297 changeBuilder. delete(current);
296298 }
297299}
298300
299301// Build and apply the change request to our zone if it contains records to delete
300302ChangeRequestInfo changeRequest = changeBuilder. build();
301- if (! changeRequest. deletions (). isEmpty()) {
303+ if (! changeRequest. getDeletions (). isEmpty()) {
302304 ChangeRequest pendingRequest = dns. applyChangeRequest(zoneName, changeRequest);
303305
304306 // Wait for the change request to complete
@@ -325,7 +327,7 @@ if (result) {
325327#### Complete Source Code
326328
327329We composed some of the aforementioned snippets into complete executable code samples. In
328- [ CreateZones .java] ( ../google-cloud-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateZone.java )
330+ [ CreateZone .java] ( ../google-cloud-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateZone.java )
329331we create a zone. In [ CreateOrUpdateRecordSets.java] ( ../google-cloud-examples/src/main/java/com/google/cloud/examples/dns/snippets/CreateOrUpdateRecordSets.java )
330332we create a type A record set for a zone, or update an existing type A record set to a new IP address. We
331333demonstrate how to delete a zone in [ DeleteZone.java] ( ../google-cloud-examples/src/main/java/com/google/cloud/examples/dns/snippets/DeleteZone.java ) .
0 commit comments