diff --git a/README.md b/README.md index 786a28824e3d..a908cef0bf35 100644 --- a/README.md +++ b/README.md @@ -269,7 +269,7 @@ DnsRecord toCreate = DnsRecord.builder("www.someexampledomain.com.", DnsRecord.T .ttl(24, TimeUnit.HOURS) .addRecord(ip) .build(); -ChangeRequest changeRequest = ChangeRequest.builder().add(toCreate).build(); +ChangeRequest.Builder changeBuilder = ChangeRequest.builder().add(toCreate); // Verify that the record does not exist yet. // If it does exist, we will overwrite it with our prepared record. @@ -282,6 +282,7 @@ while (recordIterator.hasNext()) { } } +ChangeRequest changeRequest = changeBuilder.build(); zone.applyChangeRequest(changeRequest); ``` diff --git a/gcloud-java-dns/README.md b/gcloud-java-dns/README.md index b07ebca35558..4f65d8e3b814 100644 --- a/gcloud-java-dns/README.md +++ b/gcloud-java-dns/README.md @@ -96,12 +96,11 @@ DNS records in `gcloud-java-dns` are managed inside containers called "zones". ` which encapsulates metadata that describe a zone in Google Cloud DNS. `Zone`, a subclass of `ZoneInfo`, adds service-related functionality over `ZoneInfo`. -*Important: Zone must be unique to the project. If you choose a zone name that already +*Important: Zone names must be unique to the project. If you choose a zone name that already exists within your project, you'll get a helpful error message telling you to choose another name. In the code below, replace "my-unique-zone" with a unique zone name. See more about naming rules [here](https://cloud.google.com/dns/api/v1/managedZones#name).* -In this code snippet, we create a new zone in which we intend to -manage DNS record for domain `someexampledomain.com.` +In this code snippet, we create a new zone to manage DNS records for domain `someexampledomain.com.` *Important: The service may require that you verify ownership of the domain for which you are creating a zone. Hence, we recommend that you do so beforehand. You can verify ownership of @@ -133,7 +132,13 @@ You now have an empty zone hosted in Google Cloud DNS which is ready to be popul records for domain name `someexampledomain.com.` Upon creating the zone, the cloud service assigned a set of DNS servers to host records for this zone and created the required SOA and NS records for the domain. The following snippet prints the list of servers -assigned to the zone created above. +assigned to the zone created above. First, import + +```java +import java.util.List; +``` + +and then add ```java // Print assigned name servers @@ -324,7 +329,7 @@ we create a type A record for a zone, or update an existing type A record to a n demonstrate how to delete a zone in [DeleteZone.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/DeleteZone.java). Finally, in [ManipulateZonesAndRecords.java](../gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/ManipulateZonesAndRecords.java) we assemble all the code snippets together and create zone, create or update a DNS record, list zones, list DNS records, list changes, and -delete a zone. The applications assume that they are running on Compute Engine or from your own desktop. To run the example on App +delete a zone. The applications assume that they are running on Compute Engine or from your own desktop. To run any of these examples on App Engine, simply move the code from the main method to your application's servlet class and change the print statements to display on your webpage.