@@ -159,7 +159,7 @@ our zone that creates a record set of type A and points URL www.someexampledomai
159159IP address 12.13.14.15. Start by adding
160160
161161``` java
162- import com.google.gcloud.dns.ChangeRequest ;
162+ import com.google.gcloud.dns.ChangeRequestInfo ;
163163import com.google.gcloud.dns.RecordSet ;
164164
165165import java.util.concurrent.TimeUnit ;
@@ -176,7 +176,7 @@ RecordSet toCreate = RecordSet.builder("www." + zone.dnsName(), RecordSet.Type.A
176176 .build();
177177
178178// Make a change
179- ChangeRequest changeRequest = ChangeRequest . builder(). add(toCreate). build();
179+ ChangeRequestInfo changeRequest = ChangeRequestInfo . builder(). add(toCreate). build();
180180
181181// Build and apply the change request to our zone
182182changeRequest = zone. applyChangeRequest(changeRequest);
@@ -198,7 +198,7 @@ and in the code
198198
199199``` java
200200// Make a change
201- ChangeRequest . Builder changeBuilder = ChangeRequest . builder(). add(toCreate);
201+ ChangeRequestInfo . Builder changeBuilder = ChangeRequestInfo . builder(). add(toCreate);
202202
203203// Verify the type A record does not exist yet.
204204// If it does exist, we will overwrite it with our prepared record.
@@ -211,7 +211,7 @@ while (recordSetIterator.hasNext()) {
211211}
212212
213213// Build and apply the change request to our zone
214- ChangeRequest changeRequest = changeBuilder. build();
214+ ChangeRequestInfo changeRequest = changeBuilder. build();
215215zone. applyChangeRequest(changeRequest);
216216```
217217You can find more information about changes in the [ Cloud DNS documentation] (https://cloud.google.com/dns/what-is-cloud-dns#cloud_dns_api_concepts ).
@@ -220,7 +220,7 @@ When the change request is applied, it is registered with the Cloud DNS service
220220can wait for its completion as follows:
221221
222222``` java
223- while (ChangeRequest . Status . PENDING. equals(changeRequest. status())) {
223+ while (ChangeRequestInfo . Status . PENDING. equals(changeRequest. status())) {
224224 try {
225225 Thread . sleep(500L );
226226 } catch (InterruptedException e) {
@@ -262,9 +262,17 @@ while (recordSetIterator.hasNext()) {
262262}
263263```
264264
265- You can also list the history of change requests that were applied to a zone:
265+ You can also list the history of change requests that were applied to a zone.
266+ First add:
266267
267268``` java
269+ import java.util.ChangeRequest ;
270+ ```
271+
272+ and then:
273+
274+ ``` java
275+
268276// List the change requests applied to a particular zone
269277Iterator<ChangeRequest > changeIterator = zone. listChangeRequests(). iterateAll();
270278System . out. println(String . format(" The history of changes in %s:" , zone. name()));
@@ -280,7 +288,7 @@ First, you need to empty the zone by deleting all its records except for the def
280288
281289``` java
282290// Make a change for deleting the record sets
283- changeBuilder = ChangeRequest . builder();
291+ changeBuilder = ChangeRequestInfo . builder();
284292while (recordIterator. hasNext()) {
285293 RecordSet current = recordIterator. next();
286294 // SOA and NS records cannot be deleted
@@ -290,14 +298,14 @@ while (recordIterator.hasNext()) {
290298}
291299
292300// Build and apply the change request to our zone if it contains records to delete
293- ChangeRequest changeRequest = changeBuilder. build();
301+ ChangeRequestInfo changeRequest = changeBuilder. build();
294302if (! changeRequest. deletions(). isEmpty()) {
295303 changeRequest = dns. applyChangeRequest(zoneName, changeRequest);
296304
297305 // Wait for change to finish, but save data traffic by transferring only ID and status
298306 Dns . ChangeRequestOption option =
299307 Dns . ChangeRequestOption . fields(Dns . ChangeRequestField . STATUS );
300- while (ChangeRequest . Status . PENDING. equals(changeRequest. status())) {
308+ while (ChangeRequestInfo . Status . PENDING. equals(changeRequest. status())) {
301309 System . out. println(" Waiting for change to complete. Going to sleep for 500ms..." );
302310 try {
303311 Thread . sleep(500 );
0 commit comments