@@ -14,6 +14,8 @@ This client supports the following Google Cloud Platform services:
1414
1515- [ Google Cloud Datastore] (#google-cloud-datastore)
1616- [ Google Cloud Storage] (#google-cloud-storage)
17+ - [ Google Cloud Resource Manager] (#google-cloud-resource-manager)
18+ - [ Google Cloud BigQuery] (#google-cloud-bigquery)
1719
1820> Note: This client is a work-in-progress, and may occasionally
1921> make backwards-incompatible changes.
@@ -182,6 +184,82 @@ if (blob == null) {
182184}
183185` ` `
184186
187+ Google Cloud Resource Manager
188+ ----------------------
189+
190+ - [API Documentation][resourcemanager-api]
191+ - [Official Documentation][cloud-resourcemanager-docs]
192+
193+ # ### Preview
194+
195+ Here is a code snippet showing a simple usage example. Note that you must supply Google SDK credentials for this service, not other forms of authentication listed in the [Authentication section](# authentication).
196+
197+ ` ` ` java
198+ import com.google.gcloud.resourcemanager.ProjectInfo;
199+ import com.google.gcloud.resourcemanager.ResourceManager;
200+ import com.google.gcloud.resourcemanager.ResourceManagerOptions;
201+
202+ import java.util.Iterator;
203+
204+ ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service ();
205+ ProjectInfo myProject = resourceManager.get(" some-project-id" ); // Use an existing project' s ID
206+ ProjectInfo newProjectInfo = resourceManager.replace(myProject.toBuilder()
207+ .addLabel("launch-status", "in-development").build());
208+ System.out.println("Updated the labels of project " + newProjectInfo.projectId()
209+ + " to be " + newProjectInfo.labels());
210+ // List all the projects you have permission to view.
211+ Iterator<ProjectInfo> projectIterator = resourceManager.list().iterateAll();
212+ System.out.println("Projects I can view:");
213+ while (projectIterator.hasNext()) {
214+ System.out.println(projectIterator.next().projectId());
215+ }
216+ ```
217+
218+ Google Cloud BigQuery
219+ ----------------------
220+
221+ - [API Documentation][bigquery-api]
222+ - [Official Documentation][cloud-bigquery-docs]
223+
224+ #### Preview
225+
226+ Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
227+ must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
228+
229+ ```java
230+ import com.google.gcloud.bigquery.BaseTableInfo;
231+ import com.google.gcloud.bigquery.BigQuery;
232+ import com.google.gcloud.bigquery.BigQueryOptions;
233+ import com.google.gcloud.bigquery.Field;
234+ import com.google.gcloud.bigquery.JobStatus;
235+ import com.google.gcloud.bigquery.LoadJobInfo;
236+ import com.google.gcloud.bigquery.Schema;
237+ import com.google.gcloud.bigquery.TableId;
238+ import com.google.gcloud.bigquery.TableInfo;
239+
240+ BigQuery bigquery = BigQueryOptions.defaultInstance().service();
241+ TableId tableId = TableId.of("dataset", "table");
242+ BaseTableInfo info = bigquery.getTable(tableId);
243+ if (info == null) {
244+ System.out.println("Creating table " + tableId);
245+ Field integerField = Field.of("fieldName", Field.Type.integer());
246+ bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
247+ } else {
248+ System.out.println("Loading data into table " + tableId);
249+ LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
250+ loadJob = bigquery.create(loadJob);
251+ while (loadJob.status().state() != JobStatus.State.DONE) {
252+ Thread.sleep(1000L);
253+ loadJob = bigquery.getJob(loadJob.jobId());
254+ }
255+ if (loadJob.status().error() != null) {
256+ System.out.println("Job completed with errors");
257+ } else {
258+ System.out.println("Job succeeded");
259+ }
260+ }
261+ ```
262+
185263Troubleshooting
186264---------------
187265
@@ -241,3 +319,10 @@ Apache 2.0 - See [LICENSE] for more information.
241319[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
242320[cloud-storage-activation]: https://cloud.google.com/storage/docs/signup
243321[storage-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html? com/google/gcloud/storage/package-summary.html
322+
323+ [resourcemanager-api]:http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html? com/google/gcloud/resourcemanager/package-summary.html
324+ [cloud-resourcemanager-docs]:https://cloud.google.com/resource-manager/
325+
326+ [cloud-bigquery]: https://cloud.google.com/bigquery/
327+ [cloud-bigquery-docs]: https://cloud.google.com/bigquery/docs/overview
328+ [bigquery-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html? com/google/gcloud/bigquery/package-summary.html
0 commit comments