Skip to content

Commit

Permalink
Update all generated readme auth instructions [(googleapis#1121)](Goo…
Browse files Browse the repository at this point in the history
…gleCloudPlatform/python-docs-samples#1121)

Change-Id: I03b5eaef8b17ac3dc3c0339fd2c7447bd3e11bd2
  • Loading branch information
Jon Wayne Parrott authored Sep 18, 2017
1 parent 211387d commit 8147700
Showing 1 changed file with 9 additions and 29 deletions.
38 changes: 9 additions & 29 deletions samples/samples/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,12 @@ Setup
Authentication
++++++++++++++

Authentication is typically done through `Application Default Credentials`_,
which means you do not have to change the code to authenticate as long as
your environment has credentials. You have a few options for setting up
authentication:
This sample requires you to have authentication setup. Refer to the
`Authentication Getting Started Guide`_ for instructions on setting up
credentials for applications.

#. When running locally, use the `Google Cloud SDK`_

.. code-block:: bash
gcloud auth application-default login
#. When running on App Engine or Compute Engine, credentials are already
set-up. However, you may need to configure your Compute Engine instance
with `additional scopes`_.

#. You can create a `Service Account key file`_. This file can be used to
authenticate to Google Cloud Platform services from any environment. To use
the file, set the ``GOOGLE_APPLICATION_CREDENTIALS`` environment variable to
the path to the key file, for example:

.. code-block:: bash
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
.. _Application Default Credentials: https://cloud.google.com/docs/authentication#getting_credentials_for_server-centric_flow
.. _additional scopes: https://cloud.google.com/compute/docs/authentication#using
.. _Service Account key file: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount
.. _Authentication Getting Started Guide:
https://cloud.google.com/docs/authentication/getting-started

Install Dependencies
++++++++++++++++++++
Expand Down Expand Up @@ -83,7 +61,7 @@ To run this sample:
usage: snippets.py [-h] [--database-id DATABASE_ID]
instance_id
{create_database,insert_data,query_data,read_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index}
{create_database,insert_data,query_data,read_data,read_stale_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index}
...
This application demonstrates how to do basic operations using Cloud
Expand All @@ -93,13 +71,15 @@ To run this sample:
positional arguments:
instance_id Your Cloud Spanner instance ID.
{create_database,insert_data,query_data,read_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index}
{create_database,insert_data,query_data,read_data,read_stale_data,add_column,update_data,query_data_with_new_column,read_write_transaction,read_only_transaction,add_index,query_data_with_index,read_data_with_index,add_storing_index,read_data_with_storing_index}
create_database Creates a database and tables for sample data.
insert_data Inserts sample data into the given database. The
database and table must already exist and can be
created using `create_database`.
query_data Queries sample data from the database using SQL.
read_data Reads sample data from the database.
read_stale_data Reads sample data from the database. The data is
exactly 10 seconds stale.
add_column Adds a new column to the Albums table in the example
database.
update_data Updates sample data in the database. This updates the
Expand Down

0 comments on commit 8147700

Please sign in to comment.