diff --git a/packages/google-cloud-os-login/.flake8 b/packages/google-cloud-os-login/.flake8 index 20fe9bda2ee4..ed9316381c9c 100644 --- a/packages/google-cloud-os-login/.flake8 +++ b/packages/google-cloud-os-login/.flake8 @@ -21,6 +21,8 @@ exclude = # Exclude generated code. **/proto/** **/gapic/** + **/services/** + **/types/** *_pb2.py # Standard linting exemptions. diff --git a/packages/google-cloud-os-login/.gitignore b/packages/google-cloud-os-login/.gitignore index 3fb06e09ce74..b87e1ed580d9 100644 --- a/packages/google-cloud-os-login/.gitignore +++ b/packages/google-cloud-os-login/.gitignore @@ -10,6 +10,7 @@ dist build eggs +.eggs parts bin var @@ -49,6 +50,7 @@ bigquery/docs/generated # Virtual environment env/ coverage.xml +sponge_log.xml # System test environment variables. system_tests/local_test_setup diff --git a/packages/google-cloud-os-login/.kokoro/publish-docs.sh b/packages/google-cloud-os-login/.kokoro/publish-docs.sh index 55e9821c907e..7a8b82b2524d 100755 --- a/packages/google-cloud-os-login/.kokoro/publish-docs.sh +++ b/packages/google-cloud-os-login/.kokoro/publish-docs.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -eo pipefail # Disable buffering, so that the logs stream through. diff --git a/packages/google-cloud-os-login/.kokoro/release.sh b/packages/google-cloud-os-login/.kokoro/release.sh index 5edf8656059c..5411a9d13ec3 100755 --- a/packages/google-cloud-os-login/.kokoro/release.sh +++ b/packages/google-cloud-os-login/.kokoro/release.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -eo pipefail # Start the releasetool reporter diff --git a/packages/google-cloud-os-login/.kokoro/samples/lint/common.cfg b/packages/google-cloud-os-login/.kokoro/samples/lint/common.cfg new file mode 100644 index 000000000000..1aa1c33d04eb --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/lint/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "lint" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-oslogin/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-oslogin/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/lint/continuous.cfg b/packages/google-cloud-os-login/.kokoro/samples/lint/continuous.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/lint/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/lint/periodic.cfg b/packages/google-cloud-os-login/.kokoro/samples/lint/periodic.cfg new file mode 100644 index 000000000000..50fec9649732 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/lint/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/lint/presubmit.cfg b/packages/google-cloud-os-login/.kokoro/samples/lint/presubmit.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/lint/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.6/common.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.6/common.cfg new file mode 100644 index 000000000000..c647069053f8 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.6/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.6" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-oslogin/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-oslogin/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.6/continuous.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.6/continuous.cfg new file mode 100644 index 000000000000..7218af1499e5 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.6/continuous.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.6/periodic.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.6/periodic.cfg new file mode 100644 index 000000000000..50fec9649732 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.6/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.6/presubmit.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.6/presubmit.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.6/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.7/common.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.7/common.cfg new file mode 100644 index 000000000000..7de55cd6cf5a --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.7/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.7" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-oslogin/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-oslogin/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.7/continuous.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.7/continuous.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.7/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.7/periodic.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.7/periodic.cfg new file mode 100644 index 000000000000..50fec9649732 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.7/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.7/presubmit.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.7/presubmit.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.7/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.8/common.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.8/common.cfg new file mode 100644 index 000000000000..ef192852ab18 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.8/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-oslogin/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-oslogin/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.8/continuous.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.8/continuous.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.8/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.8/periodic.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.8/periodic.cfg new file mode 100644 index 000000000000..50fec9649732 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.8/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/samples/python3.8/presubmit.cfg b/packages/google-cloud-os-login/.kokoro/samples/python3.8/presubmit.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/samples/python3.8/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-os-login/.kokoro/test-samples.sh b/packages/google-cloud-os-login/.kokoro/test-samples.sh new file mode 100755 index 000000000000..1d809253d1eb --- /dev/null +++ b/packages/google-cloud-os-login/.kokoro/test-samples.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright 2020 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. + + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +cd github/python-oslogin + +# Run periodic samples tests at latest release +if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + LATEST_RELEASE=$(git describe --abbrev=0 --tags) + git checkout $LATEST_RELEASE +fi + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Debug: show build environment +env | grep KOKORO + +# Install nox +python3.6 -m pip install --upgrade --quiet nox + +# Use secrets acessor service account to get secrets +if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then + gcloud auth activate-service-account \ + --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ + --project="cloud-devrel-kokoro-resources" +fi + +# This script will create 3 files: +# - testing/test-env.sh +# - testing/service-account.json +# - testing/client-secrets.json +./scripts/decrypt-secrets.sh + +source ./testing/test-env.sh +export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json + +# For cloud-run session, we activate the service account for gcloud sdk. +gcloud auth activate-service-account \ + --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" + +export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json + +echo -e "\n******************** TESTING PROJECTS ********************" + +# Switch to 'fail at end' to allow all tests to complete before exiting. +set +e +# Use RTN to return a non-zero value if the test fails. +RTN=0 +ROOT=$(pwd) +# Find all requirements.txt in the samples directory (may break on whitespace). +for file in samples/**/requirements.txt; do + cd "$ROOT" + # Navigate to the project folder. + file=$(dirname "$file") + cd "$file" + + echo "------------------------------------------------------------" + echo "- testing $file" + echo "------------------------------------------------------------" + + # Use nox to execute the tests for the project. + python3.6 -m nox -s "$RUN_TESTS_SESSION" + EXIT=$? + + # If this is a periodic build, send the test log to the Build Cop Bot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop + $KOKORO_GFILE_DIR/linux_amd64/buildcop + fi + + if [[ $EXIT -ne 0 ]]; then + RTN=1 + echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" + else + echo -e "\n Testing completed.\n" + fi + +done +cd "$ROOT" + +# Workaround for Kokoro permissions issue: delete secrets +rm testing/{test-env.sh,client-secrets.json,service-account.json} + +exit "$RTN" \ No newline at end of file diff --git a/packages/google-cloud-os-login/MANIFEST.in b/packages/google-cloud-os-login/MANIFEST.in index 68855abc3f02..e9e29d12033d 100644 --- a/packages/google-cloud-os-login/MANIFEST.in +++ b/packages/google-cloud-os-login/MANIFEST.in @@ -20,3 +20,6 @@ recursive-include google *.json *.proto recursive-include tests * global-exclude *.py[co] global-exclude __pycache__ + +# Exclude scripts for samples readmegen +prune scripts/readme-gen \ No newline at end of file diff --git a/packages/google-cloud-os-login/docs/conf.py b/packages/google-cloud-os-login/docs/conf.py index ffacb6ee9fe2..f82a1562e07c 100644 --- a/packages/google-cloud-os-login/docs/conf.py +++ b/packages/google-cloud-os-login/docs/conf.py @@ -38,21 +38,18 @@ "sphinx.ext.napoleon", "sphinx.ext.todo", "sphinx.ext.viewcode", + "recommonmark", ] # autodoc/autosummary flags autoclass_content = "both" -autodoc_default_flags = ["members"] +autodoc_default_options = {"members": True} autosummary_generate = True # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] @@ -340,7 +337,7 @@ intersphinx_mapping = { "python": ("http://python.readthedocs.org/en/latest/", None), "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), "grpc": ("https://grpc.io/grpc/python/", None), } diff --git a/packages/google-cloud-os-login/docs/index.rst b/packages/google-cloud-os-login/docs/index.rst index 051c6ec77fc0..719f4f9f0092 100644 --- a/packages/google-cloud-os-login/docs/index.rst +++ b/packages/google-cloud-os-login/docs/index.rst @@ -1,5 +1,7 @@ .. include:: README.rst +.. include:: multiprocessing.rst + Api Reference ------------- .. toctree:: diff --git a/packages/google-cloud-os-login/docs/multiprocessing.rst b/packages/google-cloud-os-login/docs/multiprocessing.rst new file mode 100644 index 000000000000..1cb29d4ca967 --- /dev/null +++ b/packages/google-cloud-os-login/docs/multiprocessing.rst @@ -0,0 +1,7 @@ +.. note:: + + Because this client uses :mod:`grpcio` library, it is safe to + share instances across threads. In multiprocessing scenarios, the best + practice is to create client instances *after* the invocation of + :func:`os.fork` by :class:`multiprocessing.Pool` or + :class:`multiprocessing.Process`. diff --git a/packages/google-cloud-os-login/google/cloud/oslogin.py b/packages/google-cloud-os-login/google/cloud/oslogin.py index 8e9daac48e16..022d27d3f90d 100644 --- a/packages/google-cloud-os-login/google/cloud/oslogin.py +++ b/packages/google-cloud-os-login/google/cloud/oslogin.py @@ -22,4 +22,8 @@ from google.cloud.oslogin_v1 import types -__all__ = ("enums", "types", "OsLoginServiceClient") +__all__ = ( + "enums", + "types", + "OsLoginServiceClient", +) diff --git a/packages/google-cloud-os-login/google/cloud/oslogin_v1/__init__.py b/packages/google-cloud-os-login/google/cloud/oslogin_v1/__init__.py index 24017b9784ca..08f98e4b6b8f 100644 --- a/packages/google-cloud-os-login/google/cloud/oslogin_v1/__init__.py +++ b/packages/google-cloud-os-login/google/cloud/oslogin_v1/__init__.py @@ -26,8 +26,8 @@ if sys.version_info[:2] == (2, 7): message = ( - "A future version of this library will drop support for Python 2.7." - "More details about Python 2 support for Google Cloud Client Libraries" + "A future version of this library will drop support for Python 2.7. " + "More details about Python 2 support for Google Cloud Client Libraries " "can be found at https://cloud.google.com/python/docs/python2-sunset/" ) warnings.warn(message, DeprecationWarning) @@ -38,4 +38,8 @@ class OsLoginServiceClient(os_login_service_client.OsLoginServiceClient): enums = enums -__all__ = ("enums", "types", "OsLoginServiceClient") +__all__ = ( + "enums", + "types", + "OsLoginServiceClient", +) diff --git a/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/os_login_service_client.py b/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/os_login_service_client.py index e4abdbd8acec..2f8e11efba14 100644 --- a/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/os_login_service_client.py +++ b/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/os_login_service_client.py @@ -39,7 +39,9 @@ from google.protobuf import field_mask_pb2 -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-os-login").version +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( + "google-cloud-os-login", +).version class OsLoginServiceClient(object): @@ -81,7 +83,7 @@ def from_service_account_file(cls, filename, *args, **kwargs): def posix_account_path(cls, user, project): """Return a fully-qualified posix_account string.""" return google.api_core.path_template.expand( - "users/{user}/projects/{project}", user=user, project=project + "users/{user}/projects/{project}", user=user, project=project, ) @classmethod @@ -96,7 +98,7 @@ def ssh_public_key_path(cls, user, fingerprint): @classmethod def user_path(cls, user): """Return a fully-qualified user string.""" - return google.api_core.path_template.expand("users/{user}", user=user) + return google.api_core.path_template.expand("users/{user}", user=user,) def __init__( self, @@ -185,12 +187,12 @@ def __init__( self.transport = transport else: self.transport = os_login_service_grpc_transport.OsLoginServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + address=api_endpoint, channel=channel, credentials=credentials, ) if client_info is None: client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION + gapic_version=_GAPIC_LIBRARY_VERSION, ) else: client_info.gapic_version = _GAPIC_LIBRARY_VERSION @@ -201,7 +203,7 @@ def __init__( # (Ordinarily, these are the defaults specified in the `*_config.py` # file next to this one.) self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] + client_config["interfaces"][self._INTERFACE_NAME], ) # Save a dictionary of cached API call functions. @@ -231,9 +233,9 @@ def delete_posix_account( >>> client.delete_posix_account(name) Args: - name (str): Required. A reference to the POSIX account to update. POSIX accounts are - identified by the project ID they are associated with. A reference to - the POSIX account is in format ``users/{user}/projects/{project}``. + name (str): Required. A reference to the POSIX account to update. POSIX accounts + are identified by the project ID they are associated with. A reference + to the POSIX account is in format ``users/{user}/projects/{project}``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will be retried using a default configuration. @@ -261,7 +263,7 @@ def delete_posix_account( client_info=self._client_info, ) - request = oslogin_pb2.DeletePosixAccountRequest(name=name) + request = oslogin_pb2.DeletePosixAccountRequest(name=name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -299,9 +301,9 @@ def delete_ssh_public_key( >>> client.delete_ssh_public_key(name) Args: - name (str): Required. The fingerprint of the public key to update. Public keys are - identified by their SHA-256 fingerprint. The fingerprint of the public - key is in format ``users/{user}/sshPublicKeys/{fingerprint}``. + name (str): Required. The fingerprint of the public key to update. Public keys + are identified by their SHA-256 fingerprint. The fingerprint of the + public key is in format ``users/{user}/sshPublicKeys/{fingerprint}``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will be retried using a default configuration. @@ -329,7 +331,7 @@ def delete_ssh_public_key( client_info=self._client_info, ) - request = oslogin_pb2.DeleteSshPublicKeyRequest(name=name) + request = oslogin_pb2.DeleteSshPublicKeyRequest(name=name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -404,7 +406,7 @@ def get_login_profile( ) request = oslogin_pb2.GetLoginProfileRequest( - name=name, project_id=project_id, system_id=system_id + name=name, project_id=project_id, system_id=system_id, ) if metadata is None: metadata = [] @@ -443,9 +445,9 @@ def get_ssh_public_key( >>> response = client.get_ssh_public_key(name) Args: - name (str): Required. The fingerprint of the public key to retrieve. Public keys are - identified by their SHA-256 fingerprint. The fingerprint of the public - key is in format ``users/{user}/sshPublicKeys/{fingerprint}``. + name (str): Required. The fingerprint of the public key to retrieve. Public keys + are identified by their SHA-256 fingerprint. The fingerprint of the + public key is in format ``users/{user}/sshPublicKeys/{fingerprint}``. retry (Optional[google.api_core.retry.Retry]): A retry object used to retry requests. If ``None`` is specified, requests will be retried using a default configuration. @@ -476,7 +478,7 @@ def get_ssh_public_key( client_info=self._client_info, ) - request = oslogin_pb2.GetSshPublicKeyRequest(name=name) + request = oslogin_pb2.GetSshPublicKeyRequest(name=name,) if metadata is None: metadata = [] metadata = list(metadata) @@ -555,7 +557,7 @@ def import_ssh_public_key( ) request = oslogin_pb2.ImportSshPublicKeyRequest( - parent=parent, ssh_public_key=ssh_public_key, project_id=project_id + parent=parent, ssh_public_key=ssh_public_key, project_id=project_id, ) if metadata is None: metadata = [] @@ -600,9 +602,9 @@ def update_ssh_public_key( >>> response = client.update_ssh_public_key(name, ssh_public_key) Args: - name (str): Required. The fingerprint of the public key to update. Public keys are - identified by their SHA-256 fingerprint. The fingerprint of the public - key is in format ``users/{user}/sshPublicKeys/{fingerprint}``. + name (str): Required. The fingerprint of the public key to update. Public keys + are identified by their SHA-256 fingerprint. The fingerprint of the + public key is in format ``users/{user}/sshPublicKeys/{fingerprint}``. ssh_public_key (Union[dict, ~google.cloud.oslogin_v1.types.SshPublicKey]): Required. The SSH public key and expiration time. If a dict is provided, it must be of the same form as the protobuf @@ -642,7 +644,7 @@ def update_ssh_public_key( ) request = oslogin_pb2.UpdateSshPublicKeyRequest( - name=name, ssh_public_key=ssh_public_key, update_mask=update_mask + name=name, ssh_public_key=ssh_public_key, update_mask=update_mask, ) if metadata is None: metadata = [] diff --git a/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/os_login_service_client_config.py b/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/os_login_service_client_config.py index 6d64718728d7..cc3bb692e009 100644 --- a/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/os_login_service_client_config.py +++ b/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/os_login_service_client_config.py @@ -2,50 +2,59 @@ "interfaces": { "google.cloud.oslogin.v1.OsLoginService": { "retry_codes": { - "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "non_idempotent": [], + "retry_policy_1_codes": ["UNAVAILABLE", "DEADLINE_EXCEEDED"], + "no_retry_codes": [], }, "retry_params": { - "default": { + "retry_policy_1_params": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 20000, + "initial_rpc_timeout_millis": 10000, "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 20000, - "total_timeout_millis": 600000, - } + "max_rpc_timeout_millis": 10000, + "total_timeout_millis": 10000, + }, + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0, + }, }, "methods": { "DeletePosixAccount": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "DeleteSshPublicKey": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "GetLoginProfile": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "GetSshPublicKey": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "ImportSshPublicKey": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "UpdateSshPublicKey": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 10000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, }, } diff --git a/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/transports/os_login_service_grpc_transport.py b/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/transports/os_login_service_grpc_transport.py index ff1db19048e2..1ee7295d9f9a 100644 --- a/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/transports/os_login_service_grpc_transport.py +++ b/packages/google-cloud-os-login/google/cloud/oslogin_v1/gapic/transports/os_login_service_grpc_transport.py @@ -56,7 +56,7 @@ def __init__( # exception (channels come with credentials baked in already). if channel is not None and credentials is not None: raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." + "The `channel` and `credentials` arguments are mutually " "exclusive.", ) # Create the channel. @@ -75,7 +75,7 @@ def __init__( # gRPC uses objects called "stubs" that are bound to the # channel and provide a basic method for each RPC. self._stubs = { - "os_login_service_stub": oslogin_pb2_grpc.OsLoginServiceStub(channel) + "os_login_service_stub": oslogin_pb2_grpc.OsLoginServiceStub(channel), } @classmethod diff --git a/packages/google-cloud-os-login/google/cloud/oslogin_v1/proto/common_pb2.py b/packages/google-cloud-os-login/google/cloud/oslogin_v1/proto/common_pb2.py index 43971f9d5ccb..cfc12d195f17 100644 --- a/packages/google-cloud-os-login/google/cloud/oslogin_v1/proto/common_pb2.py +++ b/packages/google-cloud-os-login/google/cloud/oslogin_v1/proto/common_pb2.py @@ -2,9 +2,6 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/oslogin/common/common.proto -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message @@ -24,12 +21,9 @@ name="google/cloud/oslogin/common/common.proto", package="google.cloud.oslogin.common", syntax="proto3", - serialized_options=_b( - "\n\037com.google.cloud.oslogin.commonB\014OsLoginProtoZAgoogle.golang.org/genproto/googleapis/cloud/oslogin/common;common\252\002\033Google.Cloud.OsLogin.Common\312\002\033Google\\Cloud\\OsLogin\\Common\352\002\036Google::Cloud::OsLogin::Common\352A+\n\033oslogin.googleapis.com/User\022\014users/{user}" - ), - serialized_pb=_b( - '\n(google/cloud/oslogin/common/common.proto\x12\x1bgoogle.cloud.oslogin.common\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto"\xdc\x02\n\x0cPosixAccount\x12\x0f\n\x07primary\x18\x01 \x01(\x08\x12\x10\n\x08username\x18\x02 \x01(\t\x12\x0b\n\x03uid\x18\x03 \x01(\x03\x12\x0b\n\x03gid\x18\x04 \x01(\x03\x12\x16\n\x0ehome_directory\x18\x05 \x01(\t\x12\r\n\x05shell\x18\x06 \x01(\t\x12\r\n\x05gecos\x18\x07 \x01(\t\x12\x11\n\tsystem_id\x18\x08 \x01(\t\x12\x17\n\naccount_id\x18\t \x01(\tB\x03\xe0\x41\x03\x12O\n\x15operating_system_type\x18\n \x01(\x0e\x32\x30.google.cloud.oslogin.common.OperatingSystemType\x12\x11\n\x04name\x18\x0b \x01(\tB\x03\xe0\x41\x03:I\xea\x41\x46\n#oslogin.googleapis.com/PosixAccount\x12\x1fusers/{user}/projects/{project}"\xba\x01\n\x0cSshPublicKey\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x14\x65xpiration_time_usec\x18\x02 \x01(\x03\x12\x18\n\x0b\x66ingerprint\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12\x11\n\x04name\x18\x04 \x01(\tB\x03\xe0\x41\x03:R\xea\x41O\n#oslogin.googleapis.com/SshPublicKey\x12(users/{user}/sshPublicKeys/{fingerprint}*T\n\x13OperatingSystemType\x12%\n!OPERATING_SYSTEM_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05LINUX\x10\x01\x12\x0b\n\x07WINDOWS\x10\x02\x42\xfd\x01\n\x1f\x63om.google.cloud.oslogin.commonB\x0cOsLoginProtoZAgoogle.golang.org/genproto/googleapis/cloud/oslogin/common;common\xaa\x02\x1bGoogle.Cloud.OsLogin.Common\xca\x02\x1bGoogle\\Cloud\\OsLogin\\Common\xea\x02\x1eGoogle::Cloud::OsLogin::Common\xea\x41+\n\x1boslogin.googleapis.com/User\x12\x0cusers/{user}b\x06proto3' - ), + serialized_options=b"\n\037com.google.cloud.oslogin.commonB\014OsLoginProtoZAgoogle.golang.org/genproto/googleapis/cloud/oslogin/common;common\252\002\033Google.Cloud.OsLogin.Common\312\002\033Google\\Cloud\\OsLogin\\Common\352\002\036Google::Cloud::OsLogin::Common\352A+\n\033oslogin.googleapis.com/User\022\014users/{user}", + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n(google/cloud/oslogin/common/common.proto\x12\x1bgoogle.cloud.oslogin.common\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto"\xdc\x02\n\x0cPosixAccount\x12\x0f\n\x07primary\x18\x01 \x01(\x08\x12\x10\n\x08username\x18\x02 \x01(\t\x12\x0b\n\x03uid\x18\x03 \x01(\x03\x12\x0b\n\x03gid\x18\x04 \x01(\x03\x12\x16\n\x0ehome_directory\x18\x05 \x01(\t\x12\r\n\x05shell\x18\x06 \x01(\t\x12\r\n\x05gecos\x18\x07 \x01(\t\x12\x11\n\tsystem_id\x18\x08 \x01(\t\x12\x17\n\naccount_id\x18\t \x01(\tB\x03\xe0\x41\x03\x12O\n\x15operating_system_type\x18\n \x01(\x0e\x32\x30.google.cloud.oslogin.common.OperatingSystemType\x12\x11\n\x04name\x18\x0b \x01(\tB\x03\xe0\x41\x03:I\xea\x41\x46\n#oslogin.googleapis.com/PosixAccount\x12\x1fusers/{user}/projects/{project}"\xba\x01\n\x0cSshPublicKey\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x14\x65xpiration_time_usec\x18\x02 \x01(\x03\x12\x18\n\x0b\x66ingerprint\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12\x11\n\x04name\x18\x04 \x01(\tB\x03\xe0\x41\x03:R\xea\x41O\n#oslogin.googleapis.com/SshPublicKey\x12(users/{user}/sshPublicKeys/{fingerprint}*T\n\x13OperatingSystemType\x12%\n!OPERATING_SYSTEM_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05LINUX\x10\x01\x12\x0b\n\x07WINDOWS\x10\x02\x42\xfd\x01\n\x1f\x63om.google.cloud.oslogin.commonB\x0cOsLoginProtoZAgoogle.golang.org/genproto/googleapis/cloud/oslogin/common;common\xaa\x02\x1bGoogle.Cloud.OsLogin.Common\xca\x02\x1bGoogle\\Cloud\\OsLogin\\Common\xea\x02\x1eGoogle::Cloud::OsLogin::Common\xea\x41+\n\x1boslogin.googleapis.com/User\x12\x0cusers/{user}b\x06proto3', dependencies=[ google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, google_dot_api_dot_resource__pb2.DESCRIPTOR, @@ -41,6 +35,7 @@ full_name="google.cloud.oslogin.common.OperatingSystemType", filename=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( name="OPERATING_SYSTEM_TYPE_UNSPECIFIED", @@ -48,12 +43,23 @@ number=0, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="LINUX", index=1, number=1, serialized_options=None, type=None + name="LINUX", + index=1, + number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="WINDOWS", index=2, number=2, serialized_options=None, type=None + name="WINDOWS", + index=2, + number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), ], containing_type=None, @@ -75,6 +81,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="primary", @@ -93,6 +100,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="username", @@ -103,7 +111,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -111,6 +119,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="uid", @@ -129,6 +138,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="gid", @@ -147,6 +157,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="home_directory", @@ -157,7 +168,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -165,6 +176,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="shell", @@ -175,7 +187,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -183,6 +195,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="gecos", @@ -193,7 +206,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -201,6 +214,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="system_id", @@ -211,7 +225,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -219,6 +233,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="account_id", @@ -229,14 +244,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\003"), + serialized_options=b"\340A\003", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="operating_system_type", @@ -255,6 +271,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="name", @@ -265,22 +282,21 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\003"), + serialized_options=b"\340A\003", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b( - "\352AF\n#oslogin.googleapis.com/PosixAccount\022\037users/{user}/projects/{project}" - ), + serialized_options=b"\352AF\n#oslogin.googleapis.com/PosixAccount\022\037users/{user}/projects/{project}", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -296,6 +312,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="key", @@ -306,7 +323,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -314,6 +331,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="expiration_time_usec", @@ -332,6 +350,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="fingerprint", @@ -342,14 +361,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\003"), + serialized_options=b"\340A\003", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="name", @@ -360,22 +380,21 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\003"), + serialized_options=b"\340A\003", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b( - "\352AO\n#oslogin.googleapis.com/SshPublicKey\022(users/{user}/sshPublicKeys/{fingerprint}" - ), + serialized_options=b"\352AO\n#oslogin.googleapis.com/SshPublicKey\022(users/{user}/sshPublicKeys/{fingerprint}", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -393,10 +412,11 @@ PosixAccount = _reflection.GeneratedProtocolMessageType( "PosixAccount", (_message.Message,), - dict( - DESCRIPTOR=_POSIXACCOUNT, - __module__="google.cloud.oslogin.common.common_pb2", - __doc__="""The POSIX account information associated with a Google account. + { + "DESCRIPTOR": _POSIXACCOUNT, + "__module__": "google.cloud.oslogin.common.common_pb2", + "__doc__": """The POSIX account information associated with a Google account. + Attributes: primary: Only one POSIX account can be marked as primary. @@ -423,17 +443,18 @@ Output only. The canonical resource name. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.common.PosixAccount) - ), + }, ) _sym_db.RegisterMessage(PosixAccount) SshPublicKey = _reflection.GeneratedProtocolMessageType( "SshPublicKey", (_message.Message,), - dict( - DESCRIPTOR=_SSHPUBLICKEY, - __module__="google.cloud.oslogin.common.common_pb2", - __doc__="""The SSH public key information associated with a Google account. + { + "DESCRIPTOR": _SSHPUBLICKEY, + "__module__": "google.cloud.oslogin.common.common_pb2", + "__doc__": """The SSH public key information associated with a Google account. + Attributes: key: Public key text in SSH format, defined by RFC4253 section 6.6. @@ -445,7 +466,7 @@ Output only. The canonical resource name. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.common.SshPublicKey) - ), + }, ) _sym_db.RegisterMessage(SshPublicKey) diff --git a/packages/google-cloud-os-login/google/cloud/oslogin_v1/proto/oslogin_pb2.py b/packages/google-cloud-os-login/google/cloud/oslogin_v1/proto/oslogin_pb2.py index fc0be177dece..845a4229cabc 100644 --- a/packages/google-cloud-os-login/google/cloud/oslogin_v1/proto/oslogin_pb2.py +++ b/packages/google-cloud-os-login/google/cloud/oslogin_v1/proto/oslogin_pb2.py @@ -2,9 +2,6 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/oslogin_v1/proto/oslogin.proto -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -30,12 +27,9 @@ name="google/cloud/oslogin_v1/proto/oslogin.proto", package="google.cloud.oslogin.v1", syntax="proto3", - serialized_options=_b( - "\n\033com.google.cloud.oslogin.v1B\014OsLoginProtoP\001Z>google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin\252\002\027Google.Cloud.OsLogin.V1\312\002\027Google\\Cloud\\OsLogin\\V1\352\002\032Google::Cloud::OsLogin::V1" - ), - serialized_pb=_b( - '\n+google/cloud/oslogin_v1/proto/oslogin.proto\x12\x17google.cloud.oslogin.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a(google/cloud/oslogin/common/common.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\x98\x02\n\x0cLoginProfile\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x41\n\x0eposix_accounts\x18\x02 \x03(\x0b\x32).google.cloud.oslogin.common.PosixAccount\x12Q\n\x0fssh_public_keys\x18\x03 \x03(\x0b\x32\x38.google.cloud.oslogin.v1.LoginProfile.SshPublicKeysEntry\x1a_\n\x12SshPublicKeysEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).google.cloud.oslogin.common.SshPublicKey:\x02\x38\x01"V\n\x19\x44\x65letePosixAccountRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#oslogin.googleapis.com/PosixAccount"V\n\x19\x44\x65leteSshPublicKeyRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#oslogin.googleapis.com/SshPublicKey"z\n\x16GetLoginProfileRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\x12#oslogin.googleapis.com/PosixAccount\x12\x12\n\nproject_id\x18\x02 \x01(\t\x12\x11\n\tsystem_id\x18\x03 \x01(\t"S\n\x16GetSshPublicKeyRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#oslogin.googleapis.com/SshPublicKey"\xb4\x01\n\x19ImportSshPublicKeyRequest\x12;\n\x06parent\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\x12#oslogin.googleapis.com/SshPublicKey\x12\x46\n\x0essh_public_key\x18\x02 \x01(\x0b\x32).google.cloud.oslogin.common.SshPublicKeyB\x03\xe0\x41\x01\x12\x12\n\nproject_id\x18\x03 \x01(\t"Z\n\x1aImportSshPublicKeyResponse\x12<\n\rlogin_profile\x18\x01 \x01(\x0b\x32%.google.cloud.oslogin.v1.LoginProfile"\xcf\x01\n\x19UpdateSshPublicKeyRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#oslogin.googleapis.com/SshPublicKey\x12\x46\n\x0essh_public_key\x18\x02 \x01(\x0b\x32).google.cloud.oslogin.common.SshPublicKeyB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask2\xd0\t\n\x0eOsLoginService\x12\x8e\x01\n\x12\x44\x65letePosixAccount\x12\x32.google.cloud.oslogin.v1.DeletePosixAccountRequest\x1a\x16.google.protobuf.Empty",\x82\xd3\xe4\x93\x02\x1f*\x1d/v1/{name=users/*/projects/*}\xda\x41\x04name\x12\x93\x01\n\x12\x44\x65leteSshPublicKey\x12\x32.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest\x1a\x16.google.protobuf.Empty"1\x82\xd3\xe4\x93\x02$*"/v1/{name=users/*/sshPublicKeys/*}\xda\x41\x04name\x12\x99\x01\n\x0fGetLoginProfile\x12/.google.cloud.oslogin.v1.GetLoginProfileRequest\x1a%.google.cloud.oslogin.v1.LoginProfile".\x82\xd3\xe4\x93\x02!\x12\x1f/v1/{name=users/*}/loginProfile\xda\x41\x04name\x12\xa0\x01\n\x0fGetSshPublicKey\x12/.google.cloud.oslogin.v1.GetSshPublicKeyRequest\x1a).google.cloud.oslogin.common.SshPublicKey"1\x82\xd3\xe4\x93\x02$\x12"/v1/{name=users/*/sshPublicKeys/*}\xda\x41\x04name\x12\xf9\x01\n\x12ImportSshPublicKey\x12\x32.google.cloud.oslogin.v1.ImportSshPublicKeyRequest\x1a\x33.google.cloud.oslogin.v1.ImportSshPublicKeyResponse"z\x82\xd3\xe4\x93\x02\x39"\'/v1/{parent=users/*}:importSshPublicKey:\x0essh_public_key\xda\x41\x15parent,ssh_public_key\xda\x41 parent,ssh_public_key,project_id\x12\xe7\x01\n\x12UpdateSshPublicKey\x12\x32.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest\x1a).google.cloud.oslogin.common.SshPublicKey"r\x82\xd3\xe4\x93\x02\x34\x32"/v1/{name=users/*/sshPublicKeys/*}:\x0essh_public_key\xda\x41\x13name,ssh_public_key\xda\x41\x1fname,ssh_public_key,update_mask\x1ar\xca\x41\x16oslogin.googleapis.com\xd2\x41Vhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/computeB\xbe\x01\n\x1b\x63om.google.cloud.oslogin.v1B\x0cOsLoginProtoP\x01Z>google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin\xaa\x02\x17Google.Cloud.OsLogin.V1\xca\x02\x17Google\\Cloud\\OsLogin\\V1\xea\x02\x1aGoogle::Cloud::OsLogin::V1b\x06proto3' - ), + serialized_options=b"\n\033com.google.cloud.oslogin.v1B\014OsLoginProtoP\001Z>google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin\252\002\027Google.Cloud.OsLogin.V1\312\002\027Google\\Cloud\\OsLogin\\V1\352\002\032Google::Cloud::OsLogin::V1", + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n+google/cloud/oslogin_v1/proto/oslogin.proto\x12\x17google.cloud.oslogin.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a(google/cloud/oslogin/common/common.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\x98\x02\n\x0cLoginProfile\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x41\n\x0eposix_accounts\x18\x02 \x03(\x0b\x32).google.cloud.oslogin.common.PosixAccount\x12Q\n\x0fssh_public_keys\x18\x03 \x03(\x0b\x32\x38.google.cloud.oslogin.v1.LoginProfile.SshPublicKeysEntry\x1a_\n\x12SshPublicKeysEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).google.cloud.oslogin.common.SshPublicKey:\x02\x38\x01"V\n\x19\x44\x65letePosixAccountRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#oslogin.googleapis.com/PosixAccount"V\n\x19\x44\x65leteSshPublicKeyRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#oslogin.googleapis.com/SshPublicKey"z\n\x16GetLoginProfileRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\x12#oslogin.googleapis.com/PosixAccount\x12\x12\n\nproject_id\x18\x02 \x01(\t\x12\x11\n\tsystem_id\x18\x03 \x01(\t"S\n\x16GetSshPublicKeyRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#oslogin.googleapis.com/SshPublicKey"\xb4\x01\n\x19ImportSshPublicKeyRequest\x12;\n\x06parent\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\x12#oslogin.googleapis.com/SshPublicKey\x12\x46\n\x0essh_public_key\x18\x02 \x01(\x0b\x32).google.cloud.oslogin.common.SshPublicKeyB\x03\xe0\x41\x01\x12\x12\n\nproject_id\x18\x03 \x01(\t"Z\n\x1aImportSshPublicKeyResponse\x12<\n\rlogin_profile\x18\x01 \x01(\x0b\x32%.google.cloud.oslogin.v1.LoginProfile"\xcf\x01\n\x19UpdateSshPublicKeyRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#oslogin.googleapis.com/SshPublicKey\x12\x46\n\x0essh_public_key\x18\x02 \x01(\x0b\x32).google.cloud.oslogin.common.SshPublicKeyB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask2\xd0\t\n\x0eOsLoginService\x12\x8e\x01\n\x12\x44\x65letePosixAccount\x12\x32.google.cloud.oslogin.v1.DeletePosixAccountRequest\x1a\x16.google.protobuf.Empty",\x82\xd3\xe4\x93\x02\x1f*\x1d/v1/{name=users/*/projects/*}\xda\x41\x04name\x12\x93\x01\n\x12\x44\x65leteSshPublicKey\x12\x32.google.cloud.oslogin.v1.DeleteSshPublicKeyRequest\x1a\x16.google.protobuf.Empty"1\x82\xd3\xe4\x93\x02$*"/v1/{name=users/*/sshPublicKeys/*}\xda\x41\x04name\x12\x99\x01\n\x0fGetLoginProfile\x12/.google.cloud.oslogin.v1.GetLoginProfileRequest\x1a%.google.cloud.oslogin.v1.LoginProfile".\x82\xd3\xe4\x93\x02!\x12\x1f/v1/{name=users/*}/loginProfile\xda\x41\x04name\x12\xa0\x01\n\x0fGetSshPublicKey\x12/.google.cloud.oslogin.v1.GetSshPublicKeyRequest\x1a).google.cloud.oslogin.common.SshPublicKey"1\x82\xd3\xe4\x93\x02$\x12"/v1/{name=users/*/sshPublicKeys/*}\xda\x41\x04name\x12\xf9\x01\n\x12ImportSshPublicKey\x12\x32.google.cloud.oslogin.v1.ImportSshPublicKeyRequest\x1a\x33.google.cloud.oslogin.v1.ImportSshPublicKeyResponse"z\x82\xd3\xe4\x93\x02\x39"\'/v1/{parent=users/*}:importSshPublicKey:\x0essh_public_key\xda\x41\x15parent,ssh_public_key\xda\x41 parent,ssh_public_key,project_id\x12\xe7\x01\n\x12UpdateSshPublicKey\x12\x32.google.cloud.oslogin.v1.UpdateSshPublicKeyRequest\x1a).google.cloud.oslogin.common.SshPublicKey"r\x82\xd3\xe4\x93\x02\x34\x32"/v1/{name=users/*/sshPublicKeys/*}:\x0essh_public_key\xda\x41\x13name,ssh_public_key\xda\x41\x1fname,ssh_public_key,update_mask\x1ar\xca\x41\x16oslogin.googleapis.com\xd2\x41Vhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/computeB\xbe\x01\n\x1b\x63om.google.cloud.oslogin.v1B\x0cOsLoginProtoP\x01Z>google.golang.org/genproto/googleapis/cloud/oslogin/v1;oslogin\xaa\x02\x17Google.Cloud.OsLogin.V1\xca\x02\x17Google\\Cloud\\OsLogin\\V1\xea\x02\x1aGoogle::Cloud::OsLogin::V1b\x06proto3', dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, google_dot_api_dot_client__pb2.DESCRIPTOR, @@ -54,6 +48,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="key", @@ -64,7 +59,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -72,6 +67,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="value", @@ -90,12 +86,13 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -110,6 +107,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -120,14 +118,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="posix_accounts", @@ -146,6 +145,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ssh_public_keys", @@ -164,10 +164,11 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], - nested_types=[_LOGINPROFILE_SSHPUBLICKEYSENTRY], + nested_types=[_LOGINPROFILE_SSHPUBLICKEYSENTRY,], enum_types=[], serialized_options=None, is_extendable=False, @@ -185,6 +186,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -195,17 +197,16 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A%\n#oslogin.googleapis.com/PosixAccount" - ), + serialized_options=b"\340A\002\372A%\n#oslogin.googleapis.com/PosixAccount", file=DESCRIPTOR, - ) + create_key=_descriptor._internal_create_key, + ), ], extensions=[], nested_types=[], @@ -226,6 +227,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -236,17 +238,16 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A%\n#oslogin.googleapis.com/SshPublicKey" - ), + serialized_options=b"\340A\002\372A%\n#oslogin.googleapis.com/SshPublicKey", file=DESCRIPTOR, - ) + create_key=_descriptor._internal_create_key, + ), ], extensions=[], nested_types=[], @@ -267,6 +268,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -277,16 +279,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A%\022#oslogin.googleapis.com/PosixAccount" - ), + serialized_options=b"\340A\002\372A%\022#oslogin.googleapis.com/PosixAccount", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="project_id", @@ -297,7 +298,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -305,6 +306,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="system_id", @@ -315,7 +317,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -323,6 +325,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -344,6 +347,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -354,17 +358,16 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A%\n#oslogin.googleapis.com/SshPublicKey" - ), + serialized_options=b"\340A\002\372A%\n#oslogin.googleapis.com/SshPublicKey", file=DESCRIPTOR, - ) + create_key=_descriptor._internal_create_key, + ), ], extensions=[], nested_types=[], @@ -385,6 +388,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="parent", @@ -395,16 +399,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A%\022#oslogin.googleapis.com/SshPublicKey" - ), + serialized_options=b"\340A\002\372A%\022#oslogin.googleapis.com/SshPublicKey", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ssh_public_key", @@ -421,8 +424,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\001"), + serialized_options=b"\340A\001", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="project_id", @@ -433,7 +437,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -441,6 +445,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -462,6 +467,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="login_profile", @@ -480,7 +486,8 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, - ) + create_key=_descriptor._internal_create_key, + ), ], extensions=[], nested_types=[], @@ -501,6 +508,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="name", @@ -511,16 +519,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b( - "\340A\002\372A%\n#oslogin.googleapis.com/SshPublicKey" - ), + serialized_options=b"\340A\002\372A%\n#oslogin.googleapis.com/SshPublicKey", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="ssh_public_key", @@ -537,8 +544,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="update_mask", @@ -557,6 +565,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -614,20 +623,21 @@ LoginProfile = _reflection.GeneratedProtocolMessageType( "LoginProfile", (_message.Message,), - dict( - SshPublicKeysEntry=_reflection.GeneratedProtocolMessageType( + { + "SshPublicKeysEntry": _reflection.GeneratedProtocolMessageType( "SshPublicKeysEntry", (_message.Message,), - dict( - DESCRIPTOR=_LOGINPROFILE_SSHPUBLICKEYSENTRY, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2" + { + "DESCRIPTOR": _LOGINPROFILE_SSHPUBLICKEYSENTRY, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2" # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.LoginProfile.SshPublicKeysEntry) - ), + }, ), - DESCRIPTOR=_LOGINPROFILE, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2", - __doc__="""The user profile information used for logging in to a virtual machine + "DESCRIPTOR": _LOGINPROFILE, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2", + "__doc__": """The user profile information used for logging in to a virtual machine on Google Compute Engine. + Attributes: name: Required. A unique user ID. @@ -638,7 +648,7 @@ object. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.LoginProfile) - ), + }, ) _sym_db.RegisterMessage(LoginProfile) _sym_db.RegisterMessage(LoginProfile.SshPublicKeysEntry) @@ -646,10 +656,11 @@ DeletePosixAccountRequest = _reflection.GeneratedProtocolMessageType( "DeletePosixAccountRequest", (_message.Message,), - dict( - DESCRIPTOR=_DELETEPOSIXACCOUNTREQUEST, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2", - __doc__="""A request message for deleting a POSIX account entry. + { + "DESCRIPTOR": _DELETEPOSIXACCOUNTREQUEST, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2", + "__doc__": """A request message for deleting a POSIX account entry. + Attributes: name: Required. A reference to the POSIX account to update. POSIX @@ -658,17 +669,18 @@ ``users/{user}/projects/{project}``. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.DeletePosixAccountRequest) - ), + }, ) _sym_db.RegisterMessage(DeletePosixAccountRequest) DeleteSshPublicKeyRequest = _reflection.GeneratedProtocolMessageType( "DeleteSshPublicKeyRequest", (_message.Message,), - dict( - DESCRIPTOR=_DELETESSHPUBLICKEYREQUEST, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2", - __doc__="""A request message for deleting an SSH public key. + { + "DESCRIPTOR": _DELETESSHPUBLICKEYREQUEST, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2", + "__doc__": """A request message for deleting an SSH public key. + Attributes: name: Required. The fingerprint of the public key to update. Public @@ -677,18 +689,19 @@ ``users/{user}/sshPublicKeys/{fingerprint}``. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.DeleteSshPublicKeyRequest) - ), + }, ) _sym_db.RegisterMessage(DeleteSshPublicKeyRequest) GetLoginProfileRequest = _reflection.GeneratedProtocolMessageType( "GetLoginProfileRequest", (_message.Message,), - dict( - DESCRIPTOR=_GETLOGINPROFILEREQUEST, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2", - __doc__="""A request message for retrieving the login profile information for a + { + "DESCRIPTOR": _GETLOGINPROFILEREQUEST, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2", + "__doc__": """A request message for retrieving the login profile information for a user. + Attributes: name: Required. The unique ID for the user in format @@ -699,17 +712,18 @@ A system ID for filtering the results of the request. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.GetLoginProfileRequest) - ), + }, ) _sym_db.RegisterMessage(GetLoginProfileRequest) GetSshPublicKeyRequest = _reflection.GeneratedProtocolMessageType( "GetSshPublicKeyRequest", (_message.Message,), - dict( - DESCRIPTOR=_GETSSHPUBLICKEYREQUEST, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2", - __doc__="""A request message for retrieving an SSH public key. + { + "DESCRIPTOR": _GETSSHPUBLICKEYREQUEST, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2", + "__doc__": """A request message for retrieving an SSH public key. + Attributes: name: Required. The fingerprint of the public key to retrieve. @@ -718,17 +732,18 @@ ``users/{user}/sshPublicKeys/{fingerprint}``. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.GetSshPublicKeyRequest) - ), + }, ) _sym_db.RegisterMessage(GetSshPublicKeyRequest) ImportSshPublicKeyRequest = _reflection.GeneratedProtocolMessageType( "ImportSshPublicKeyRequest", (_message.Message,), - dict( - DESCRIPTOR=_IMPORTSSHPUBLICKEYREQUEST, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2", - __doc__="""A request message for importing an SSH public key. + { + "DESCRIPTOR": _IMPORTSSHPUBLICKEYREQUEST, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2", + "__doc__": """A request message for importing an SSH public key. + Attributes: parent: Required. The unique ID for the user in format @@ -739,33 +754,35 @@ The project ID of the Google Cloud Platform project. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.ImportSshPublicKeyRequest) - ), + }, ) _sym_db.RegisterMessage(ImportSshPublicKeyRequest) ImportSshPublicKeyResponse = _reflection.GeneratedProtocolMessageType( "ImportSshPublicKeyResponse", (_message.Message,), - dict( - DESCRIPTOR=_IMPORTSSHPUBLICKEYRESPONSE, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2", - __doc__="""A response message for importing an SSH public key. + { + "DESCRIPTOR": _IMPORTSSHPUBLICKEYRESPONSE, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2", + "__doc__": """A response message for importing an SSH public key. + Attributes: login_profile: The login profile information for the user. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.ImportSshPublicKeyResponse) - ), + }, ) _sym_db.RegisterMessage(ImportSshPublicKeyResponse) UpdateSshPublicKeyRequest = _reflection.GeneratedProtocolMessageType( "UpdateSshPublicKeyRequest", (_message.Message,), - dict( - DESCRIPTOR=_UPDATESSHPUBLICKEYREQUEST, - __module__="google.cloud.oslogin_v1.proto.oslogin_pb2", - __doc__="""A request message for updating an SSH public key. + { + "DESCRIPTOR": _UPDATESSHPUBLICKEYREQUEST, + "__module__": "google.cloud.oslogin_v1.proto.oslogin_pb2", + "__doc__": """A request message for updating an SSH public key. + Attributes: name: Required. The fingerprint of the public key to update. Public @@ -779,7 +796,7 @@ present. """, # @@protoc_insertion_point(class_scope:google.cloud.oslogin.v1.UpdateSshPublicKeyRequest) - ), + }, ) _sym_db.RegisterMessage(UpdateSshPublicKeyRequest) @@ -801,9 +818,8 @@ full_name="google.cloud.oslogin.v1.OsLoginService", file=DESCRIPTOR, index=0, - serialized_options=_b( - "\312A\026oslogin.googleapis.com\322AVhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/compute" - ), + serialized_options=b"\312A\026oslogin.googleapis.com\322AVhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/compute", + create_key=_descriptor._internal_create_key, serialized_start=1446, serialized_end=2678, methods=[ @@ -814,9 +830,8 @@ containing_service=None, input_type=_DELETEPOSIXACCOUNTREQUEST, output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=_b( - "\202\323\344\223\002\037*\035/v1/{name=users/*/projects/*}\332A\004name" - ), + serialized_options=b"\202\323\344\223\002\037*\035/v1/{name=users/*/projects/*}\332A\004name", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="DeleteSshPublicKey", @@ -825,9 +840,8 @@ containing_service=None, input_type=_DELETESSHPUBLICKEYREQUEST, output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=_b( - '\202\323\344\223\002$*"/v1/{name=users/*/sshPublicKeys/*}\332A\004name' - ), + serialized_options=b'\202\323\344\223\002$*"/v1/{name=users/*/sshPublicKeys/*}\332A\004name', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="GetLoginProfile", @@ -836,9 +850,8 @@ containing_service=None, input_type=_GETLOGINPROFILEREQUEST, output_type=_LOGINPROFILE, - serialized_options=_b( - "\202\323\344\223\002!\022\037/v1/{name=users/*}/loginProfile\332A\004name" - ), + serialized_options=b"\202\323\344\223\002!\022\037/v1/{name=users/*}/loginProfile\332A\004name", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="GetSshPublicKey", @@ -847,9 +860,8 @@ containing_service=None, input_type=_GETSSHPUBLICKEYREQUEST, output_type=google_dot_cloud_dot_oslogin_dot_common_dot_common__pb2._SSHPUBLICKEY, - serialized_options=_b( - '\202\323\344\223\002$\022"/v1/{name=users/*/sshPublicKeys/*}\332A\004name' - ), + serialized_options=b'\202\323\344\223\002$\022"/v1/{name=users/*/sshPublicKeys/*}\332A\004name', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="ImportSshPublicKey", @@ -858,9 +870,8 @@ containing_service=None, input_type=_IMPORTSSHPUBLICKEYREQUEST, output_type=_IMPORTSSHPUBLICKEYRESPONSE, - serialized_options=_b( - "\202\323\344\223\0029\"'/v1/{parent=users/*}:importSshPublicKey:\016ssh_public_key\332A\025parent,ssh_public_key\332A parent,ssh_public_key,project_id" - ), + serialized_options=b"\202\323\344\223\0029\"'/v1/{parent=users/*}:importSshPublicKey:\016ssh_public_key\332A\025parent,ssh_public_key\332A parent,ssh_public_key,project_id", + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="UpdateSshPublicKey", @@ -869,9 +880,8 @@ containing_service=None, input_type=_UPDATESSHPUBLICKEYREQUEST, output_type=google_dot_cloud_dot_oslogin_dot_common_dot_common__pb2._SSHPUBLICKEY, - serialized_options=_b( - '\202\323\344\223\00242"/v1/{name=users/*/sshPublicKeys/*}:\016ssh_public_key\332A\023name,ssh_public_key\332A\037name,ssh_public_key,update_mask' - ), + serialized_options=b'\202\323\344\223\00242"/v1/{name=users/*/sshPublicKeys/*}:\016ssh_public_key\332A\023name,ssh_public_key\332A\037name,ssh_public_key,update_mask', + create_key=_descriptor._internal_create_key, ), ], ) diff --git a/packages/google-cloud-os-login/google/cloud/oslogin_v1/types.py b/packages/google-cloud-os-login/google/cloud/oslogin_v1/types.py index 7a4c50766e11..898477688e5a 100644 --- a/packages/google-cloud-os-login/google/cloud/oslogin_v1/types.py +++ b/packages/google-cloud-os-login/google/cloud/oslogin_v1/types.py @@ -26,9 +26,15 @@ from google.protobuf import field_mask_pb2 -_shared_modules = [common_pb2, empty_pb2, field_mask_pb2] - -_local_modules = [oslogin_pb2] +_shared_modules = [ + common_pb2, + empty_pb2, + field_mask_pb2, +] + +_local_modules = [ + oslogin_pb2, +] names = [] diff --git a/packages/google-cloud-os-login/noxfile.py b/packages/google-cloud-os-login/noxfile.py index 7647e9dfea1d..2981137d7a61 100644 --- a/packages/google-cloud-os-login/noxfile.py +++ b/packages/google-cloud-os-login/noxfile.py @@ -23,14 +23,15 @@ import nox -BLACK_VERSION = "black==19.3b0" +BLACK_VERSION = "black==19.10b0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] -if os.path.exists("samples"): - BLACK_PATHS.append("samples") +DEFAULT_PYTHON_VERSION = "3.8" +SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.8"] +UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8"] -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): """Run linters. @@ -38,7 +39,9 @@ def lint(session): serious code quality issues. """ session.install("flake8", BLACK_VERSION) - session.run("black", "--check", *BLACK_PATHS) + session.run( + "black", "--check", *BLACK_PATHS, + ) session.run("flake8", "google", "tests") @@ -53,10 +56,12 @@ def blacken(session): check the state of the `gcp_ubuntu_config` we use for that Kokoro run. """ session.install(BLACK_VERSION) - session.run("black", *BLACK_PATHS) + session.run( + "black", *BLACK_PATHS, + ) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" session.install("docutils", "pygments") @@ -84,13 +89,13 @@ def default(session): ) -@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"]) +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS) def unit(session): """Run the unit test suite.""" default(session) -@nox.session(python=["2.7", "3.7"]) +@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" system_test_path = os.path.join("tests", "system.py") @@ -110,8 +115,9 @@ def system(session): # Install all test dependencies, then install this package into the # virtualenv's dist-packages. - session.install("mock", "pytest") - session.install("git+https://github.com/googleapis/python-test-utils") + session.install( + "mock", "pytest", "google-cloud-testutils", + ) session.install("-e", ".") # Run py.test against the system tests. @@ -121,7 +127,7 @@ def system(session): session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def cover(session): """Run the final coverage report. @@ -134,7 +140,7 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def docs(session): """Build the docs for this library.""" diff --git a/packages/google-cloud-os-login/scripts/decrypt-secrets.sh b/packages/google-cloud-os-login/scripts/decrypt-secrets.sh new file mode 100755 index 000000000000..ff599eb2af25 --- /dev/null +++ b/packages/google-cloud-os-login/scripts/decrypt-secrets.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright 2015 Google Inc. All rights reserved. +# +# 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 +# +# http://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. + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +ROOT=$( dirname "$DIR" ) + +# Work from the project root. +cd $ROOT + +# Use SECRET_MANAGER_PROJECT if set, fallback to cloud-devrel-kokoro-resources. +PROJECT_ID="${SECRET_MANAGER_PROJECT:-cloud-devrel-kokoro-resources}" + +gcloud secrets versions access latest --secret="python-docs-samples-test-env" \ + > testing/test-env.sh +gcloud secrets versions access latest \ + --secret="python-docs-samples-service-account" \ + > testing/service-account.json +gcloud secrets versions access latest \ + --secret="python-docs-samples-client-secrets" \ + > testing/client-secrets.json \ No newline at end of file diff --git a/packages/google-cloud-os-login/scripts/readme-gen/readme_gen.py b/packages/google-cloud-os-login/scripts/readme-gen/readme_gen.py new file mode 100644 index 000000000000..d309d6e97518 --- /dev/null +++ b/packages/google-cloud-os-login/scripts/readme-gen/readme_gen.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +# Copyright 2016 Google Inc +# +# 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 +# +# http://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. + +"""Generates READMEs using configuration defined in yaml.""" + +import argparse +import io +import os +import subprocess + +import jinja2 +import yaml + + +jinja_env = jinja2.Environment( + trim_blocks=True, + loader=jinja2.FileSystemLoader( + os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + +README_TMPL = jinja_env.get_template('README.tmpl.rst') + + +def get_help(file): + return subprocess.check_output(['python', file, '--help']).decode() + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('source') + parser.add_argument('--destination', default='README.rst') + + args = parser.parse_args() + + source = os.path.abspath(args.source) + root = os.path.dirname(source) + destination = os.path.join(root, args.destination) + + jinja_env.globals['get_help'] = get_help + + with io.open(source, 'r') as f: + config = yaml.load(f) + + # This allows get_help to execute in the right directory. + os.chdir(root) + + output = README_TMPL.render(config) + + with io.open(destination, 'w') as f: + f.write(output) + + +if __name__ == '__main__': + main() diff --git a/packages/google-cloud-os-login/scripts/readme-gen/templates/README.tmpl.rst b/packages/google-cloud-os-login/scripts/readme-gen/templates/README.tmpl.rst new file mode 100644 index 000000000000..4fd239765b0a --- /dev/null +++ b/packages/google-cloud-os-login/scripts/readme-gen/templates/README.tmpl.rst @@ -0,0 +1,87 @@ +{# The following line is a lie. BUT! Once jinja2 is done with it, it will + become truth! #} +.. This file is automatically generated. Do not edit this file directly. + +{{product.name}} 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={{folder}}/README.rst + + +This directory contains samples for {{product.name}}. {{product.description}} + +{{description}} + +.. _{{product.name}}: {{product.url}} + +{% if required_api_url %} +To run the sample, you need to enable the API at: {{required_api_url}} +{% endif %} + +{% if required_role %} +To run the sample, you need to have `{{required_role}}` role. +{% endif %} + +{{other_required_steps}} + +{% if setup %} +Setup +------------------------------------------------------------------------------- + +{% for section in setup %} + +{% include section + '.tmpl.rst' %} + +{% endfor %} +{% endif %} + +{% if samples %} +Samples +------------------------------------------------------------------------------- + +{% for sample in samples %} +{{sample.name}} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +{% if not sample.hide_cloudshell_button %} +.. 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={{folder}}/{{sample.file}},{{folder}}/README.rst +{% endif %} + + +{{sample.description}} + +To run this sample: + +.. code-block:: bash + + $ python {{sample.file}} +{% if sample.show_help %} + + {{get_help(sample.file)|indent}} +{% endif %} + + +{% endfor %} +{% endif %} + +{% if cloud_client_library %} + +The client library +------------------------------------------------------------------------------- + +This sample uses the `Google Cloud Client Library for Python`_. +You can read the documentation for more details on API usage and use GitHub +to `browse the source`_ and `report issues`_. + +.. _Google Cloud Client Library for Python: + https://googlecloudplatform.github.io/google-cloud-python/ +.. _browse the source: + https://github.com/GoogleCloudPlatform/google-cloud-python +.. _report issues: + https://github.com/GoogleCloudPlatform/google-cloud-python/issues + +{% endif %} + +.. _Google Cloud SDK: https://cloud.google.com/sdk/ \ No newline at end of file diff --git a/packages/google-cloud-os-login/scripts/readme-gen/templates/auth.tmpl.rst b/packages/google-cloud-os-login/scripts/readme-gen/templates/auth.tmpl.rst new file mode 100644 index 000000000000..1446b94a5e3a --- /dev/null +++ b/packages/google-cloud-os-login/scripts/readme-gen/templates/auth.tmpl.rst @@ -0,0 +1,9 @@ +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 diff --git a/packages/google-cloud-os-login/scripts/readme-gen/templates/auth_api_key.tmpl.rst b/packages/google-cloud-os-login/scripts/readme-gen/templates/auth_api_key.tmpl.rst new file mode 100644 index 000000000000..11957ce2714a --- /dev/null +++ b/packages/google-cloud-os-login/scripts/readme-gen/templates/auth_api_key.tmpl.rst @@ -0,0 +1,14 @@ +Authentication +++++++++++++++ + +Authentication for this service is done via an `API Key`_. To obtain an API +Key: + +1. Open the `Cloud Platform Console`_ +2. Make sure that billing is enabled for your project. +3. From the **Credentials** page, create a new **API Key** or use an existing + one for your project. + +.. _API Key: + https://developers.google.com/api-client-library/python/guide/aaa_apikeys +.. _Cloud Console: https://console.cloud.google.com/project?_ diff --git a/packages/google-cloud-os-login/scripts/readme-gen/templates/install_deps.tmpl.rst b/packages/google-cloud-os-login/scripts/readme-gen/templates/install_deps.tmpl.rst new file mode 100644 index 000000000000..a0406dba8c84 --- /dev/null +++ b/packages/google-cloud-os-login/scripts/readme-gen/templates/install_deps.tmpl.rst @@ -0,0 +1,29 @@ +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/ diff --git a/packages/google-cloud-os-login/scripts/readme-gen/templates/install_portaudio.tmpl.rst b/packages/google-cloud-os-login/scripts/readme-gen/templates/install_portaudio.tmpl.rst new file mode 100644 index 000000000000..5ea33d18c00c --- /dev/null +++ b/packages/google-cloud-os-login/scripts/readme-gen/templates/install_portaudio.tmpl.rst @@ -0,0 +1,35 @@ +Install PortAudio ++++++++++++++++++ + +Install `PortAudio`_. This is required by the `PyAudio`_ library to stream +audio from your computer's microphone. PyAudio depends on PortAudio for cross-platform compatibility, and is installed differently depending on the +platform. + +* For Mac OS X, you can use `Homebrew`_:: + + brew install portaudio + + **Note**: if you encounter an error when running `pip install` that indicates + it can't find `portaudio.h`, try running `pip install` with the following + flags:: + + pip install --global-option='build_ext' \ + --global-option='-I/usr/local/include' \ + --global-option='-L/usr/local/lib' \ + pyaudio + +* For Debian / Ubuntu Linux:: + + apt-get install portaudio19-dev python-all-dev + +* Windows may work without having to install PortAudio explicitly (it will get + installed with PyAudio). + +For more details, see the `PyAudio installation`_ page. + + +.. _PyAudio: https://people.csail.mit.edu/hubert/pyaudio/ +.. _PortAudio: http://www.portaudio.com/ +.. _PyAudio installation: + https://people.csail.mit.edu/hubert/pyaudio/#downloads +.. _Homebrew: http://brew.sh diff --git a/packages/google-cloud-os-login/synth.metadata b/packages/google-cloud-os-login/synth.metadata index 7935d0fd1aec..eb99d89278ad 100644 --- a/packages/google-cloud-os-login/synth.metadata +++ b/packages/google-cloud-os-login/synth.metadata @@ -1,32 +1,25 @@ { "sources": [ - { - "generator": { - "name": "artman", - "version": "2.0.0", - "dockerImage": "googleapis/artman@sha256:b3b47805231a305d0f40c4bf069df20f6a2635574e6d4259fac651d3f9f6e098" - } - }, { "git": { "name": ".", "remote": "https://github.com/googleapis/python-oslogin.git", - "sha": "d872602ba2650eea4ae77686d11144bc0b66ca3a" + "sha": "f0254af9a85859f55bf1dbc7608c4a19be270368" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "42ee97c1b93a0e3759bbba3013da309f670a90ab", - "internalRef": "307114445" + "sha": "cf41866c6f14f10a07aa1e2a1260fc0a2727d889", + "internalRef": "317812187" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "f5e4c17dc78a966dbf29961dd01f9bbd63e20a04" + "sha": "cf2eff09d0f5319a4dc5cdce2b6356d85af4a798" } } ], @@ -37,8 +30,7 @@ "apiName": "oslogin", "apiVersion": "v1", "language": "python", - "generator": "gapic", - "config": "google/cloud/oslogin/artman_oslogin_v1.yaml" + "generator": "bazel" } } ] diff --git a/packages/google-cloud-os-login/synth.py b/packages/google-cloud-os-login/synth.py index 4855ba3df180..b5610426350c 100644 --- a/packages/google-cloud-os-login/synth.py +++ b/packages/google-cloud-os-login/synth.py @@ -62,4 +62,8 @@ templated_files = common.py_library(cov_level=70) s.move(templated_files) +# TODO(busunkim): Use latest sphinx after microgenerator transition +s.replace("noxfile.py", """['"]sphinx['"]""", '"sphinx<3.0.0"') + + s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/packages/google-cloud-os-login/testing/.gitignore b/packages/google-cloud-os-login/testing/.gitignore new file mode 100644 index 000000000000..b05fbd630881 --- /dev/null +++ b/packages/google-cloud-os-login/testing/.gitignore @@ -0,0 +1,3 @@ +test-env.sh +service-account.json +client-secrets.json \ No newline at end of file