GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add initial Secret Manager samples by sethvargo · Pull Request #2664 · GoogleCloudPlatform/python-docs-samples

Add initial Secret Manager samples #2664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
kurtisvg merged 6 commits into GoogleCloudPlatform:master from sethvargo:sethvargo/secretmanager_samples
Dec 30, 2019

Uh oh!

There was an error while loading. Please reload this page.

Merged

Add initial Secret Manager samples #2664

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
6 commits
Select commit Hold shift + click to select a range
14202be
Add initial Secret Manager samples
sethvargo Dec 27, 2019
688e2bc
Fix quickstart tests
sethvargo Dec 28, 2019
148de1b
Pin to a specific version secretmanager version
sethvargo Dec 28, 2019
0c8aee6
Fix indentation
sethvargo Dec 28, 2019
dbbd2ce
Update copyright header to LLC
sethvargo Dec 28, 2019
286ba29
Remove unused import
sethvargo Dec 30, 2019
File filter
Filter by extension


Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

395 changes: 395 additions & 0 deletions 395 secretmanager/api-client/README.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,395 @@
.. This file is automatically generated. Do not edit this file directly.

Google Secret Manager Python Samples
===============================================================================

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/README.rst


This directory contains samples for Google Secret Manager. `Google Secret Manager` is a service that allows you to store, manage, and secure access to application secrets.




.. _Google Secret Manager: https://cloud.google.com/secret-manager

Setup
-------------------------------------------------------------------------------


Authentication
++++++++++++++

This sample requires you to have authentication setup. Refer to the
`Authentication Getting Started Guide`_ for instructions on setting up
credentials for applications.

.. _Authentication Getting Started Guide:
https://cloud.google.com/docs/authentication/getting-started

Install Dependencies
++++++++++++++++++++

#. Clone python-docs-samples and change directory to the sample directory you want to use.

.. code-block:: bash

$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git

#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions.

.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup

#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.

.. code-block:: bash

$ virtualenv env
$ source env/bin/activate

#. Install the dependencies needed to run the samples.

.. code-block:: bash

$ pip install -r requirements.txt

.. _pip: https://pip.pypa.io/
.. _virtualenv: https://virtualenv.pypa.io/

Samples
-------------------------------------------------------------------------------

Quickstart
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/quickstart.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python quickstart.py


Access Secret Version
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/access_secret_version.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python access_secret_version.py

usage: access_secret_version.py [-h] project_id secret_id version_id

command line application and sample code for accessing a secret version.

positional arguments:
project_id id of the GCP project
secret_id id of the secret to access
version_id version to access

optional arguments:
-h, --help show this help message and exit



Add Secret Version
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/add_secret_version.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python add_secret_version.py

usage: add_secret_version.py [-h] project_id secret_id payload

command line application and sample code for adding a secret version with the
specified payload to an existing secret.

positional arguments:
project_id id of the GCP project
secret_id id of the secret in which to add
payload secret material payload

optional arguments:
-h, --help show this help message and exit



Create Secret
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/create_secret.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python create_secret.py

usage: create_secret.py [-h] project_id secret_id

command line application and sample code for creating a new secret.

positional arguments:
project_id id of the GCP project
secret_id id of the secret to create

optional arguments:
-h, --help show this help message and exit



Delete Secret
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/delete_secret.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python delete_secret.py

usage: delete_secret.py [-h] project_id secret_id

command line application and sample code for deleting an existing secret.

positional arguments:
project_id id of the GCP project
secret_id id of the secret to delete

optional arguments:
-h, --help show this help message and exit



Destroy Secret Version
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/destroy_secret_version.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python destroy_secret_version.py

usage: destroy_secret_version.py [-h] project_id secret_id version_id

command line application and sample code for destroying a secret verison.

positional arguments:
project_id id of the GCP project
secret_id id of the secret from which to act
version_id id of the version to destroy

optional arguments:
-h, --help show this help message and exit



Enable Secret Version
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/enable_secret_version.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python enable_secret_version.py

usage: enable_secret_version.py [-h] project_id secret_id version_id

command line application and sample code for enabling a secret version.

positional arguments:
project_id id of the GCP project
secret_id id of the secret from which to act
version_id id of the version to enable

optional arguments:
-h, --help show this help message and exit



Get Secret Version
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/get_secret_version.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python get_secret_version.py

usage: get_secret_version.py [-h] project_id secret_id version_id

command line application and sample code for getting metdata about a secret
version, but not the secret payload.

positional arguments:
project_id id of the GCP project
secret_id id of the secret from which to act
version_id id of the version to get

optional arguments:
-h, --help show this help message and exit



Get Secret
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/get_secret.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python get_secret.py

usage: get_secret.py [-h] project_id secret_id

command line application and sample code for getting metadata about a secret.

positional arguments:
project_id id of the GCP project
secret_id id of the secret to get

optional arguments:
-h, --help show this help message and exit



List Secret Versions
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/list_secret_versions.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python list_secret_versions.py

usage: list_secret_versions.py [-h] project_id secret_id

command line application and sample code for listing secret versions of a
secret.

positional arguments:
project_id id of the GCP project
secret_id id of the secret in which to list

optional arguments:
-h, --help show this help message and exit



List Secrets
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/list_secrets.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python list_secrets.py

usage: list_secrets.py [-h] project_id

command line application and sample code for listing secrets in a project.

positional arguments:
project_id id of the GCP project

optional arguments:
-h, --help show this help message and exit



Update Secret
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=secretmanager/api-client/update_secret.py,secretmanager/api-client/README.rst




To run this sample:

.. code-block:: bash

$ python update_secret.py

usage: update_secret.py [-h] --secret-id SECRET_ID project_id

positional arguments:
project_id id of the GCP project

optional arguments:
-h, --help show this help message and exit
--secret-id SECRET_ID





.. _Google Cloud SDK: https://cloud.google.com/sdk/
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.