Skip to content

Commit

Permalink
Added READMEs. This includes:
Browse files Browse the repository at this point in the history
- Package README
- Adjusted global gcloud-java README
- Package description

Also added defaultInstance to DnsOptions.
  • Loading branch information
mderka committed Mar 14, 2016
1 parent 6be68bc commit b5c3566
Show file tree
Hide file tree
Showing 5 changed files with 452 additions and 1 deletion.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This client supports the following Google Cloud Platform services:

- [Google Cloud BigQuery] (#google-cloud-bigquery-alpha) (Alpha)
- [Google Cloud Datastore] (#google-cloud-datastore)
- [Google Cloud DNS] (#google-cloud-dns-alpha) (Alpha)
- [Google Cloud Resource Manager] (#google-cloud-resource-manager-alpha) (Alpha)
- [Google Cloud Storage] (#google-cloud-storage)

Expand Down Expand Up @@ -50,6 +51,8 @@ Example Applications
- This app uses `gcloud-java` to interface with Cloud Datastore and Cloud Storage. It also uses Cloud SQL, another Google Cloud Platform service.
- [`DatastoreExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
- Read more about using this application on the [`DatastoreExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/datastore/DatastoreExample.html).
- [`DnsExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/DnsExample.java) - A simple command line interface for the Cloud DNS
- Read more about using this application on the [`DnsExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/dns/DnsExample.html).
- [`ResourceManagerExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
- Read more about using this application on the [`ResourceManagerExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/resourcemanager/ResourceManagerExample.html).
- [`SparkDemo`](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/managed_vms/sparkjava) - An example of using gcloud-java-datastore from within the SparkJava and App Engine Managed VM frameworks.
Expand Down Expand Up @@ -218,6 +221,58 @@ if (entity != null) {
}
```
Google Cloud DNS (Alpha)
----------------------
- [API Documentation][dns-api]
- [Official Documentation][cloud-dns-docs]
*Follow the [activation instructions][cloud-dns-activation] to use the Google Cloud DNS API with your project.*
#### Preview
Here are two code snippets showing simple usage examples from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
The first snippet shows how to create a zone resource. Complete source code can be found on
[CreateAndListZones.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateAndListZones.java).
```java
import com.google.gcloud.dns.Dns;
import com.google.gcloud.dns.DnsOptions;
import com.google.gcloud.dns.Zone;
import com.google.gcloud.dns.ZoneInfo;
Dns dns = DnsOptions.defaultInstance().service();
String zoneName = "my_unique_zone";
String domainName = "someexampledomain.com.";
String description = "This is a gcloud-java-dns sample zone.";
ZoneInfo zoneInfo = ZoneInfo.of(zoneName, domainName, description);
Zone createdZone = dns.create(zoneInfo);
```
The second snippet shows how to create records inside a zone. The complete code can be found on [CreateAndListDnsRecords.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateAndListDnsRecords.java).
```java
import com.google.gcloud.dns.ChangeRequest;
import com.google.gcloud.dns.Dns;
import com.google.gcloud.dns.DnsOptions;
import com.google.gcloud.dns.DnsRecord;
import com.google.gcloud.dns.Zone;
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
Dns dns = DnsOptions.defaultInstance().service();
String zoneName = "some-sample-zone";
Zone zone = dns.getZone(zoneName);
String ip = "12.13.14.15";
DnsRecord toCreate = DnsRecord.builder("www.someexampledomain.com.", DnsRecord.Type.A)
.ttl(24, TimeUnit.HOURS)
.addRecord(ip)
.build();
ChangeRequest changeRequest = ChangeRequest.builder().add(toCreate).build();
zone.applyChangeRequest(changeRequest);
```
Google Cloud Resource Manager (Alpha)
----------------------
Expand Down Expand Up @@ -359,6 +414,10 @@ Apache 2.0 - See [LICENSE] for more information.
[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate
[datastore-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/datastore/package-summary.html
[dns-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/dns/package-summary.html
[cloud-dns-docs]: https://cloud.google.com/dns/docs
[cloud-dns-activation]: https://console.cloud.google.com/start/api?id=dns&_ga=1.63051695.1811492016.1457580760
[cloud-pubsub]: https://cloud.google.com/pubsub/
[cloud-pubsub-docs]: https://cloud.google.com/pubsub/docs
Expand Down
Loading

0 comments on commit b5c3566

Please sign in to comment.