templates/cloud/gem/authentication.erb in gapic-generator-cloud-0.1.3 vs templates/cloud/gem/authentication.erb in gapic-generator-cloud-0.1.4

- old
+ new

@@ -1,21 +1,22 @@ <%- assert_locals gem -%> <%- service = gem.services.first -%> <%- assert_locals service -%> # Authentication -In general, the <%= gem.name %> library uses [Service -Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) -credentials to connect to Google Cloud services. When running within [Google -Cloud Platform environments](#google-cloud-platform-environments) -the credentials will be discovered automatically. When running on other +In general, the <%= gem.name %> library uses +[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) +credentials to connect to Google Cloud services. When running within +[Google Cloud Platform environments](#google-cloud-platform-environments) the +credentials will be discovered automatically. When running on other environments, the Service Account credentials can be specified by providing the -path to the [JSON -keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) for -the account (or the JSON itself) in [environment -variables](#environment-variables). Additionally, Cloud SDK credentials can also -be discovered automatically, but this is only recommended during development. +path to the +[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys) +for the account (or the JSON itself) in +[environment variables](#environment-variables). Additionally, Cloud SDK +credentials can also be discovered automatically, but this is only recommended +during development. ## Quickstart 1. [Create a service account and credentials](#creating-a-service-account). 2. Set the [environment variable](#environment-variables). @@ -47,27 +48,28 @@ 5. Discover credentials file in the Cloud SDK's path 6. Discover GCP credentials ### Google Cloud Platform environments -When running on Google Cloud Platform (GCP), including Google Compute Engine (GCE), -Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud Functions -(GCF) and Cloud Run, **Credentials** and are discovered -automatically. Code should be written as if already authenticated. +When running on Google Cloud Platform (GCP), including Google Compute Engine +(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud +Functions (GCF) and Cloud Run, **Credentials** are discovered automatically. +Code should be written as if already authenticated. ### Environment Variables -The **Credentials JSON** can be placed in environment -variables instead of declaring them directly in code. Each service has its own -environment variable, allowing for different service accounts to be used for -different services. (See the READMEs for the individual service gems for -details.) The path to the **Credentials JSON** file can be stored in the -environment variable, or the **Credentials JSON** itself can be stored for -environments such as Docker containers where writing files is difficult or not -encouraged. +The **Credentials JSON** can be placed in environment variables instead of +declaring them directly in code. Each service has its own environment variable, +allowing for different service accounts to be used for different services. (See +the READMEs for the individual service gems for details.) The path to the +**Credentials JSON** file can be stored in the environment variable, or the +**Credentials JSON** itself can be stored for environments such as Docker +containers where writing files is difficult or not encouraged. -The environment variables that <%= gem.name %> checks for credentials are configured on the service Credentials class (such as {<%= service.credentials_name_full %>}): +The environment variables that <%= gem.name %> +checks for credentials are configured on the service Credentials class (such as +{<%= service.credentials_name_full %>}): 1. `<%= gem.env_prefix %>_CREDENTIALS` - Path to JSON file, or JSON contents 2. `<%= gem.env_prefix %>_KEYFILE` - Path to JSON file, or JSON contents 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents @@ -81,11 +83,12 @@ client = <%= service.client_name_full %>.new ``` ### Configuration -The **Credentials JSON** can be configured instead of placing them in environment variables. Either on an individual client initialization: +The **Credentials JSON** can be configured instead of placing them in +environment variables. Either on an individual client initialization: ```ruby require "<%= service.package.package_require %>" client = <%= service.client_name_full %>.new do |config| @@ -138,18 +141,18 @@ If you are not running this client within [Google Cloud Platform environments](#google-cloud-platform-environments), you need a Google Developers service account. 1. Visit the [Google Developers Console][dev-console]. -1. Create a new project or click on an existing project. -1. Activate the slide-out navigation tray and select **API Manager**. From +2. Create a new project or click on an existing project. +3. Activate the slide-out navigation tray and select **API Manager**. From here, you will enable the APIs that your application requires. ![Enable the APIs that your application requires][enable-apis] *Note: You may need to enable billing in order to use these services.* -1. Select **Credentials** from the side navigation. +4. Select **Credentials** from the side navigation. You should see a screen like one of the following. ![Create a new service account][create-new-service-account]