From 90097bca7660f148f36e009f70d108404efa5308 Mon Sep 17 00:00:00 2001 From: Alexa B Date: Fri, 7 Aug 2020 14:11:43 -0400 Subject: [PATCH 1/4] docs: Generate using new common.py_samples() synthtool functionality (#35) * docs: Generate using new common.py_samples() synthtool functionality * docs: Generate using new common.py_samples() synthtool functionality * Delete old README * Updated README to remove duplicate info * Minor change --- .repo-metadata.json | 12 ++++- samples/snippets/README.md | 54 +++++++++++++++++++ samples/snippets/README.rst | 98 ---------------------------------- samples/snippets/README.rst.in | 19 ------- synth.py | 3 +- 5 files changed, 67 insertions(+), 119 deletions(-) create mode 100644 samples/snippets/README.md delete mode 100644 samples/snippets/README.rst delete mode 100644 samples/snippets/README.rst.in diff --git a/.repo-metadata.json b/.repo-metadata.json index a78afd7b..5ce321d4 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -9,5 +9,15 @@ "repo": "googleapis/python-kms", "distribution_name": "google-cloud-kms", "api_id": "cloudkms.googleapis.com", - "requires_billing": true + "requires_billing": true, + "client_library": true, + "custom_content": "The Google Cloud KMS API is a service that allows you to keep encryption keys centrally in the cloud, for direct use by cloud services. More info about Cloud KMS can be found at https://cloud.google.com/kms/docs/", + "sample_project_dir": "samples/snippets/", + "samples": [ + {"name": "Quickstart", + "description": "This quickstart shows you how to create and use encryption keys with Cloud Key Management Service.", + "file": "quickstart.py", + "runnable": true, + "custom_content": "More information about the Cloud KMS quickstart is available at https://cloud.google.com/kms/docs/quickstart"} + ] } \ No newline at end of file diff --git a/samples/snippets/README.md b/samples/snippets/README.md new file mode 100644 index 00000000..f2bb8290 --- /dev/null +++ b/samples/snippets/README.md @@ -0,0 +1,54 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." + +## Python Samples for Google Cloud Key Management Service + +This directory contains samples for Google Cloud Key Management Service, which may be used as a refererence for how to use Google Cloud Key Management Service. +The Google Cloud KMS API is a service that allows you to keep encryption keys centrally in the cloud, for direct use by cloud services. More info about Cloud KMS can be found at https://cloud.google.com/kms/docs/ +Samples, quickstarts, and other documentation are available at cloud.google.com. + + +### Quickstart + +This quickstart shows you how to create and use encryption keys with Cloud Key Management Service. + + +Open in Cloud Shell + + +To run this sample: + +1. If this is your first time working with GCP products, you will need to set up [the Cloud SDK][cloud_sdk] or utilize [Google Cloud Shell][gcloud_shell]. This sample may [require authetication][authentication] and you will need to [enable billing][enable_billing]. + +1. Make a fork of this repo and clone the branch locally, then navigate to the sample directory you want to use. + +1. Install the dependencies needed to run the samples. + + pip install -r requirements.txt + +1. Run the sample using + + python quickstart.py + + +More information about the Cloud KMS quickstart is available at https://cloud.google.com/kms/docs/quickstart + +## Additional Information + +These samples use the [Google Cloud Client Library for Python][client_library_python]. +You can read the documentation for more details on API usage and use GitHub +to [browse the source][source] and [report issues][issues]. + +### Contributing +For [contributing guidelines][contrib_guide], the [Python style guide][py_style], and more information on prerequisite steps to contribute, view the source code at googleapis/python-kms. + +[authentication]: https://cloud.google.com/docs/authentication/getting-started +[enable_billing]:https://cloud.google.com/apis/docs/getting-started#enabling_billing +[client_library_python]: https://googlecloudplatform.github.io/google-cloud-python/ +[source]: https://github.com/GoogleCloudPlatform/google-cloud-python +[issues]: https://github.com/GoogleCloudPlatform/google-cloud-python/issues +[contrib_guide]: https://github.com/googleapis/google-cloud-python/blob/master/CONTRIBUTING.rst +[py_style]: http://google.github.io/styleguide/pyguide.html +[cloud_sdk]: https://cloud.google.com/sdk/docs +[gcloud_shell]: https://cloud.google.com/shell/docs +[gcloud_shell]: https://cloud.google.com/shell/docs diff --git a/samples/snippets/README.rst b/samples/snippets/README.rst deleted file mode 100644 index 7a52a081..00000000 --- a/samples/snippets/README.rst +++ /dev/null @@ -1,98 +0,0 @@ - -.. This file is automatically generated. Do not edit this file directly. - -Google Cloud KMS API 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=kms/api-client/README.rst - - -This directory contains samples for Google Cloud KMS API. The `Google Cloud KMS API`_ is a service that allows you to keep encryption keys centrally in the cloud, for direct use by cloud services. - - - - -.. _Google Cloud KMS API: https://cloud.google.com/kms/docs/ - - -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 3.6+. - - .. 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=kms/api-client/quickstart.py,kms/api-client/README.rst - - - - -To run this sample: - -.. code-block:: bash - - $ python quickstart.py - - - - - - - - -.. _Google Cloud SDK: https://cloud.google.com/sdk/ diff --git a/samples/snippets/README.rst.in b/samples/snippets/README.rst.in deleted file mode 100644 index cfd81fc8..00000000 --- a/samples/snippets/README.rst.in +++ /dev/null @@ -1,19 +0,0 @@ -# This file is used to generate README.rst - -product: - name: Google Cloud KMS API - short_name: Cloud KMS API - url: https://cloud.google.com/kms/docs/ - description: > - The `Google Cloud KMS API`_ is a service that allows you to keep encryption - keys centrally in the cloud, for direct use by cloud services. - -setup: -- auth -- install_deps - -samples: -- name: Quickstart - file: quickstart.py - -folder: kms/api-client diff --git a/synth.py b/synth.py index 7dbde9b4..6f66bc6c 100644 --- a/synth.py +++ b/synth.py @@ -97,6 +97,7 @@ # Samples templates # ---------------------------------------------------------------------------- -python.py_samples() +sample_files = common.py_samples(unit_cov_level=97, cov_level=99, samples=True) +s.move(sample_files, excludes=['noxfile.py']) s.shell.run(["nox", "-s", "blacken"], hide_output=False) From adc3f70bd65db63d40941e12a3565f732afee36a Mon Sep 17 00:00:00 2001 From: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com> Date: Mon, 24 Aug 2020 07:28:57 -0700 Subject: [PATCH 2/4] test: add system test back (#38) --- tests/system/test_system.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/system/test_system.py diff --git a/tests/system/test_system.py b/tests/system/test_system.py new file mode 100644 index 00000000..fd0789fe --- /dev/null +++ b/tests/system/test_system.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +from google.cloud import kms_v1 + + +class TestKeyManagementServiceClient(object): + def test_list_global_key_rings(self): + project_id = os.environ["PROJECT_ID"] + + client = kms_v1.KeyManagementServiceClient() + parent = f"projects/{project_id}/locations/global" + client.list_key_rings(request={"parent": parent}) From fc5a720d93ba41cd2616c7c9c8012d9a3e8f4a9c Mon Sep 17 00:00:00 2001 From: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com> Date: Mon, 24 Aug 2020 10:54:55 -0700 Subject: [PATCH 3/4] fix: add system test back (#39) --- tests/system/test_system.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/system/test_system.py b/tests/system/test_system.py index fd0789fe..273e075c 100644 --- a/tests/system/test_system.py +++ b/tests/system/test_system.py @@ -23,6 +23,7 @@ class TestKeyManagementServiceClient(object): def test_list_global_key_rings(self): project_id = os.environ["PROJECT_ID"] + # List key rings from the global location. client = kms_v1.KeyManagementServiceClient() parent = f"projects/{project_id}/locations/global" client.list_key_rings(request={"parent": parent}) From 9edcc9abceb6f790f4d1968aef3ba61903e30824 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2020 12:36:14 -0600 Subject: [PATCH 4/4] chore: release 2.0.1 (#36) --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e442029..01482403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ [1]: https://pypi.org/project/google-cloud-kms/#history +### [2.0.1](https://www.github.com/googleapis/python-kms/compare/v2.0.0...v2.0.1) (2020-08-24) + + +### Bug Fixes + +* add system test back ([#39](https://www.github.com/googleapis/python-kms/issues/39)) ([fc5a720](https://www.github.com/googleapis/python-kms/commit/fc5a720d93ba41cd2616c7c9c8012d9a3e8f4a9c)) + + +### Documentation + +* Generate using new common.py_samples() synthtool functionality ([#35](https://www.github.com/googleapis/python-kms/issues/35)) ([90097bc](https://www.github.com/googleapis/python-kms/commit/90097bca7660f148f36e009f70d108404efa5308)) + ## [2.0.0](https://www.github.com/googleapis/python-kms/compare/v1.4.0...v2.0.0) (2020-07-30) diff --git a/setup.py b/setup.py index ea47bf3a..fcfd3689 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "google-cloud-kms" description = "Cloud Key Management Service (KMS) API client library" -version = "2.0.0" +version = "2.0.1" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ "google-api-core[grpc] >= 1.22.0, < 2.0.0dev",