You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cloud-storage/xml-api/serviceaccount-cmdline-sample/README.md
+30-37
Original file line number
Diff line number
Diff line change
@@ -6,43 +6,44 @@ Browse Online
6
6
7
7
The main file is [StorageServiceAccountSample.java](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/cloud-storage/xml-api/serviceaccount-cmdline-sample/src/main/java/StorageServiceAccountSample.java).
8
8
9
-
Get a Service Account
10
-
---------------------
11
9
12
-
See the instructions at https://developers.google.com/storage/docs/xml-api-java-samples
13
-
for setting up a service account.
10
+
Setup
11
+
-----
14
12
15
-
Checkout Instructions
16
-
---------------------
17
-
18
-
1.**Prerequisites:**
19
-
1. install the latest version of [Java](http//java.com) and [Maven](http://maven.apache.org/download.html).
20
-
1.[Create](https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets) a Google Cloud Storage bucket
21
-
1. You must also be able to work with [GitHub](https://help.github.com/articles/set-up-git) repositories.
22
-
1. You may need to set your `JAVA_HOME`.
23
-
24
-
1. Clone repository.
13
+
*[Create](https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets) a Google Cloud Storage bucket
14
+
* This module uses [Application Default Credentials](https://developers.google.com/accounts/docs/application-default-credentials). If you are running it outside of [Google Compute Engine](https://cloud.google.com/compute/), you'll need to
15
+
* Download the json private key for a [Service Account](https://cloud.google.com/storage/docs/authentication#service_accounts) and have it available.
16
+
* Set an environment variable: `export GOOGLE_APPLICATION_CREDENTIALS=path/to/your-key.json`
17
+
* You must also be able to work with [GitHub](https://help.github.com/articles/set-up-git) repositories.
cd java-docs-samples/cloud-storage/xml-api/serviceaccount-cmdline-sample
28
21
29
-
1. Update key.json file.
30
-
1. Compile and run
31
22
32
-
mvn compile install
33
-
export GOOGLE_APPLICATION_CREDENTIALS=key.json
34
-
mvn -q exec:java -Dexec.args="your-bucket-name"
23
+
Command-line Instructions
24
+
-------------------------
35
25
36
-
37
-
To enable logging of HTTP requests and responses (highly recommended when
26
+
***Prerequisites:**
27
+
* Install the latest version of [Java](http//java.com) and [Maven](http://maven.apache.org/download.html).
28
+
* Set the environment variable: `export GOOGLE_APPLICATION_CREDENTIALS=your-key-filename.json`
29
+
* You may need to set your `JAVA_HOME`.
30
+
31
+
```bash
32
+
cd java-docs-samples/cloud-storage/xml-api/serviceaccount-cmdline-sample
33
+
# Compile and run
34
+
mvn compile install
35
+
mvn -q exec:java -Dexec.args="your-bucket-name"
36
+
```
37
+
38
+
To enable logging of HTTP requests and responses (highly recommended when
38
39
developing), please take a look at logging.properties.
39
40
40
-
Set Up a Project in Eclipse
41
-
---------------------------
41
+
42
+
Eclipse Instructions
43
+
--------------------
42
44
43
45
***Prerequisites:**
44
46
* Install [Eclipse](http://www.eclipse.org/downloads/), the [Maven plugin](http://eclipse.org/m2e/), and optionally the [GitHub plugin](http://eclipse.github.com/).
45
-
*[Create](https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets) a Google Cloud Storage bucket
46
47
47
48
* Set up Eclipse Preferences
48
49
@@ -52,23 +53,15 @@ Set Up a Project in Eclipse
52
53
* check on "Download Artifact Sources"
53
54
* check on "Download Artifact JavaDoc"
54
55
55
-
* Clone the `serviceaccount-cmdline-sample` to your computer
56
-
57
-
* You can use either a plugin with Eclipse or any other tool you normally use
58
-
to work with GitHub repositories.
59
-
60
-
* Create a new project using `serviceaccount-cmdline-sample`
56
+
* Create a new project using `cloud-storage/xml-api/serviceaccount-cmdline-sample`
61
57
62
58
* Create a new Java Project.
63
-
* Choose the **Location** of the project to be the root directory of the sample you cloned locally.
64
-
* Make sure the Eclipse package name matches the package name used in the
0 commit comments