From b986f666e293fcd182a195e5e52ed1780567bf1f Mon Sep 17 00:00:00 2001 From: Anton Antonov Date: Mon, 31 Oct 2016 17:25:37 +0200 Subject: [PATCH 1/2] Update storage README.md Add missing option how to use the storage client with an API key. Update button names to refer to the actual names in the UI. --- packages/storage/README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/storage/README.md b/packages/storage/README.md index 08fb071cfbb..017d45c9a0d 100644 --- a/packages/storage/README.md +++ b/packages/storage/README.md @@ -90,20 +90,26 @@ If you are not running this client on Google Compute Engine, you need a Google D * Google Cloud Storage * Google Cloud Storage JSON API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new API key, click on **Create credentials** and select **API key**. After the API key is created, you will see a newly opened modal with the API key in a field named **Your API key** that the library uses to authenticate your requests. + * If you want to generate a new API key for an existing API key, click on an existing API key and click **Regenerate key**. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' var gcs = require('@google-cloud/storage')({ + // 1. Specify projectId projectId: projectId, - + // 2. Specify authentication + // To authenticate with a service account key use // The path to your key file: keyFilename: '/path/to/keyfile.json' - // Or the contents of the key file: credentials: require('./path/to/keyfile.json') + + // To authenticate with an API key use + key: 'yourKeyContent' }); // ...you're good to go! From 184870c6151d7cafd91489b9b7b88210d0678362 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Mon, 14 Nov 2016 16:58:07 -0500 Subject: [PATCH 2/2] docs: update API key generation steps --- README.md | 7 +++++-- packages/bigquery/README.md | 4 ++-- packages/bigtable/README.md | 4 ++-- packages/compute/README.md | 4 ++-- packages/datastore/README.md | 4 ++-- packages/dns/README.md | 4 ++-- packages/language/README.md | 4 ++-- packages/logging/README.md | 4 ++-- packages/monitoring/README.md | 4 ++-- packages/prediction/README.md | 4 ++-- packages/pubsub/README.md | 4 ++-- packages/resource/README.md | 4 ++-- packages/speech/README.md | 4 ++-- packages/storage/README.md | 10 ++-------- packages/translate/README.md | 9 +++++++-- 15 files changed, 38 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index a3c723530eb..a7fb2f2b8a8 100644 --- a/README.md +++ b/README.md @@ -103,8 +103,8 @@ If you are not running this client on Google Compute Engine, you need a Google D * Prediction API * Stackdriver Logging API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js // Authenticating on a global basis. @@ -118,6 +118,9 @@ var gcloud = require('google-cloud')({ // Or the contents of the key file: credentials: require('./path/to/keyfile.json') + + // For any APIs that accept an API key: + key: '...' }); // ...you're good to go! See the next section to get started using the APIs. diff --git a/packages/bigquery/README.md b/packages/bigquery/README.md index 63c7f2fe4f1..97f21a7fb5b 100644 --- a/packages/bigquery/README.md +++ b/packages/bigquery/README.md @@ -72,8 +72,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * BigQuery API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/bigtable/README.md b/packages/bigtable/README.md index c3d23acd694..89da4d04e3e 100644 --- a/packages/bigtable/README.md +++ b/packages/bigtable/README.md @@ -90,8 +90,8 @@ If you are not running this client on Google Compute Engine, you need a Google D * Cloud Bigtable Admin API * Cloud Bigtable Table Admin API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/compute/README.md b/packages/compute/README.md index f3c5b4163fb..c3c12b0e279 100644 --- a/packages/compute/README.md +++ b/packages/compute/README.md @@ -78,8 +78,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Google Compute Engine API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/datastore/README.md b/packages/datastore/README.md index 45de4c2fe39..9e09143964b 100644 --- a/packages/datastore/README.md +++ b/packages/datastore/README.md @@ -93,8 +93,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Google Cloud Datastore API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/dns/README.md b/packages/dns/README.md index 8ee4b2cd22d..b819ea3fd13 100644 --- a/packages/dns/README.md +++ b/packages/dns/README.md @@ -76,8 +76,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Google Cloud DNS API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/language/README.md b/packages/language/README.md index 90b6763ebda..da7d35ddc5f 100644 --- a/packages/language/README.md +++ b/packages/language/README.md @@ -101,8 +101,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Google Cloud Natural Language API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/logging/README.md b/packages/logging/README.md index 4757b2b0d4e..2a937c0bbf8 100644 --- a/packages/logging/README.md +++ b/packages/logging/README.md @@ -90,8 +90,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Stackdriver Logging API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/monitoring/README.md b/packages/monitoring/README.md index 1f4af9006ee..36bb4f93cae 100644 --- a/packages/monitoring/README.md +++ b/packages/monitoring/README.md @@ -49,8 +49,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 1. Visit the [Google Developers Console][dev-console]. 2. Create a new project or click on an existing project. 3. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/prediction/README.md b/packages/prediction/README.md index 0d95f2dc8cc..878b95e9c93 100644 --- a/packages/prediction/README.md +++ b/packages/prediction/README.md @@ -86,8 +86,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Prediction API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/pubsub/README.md b/packages/pubsub/README.md index b8d8ca252ec..f61b991eb52 100644 --- a/packages/pubsub/README.md +++ b/packages/pubsub/README.md @@ -79,8 +79,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Google Cloud Pub/Sub API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/resource/README.md b/packages/resource/README.md index ce7acc8b11c..a22834e4d3b 100644 --- a/packages/resource/README.md +++ b/packages/resource/README.md @@ -72,8 +72,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Google Cloud Resource Manager API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/speech/README.md b/packages/speech/README.md index 8f47b7efec7..f5816159d02 100644 --- a/packages/speech/README.md +++ b/packages/speech/README.md @@ -102,8 +102,8 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Google Cloud Speech API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' diff --git a/packages/storage/README.md b/packages/storage/README.md index 017d45c9a0d..89f4988cd21 100644 --- a/packages/storage/README.md +++ b/packages/storage/README.md @@ -92,24 +92,18 @@ If you are not running this client on Google Compute Engine, you need a Google D 4. Navigate to **APIs & auth** > **Credentials** and then: * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. - * If you want to use a new API key, click on **Create credentials** and select **API key**. After the API key is created, you will see a newly opened modal with the API key in a field named **Your API key** that the library uses to authenticate your requests. - * If you want to generate a new API key for an existing API key, click on an existing API key and click **Regenerate key**. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' var gcs = require('@google-cloud/storage')({ - // 1. Specify projectId projectId: projectId, - // 2. Specify authentication - // To authenticate with a service account key use + // The path to your key file: keyFilename: '/path/to/keyfile.json' + // Or the contents of the key file: credentials: require('./path/to/keyfile.json') - - // To authenticate with an API key use - key: 'yourKeyContent' }); // ...you're good to go! diff --git a/packages/translate/README.md b/packages/translate/README.md index 04c94742fe7..62eae7cc405 100644 --- a/packages/translate/README.md +++ b/packages/translate/README.md @@ -86,8 +86,10 @@ If you are not running this client on Google Compute Engine, you need a Google D 3. Navigate to **APIs & auth** > **APIs section** and turn on the following APIs (you may need to enable billing in order to use these services): * Google Translate API 4. Navigate to **APIs & auth** > **Credentials** and then: - * If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. - * If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests. + * If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file. + * If you want to use an API key, click on **Create credentials** and select **API key**. After the API key is created, you will see a newly opened modal with the API key in a field named **Your API key** that the library uses to authenticate your requests. + * If you want to generate a new API key for an existing API key, click on an existing API key and click **Regenerate key**. ``` js var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123' @@ -100,6 +102,9 @@ var translate = require('@google-cloud/translate')({ // Or the contents of the key file: credentials: require('./path/to/keyfile.json') + + // Your API key (if not using a service account JSON file): + key: '...' }); // ...you're good to go!