Skip to content

Commit d184254

Browse files
committed
---
yaml --- r: 1473 b: refs/heads/master c: 6c5a642 h: refs/heads/master i: 1471: 395cf63
1 parent 7bebc1b commit d184254

33 files changed

Lines changed: 17 additions & 3974 deletions

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 637f1566d5bacf409cd94945a8fc707dcc34047c
2+
refs/heads/master: 6c5a642aa3dd52e8bea4f29a13f01b458283cbc7
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: d1b373c30c176edc08692348167bec3a244bb823
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3

trunk/README.md

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ 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)
1817

1918
> Note: This client is a work-in-progress, and may occasionally
2019
> make backwards-incompatible changes.
@@ -183,37 +182,6 @@ if (blob == null) {
183182
}
184183
```
185184
186-
Google Cloud Resource Manager
187-
----------------------
188-
189-
- [API Documentation][resourcemanager-api]
190-
- [Official Documentation][cloud-resourcemanager-docs]
191-
192-
#### Preview
193-
194-
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).
195-
196-
```java
197-
import com.google.gcloud.resourcemanager.ProjectInfo;
198-
import com.google.gcloud.resourcemanager.ResourceManager;
199-
import com.google.gcloud.resourcemanager.ResourceManagerOptions;
200-
201-
import java.util.Iterator;
202-
203-
ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service();
204-
ProjectInfo myProject = resourceManager.get("some-project-id"); // Use an existing project's ID
205-
ProjectInfo newProjectInfo = resourceManager.replace(myProject.toBuilder()
206-
.addLabel("launch-status", "in-development").build());
207-
System.out.println("Updated the labels of project " + newProjectInfo.projectId()
208-
+ " to be " + newProjectInfo.labels());
209-
// List all the projects you have permission to view.
210-
Iterator<ProjectInfo> projectIterator = resourceManager.list().iterateAll();
211-
System.out.println("Projects I can view:");
212-
while (projectIterator.hasNext()) {
213-
System.out.println(projectIterator.next().projectId());
214-
}
215-
```
216-
217185
Troubleshooting
218186
---------------
219187
@@ -273,6 +241,3 @@ Apache 2.0 - See [LICENSE] for more information.
273241
[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets
274242
[cloud-storage-activation]: https://cloud.google.com/storage/docs/signup
275243
[storage-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/storage/package-summary.html
276-
277-
[resourcemanager-api]:http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/resourcemanager/package-summary.html
278-
[cloud-resourcemanager-docs]:https://cloud.google.com/resource-manager/

trunk/TESTING.md

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
## gcloud-java tools for testing
22

3-
This library provides tools to help write tests for code that uses the following gcloud-java services:
4-
5-
- [Datastore] (#testing-code-that-uses-datastore)
6-
- [Storage] (#testing-code-that-uses-storage)
7-
- [Resource Manager] (#testing-code-that-uses-resource-manager)
3+
This library provides tools to help write tests for code that uses gcloud-java services.
84

95
### Testing code that uses Datastore
106

@@ -55,7 +51,8 @@ Currently, there isn't an emulator for Google Cloud Storage, so an alternative i
5551
3. Create a `RemoteGcsHelper` object using your project ID and JSON key.
5652
Here is an example that uses the `RemoteGcsHelper` to create a bucket.
5753
```java
58-
RemoteGcsHelper gcsHelper = RemoteGcsHelper.create(PROJECT_ID, "/path/to/my/JSON/key.json");
54+
RemoteGcsHelper gcsHelper =
55+
RemoteGcsHelper.create(PROJECT_ID, new FileInputStream("/path/to/my/JSON/key.json"));
5956
Storage storage = gcsHelper.options().service();
6057
String bucket = RemoteGcsHelper.generateBucketName();
6158
storage.create(BucketInfo.of(bucket));
@@ -69,38 +66,5 @@ Here is an example that clears the bucket created in Step 3 with a timeout of 5
6966
RemoteGcsHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
7067
```
7168

72-
### Testing code that uses Resource Manager
73-
74-
#### On your machine
75-
76-
You can test against a temporary local Resource Manager by following these steps:
77-
78-
1. Before running your testing code, start the Resource Manager emulator `LocalResourceManagerHelper`. This can be done as follows:
79-
80-
```java
81-
import com.google.gcloud.resourcemanager.testing.LocalResourceManagerHelper;
82-
83-
LocalResourceManagerHelper helper = LocalResourceManagerHelper.create();
84-
helper.start();
85-
```
86-
87-
This will spawn a server thread that listens to `localhost` at an ephemeral port for Resource Manager requests.
88-
89-
2. In your program, create and use a Resource Manager service object whose host is set to `localhost` at the appropriate port. For example:
90-
91-
```java
92-
ResourceManager resourceManager = LocalResourceManagerHelper.options().service();
93-
```
94-
95-
3. Run your tests.
96-
97-
4. Stop the Resource Manager emulator.
98-
99-
```java
100-
helper.stop();
101-
```
102-
103-
This method will block until the server thread has been terminated.
104-
10569

10670
[cloud-platform-storage-authentication]:https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts

trunk/gcloud-java-examples/README.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To run examples from your command line:
3333

3434
1. Login using gcloud SDK (`gcloud auth login` in command line)
3535

36-
2. Set your current project using `gcloud config set project PROJECT_ID`. This step is not necessary for `ResourceManagerExample`.
36+
2. Set your current project using `gcloud config set project PROJECT_ID`
3737

3838
3. Compile using Maven (`mvn compile` in command line from your base project directory)
3939

@@ -56,16 +56,7 @@ To run examples from your command line:
5656
$mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.StorageExample" -Dexec.args="list <bucket_name>"
5757
$mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.StorageExample" -Dexec.args="download <bucket_name> test.txt"
5858
$mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.StorageExample" -Dexec.args="delete <bucket_name> test.txt"
59-
```
60-
61-
Here's an example run of `ResourceManagerExample`.
62-
63-
Be sure to change the placeholder project ID "my-project-id" with your own globally unique project ID.
64-
```
65-
$mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.ResourceManagerExample" -Dexec.args="create my-project-id"
66-
$mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.ResourceManagerExample" -Dexec.args="list"
67-
$mvn exec:java -Dexec.mainClass="com.google.gcloud.examples.ResourceManagerExample" -Dexec.args="get my-project-id"
68-
```
59+
```
6960

7061
Troubleshooting
7162
---------------

trunk/gcloud-java-examples/src/main/java/com/google/gcloud/examples/ResourceManagerExample.java

Lines changed: 0 additions & 223 deletions
This file was deleted.

0 commit comments

Comments
 (0)