From e64ae35a4b03353f9305c8fba9453c284d630c25 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 15:22:35 -0500 Subject: [PATCH 01/16] chore: use gapic-generator-python 0.56.2 (#87) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: https://github.com/googleapis/googleapis/commit/2921f9fb3bfbd16f6b2da0104373e2b47a80a65e Source-Link: https://github.com/googleapis/googleapis-gen/commit/6598ca8cbbf5226733a099c4506518a5af6ff74c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/quota_controller/async_client.py | 13 ++++++---- .../services/quota_controller/client.py | 25 +++++++++++++------ .../quota_controller/transports/base.py | 8 +++--- .../quota_controller/transports/grpc.py | 4 +-- .../transports/grpc_asyncio.py | 4 +-- .../service_controller/async_client.py | 13 ++++++---- .../services/service_controller/client.py | 25 +++++++++++++------ .../service_controller/transports/base.py | 8 +++--- .../service_controller/transports/grpc.py | 4 +-- .../transports/grpc_asyncio.py | 4 +-- .../servicecontrol_v1/types/distribution.py | 3 +++ .../servicecontrol_v1/types/log_entry.py | 3 +++ .../servicecontrol_v1/types/metric_value.py | 5 ++++ 13 files changed, 77 insertions(+), 42 deletions(-) diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py index d91c49b..8f5c00b 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.servicecontrol_v1.types import metric_value from google.cloud.servicecontrol_v1.types import quota_controller diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/client.py b/google/cloud/servicecontrol_v1/services/quota_controller/client.py index cb4e64b..1e93602 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.servicecontrol_v1.types import metric_value from google.cloud.servicecontrol_v1.types import quota_controller @@ -271,8 +273,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py index a3e7ff7..f4a8645 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py index 86e4b17..e4775ac 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py index e25b311..69c323e 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py index 1f13c8a..836dede 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.servicecontrol_v1.types import check_error from google.cloud.servicecontrol_v1.types import service_controller diff --git a/google/cloud/servicecontrol_v1/services/service_controller/client.py b/google/cloud/servicecontrol_v1/services/service_controller/client.py index 3b5f129..cd8d957 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.servicecontrol_v1.types import check_error from google.cloud.servicecontrol_v1.types import service_controller @@ -273,8 +275,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py index 07eb753..d90451c 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py @@ -18,10 +18,10 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py index 7100c53..d22f6c5 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py @@ -16,8 +16,8 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py index 46f953d..dc2f0a3 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/servicecontrol_v1/types/distribution.py b/google/cloud/servicecontrol_v1/types/distribution.py index 22c57bd..e145d45 100644 --- a/google/cloud/servicecontrol_v1/types/distribution.py +++ b/google/cloud/servicecontrol_v1/types/distribution.py @@ -75,12 +75,15 @@ class Distribution(proto.Message): Any suffix of trailing zeros may be omitted. linear_buckets (google.cloud.servicecontrol_v1.types.Distribution.LinearBuckets): Buckets with constant width. + This field is a member of `oneof`_ ``bucket_option``. exponential_buckets (google.cloud.servicecontrol_v1.types.Distribution.ExponentialBuckets): Buckets with exponentially growing width. + This field is a member of `oneof`_ ``bucket_option``. explicit_buckets (google.cloud.servicecontrol_v1.types.Distribution.ExplicitBuckets): Buckets with arbitrary user-provided width. + This field is a member of `oneof`_ ``bucket_option``. exemplars (Sequence[google.api.distribution_pb2.Exemplar]): Example points. Must be in increasing order of ``value`` diff --git a/google/cloud/servicecontrol_v1/types/log_entry.py b/google/cloud/servicecontrol_v1/types/log_entry.py index dc8ec7f..edc058a 100644 --- a/google/cloud/servicecontrol_v1/types/log_entry.py +++ b/google/cloud/servicecontrol_v1/types/log_entry.py @@ -70,14 +70,17 @@ class LogEntry(proto.Message): The log entry payload, represented as a protocol buffer that is expressed as a JSON object. The only accepted type currently is [AuditLog][google.cloud.audit.AuditLog]. + This field is a member of `oneof`_ ``payload``. text_payload (str): The log entry payload, represented as a Unicode string (UTF-8). + This field is a member of `oneof`_ ``payload``. struct_payload (google.protobuf.struct_pb2.Struct): The log entry payload, represented as a structure that is expressed as a JSON object. + This field is a member of `oneof`_ ``payload``. operation (google.cloud.servicecontrol_v1.types.LogEntryOperation): Optional. Information about an operation diff --git a/google/cloud/servicecontrol_v1/types/metric_value.py b/google/cloud/servicecontrol_v1/types/metric_value.py index ed11979..219df73 100644 --- a/google/cloud/servicecontrol_v1/types/metric_value.py +++ b/google/cloud/servicecontrol_v1/types/metric_value.py @@ -55,18 +55,23 @@ class MetricValue(proto.Message): will be used. bool_value (bool): A boolean value. + This field is a member of `oneof`_ ``value``. int64_value (int): A signed 64-bit integer value. + This field is a member of `oneof`_ ``value``. double_value (float): A double precision floating point value. + This field is a member of `oneof`_ ``value``. string_value (str): A text string value. + This field is a member of `oneof`_ ``value``. distribution_value (google.cloud.servicecontrol_v1.types.Distribution): A distribution value. + This field is a member of `oneof`_ ``value``. """ From 0f745a3fa8478bab666ca17f8312a61bd3700f63 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:20:29 -0500 Subject: [PATCH 02/16] chore(python): add .github/CODEOWNERS as a templated file (#88) Source-Link: https://github.com/googleapis/synthtool/commit/c5026b3217973a8db55db8ee85feee0e9a65e295 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/CODEOWNERS | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index cb89b2e..7519fa3 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ec49167c606648a063d1222220b48119c912562849a0528f35bfb592a9f72737 + digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index be888a9..44cc868 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,9 +3,10 @@ # # For syntax help see: # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax +# Note: This file is autogenerated. To make changes to the codeowner team, please update .repo-metadata.json. -# The @googleapis/yoshi-python is the default owner for changes in this repo -* @googleapis/yoshi-python - +# @googleapis/yoshi-python is the default owner for changes in this repo +* @googleapis/yoshi-python +# @googleapis/python-samples-owners is the default owner for samples changes /samples/ @googleapis/python-samples-owners From 72104966966029ebd6d52af5299765a296d4a7bd Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Tue, 16 Nov 2021 11:04:15 -0500 Subject: [PATCH 03/16] chore: update doc links from googleapis.dev to cloud.google.com (#89) --- .repo-metadata.json | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 70a5000..0d4423f 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -2,7 +2,7 @@ "name": "servicecontrol", "name_pretty": "Service Control API", "product_documentation": "https://cloud.google.com/service-infrastructure/docs/overview/", - "client_documentation": "https://googleapis.dev/python/servicecontrol/latest", + "client_documentation": "https://cloud.google.com/python/docs/reference/servicecontrol/latest", "issue_tracker": "", "release_level": "ga", "language": "python", diff --git a/README.rst b/README.rst index 3404d73..de0da92 100644 --- a/README.rst +++ b/README.rst @@ -20,7 +20,7 @@ auditing, rate limiting, analytics, billing, logging, and monitoring. .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-service-control.svg :target: https://pypi.org/project/google-cloud-service-control/ .. _Service Control: https://cloud.google.com/service-infrastructure/docs/overview/ -.. _Client Library Documentation: https://googleapis.dev/python/servicecontrol/latest +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/servicecontrol/latest .. _Product Documentation: https://cloud.google.com/service-infrastructure/docs/overview/ Quick Start From 83f981c6157e15e1ca0c5ccb1acd5cd646019a93 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 28 Dec 2021 13:14:09 -0500 Subject: [PATCH 04/16] chore: update .repo-metadata.json (#92) --- .repo-metadata.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 0d4423f..fe81780 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -4,12 +4,13 @@ "product_documentation": "https://cloud.google.com/service-infrastructure/docs/overview/", "client_documentation": "https://cloud.google.com/python/docs/reference/servicecontrol/latest", "issue_tracker": "", - "release_level": "ga", + "release_level": "stable", "language": "python", "library_type": "GAPIC_AUTO", "repo": "googleapis/python-service-control", "distribution_name": "google-cloud-service-control", "api_id": "servicecontrol.googleapis.com", "default_version": "v1", - "codeowner_team": "" + "codeowner_team": "", + "api_shortname": "servicecontrol" } From ace8cf61100aaa3fe0b9eeea2362f5193a87efa9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 6 Jan 2022 16:00:30 +0000 Subject: [PATCH 05/16] chore: use python-samples-reviewers (#94) --- .github/.OwlBot.lock.yaml | 2 +- .github/CODEOWNERS | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7519fa3..f33299d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 + digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 44cc868..e446644 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,5 +8,5 @@ # @googleapis/yoshi-python is the default owner for changes in this repo * @googleapis/yoshi-python -# @googleapis/python-samples-owners is the default owner for samples changes -/samples/ @googleapis/python-samples-owners +# @googleapis/python-samples-reviewers is the default owner for samples changes +/samples/ @googleapis/python-samples-reviewers From 187b19c52a9a0e40f5e6ec4809bd9b66daa2ce7d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 8 Jan 2022 05:36:37 -0500 Subject: [PATCH 06/16] chore: use gapic-generator-python 0.58.4 (#93) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: https://github.com/googleapis/googleapis/commit/73da6697f598f1ba30618924936a59f8e457ec89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../quota_controller/transports/base.py | 1 - .../service_controller/transports/base.py | 1 - .../test_quota_controller.py | 23 ++++++--------- .../test_service_controller.py | 28 ++++++++----------- 4 files changed, 20 insertions(+), 33 deletions(-) diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py index f4a8645..8099043 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py @@ -104,7 +104,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py index d90451c..bb78aa3 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py @@ -104,7 +104,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py b/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py index 3022024..28f3dc3 100644 --- a/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py +++ b/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py @@ -254,20 +254,20 @@ def test_quota_controller_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -336,7 +336,7 @@ def test_quota_controller_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -431,7 +431,7 @@ def test_quota_controller_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -462,7 +462,7 @@ def test_quota_controller_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -495,9 +495,8 @@ def test_quota_controller_client_client_options_from_dict(): ) -def test_allocate_quota( - transport: str = "grpc", request_type=quota_controller.AllocateQuotaRequest -): +@pytest.mark.parametrize("request_type", [quota_controller.AllocateQuotaRequest, dict,]) +def test_allocate_quota(request_type, transport: str = "grpc"): client = QuotaControllerClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -526,10 +525,6 @@ def test_allocate_quota( assert response.service_config_id == "service_config_id_value" -def test_allocate_quota_from_dict(): - test_allocate_quota(request_type=dict) - - def test_allocate_quota_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1084,7 +1079,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( diff --git a/tests/unit/gapic/servicecontrol_v1/test_service_controller.py b/tests/unit/gapic/servicecontrol_v1/test_service_controller.py index 4b068e8..55e291e 100644 --- a/tests/unit/gapic/servicecontrol_v1/test_service_controller.py +++ b/tests/unit/gapic/servicecontrol_v1/test_service_controller.py @@ -262,20 +262,20 @@ def test_service_controller_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -344,7 +344,7 @@ def test_service_controller_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -439,7 +439,7 @@ def test_service_controller_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -470,7 +470,7 @@ def test_service_controller_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -503,7 +503,8 @@ def test_service_controller_client_client_options_from_dict(): ) -def test_check(transport: str = "grpc", request_type=service_controller.CheckRequest): +@pytest.mark.parametrize("request_type", [service_controller.CheckRequest, dict,]) +def test_check(request_type, transport: str = "grpc"): client = ServiceControllerClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -534,10 +535,6 @@ def test_check(transport: str = "grpc", request_type=service_controller.CheckReq assert response.service_rollout_id == "service_rollout_id_value" -def test_check_from_dict(): - test_check(request_type=dict) - - def test_check_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -594,7 +591,8 @@ async def test_check_async_from_dict(): await test_check_async(request_type=dict) -def test_report(transport: str = "grpc", request_type=service_controller.ReportRequest): +@pytest.mark.parametrize("request_type", [service_controller.ReportRequest, dict,]) +def test_report(request_type, transport: str = "grpc"): client = ServiceControllerClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -623,10 +621,6 @@ def test_report(transport: str = "grpc", request_type=service_controller.ReportR assert response.service_rollout_id == "service_rollout_id_value" -def test_report_from_dict(): - test_report(request_type=dict) - - def test_report_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1184,7 +1178,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( From 547fd92ee5fb2c75add0c3753d5be7bbf857585a Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 14 Jan 2022 10:02:08 -0500 Subject: [PATCH 07/16] build: switch to release-please for tagging (#95) Source-Link: https://github.com/googleapis/synthtool/commit/f8077d237e0df2cb0066dfc6e09fc41e1c59646a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/release-please.yml | 1 + .github/release-trigger.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .github/release-trigger.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f33299d..ff5126c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 + digest: sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 diff --git a/.github/release-please.yml b/.github/release-please.yml index 4507ad0..466597e 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1 +1,2 @@ releaseType: python +handleGHRelease: true diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 0000000..d4ca941 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true From 2c42063709011774d9880bc9760d9728cbb56560 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 14 Jan 2022 11:11:29 -0500 Subject: [PATCH 08/16] chore(python): update release.sh to use keystore (#96) Source-Link: https://github.com/googleapis/synthtool/commit/69fda12e2994f0b595a397e8bb6e3e9f380524eb Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/release.sh | 2 +- .kokoro/release/common.cfg | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ff5126c..eecb84c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 + digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 0938de5..a865175 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") +TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1") cd github/python-service-control python3 setup.py sdist bdist_wheel twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index b33b92e..ff19f3c 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,8 +23,18 @@ env_vars: { value: "github/python-service-control/.kokoro/release.sh" } +# Fetch PyPI password +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "google-cloud-pypi-token-keystore-1" + } + } +} + # Tokens needed to report release status back to GitHub env_vars: { key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } From cff771d128ae7961f125eafe91059dd1ff786481 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 20 Jan 2022 11:08:46 -0500 Subject: [PATCH 09/16] ci(python): run lint / unit tests / docs as GH actions (#97) * ci(python): run lint / unit tests / docs as GH actions Source-Link: https://github.com/googleapis/synthtool/commit/57be0cdb0b94e1669cee0ca38d790de1dfdbcd44 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 * add commit to trigger gh action Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 16 +++++++++- .github/workflows/docs.yml | 38 +++++++++++++++++++++++ .github/workflows/lint.yml | 25 +++++++++++++++ .github/workflows/unittest.yml | 57 ++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unittest.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index eecb84c..b668c04 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,17 @@ +# Copyright 2022 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 +# +# 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. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 + digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 + diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..f7b8344 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +on: + pull_request: + branches: + - main +name: docs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docs + run: | + nox -s docs + docfx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docfx + run: | + nox -s docfx diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..1e8b05c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +on: + pull_request: + branches: + - main +name: lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run lint + run: | + nox -s lint + - name: Run lint_setup_py + run: | + nox -s lint_setup_py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 0000000..074ee25 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,57 @@ +on: + pull_request: + branches: + - main +name: unittest +jobs: + unit: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8', '3.9', '3.10'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run unit tests + env: + COVERAGE_FILE: .coverage-${{ matrix.python }} + run: | + nox -s unit-${{ matrix.python }} + - name: Upload coverage results + uses: actions/upload-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + + cover: + runs-on: ubuntu-latest + needs: + - unit + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install coverage + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install coverage + - name: Download coverage results + uses: actions/download-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-results/ + - name: Report coverage results + run: | + coverage combine .coverage-results/.coverage* + coverage report --show-missing --fail-under=100 From ca4238f594bfd2cfb851b6f2e354b130f269c09d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 12:44:47 -0500 Subject: [PATCH 10/16] feat: add api key support (#98) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: upgrade gapic-generator-java, gax-java and gapic-generator-python PiperOrigin-RevId: 423842556 Source-Link: https://github.com/googleapis/googleapis/commit/a616ca08f4b1416abbac7bc5dd6d61c791756a81 Source-Link: https://github.com/googleapis/googleapis-gen/commit/29b938c58c1e51d019f2ee539d55dc0a3c86a905 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjliOTM4YzU4YzFlNTFkMDE5ZjJlZTUzOWQ1NWRjMGEzYzg2YTkwNSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/quota_controller/async_client.py | 38 ++++- .../services/quota_controller/client.py | 127 +++++++++++------ .../service_controller/async_client.py | 38 ++++- .../services/service_controller/client.py | 127 +++++++++++------ .../test_quota_controller.py | 128 +++++++++++++++++ .../test_service_controller.py | 131 ++++++++++++++++++ 6 files changed, 501 insertions(+), 88 deletions(-) diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py index 8f5c00b..38b5fb5 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -108,6 +108,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return QuotaControllerClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + @property def transport(self) -> QuotaControllerTransport: """Returns the transport used by the client instance. diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/client.py b/google/cloud/servicecontrol_v1/services/quota_controller/client.py index 1e93602..5cdc041 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/client.py @@ -222,6 +222,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + def __init__( self, *, @@ -272,57 +339,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. if isinstance(transport, QuotaControllerTransport): # transport is a QuotaControllerTransport instance. - if credentials or client_options.credentials_file: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -334,6 +366,15 @@ def __init__( ) self._transport = transport else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + Transport = type(self).get_transport_class(transport) self._transport = Transport( credentials=credentials, diff --git a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py index 836dede..8321ba6 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -108,6 +108,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return ServiceControllerClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + @property def transport(self) -> ServiceControllerTransport: """Returns the transport used by the client instance. diff --git a/google/cloud/servicecontrol_v1/services/service_controller/client.py b/google/cloud/servicecontrol_v1/services/service_controller/client.py index cd8d957..e5f1e78 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/client.py @@ -224,6 +224,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + def __init__( self, *, @@ -274,57 +341,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. if isinstance(transport, ServiceControllerTransport): # transport is a ServiceControllerTransport instance. - if credentials or client_options.credentials_file: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -336,6 +368,15 @@ def __init__( ) self._transport = transport else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + Transport = type(self).get_transport_class(transport) self._transport = Transport( credentials=credentials, diff --git a/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py b/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py index 28f3dc3..7764d7e 100644 --- a/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py +++ b/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py @@ -413,6 +413,87 @@ def test_quota_controller_client_mtls_env_auto( ) +@pytest.mark.parametrize( + "client_class", [QuotaControllerClient, QuotaControllerAsyncClient] +) +@mock.patch.object( + QuotaControllerClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(QuotaControllerClient), +) +@mock.patch.object( + QuotaControllerAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(QuotaControllerAsyncClient), +) +def test_quota_controller_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + @pytest.mark.parametrize( "client_class,transport_class,transport_name", [ @@ -599,6 +680,23 @@ def test_credentials_transport_error(): transport=transport, ) + # It is an error to provide an api_key and a transport instance. + transport = transports.QuotaControllerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = QuotaControllerClient(client_options=options, transport=transport,) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = QuotaControllerClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + # It is an error to provide scopes and a transport instance. transport = transports.QuotaControllerGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), @@ -1144,3 +1242,33 @@ def test_client_ctx(): with client: pass close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + (QuotaControllerClient, transports.QuotaControllerGrpcTransport), + (QuotaControllerAsyncClient, transports.QuotaControllerGrpcAsyncIOTransport), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) diff --git a/tests/unit/gapic/servicecontrol_v1/test_service_controller.py b/tests/unit/gapic/servicecontrol_v1/test_service_controller.py index 55e291e..c4971b5 100644 --- a/tests/unit/gapic/servicecontrol_v1/test_service_controller.py +++ b/tests/unit/gapic/servicecontrol_v1/test_service_controller.py @@ -421,6 +421,87 @@ def test_service_controller_client_mtls_env_auto( ) +@pytest.mark.parametrize( + "client_class", [ServiceControllerClient, ServiceControllerAsyncClient] +) +@mock.patch.object( + ServiceControllerClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(ServiceControllerClient), +) +@mock.patch.object( + ServiceControllerAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(ServiceControllerAsyncClient), +) +def test_service_controller_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + @pytest.mark.parametrize( "client_class,transport_class,transport_name", [ @@ -695,6 +776,23 @@ def test_credentials_transport_error(): transport=transport, ) + # It is an error to provide an api_key and a transport instance. + transport = transports.ServiceControllerGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = ServiceControllerClient(client_options=options, transport=transport,) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = ServiceControllerClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + # It is an error to provide scopes and a transport instance. transport = transports.ServiceControllerGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), @@ -1243,3 +1341,36 @@ def test_client_ctx(): with client: pass close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + (ServiceControllerClient, transports.ServiceControllerGrpcTransport), + ( + ServiceControllerAsyncClient, + transports.ServiceControllerGrpcAsyncIOTransport, + ), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) From 91d18fae62221a55202ded68ec0d0551ca3202a4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 12:56:49 +0000 Subject: [PATCH 11/16] chore: use gapic-generator-python 0.62.1 (#101) - [ ] Regenerate this pull request now. fix: resolve DuplicateCredentialArgs error when using credentials_file committer: parthea PiperOrigin-RevId: 425964861 Source-Link: https://github.com/googleapis/googleapis/commit/84b1a5a4f6fb2d04905be58e586b8a7a4310a8cf Source-Link: https://github.com/googleapis/googleapis-gen/commit/4fb761bbd8506ac156f49bac5f18306aa8eb3aa8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZiNzYxYmJkODUwNmFjMTU2ZjQ5YmFjNWYxODMwNmFhOGViM2FhOCJ9 --- .../quota_controller/transports/grpc.py | 5 +- .../transports/grpc_asyncio.py | 5 +- .../service_controller/transports/grpc.py | 5 +- .../transports/grpc_asyncio.py | 5 +- .../test_quota_controller.py | 82 ++++++++++++++++++- .../test_service_controller.py | 82 ++++++++++++++++++- 6 files changed, 174 insertions(+), 10 deletions(-) diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py index e4775ac..0c229e6 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py @@ -161,8 +161,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py index 69c323e..da1c51d 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py @@ -206,8 +206,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py index d22f6c5..7d52010 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py @@ -161,8 +161,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py index dc2f0a3..883a999 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py @@ -206,8 +206,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py b/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py index 7764d7e..75b5164 100644 --- a/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py +++ b/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py @@ -526,21 +526,28 @@ def test_quota_controller_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (QuotaControllerClient, transports.QuotaControllerGrpcTransport, "grpc"), + ( + QuotaControllerClient, + transports.QuotaControllerGrpcTransport, + "grpc", + grpc_helpers, + ), ( QuotaControllerAsyncClient, transports.QuotaControllerGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_quota_controller_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -576,6 +583,75 @@ def test_quota_controller_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + QuotaControllerClient, + transports.QuotaControllerGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + QuotaControllerAsyncClient, + transports.QuotaControllerGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_quota_controller_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "servicecontrol.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/servicecontrol", + ), + scopes=None, + default_host="servicecontrol.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [quota_controller.AllocateQuotaRequest, dict,]) def test_allocate_quota(request_type, transport: str = "grpc"): client = QuotaControllerClient( diff --git a/tests/unit/gapic/servicecontrol_v1/test_service_controller.py b/tests/unit/gapic/servicecontrol_v1/test_service_controller.py index c4971b5..74fc133 100644 --- a/tests/unit/gapic/servicecontrol_v1/test_service_controller.py +++ b/tests/unit/gapic/servicecontrol_v1/test_service_controller.py @@ -534,21 +534,28 @@ def test_service_controller_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (ServiceControllerClient, transports.ServiceControllerGrpcTransport, "grpc"), + ( + ServiceControllerClient, + transports.ServiceControllerGrpcTransport, + "grpc", + grpc_helpers, + ), ( ServiceControllerAsyncClient, transports.ServiceControllerGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_service_controller_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -584,6 +591,75 @@ def test_service_controller_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + ServiceControllerClient, + transports.ServiceControllerGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + ServiceControllerAsyncClient, + transports.ServiceControllerGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_service_controller_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "servicecontrol.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/servicecontrol", + ), + scopes=None, + default_host="servicecontrol.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [service_controller.CheckRequest, dict,]) def test_check(request_type, transport: str = "grpc"): client = ServiceControllerClient( From b7893e527c1355cb9ecca22f3bccbbb70308ac25 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 15:37:53 -0700 Subject: [PATCH 12/16] chore: use gapic-generator-python 0.63.2 (#103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: https://github.com/googleapis/googleapis/commit/55b9e1e0b3106c850d13958352bc0751147b6b15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bf4e86b753f42cb0edb1fd51fbe840d7da0a1cde Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmY0ZTg2Yjc1M2Y0MmNiMGVkYjFmZDUxZmJlODQwZDdkYTBhMWNkZSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/quota_controller/async_client.py | 19 ++ .../services/quota_controller/client.py | 20 ++ .../service_controller/async_client.py | 38 +++ .../services/service_controller/client.py | 40 +++ ...1_quota_controller_allocate_quota_async.py | 44 +++ ...v1_quota_controller_allocate_quota_sync.py | 44 +++ ...ntrol_v1_service_controller_check_async.py | 44 +++ ...ontrol_v1_service_controller_check_sync.py | 44 +++ ...trol_v1_service_controller_report_async.py | 44 +++ ...ntrol_v1_service_controller_report_sync.py | 44 +++ .../snippet_metadata_servicecontrol_v1.json | 271 ++++++++++++++++++ 11 files changed, 652 insertions(+) create mode 100644 samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py create mode 100644 samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py create mode 100644 samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py create mode 100644 samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py create mode 100644 samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py create mode 100644 samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py create mode 100644 samples/generated_samples/snippet_metadata_servicecontrol_v1.json diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py index 38b5fb5..0f4c159 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py @@ -225,6 +225,25 @@ async def allocate_quota( inject these errors to prohibit any hard dependency on the quota functionality. + + .. code-block:: + + from google.cloud import servicecontrol_v1 + + def sample_allocate_quota(): + # Create a client + client = servicecontrol_v1.QuotaControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.AllocateQuotaRequest( + ) + + # Make the request + response = client.allocate_quota(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.servicecontrol_v1.types.AllocateQuotaRequest, dict]): The request object. Request message for the diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/client.py b/google/cloud/servicecontrol_v1/services/quota_controller/client.py index 5cdc041..19aef34 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/client.py @@ -408,6 +408,26 @@ def allocate_quota( inject these errors to prohibit any hard dependency on the quota functionality. + + + .. code-block:: + + from google.cloud import servicecontrol_v1 + + def sample_allocate_quota(): + # Create a client + client = servicecontrol_v1.QuotaControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.AllocateQuotaRequest( + ) + + # Make the request + response = client.allocate_quota(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.servicecontrol_v1.types.AllocateQuotaRequest, dict]): The request object. Request message for the diff --git a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py index 8321ba6..e811ea9 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py @@ -232,6 +232,25 @@ async def check( permission on the specified service. For more information, see `Cloud IAM `__. + + .. code-block:: + + from google.cloud import servicecontrol_v1 + + def sample_check(): + # Create a client + client = servicecontrol_v1.ServiceControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.CheckRequest( + ) + + # Make the request + response = client.check(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.servicecontrol_v1.types.CheckRequest, dict]): The request object. Request message for the Check @@ -301,6 +320,25 @@ async def report( permission on the specified service. For more information, see `Google Cloud IAM `__. + + .. code-block:: + + from google.cloud import servicecontrol_v1 + + def sample_report(): + # Create a client + client = servicecontrol_v1.ServiceControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.ReportRequest( + ) + + # Make the request + response = client.report(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.servicecontrol_v1.types.ReportRequest, dict]): The request object. Request message for the Report diff --git a/google/cloud/servicecontrol_v1/services/service_controller/client.py b/google/cloud/servicecontrol_v1/services/service_controller/client.py index e5f1e78..4c44545 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/client.py @@ -417,6 +417,26 @@ def check( permission on the specified service. For more information, see `Cloud IAM `__. + + + .. code-block:: + + from google.cloud import servicecontrol_v1 + + def sample_check(): + # Create a client + client = servicecontrol_v1.ServiceControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.CheckRequest( + ) + + # Make the request + response = client.check(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.servicecontrol_v1.types.CheckRequest, dict]): The request object. Request message for the Check @@ -478,6 +498,26 @@ def report( permission on the specified service. For more information, see `Google Cloud IAM `__. + + + .. code-block:: + + from google.cloud import servicecontrol_v1 + + def sample_report(): + # Create a client + client = servicecontrol_v1.ServiceControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.ReportRequest( + ) + + # Make the request + response = client.report(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.servicecontrol_v1.types.ReportRequest, dict]): The request object. Request message for the Report diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py new file mode 100644 index 0000000..dd42a29 --- /dev/null +++ b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# 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 +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for AllocateQuota +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-service-control + + +# [START servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_async] +from google.cloud import servicecontrol_v1 + + +async def sample_allocate_quota(): + # Create a client + client = servicecontrol_v1.QuotaControllerAsyncClient() + + # Initialize request argument(s) + request = servicecontrol_v1.AllocateQuotaRequest( + ) + + # Make the request + response = await client.allocate_quota(request=request) + + # Handle the response + print(response) + +# [END servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_async] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py new file mode 100644 index 0000000..a08ca2e --- /dev/null +++ b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# 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 +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for AllocateQuota +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-service-control + + +# [START servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_sync] +from google.cloud import servicecontrol_v1 + + +def sample_allocate_quota(): + # Create a client + client = servicecontrol_v1.QuotaControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.AllocateQuotaRequest( + ) + + # Make the request + response = client.allocate_quota(request=request) + + # Handle the response + print(response) + +# [END servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_sync] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py new file mode 100644 index 0000000..16b0e6f --- /dev/null +++ b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# 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 +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Check +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-service-control + + +# [START servicecontrol_generated_servicecontrol_v1_ServiceController_Check_async] +from google.cloud import servicecontrol_v1 + + +async def sample_check(): + # Create a client + client = servicecontrol_v1.ServiceControllerAsyncClient() + + # Initialize request argument(s) + request = servicecontrol_v1.CheckRequest( + ) + + # Make the request + response = await client.check(request=request) + + # Handle the response + print(response) + +# [END servicecontrol_generated_servicecontrol_v1_ServiceController_Check_async] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py new file mode 100644 index 0000000..2a69f49 --- /dev/null +++ b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# 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 +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Check +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-service-control + + +# [START servicecontrol_generated_servicecontrol_v1_ServiceController_Check_sync] +from google.cloud import servicecontrol_v1 + + +def sample_check(): + # Create a client + client = servicecontrol_v1.ServiceControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.CheckRequest( + ) + + # Make the request + response = client.check(request=request) + + # Handle the response + print(response) + +# [END servicecontrol_generated_servicecontrol_v1_ServiceController_Check_sync] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py new file mode 100644 index 0000000..cbb6cf9 --- /dev/null +++ b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# 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 +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Report +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-service-control + + +# [START servicecontrol_generated_servicecontrol_v1_ServiceController_Report_async] +from google.cloud import servicecontrol_v1 + + +async def sample_report(): + # Create a client + client = servicecontrol_v1.ServiceControllerAsyncClient() + + # Initialize request argument(s) + request = servicecontrol_v1.ReportRequest( + ) + + # Make the request + response = await client.report(request=request) + + # Handle the response + print(response) + +# [END servicecontrol_generated_servicecontrol_v1_ServiceController_Report_async] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py new file mode 100644 index 0000000..05a7136 --- /dev/null +++ b/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# 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 +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for Report +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-service-control + + +# [START servicecontrol_generated_servicecontrol_v1_ServiceController_Report_sync] +from google.cloud import servicecontrol_v1 + + +def sample_report(): + # Create a client + client = servicecontrol_v1.ServiceControllerClient() + + # Initialize request argument(s) + request = servicecontrol_v1.ReportRequest( + ) + + # Make the request + response = client.report(request=request) + + # Handle the response + print(response) + +# [END servicecontrol_generated_servicecontrol_v1_ServiceController_Report_sync] diff --git a/samples/generated_samples/snippet_metadata_servicecontrol_v1.json b/samples/generated_samples/snippet_metadata_servicecontrol_v1.json new file mode 100644 index 0000000..739a5ec --- /dev/null +++ b/samples/generated_samples/snippet_metadata_servicecontrol_v1.json @@ -0,0 +1,271 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "QuotaController" + }, + "shortName": "AllocateQuota" + } + }, + "file": "servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py", + "regionTag": "servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "QuotaController" + }, + "shortName": "AllocateQuota" + } + }, + "file": "servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py", + "regionTag": "servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ServiceController" + }, + "shortName": "Check" + } + }, + "file": "servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py", + "regionTag": "servicecontrol_generated_servicecontrol_v1_ServiceController_Check_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ServiceController" + }, + "shortName": "Check" + } + }, + "file": "servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py", + "regionTag": "servicecontrol_generated_servicecontrol_v1_ServiceController_Check_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ServiceController" + }, + "shortName": "Report" + } + }, + "file": "servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py", + "regionTag": "servicecontrol_generated_servicecontrol_v1_ServiceController_Report_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ServiceController" + }, + "shortName": "Report" + } + }, + "file": "servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py", + "regionTag": "servicecontrol_generated_servicecontrol_v1_ServiceController_Report_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} From d6f7dedbbc6620cdd74f63c19ccba82a847fa8d4 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Tue, 15 Feb 2022 09:20:56 -0700 Subject: [PATCH 13/16] fix(deps): remove unused libcst dependency (#104) --- setup.py | 3 ++- testing/constraints-3.6.txt | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f50d930..52a594e 100644 --- a/setup.py +++ b/setup.py @@ -29,9 +29,9 @@ # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.28.0, <3.0.0dev", - "libcst >= 0.2.5", "proto-plus >= 1.15.0", ] +extras = {} package_root = os.path.abspath(os.path.dirname(__file__)) @@ -52,6 +52,7 @@ platforms="Posix; MacOS X; Windows", include_package_data=True, install_requires=dependencies, + extras_require=extras, python_requires=">=3.6", classifiers=[ release_status, diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index d5ee700..aff6bee 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -6,5 +6,4 @@ # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 google-api-core==1.28.0 -libcst==0.2.5 proto-plus==1.15.0 From 8431c3cc337d8a6b51e3a77550c006e586a4b87b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 25 Feb 2022 09:29:43 -0700 Subject: [PATCH 14/16] chore: use gapic-generator-python 0.63.4 (#105) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.4 chore: fix snippet region tag format chore: fix docstring code block formatting PiperOrigin-RevId: 430730865 Source-Link: https://github.com/googleapis/googleapis/commit/ea5800229f73f94fd7204915a86ed09dcddf429a Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca893ff8af25fc7fe001de1405a517d80446ecca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: delete duplicates Co-authored-by: Owl Bot Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- .../services/quota_controller/async_client.py | 2 +- .../services/quota_controller/client.py | 3 +-- .../service_controller/async_client.py | 4 ++-- .../services/service_controller/client.py | 6 ++--- ..._quota_controller_allocate_quota_async.py} | 4 ++-- ...d_quota_controller_allocate_quota_sync.py} | 4 ++-- ...nerated_service_controller_check_async.py} | 4 ++-- ...enerated_service_controller_check_sync.py} | 4 ++-- ...erated_service_controller_report_async.py} | 4 ++-- ...nerated_service_controller_report_sync.py} | 4 ++-- .../snippet_metadata_servicecontrol_v1.json | 24 +++++++++---------- 11 files changed, 30 insertions(+), 33 deletions(-) rename samples/generated_samples/{servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py => servicecontrol_v1_generated_quota_controller_allocate_quota_async.py} (88%) rename samples/generated_samples/{servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py => servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py} (88%) rename samples/generated_samples/{servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py => servicecontrol_v1_generated_service_controller_check_async.py} (88%) rename samples/generated_samples/{servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py => servicecontrol_v1_generated_service_controller_check_sync.py} (88%) rename samples/generated_samples/{servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py => servicecontrol_v1_generated_service_controller_report_async.py} (88%) rename samples/generated_samples/{servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py => servicecontrol_v1_generated_service_controller_report_sync.py} (88%) diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py index 0f4c159..75d34a0 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py @@ -226,7 +226,7 @@ async def allocate_quota( functionality. - .. code-block:: + .. code-block:: python from google.cloud import servicecontrol_v1 diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/client.py b/google/cloud/servicecontrol_v1/services/quota_controller/client.py index 19aef34..cd7f2ff 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/client.py @@ -409,8 +409,7 @@ def allocate_quota( functionality. - - .. code-block:: + .. code-block:: python from google.cloud import servicecontrol_v1 diff --git a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py index e811ea9..6c349de 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py @@ -233,7 +233,7 @@ async def check( `Cloud IAM `__. - .. code-block:: + .. code-block:: python from google.cloud import servicecontrol_v1 @@ -321,7 +321,7 @@ async def report( `Google Cloud IAM `__. - .. code-block:: + .. code-block:: python from google.cloud import servicecontrol_v1 diff --git a/google/cloud/servicecontrol_v1/services/service_controller/client.py b/google/cloud/servicecontrol_v1/services/service_controller/client.py index 4c44545..6b7c148 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/client.py @@ -418,8 +418,7 @@ def check( `Cloud IAM `__. - - .. code-block:: + .. code-block:: python from google.cloud import servicecontrol_v1 @@ -499,8 +498,7 @@ def report( `Google Cloud IAM `__. - - .. code-block:: + .. code-block:: python from google.cloud import servicecontrol_v1 diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py b/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_async.py similarity index 88% rename from samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py rename to samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_async.py index dd42a29..0b552fe 100644 --- a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py +++ b/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-service-control -# [START servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_async] +# [START servicecontrol_v1_generated_QuotaController_AllocateQuota_async] from google.cloud import servicecontrol_v1 @@ -41,4 +41,4 @@ async def sample_allocate_quota(): # Handle the response print(response) -# [END servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_async] +# [END servicecontrol_v1_generated_QuotaController_AllocateQuota_async] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py b/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py similarity index 88% rename from samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py rename to samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py index a08ca2e..9b291df 100644 --- a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py +++ b/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-service-control -# [START servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_sync] +# [START servicecontrol_v1_generated_QuotaController_AllocateQuota_sync] from google.cloud import servicecontrol_v1 @@ -41,4 +41,4 @@ def sample_allocate_quota(): # Handle the response print(response) -# [END servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_sync] +# [END servicecontrol_v1_generated_QuotaController_AllocateQuota_sync] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py b/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_async.py similarity index 88% rename from samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py rename to samples/generated_samples/servicecontrol_v1_generated_service_controller_check_async.py index 16b0e6f..5309d09 100644 --- a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py +++ b/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-service-control -# [START servicecontrol_generated_servicecontrol_v1_ServiceController_Check_async] +# [START servicecontrol_v1_generated_ServiceController_Check_async] from google.cloud import servicecontrol_v1 @@ -41,4 +41,4 @@ async def sample_check(): # Handle the response print(response) -# [END servicecontrol_generated_servicecontrol_v1_ServiceController_Check_async] +# [END servicecontrol_v1_generated_ServiceController_Check_async] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py b/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_sync.py similarity index 88% rename from samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py rename to samples/generated_samples/servicecontrol_v1_generated_service_controller_check_sync.py index 2a69f49..cb78950 100644 --- a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py +++ b/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-service-control -# [START servicecontrol_generated_servicecontrol_v1_ServiceController_Check_sync] +# [START servicecontrol_v1_generated_ServiceController_Check_sync] from google.cloud import servicecontrol_v1 @@ -41,4 +41,4 @@ def sample_check(): # Handle the response print(response) -# [END servicecontrol_generated_servicecontrol_v1_ServiceController_Check_sync] +# [END servicecontrol_v1_generated_ServiceController_Check_sync] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py b/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_async.py similarity index 88% rename from samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py rename to samples/generated_samples/servicecontrol_v1_generated_service_controller_report_async.py index cbb6cf9..faa214a 100644 --- a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py +++ b/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_async.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-service-control -# [START servicecontrol_generated_servicecontrol_v1_ServiceController_Report_async] +# [START servicecontrol_v1_generated_ServiceController_Report_async] from google.cloud import servicecontrol_v1 @@ -41,4 +41,4 @@ async def sample_report(): # Handle the response print(response) -# [END servicecontrol_generated_servicecontrol_v1_ServiceController_Report_async] +# [END servicecontrol_v1_generated_ServiceController_Report_async] diff --git a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py b/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_sync.py similarity index 88% rename from samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py rename to samples/generated_samples/servicecontrol_v1_generated_service_controller_report_sync.py index 05a7136..2926b06 100644 --- a/samples/generated_samples/servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py +++ b/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_sync.py @@ -23,7 +23,7 @@ # python3 -m pip install google-cloud-service-control -# [START servicecontrol_generated_servicecontrol_v1_ServiceController_Report_sync] +# [START servicecontrol_v1_generated_ServiceController_Report_sync] from google.cloud import servicecontrol_v1 @@ -41,4 +41,4 @@ def sample_report(): # Handle the response print(response) -# [END servicecontrol_generated_servicecontrol_v1_ServiceController_Report_sync] +# [END servicecontrol_v1_generated_ServiceController_Report_sync] diff --git a/samples/generated_samples/snippet_metadata_servicecontrol_v1.json b/samples/generated_samples/snippet_metadata_servicecontrol_v1.json index 739a5ec..5825e62 100644 --- a/samples/generated_samples/snippet_metadata_servicecontrol_v1.json +++ b/samples/generated_samples/snippet_metadata_servicecontrol_v1.json @@ -10,8 +10,8 @@ "shortName": "AllocateQuota" } }, - "file": "servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_async.py", - "regionTag": "servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_async", + "file": "servicecontrol_v1_generated_quota_controller_allocate_quota_async.py", + "regionTag": "servicecontrol_v1_generated_QuotaController_AllocateQuota_async", "segments": [ { "end": 43, @@ -54,8 +54,8 @@ "shortName": "AllocateQuota" } }, - "file": "servicecontrol_generated_servicecontrol_v1_quota_controller_allocate_quota_sync.py", - "regionTag": "servicecontrol_generated_servicecontrol_v1_QuotaController_AllocateQuota_sync", + "file": "servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py", + "regionTag": "servicecontrol_v1_generated_QuotaController_AllocateQuota_sync", "segments": [ { "end": 43, @@ -99,8 +99,8 @@ "shortName": "Check" } }, - "file": "servicecontrol_generated_servicecontrol_v1_service_controller_check_async.py", - "regionTag": "servicecontrol_generated_servicecontrol_v1_ServiceController_Check_async", + "file": "servicecontrol_v1_generated_service_controller_check_async.py", + "regionTag": "servicecontrol_v1_generated_ServiceController_Check_async", "segments": [ { "end": 43, @@ -143,8 +143,8 @@ "shortName": "Check" } }, - "file": "servicecontrol_generated_servicecontrol_v1_service_controller_check_sync.py", - "regionTag": "servicecontrol_generated_servicecontrol_v1_ServiceController_Check_sync", + "file": "servicecontrol_v1_generated_service_controller_check_sync.py", + "regionTag": "servicecontrol_v1_generated_ServiceController_Check_sync", "segments": [ { "end": 43, @@ -188,8 +188,8 @@ "shortName": "Report" } }, - "file": "servicecontrol_generated_servicecontrol_v1_service_controller_report_async.py", - "regionTag": "servicecontrol_generated_servicecontrol_v1_ServiceController_Report_async", + "file": "servicecontrol_v1_generated_service_controller_report_async.py", + "regionTag": "servicecontrol_v1_generated_ServiceController_Report_async", "segments": [ { "end": 43, @@ -232,8 +232,8 @@ "shortName": "Report" } }, - "file": "servicecontrol_generated_servicecontrol_v1_service_controller_report_sync.py", - "regionTag": "servicecontrol_generated_servicecontrol_v1_ServiceController_Report_sync", + "file": "servicecontrol_v1_generated_service_controller_report_sync.py", + "regionTag": "servicecontrol_v1_generated_ServiceController_Report_sync", "segments": [ { "end": 43, From bdffca6e780000c1d18f476cdcc82d31693661de Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 26 Feb 2022 05:32:06 -0500 Subject: [PATCH 15/16] chore: update copyright year to 2022 (#106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update copyright year to 2022 PiperOrigin-RevId: 431037888 Source-Link: https://github.com/googleapis/googleapis/commit/b3397f5febbf21dfc69b875ddabaf76bee765058 Source-Link: https://github.com/googleapis/googleapis-gen/commit/510b54e1cdefd53173984df16645081308fe897e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTEwYjU0ZTFjZGVmZDUzMTczOTg0ZGYxNjY0NTA4MTMwOGZlODk3ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- google/cloud/servicecontrol/__init__.py | 2 +- google/cloud/servicecontrol_v1/__init__.py | 2 +- google/cloud/servicecontrol_v1/services/__init__.py | 2 +- .../servicecontrol_v1/services/quota_controller/__init__.py | 2 +- .../servicecontrol_v1/services/quota_controller/async_client.py | 2 +- .../cloud/servicecontrol_v1/services/quota_controller/client.py | 2 +- .../services/quota_controller/transports/__init__.py | 2 +- .../services/quota_controller/transports/base.py | 2 +- .../services/quota_controller/transports/grpc.py | 2 +- .../services/quota_controller/transports/grpc_asyncio.py | 2 +- .../servicecontrol_v1/services/service_controller/__init__.py | 2 +- .../services/service_controller/async_client.py | 2 +- .../servicecontrol_v1/services/service_controller/client.py | 2 +- .../services/service_controller/transports/__init__.py | 2 +- .../services/service_controller/transports/base.py | 2 +- .../services/service_controller/transports/grpc.py | 2 +- .../services/service_controller/transports/grpc_asyncio.py | 2 +- google/cloud/servicecontrol_v1/types/__init__.py | 2 +- google/cloud/servicecontrol_v1/types/check_error.py | 2 +- google/cloud/servicecontrol_v1/types/distribution.py | 2 +- google/cloud/servicecontrol_v1/types/http_request.py | 2 +- google/cloud/servicecontrol_v1/types/log_entry.py | 2 +- google/cloud/servicecontrol_v1/types/metric_value.py | 2 +- google/cloud/servicecontrol_v1/types/operation.py | 2 +- google/cloud/servicecontrol_v1/types/quota_controller.py | 2 +- google/cloud/servicecontrol_v1/types/service_controller.py | 2 +- ...ontrol_v1_generated_quota_controller_allocate_quota_async.py | 2 +- ...control_v1_generated_quota_controller_allocate_quota_sync.py | 2 +- ...ervicecontrol_v1_generated_service_controller_check_async.py | 2 +- ...servicecontrol_v1_generated_service_controller_check_sync.py | 2 +- ...rvicecontrol_v1_generated_service_controller_report_async.py | 2 +- ...ervicecontrol_v1_generated_service_controller_report_sync.py | 2 +- scripts/fixup_servicecontrol_v1_keywords.py | 2 +- tests/__init__.py | 2 +- tests/unit/__init__.py | 2 +- tests/unit/gapic/__init__.py | 2 +- tests/unit/gapic/servicecontrol_v1/__init__.py | 2 +- tests/unit/gapic/servicecontrol_v1/test_quota_controller.py | 2 +- tests/unit/gapic/servicecontrol_v1/test_service_controller.py | 2 +- 39 files changed, 39 insertions(+), 39 deletions(-) diff --git a/google/cloud/servicecontrol/__init__.py b/google/cloud/servicecontrol/__init__.py index ed26273..e62f757 100644 --- a/google/cloud/servicecontrol/__init__.py +++ b/google/cloud/servicecontrol/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/__init__.py b/google/cloud/servicecontrol_v1/__init__.py index 5d53ac5..3d8be27 100644 --- a/google/cloud/servicecontrol_v1/__init__.py +++ b/google/cloud/servicecontrol_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/__init__.py b/google/cloud/servicecontrol_v1/services/__init__.py index 4de6597..e8e1c38 100644 --- a/google/cloud/servicecontrol_v1/services/__init__.py +++ b/google/cloud/servicecontrol_v1/services/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/__init__.py b/google/cloud/servicecontrol_v1/services/quota_controller/__init__.py index 75db06f..ba1c63c 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/__init__.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py index 75d34a0..e3263a0 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/client.py b/google/cloud/servicecontrol_v1/services/quota_controller/client.py index cd7f2ff..cefb384 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/__init__.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/__init__.py index d00d592..234b798 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/__init__.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py index 8099043..0725166 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py index 0c229e6..3c979e2 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py index da1c51d..f6923ab 100644 --- a/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py +++ b/google/cloud/servicecontrol_v1/services/quota_controller/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/service_controller/__init__.py b/google/cloud/servicecontrol_v1/services/service_controller/__init__.py index 955da28..a96808b 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/__init__.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py index 6c349de..aa799b1 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/async_client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/async_client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/service_controller/client.py b/google/cloud/servicecontrol_v1/services/service_controller/client.py index 6b7c148..904d682 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/client.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/client.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/__init__.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/__init__.py index 1be8f8c..c7f03a6 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/__init__.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py index bb78aa3..0f50cb4 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/base.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py index 7d52010..3af558c 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py index 883a999..3188995 100644 --- a/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py +++ b/google/cloud/servicecontrol_v1/services/service_controller/transports/grpc_asyncio.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/__init__.py b/google/cloud/servicecontrol_v1/types/__init__.py index 82e29a3..45f99a4 100644 --- a/google/cloud/servicecontrol_v1/types/__init__.py +++ b/google/cloud/servicecontrol_v1/types/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/check_error.py b/google/cloud/servicecontrol_v1/types/check_error.py index b8baeb8..f264c81 100644 --- a/google/cloud/servicecontrol_v1/types/check_error.py +++ b/google/cloud/servicecontrol_v1/types/check_error.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/distribution.py b/google/cloud/servicecontrol_v1/types/distribution.py index e145d45..1063494 100644 --- a/google/cloud/servicecontrol_v1/types/distribution.py +++ b/google/cloud/servicecontrol_v1/types/distribution.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/http_request.py b/google/cloud/servicecontrol_v1/types/http_request.py index 53374bb..6fe2c3b 100644 --- a/google/cloud/servicecontrol_v1/types/http_request.py +++ b/google/cloud/servicecontrol_v1/types/http_request.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/log_entry.py b/google/cloud/servicecontrol_v1/types/log_entry.py index edc058a..3d1c6bf 100644 --- a/google/cloud/servicecontrol_v1/types/log_entry.py +++ b/google/cloud/servicecontrol_v1/types/log_entry.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/metric_value.py b/google/cloud/servicecontrol_v1/types/metric_value.py index 219df73..a739b3f 100644 --- a/google/cloud/servicecontrol_v1/types/metric_value.py +++ b/google/cloud/servicecontrol_v1/types/metric_value.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/operation.py b/google/cloud/servicecontrol_v1/types/operation.py index debcea7..b89542d 100644 --- a/google/cloud/servicecontrol_v1/types/operation.py +++ b/google/cloud/servicecontrol_v1/types/operation.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/quota_controller.py b/google/cloud/servicecontrol_v1/types/quota_controller.py index 3c54e1e..99f944f 100644 --- a/google/cloud/servicecontrol_v1/types/quota_controller.py +++ b/google/cloud/servicecontrol_v1/types/quota_controller.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/servicecontrol_v1/types/service_controller.py b/google/cloud/servicecontrol_v1/types/service_controller.py index aa4b73b..beb1af7 100644 --- a/google/cloud/servicecontrol_v1/types/service_controller.py +++ b/google/cloud/servicecontrol_v1/types/service_controller.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_async.py b/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_async.py index 0b552fe..09b0ef8 100644 --- a/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_async.py +++ b/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py b/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py index 9b291df..66a4aa9 100644 --- a/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py +++ b/samples/generated_samples/servicecontrol_v1_generated_quota_controller_allocate_quota_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_async.py b/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_async.py index 5309d09..dd7c632 100644 --- a/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_async.py +++ b/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_sync.py b/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_sync.py index cb78950..5caf38e 100644 --- a/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_sync.py +++ b/samples/generated_samples/servicecontrol_v1_generated_service_controller_check_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_async.py b/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_async.py index faa214a..9b43811 100644 --- a/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_async.py +++ b/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_sync.py b/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_sync.py index 2926b06..285da94 100644 --- a/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_sync.py +++ b/samples/generated_samples/servicecontrol_v1_generated_service_controller_report_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/scripts/fixup_servicecontrol_v1_keywords.py b/scripts/fixup_servicecontrol_v1_keywords.py index 0928feb..875c8ab 100644 --- a/scripts/fixup_servicecontrol_v1_keywords.py +++ b/scripts/fixup_servicecontrol_v1_keywords.py @@ -1,6 +1,6 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/__init__.py b/tests/__init__.py index 4de6597..e8e1c38 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index 4de6597..e8e1c38 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py index 4de6597..e8e1c38 100644 --- a/tests/unit/gapic/__init__.py +++ b/tests/unit/gapic/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/servicecontrol_v1/__init__.py b/tests/unit/gapic/servicecontrol_v1/__init__.py index 4de6597..e8e1c38 100644 --- a/tests/unit/gapic/servicecontrol_v1/__init__.py +++ b/tests/unit/gapic/servicecontrol_v1/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py b/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py index 75b5164..7e1997e 100644 --- a/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py +++ b/tests/unit/gapic/servicecontrol_v1/test_quota_controller.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/servicecontrol_v1/test_service_controller.py b/tests/unit/gapic/servicecontrol_v1/test_service_controller.py index 74fc133..9947535 100644 --- a/tests/unit/gapic/servicecontrol_v1/test_service_controller.py +++ b/tests/unit/gapic/servicecontrol_v1/test_service_controller.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From b17968b6a98ee375fea3093be522f36a04d71f59 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 28 Feb 2022 17:49:42 -0500 Subject: [PATCH 16/16] chore(main): release 1.3.0 (#99) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 13 +++++++++++++ setup.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efdbfe9..5466777 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [1.3.0](https://github.com/googleapis/python-service-control/compare/v1.2.1...v1.3.0) (2022-02-26) + + +### Features + +* add api key support ([#98](https://github.com/googleapis/python-service-control/issues/98)) ([ca4238f](https://github.com/googleapis/python-service-control/commit/ca4238f594bfd2cfb851b6f2e354b130f269c09d)) + + +### Bug Fixes + +* **deps:** remove unused libcst dependency ([#104](https://github.com/googleapis/python-service-control/issues/104)) ([d6f7ded](https://github.com/googleapis/python-service-control/commit/d6f7dedbbc6620cdd74f63c19ccba82a847fa8d4)) +* resolve DuplicateCredentialArgs error when using credentials_file ([91d18fa](https://github.com/googleapis/python-service-control/commit/91d18fae62221a55202ded68ec0d0551ca3202a4)) + ### [1.2.1](https://www.github.com/googleapis/python-service-control/compare/v1.2.0...v1.2.1) (2021-11-01) diff --git a/setup.py b/setup.py index 52a594e..7bca3c7 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore name = "google-cloud-service-control" -version = "1.2.1" +version = "1.3.0" description = "Service Control API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-service-control"