From 55b8936bab2cd925ac31d785c1215ef2c91e5774 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:39:55 -0500 Subject: [PATCH 1/6] chore: Update gapic-generator-python to v1.8.2 (#157) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.8.2 PiperOrigin-RevId: 504289125 Source-Link: https://github.com/googleapis/googleapis/commit/38a48a44a44279e9cf9f2f864b588958a2d87491 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b2dc22663dbe47a972c8d8c2f8a4df013dafdcbc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJkYzIyNjYzZGJlNDdhOTcyYzhkOGMyZjhhNGRmMDEzZGFmZGNiYyJ9 * 🦉 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 --- .coveragerc | 1 + google/cloud/resourcesettings_v1/__init__.py | 2 +- .../snippet_metadata_google.cloud.resourcesettings.v1.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.coveragerc b/.coveragerc index 047eec4..5d4a8de 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,6 +5,7 @@ branch = True show_missing = True omit = google/cloud/resourcesettings/__init__.py + google/cloud/resourcesettings/gapic_version.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER diff --git a/google/cloud/resourcesettings_v1/__init__.py b/google/cloud/resourcesettings_v1/__init__.py index 55ab0e2..95bde48 100644 --- a/google/cloud/resourcesettings_v1/__init__.py +++ b/google/cloud/resourcesettings_v1/__init__.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from google.cloud.resourcesettings import gapic_version as package_version +from google.cloud.resourcesettings_v1 import gapic_version as package_version __version__ = package_version.__version__ diff --git a/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json index a6117df..3465a96 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-resource-settings", - "version": "1.6.1" + "version": "0.1.0" }, "snippets": [ { From aa60ed98aa961a3e4ee9672c371ec7603995ff69 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 16:46:13 +0000 Subject: [PATCH 2/6] chore: fix prerelease_deps nox session [autoapprove] (#158) Source-Link: https://togithub.com/googleapis/synthtool/commit/26c7505b2f76981ec1707b851e1595c8c06e90fc Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790 --- .github/.OwlBot.lock.yaml | 2 +- noxfile.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 889f77d..f0f3b24 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320 + digest: sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790 diff --git a/noxfile.py b/noxfile.py index e716318..95e58c5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -189,9 +189,9 @@ def unit(session): def install_systemtest_dependencies(session, *constraints): # Use pre-release gRPC for system tests. - # Exclude version 1.49.0rc1 which has a known issue. - # See https://github.com/grpc/grpc/pull/30642 - session.install("--pre", "grpcio!=1.49.0rc1") + # Exclude version 1.52.0rc1 which has a known issue. + # See https://github.com/grpc/grpc/issues/32163 + session.install("--pre", "grpcio!=1.52.0rc1") session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) @@ -346,9 +346,7 @@ def prerelease_deps(session): unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES session.install(*unit_deps_all) system_deps_all = ( - SYSTEM_TEST_STANDARD_DEPENDENCIES - + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - + SYSTEM_TEST_EXTRAS + SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES ) session.install(*system_deps_all) @@ -378,8 +376,8 @@ def prerelease_deps(session): # dependency of grpc "six", "googleapis-common-protos", - # Exclude version 1.49.0rc1 which has a known issue. See https://github.com/grpc/grpc/pull/30642 - "grpcio!=1.49.0rc1", + # Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163 + "grpcio!=1.52.0rc1", "grpcio-status", "google-api-core", "proto-plus", From 68f8369e2798af666bdc090416746deb0e99d84b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 15:31:46 -0500 Subject: [PATCH 3/6] chore: Update gapic-generator-python to v1.8.4 (#159) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.8.4 PiperOrigin-RevId: 507808936 Source-Link: https://github.com/googleapis/googleapis/commit/64cf8492b21778ce62c66ecee81b468a293bfd4c Source-Link: https://github.com/googleapis/googleapis-gen/commit/53c48cac153d3b37f3d2c2dec4830cfd91ec4153 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTNjNDhjYWMxNTNkM2IzN2YzZDJjMmRlYzQ4MzBjZmQ5MWVjNDE1MyJ9 * 🦉 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 --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 2d4110e..1afca1f 100644 --- a/setup.py +++ b/setup.py @@ -57,9 +57,7 @@ if package.startswith("google") ] -namespaces = ["google"] -if "google.cloud" in packages: - namespaces.append("google.cloud") +namespaces = ["google", "google.cloud"] setuptools.setup( name=name, From 724c2499683bce47aa7691e4255ce37fd2442de7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 8 Feb 2023 15:18:44 +0000 Subject: [PATCH 4/6] build(deps): bump cryptography from 38.0.3 to 39.0.1 in /synthtool/gcp/templates/python_library/.kokoro (#160) Source-Link: https://togithub.com/googleapis/synthtool/commit/bb171351c3946d3c3c32e60f5f18cee8c464ec51 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/requirements.txt | 49 ++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f0f3b24..894fb6b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790 + digest: sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 05dc467..096e480 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,33 +113,28 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==38.0.3 \ - --hash=sha256:068147f32fa662c81aebab95c74679b401b12b57494872886eb5c1139250ec5d \ - --hash=sha256:06fc3cc7b6f6cca87bd56ec80a580c88f1da5306f505876a71c8cfa7050257dd \ - --hash=sha256:25c1d1f19729fb09d42e06b4bf9895212292cb27bb50229f5aa64d039ab29146 \ - --hash=sha256:402852a0aea73833d982cabb6d0c3bb582c15483d29fb7085ef2c42bfa7e38d7 \ - --hash=sha256:4e269dcd9b102c5a3d72be3c45d8ce20377b8076a43cbed6f660a1afe365e436 \ - --hash=sha256:5419a127426084933076132d317911e3c6eb77568a1ce23c3ac1e12d111e61e0 \ - --hash=sha256:554bec92ee7d1e9d10ded2f7e92a5d70c1f74ba9524947c0ba0c850c7b011828 \ - --hash=sha256:5e89468fbd2fcd733b5899333bc54d0d06c80e04cd23d8c6f3e0542358c6060b \ - --hash=sha256:65535bc550b70bd6271984d9863a37741352b4aad6fb1b3344a54e6950249b55 \ - --hash=sha256:6ab9516b85bebe7aa83f309bacc5f44a61eeb90d0b4ec125d2d003ce41932d36 \ - --hash=sha256:6addc3b6d593cd980989261dc1cce38263c76954d758c3c94de51f1e010c9a50 \ - --hash=sha256:728f2694fa743a996d7784a6194da430f197d5c58e2f4e278612b359f455e4a2 \ - --hash=sha256:785e4056b5a8b28f05a533fab69febf5004458e20dad7e2e13a3120d8ecec75a \ - --hash=sha256:78cf5eefac2b52c10398a42765bfa981ce2372cbc0457e6bf9658f41ec3c41d8 \ - --hash=sha256:7f836217000342d448e1c9a342e9163149e45d5b5eca76a30e84503a5a96cab0 \ - --hash=sha256:8d41a46251bf0634e21fac50ffd643216ccecfaf3701a063257fe0b2be1b6548 \ - --hash=sha256:984fe150f350a3c91e84de405fe49e688aa6092b3525f407a18b9646f6612320 \ - --hash=sha256:9b24bcff7853ed18a63cfb0c2b008936a9554af24af2fb146e16d8e1aed75748 \ - --hash=sha256:b1b35d9d3a65542ed2e9d90115dfd16bbc027b3f07ee3304fc83580f26e43249 \ - --hash=sha256:b1b52c9e5f8aa2b802d48bd693190341fae201ea51c7a167d69fc48b60e8a959 \ - --hash=sha256:bbf203f1a814007ce24bd4d51362991d5cb90ba0c177a9c08825f2cc304d871f \ - --hash=sha256:be243c7e2bfcf6cc4cb350c0d5cdf15ca6383bbcb2a8ef51d3c9411a9d4386f0 \ - --hash=sha256:bfbe6ee19615b07a98b1d2287d6a6073f734735b49ee45b11324d85efc4d5cbd \ - --hash=sha256:c46837ea467ed1efea562bbeb543994c2d1f6e800785bd5a2c98bc096f5cb220 \ - --hash=sha256:dfb4f4dd568de1b6af9f4cda334adf7d72cf5bc052516e1b2608b683375dd95c \ - --hash=sha256:ed7b00096790213e09eb11c97cc6e2b757f15f3d2f85833cd2d3ec3fe37c1722 +cryptography==39.0.1 \ + --hash=sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4 \ + --hash=sha256:35f7c7d015d474f4011e859e93e789c87d21f6f4880ebdc29896a60403328f1f \ + --hash=sha256:5aa67414fcdfa22cf052e640cb5ddc461924a045cacf325cd164e65312d99502 \ + --hash=sha256:5d2d8b87a490bfcd407ed9d49093793d0f75198a35e6eb1a923ce1ee86c62b41 \ + --hash=sha256:6687ef6d0a6497e2b58e7c5b852b53f62142cfa7cd1555795758934da363a965 \ + --hash=sha256:6f8ba7f0328b79f08bdacc3e4e66fb4d7aab0c3584e0bd41328dce5262e26b2e \ + --hash=sha256:706843b48f9a3f9b9911979761c91541e3d90db1ca905fd63fee540a217698bc \ + --hash=sha256:807ce09d4434881ca3a7594733669bd834f5b2c6d5c7e36f8c00f691887042ad \ + --hash=sha256:83e17b26de248c33f3acffb922748151d71827d6021d98c70e6c1a25ddd78505 \ + --hash=sha256:96f1157a7c08b5b189b16b47bc9db2332269d6680a196341bf30046330d15388 \ + --hash=sha256:aec5a6c9864be7df2240c382740fcf3b96928c46604eaa7f3091f58b878c0bb6 \ + --hash=sha256:b0afd054cd42f3d213bf82c629efb1ee5f22eba35bf0eec88ea9ea7304f511a2 \ + --hash=sha256:ced4e447ae29ca194449a3f1ce132ded8fcab06971ef5f618605aacaa612beac \ + --hash=sha256:d1f6198ee6d9148405e49887803907fe8962a23e6c6f83ea7d98f1c0de375695 \ + --hash=sha256:e124352fd3db36a9d4a21c1aa27fd5d051e621845cb87fb851c08f4f75ce8be6 \ + --hash=sha256:e422abdec8b5fa8462aa016786680720d78bdce7a30c652b7fadf83a4ba35336 \ + --hash=sha256:ef8b72fa70b348724ff1218267e7f7375b8de4e8194d1636ee60510aae104cd0 \ + --hash=sha256:f0c64d1bd842ca2633e74a1a28033d139368ad959872533b1bab8c80e8240a0c \ + --hash=sha256:f24077a3b5298a5a06a8e0536e3ea9ec60e4c7ac486755e5fb6e6ea9b3500106 \ + --hash=sha256:fdd188c8a6ef8769f148f88f859884507b954cc64db6b52f66ef199bb9ad660a \ + --hash=sha256:fe913f20024eb2cb2f323e42a64bdf2911bb9738a15dba7d3cce48151034e3a8 # via # gcp-releasetool # secretstorage From 6a98eb582064c411324eb1c11e6da8e33bb14057 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 15:38:57 -0500 Subject: [PATCH 5/6] feat: enable "rest" transport in Python for services supporting numeric enums (#161) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: enable "rest" transport in Python for services supporting numeric enums PiperOrigin-RevId: 508143576 Source-Link: https://github.com/googleapis/googleapis/commit/7a702a989db3b413f39ff8994ca53fb38b6928c2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6ad1279c0e7aa787ac6b66c9fd4a210692edffcd Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmFkMTI3OWMwZTdhYTc4N2FjNmI2NmM5ZmQ0YTIxMDY5MmVkZmZjZCJ9 * 🦉 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 --- .../resourcesettings_v1/gapic_metadata.json | 20 + .../resource_settings_service/client.py | 2 + .../transports/__init__.py | 7 + .../transports/rest.py | 601 +++++++++++ .../test_resource_settings_service.py | 963 +++++++++++++++++- 5 files changed, 1589 insertions(+), 4 deletions(-) create mode 100644 google/cloud/resourcesettings_v1/services/resource_settings_service/transports/rest.py diff --git a/google/cloud/resourcesettings_v1/gapic_metadata.json b/google/cloud/resourcesettings_v1/gapic_metadata.json index 17bb57d..560de6d 100644 --- a/google/cloud/resourcesettings_v1/gapic_metadata.json +++ b/google/cloud/resourcesettings_v1/gapic_metadata.json @@ -46,6 +46,26 @@ ] } } + }, + "rest": { + "libraryClient": "ResourceSettingsServiceClient", + "rpcs": { + "GetSetting": { + "methods": [ + "get_setting" + ] + }, + "ListSettings": { + "methods": [ + "list_settings" + ] + }, + "UpdateSetting": { + "methods": [ + "update_setting" + ] + } + } } } } diff --git a/google/cloud/resourcesettings_v1/services/resource_settings_service/client.py b/google/cloud/resourcesettings_v1/services/resource_settings_service/client.py index 3d0072b..bac5170 100644 --- a/google/cloud/resourcesettings_v1/services/resource_settings_service/client.py +++ b/google/cloud/resourcesettings_v1/services/resource_settings_service/client.py @@ -52,6 +52,7 @@ from .transports.base import DEFAULT_CLIENT_INFO, ResourceSettingsServiceTransport from .transports.grpc import ResourceSettingsServiceGrpcTransport from .transports.grpc_asyncio import ResourceSettingsServiceGrpcAsyncIOTransport +from .transports.rest import ResourceSettingsServiceRestTransport class ResourceSettingsServiceClientMeta(type): @@ -67,6 +68,7 @@ class ResourceSettingsServiceClientMeta(type): ) # type: Dict[str, Type[ResourceSettingsServiceTransport]] _transport_registry["grpc"] = ResourceSettingsServiceGrpcTransport _transport_registry["grpc_asyncio"] = ResourceSettingsServiceGrpcAsyncIOTransport + _transport_registry["rest"] = ResourceSettingsServiceRestTransport def get_transport_class( cls, diff --git a/google/cloud/resourcesettings_v1/services/resource_settings_service/transports/__init__.py b/google/cloud/resourcesettings_v1/services/resource_settings_service/transports/__init__.py index 9c15367..07db7e1 100644 --- a/google/cloud/resourcesettings_v1/services/resource_settings_service/transports/__init__.py +++ b/google/cloud/resourcesettings_v1/services/resource_settings_service/transports/__init__.py @@ -19,6 +19,10 @@ from .base import ResourceSettingsServiceTransport from .grpc import ResourceSettingsServiceGrpcTransport from .grpc_asyncio import ResourceSettingsServiceGrpcAsyncIOTransport +from .rest import ( + ResourceSettingsServiceRestInterceptor, + ResourceSettingsServiceRestTransport, +) # Compile a registry of transports. _transport_registry = ( @@ -26,9 +30,12 @@ ) # type: Dict[str, Type[ResourceSettingsServiceTransport]] _transport_registry["grpc"] = ResourceSettingsServiceGrpcTransport _transport_registry["grpc_asyncio"] = ResourceSettingsServiceGrpcAsyncIOTransport +_transport_registry["rest"] = ResourceSettingsServiceRestTransport __all__ = ( "ResourceSettingsServiceTransport", "ResourceSettingsServiceGrpcTransport", "ResourceSettingsServiceGrpcAsyncIOTransport", + "ResourceSettingsServiceRestTransport", + "ResourceSettingsServiceRestInterceptor", ) diff --git a/google/cloud/resourcesettings_v1/services/resource_settings_service/transports/rest.py b/google/cloud/resourcesettings_v1/services/resource_settings_service/transports/rest.py new file mode 100644 index 0000000..0340c23 --- /dev/null +++ b/google/cloud/resourcesettings_v1/services/resource_settings_service/transports/rest.py @@ -0,0 +1,601 @@ +# -*- coding: utf-8 -*- +# 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. +# + +import dataclasses +import json # type: ignore +import re +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +import warnings + +from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming +from google.api_core import exceptions as core_exceptions +from google.api_core import retry as retries +from google.auth import credentials as ga_credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore +from google.auth.transport.requests import AuthorizedSession # type: ignore +from google.protobuf import json_format +import grpc # type: ignore +from requests import __version__ as requests_version + +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore + + +from google.cloud.resourcesettings_v1.types import resource_settings + +from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO +from .base import ResourceSettingsServiceTransport + +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version, + grpc_version=None, + rest_version=requests_version, +) + + +class ResourceSettingsServiceRestInterceptor: + """Interceptor for ResourceSettingsService. + + Interceptors are used to manipulate requests, request metadata, and responses + in arbitrary ways. + Example use cases include: + * Logging + * Verifying requests according to service or custom semantics + * Stripping extraneous information from responses + + These use cases and more can be enabled by injecting an + instance of a custom subclass when constructing the ResourceSettingsServiceRestTransport. + + .. code-block:: python + class MyCustomResourceSettingsServiceInterceptor(ResourceSettingsServiceRestInterceptor): + def pre_get_setting(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_setting(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_list_settings(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_list_settings(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_update_setting(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_setting(self, response): + logging.log(f"Received response: {response}") + return response + + transport = ResourceSettingsServiceRestTransport(interceptor=MyCustomResourceSettingsServiceInterceptor()) + client = ResourceSettingsServiceClient(transport=transport) + + + """ + + def pre_get_setting( + self, + request: resource_settings.GetSettingRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[resource_settings.GetSettingRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for get_setting + + Override in a subclass to manipulate the request or metadata + before they are sent to the ResourceSettingsService server. + """ + return request, metadata + + def post_get_setting( + self, response: resource_settings.Setting + ) -> resource_settings.Setting: + """Post-rpc interceptor for get_setting + + Override in a subclass to manipulate the response + after it is returned by the ResourceSettingsService server but before + it is returned to user code. + """ + return response + + def pre_list_settings( + self, + request: resource_settings.ListSettingsRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[resource_settings.ListSettingsRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_settings + + Override in a subclass to manipulate the request or metadata + before they are sent to the ResourceSettingsService server. + """ + return request, metadata + + def post_list_settings( + self, response: resource_settings.ListSettingsResponse + ) -> resource_settings.ListSettingsResponse: + """Post-rpc interceptor for list_settings + + Override in a subclass to manipulate the response + after it is returned by the ResourceSettingsService server but before + it is returned to user code. + """ + return response + + def pre_update_setting( + self, + request: resource_settings.UpdateSettingRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[resource_settings.UpdateSettingRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for update_setting + + Override in a subclass to manipulate the request or metadata + before they are sent to the ResourceSettingsService server. + """ + return request, metadata + + def post_update_setting( + self, response: resource_settings.Setting + ) -> resource_settings.Setting: + """Post-rpc interceptor for update_setting + + Override in a subclass to manipulate the response + after it is returned by the ResourceSettingsService server but before + it is returned to user code. + """ + return response + + +@dataclasses.dataclass +class ResourceSettingsServiceRestStub: + _session: AuthorizedSession + _host: str + _interceptor: ResourceSettingsServiceRestInterceptor + + +class ResourceSettingsServiceRestTransport(ResourceSettingsServiceTransport): + """REST backend transport for ResourceSettingsService. + + An interface to interact with resource settings and setting values + throughout the resource hierarchy. + + Services may surface a number of settings for users to control how + their resources behave. Values of settings applied on a given Cloud + resource are evaluated hierarchically and inherited by all + descendants of that resource. + + For all requests, returns a ``google.rpc.Status`` with + ``google.rpc.Code.PERMISSION_DENIED`` if the IAM check fails or the + ``parent`` resource is not in a Cloud Organization. For all + requests, returns a ``google.rpc.Status`` with + ``google.rpc.Code.INVALID_ARGUMENT`` if the request is malformed. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends JSON representations of protocol buffers over HTTP/1.1 + + """ + + def __init__( + self, + *, + host: str = "resourcesettings.googleapis.com", + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, + client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, + always_use_jwt_access: Optional[bool] = False, + url_scheme: str = "https", + interceptor: Optional[ResourceSettingsServiceRestInterceptor] = None, + api_audience: Optional[str] = None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): + The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client + certificate to configure mutual TLS HTTP channel. It is ignored + if ``channel`` is provided. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you are developing + your own client library. + always_use_jwt_access (Optional[bool]): Whether self signed JWT should + be used for service account credentials. + url_scheme: the protocol scheme for the API endpoint. Normally + "https", but for testing or local servers, + "http" can be specified. + """ + # Run the base constructor + # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc. + # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the + # credentials object + maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host) + if maybe_url_match is None: + raise ValueError( + f"Unexpected hostname structure: {host}" + ) # pragma: NO COVER + + url_match_items = maybe_url_match.groupdict() + + host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host + + super().__init__( + host=host, + credentials=credentials, + client_info=client_info, + always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, + ) + self._session = AuthorizedSession( + self._credentials, default_host=self.DEFAULT_HOST + ) + if client_cert_source_for_mtls: + self._session.configure_mtls_channel(client_cert_source_for_mtls) + self._interceptor = interceptor or ResourceSettingsServiceRestInterceptor() + self._prep_wrapped_messages(client_info) + + class _GetSetting(ResourceSettingsServiceRestStub): + def __hash__(self): + return hash("GetSetting") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: resource_settings.GetSettingRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resource_settings.Setting: + r"""Call the get setting method over HTTP. + + Args: + request (~.resource_settings.GetSettingRequest): + The request object. The request for GetSetting. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.resource_settings.Setting: + The schema for settings. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{name=organizations/*/settings/*}", + }, + { + "method": "get", + "uri": "/v1/{name=folders/*/settings/*}", + }, + { + "method": "get", + "uri": "/v1/{name=projects/*/settings/*}", + }, + ] + request, metadata = self._interceptor.pre_get_setting(request, metadata) + pb_request = resource_settings.GetSettingRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resource_settings.Setting() + pb_resp = resource_settings.Setting.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_setting(resp) + return resp + + class _ListSettings(ResourceSettingsServiceRestStub): + def __hash__(self): + return hash("ListSettings") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: resource_settings.ListSettingsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resource_settings.ListSettingsResponse: + r"""Call the list settings method over HTTP. + + Args: + request (~.resource_settings.ListSettingsRequest): + The request object. The request for ListSettings. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.resource_settings.ListSettingsResponse: + The response from ListSettings. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1/{parent=organizations/*}/settings", + }, + { + "method": "get", + "uri": "/v1/{parent=folders/*}/settings", + }, + { + "method": "get", + "uri": "/v1/{parent=projects/*}/settings", + }, + ] + request, metadata = self._interceptor.pre_list_settings(request, metadata) + pb_request = resource_settings.ListSettingsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resource_settings.ListSettingsResponse() + pb_resp = resource_settings.ListSettingsResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_settings(resp) + return resp + + class _UpdateSetting(ResourceSettingsServiceRestStub): + def __hash__(self): + return hash("UpdateSetting") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: resource_settings.UpdateSettingRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resource_settings.Setting: + r"""Call the update setting method over HTTP. + + Args: + request (~.resource_settings.UpdateSettingRequest): + The request object. The request for UpdateSetting. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.resource_settings.Setting: + The schema for settings. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1/{setting.name=organizations/*/settings/*}", + "body": "setting", + }, + { + "method": "patch", + "uri": "/v1/{setting.name=folders/*/settings/*}", + "body": "setting", + }, + { + "method": "patch", + "uri": "/v1/{setting.name=projects/*/settings/*}", + "body": "setting", + }, + ] + request, metadata = self._interceptor.pre_update_setting(request, metadata) + pb_request = resource_settings.UpdateSettingRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resource_settings.Setting() + pb_resp = resource_settings.Setting.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_setting(resp) + return resp + + @property + def get_setting( + self, + ) -> Callable[[resource_settings.GetSettingRequest], resource_settings.Setting]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetSetting(self._session, self._host, self._interceptor) # type: ignore + + @property + def list_settings( + self, + ) -> Callable[ + [resource_settings.ListSettingsRequest], resource_settings.ListSettingsResponse + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListSettings(self._session, self._host, self._interceptor) # type: ignore + + @property + def update_setting( + self, + ) -> Callable[[resource_settings.UpdateSettingRequest], resource_settings.Setting]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateSetting(self._session, self._host, self._interceptor) # type: ignore + + @property + def kind(self) -> str: + return "rest" + + def close(self): + self._session.close() + + +__all__ = ("ResourceSettingsServiceRestTransport",) diff --git a/tests/unit/gapic/resourcesettings_v1/test_resource_settings_service.py b/tests/unit/gapic/resourcesettings_v1/test_resource_settings_service.py index 86e1e03..7ac3702 100644 --- a/tests/unit/gapic/resourcesettings_v1/test_resource_settings_service.py +++ b/tests/unit/gapic/resourcesettings_v1/test_resource_settings_service.py @@ -22,6 +22,8 @@ except ImportError: # pragma: NO COVER import mock +from collections.abc import Iterable +import json import math from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template @@ -31,11 +33,14 @@ from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.oauth2 import service_account +from google.protobuf import json_format import grpc from grpc.experimental import aio from proto.marshal.rules import wrappers from proto.marshal.rules.dates import DurationRule, TimestampRule import pytest +from requests import PreparedRequest, Request, Response +from requests.sessions import Session from google.cloud.resourcesettings_v1.services.resource_settings_service import ( ResourceSettingsServiceAsyncClient, @@ -96,6 +101,7 @@ def test__get_default_mtls_endpoint(): [ (ResourceSettingsServiceClient, "grpc"), (ResourceSettingsServiceAsyncClient, "grpc_asyncio"), + (ResourceSettingsServiceClient, "rest"), ], ) def test_resource_settings_service_client_from_service_account_info( @@ -111,7 +117,11 @@ def test_resource_settings_service_client_from_service_account_info( assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("resourcesettings.googleapis.com:443") + assert client.transport._host == ( + "resourcesettings.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://resourcesettings.googleapis.com" + ) @pytest.mark.parametrize( @@ -119,6 +129,7 @@ def test_resource_settings_service_client_from_service_account_info( [ (transports.ResourceSettingsServiceGrpcTransport, "grpc"), (transports.ResourceSettingsServiceGrpcAsyncIOTransport, "grpc_asyncio"), + (transports.ResourceSettingsServiceRestTransport, "rest"), ], ) def test_resource_settings_service_client_service_account_always_use_jwt( @@ -144,6 +155,7 @@ def test_resource_settings_service_client_service_account_always_use_jwt( [ (ResourceSettingsServiceClient, "grpc"), (ResourceSettingsServiceAsyncClient, "grpc_asyncio"), + (ResourceSettingsServiceClient, "rest"), ], ) def test_resource_settings_service_client_from_service_account_file( @@ -166,13 +178,18 @@ def test_resource_settings_service_client_from_service_account_file( assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == ("resourcesettings.googleapis.com:443") + assert client.transport._host == ( + "resourcesettings.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://resourcesettings.googleapis.com" + ) def test_resource_settings_service_client_get_transport_class(): transport = ResourceSettingsServiceClient.get_transport_class() available_transports = [ transports.ResourceSettingsServiceGrpcTransport, + transports.ResourceSettingsServiceRestTransport, ] assert transport in available_transports @@ -193,6 +210,11 @@ def test_resource_settings_service_client_get_transport_class(): transports.ResourceSettingsServiceGrpcAsyncIOTransport, "grpc_asyncio", ), + ( + ResourceSettingsServiceClient, + transports.ResourceSettingsServiceRestTransport, + "rest", + ), ], ) @mock.patch.object( @@ -348,6 +370,18 @@ def test_resource_settings_service_client_client_options( "grpc_asyncio", "false", ), + ( + ResourceSettingsServiceClient, + transports.ResourceSettingsServiceRestTransport, + "rest", + "true", + ), + ( + ResourceSettingsServiceClient, + transports.ResourceSettingsServiceRestTransport, + "rest", + "false", + ), ], ) @mock.patch.object( @@ -553,6 +587,11 @@ def test_resource_settings_service_client_get_mtls_endpoint_and_cert_source( transports.ResourceSettingsServiceGrpcAsyncIOTransport, "grpc_asyncio", ), + ( + ResourceSettingsServiceClient, + transports.ResourceSettingsServiceRestTransport, + "rest", + ), ], ) def test_resource_settings_service_client_client_options_scopes( @@ -593,6 +632,12 @@ def test_resource_settings_service_client_client_options_scopes( "grpc_asyncio", grpc_helpers_async, ), + ( + ResourceSettingsServiceClient, + transports.ResourceSettingsServiceRestTransport, + "rest", + None, + ), ], ) def test_resource_settings_service_client_client_options_credentials_file( @@ -1515,6 +1560,862 @@ async def test_update_setting_field_headers_async(): ) in kw["metadata"] +@pytest.mark.parametrize( + "request_type", + [ + resource_settings.ListSettingsRequest, + dict, + ], +) +def test_list_settings_rest(request_type): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "organizations/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resource_settings.ListSettingsResponse( + next_page_token="next_page_token_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = resource_settings.ListSettingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_settings(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSettingsPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_settings_rest_required_fields( + request_type=resource_settings.ListSettingsRequest, +): + transport_class = transports.ResourceSettingsServiceRestTransport + + request_init = {} + request_init["parent"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson( + pb_request, + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list_settings._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["parent"] = "parent_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).list_settings._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + "view", + ) + ) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" + + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = resource_settings.ListSettingsResponse() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": pb_request, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + pb_return_value = resource_settings.ListSettingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.list_settings(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_list_settings_rest_unset_required_fields(): + transport = transports.ResourceSettingsServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.list_settings._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + "view", + ) + ) + & set(("parent",)) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_settings_rest_interceptors(null_interceptor): + transport = transports.ResourceSettingsServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.ResourceSettingsServiceRestInterceptor(), + ) + client = ResourceSettingsServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ResourceSettingsServiceRestInterceptor, "post_list_settings" + ) as post, mock.patch.object( + transports.ResourceSettingsServiceRestInterceptor, "pre_list_settings" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = resource_settings.ListSettingsRequest.pb( + resource_settings.ListSettingsRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = resource_settings.ListSettingsResponse.to_json( + resource_settings.ListSettingsResponse() + ) + + request = resource_settings.ListSettingsRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = resource_settings.ListSettingsResponse() + + client.list_settings( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_settings_rest_bad_request( + transport: str = "rest", request_type=resource_settings.ListSettingsRequest +): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "organizations/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_settings(request) + + +def test_list_settings_rest_flattened(): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resource_settings.ListSettingsResponse() + + # get arguments that satisfy an http rule for this method + sample_request = {"parent": "organizations/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = resource_settings.ListSettingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.list_settings(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1/{parent=organizations/*}/settings" % client.transport._host, args[1] + ) + + +def test_list_settings_rest_flattened_error(transport: str = "rest"): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_settings( + resource_settings.ListSettingsRequest(), + parent="parent_value", + ) + + +def test_list_settings_rest_pager(transport: str = "rest"): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + resource_settings.ListSettingsResponse( + settings=[ + resource_settings.Setting(), + resource_settings.Setting(), + resource_settings.Setting(), + ], + next_page_token="abc", + ), + resource_settings.ListSettingsResponse( + settings=[], + next_page_token="def", + ), + resource_settings.ListSettingsResponse( + settings=[ + resource_settings.Setting(), + ], + next_page_token="ghi", + ), + resource_settings.ListSettingsResponse( + settings=[ + resource_settings.Setting(), + resource_settings.Setting(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + resource_settings.ListSettingsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "organizations/sample1"} + + pager = client.list_settings(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resource_settings.Setting) for i in results) + + pages = list(client.list_settings(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + resource_settings.GetSettingRequest, + dict, + ], +) +def test_get_setting_rest(request_type): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "organizations/sample1/settings/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resource_settings.Setting( + name="name_value", + etag="etag_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = resource_settings.Setting.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.get_setting(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, resource_settings.Setting) + assert response.name == "name_value" + assert response.etag == "etag_value" + + +def test_get_setting_rest_required_fields( + request_type=resource_settings.GetSettingRequest, +): + transport_class = transports.ResourceSettingsServiceRestTransport + + request_init = {} + request_init["name"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson( + pb_request, + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_setting._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["name"] = "name_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).get_setting._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("view",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" + + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = resource_settings.Setting() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "get", + "query_params": pb_request, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + pb_return_value = resource_settings.Setting.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.get_setting(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_get_setting_rest_unset_required_fields(): + transport = transports.ResourceSettingsServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.get_setting._get_unset_required_fields({}) + assert set(unset_fields) == (set(("view",)) & set(("name",))) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_get_setting_rest_interceptors(null_interceptor): + transport = transports.ResourceSettingsServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.ResourceSettingsServiceRestInterceptor(), + ) + client = ResourceSettingsServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ResourceSettingsServiceRestInterceptor, "post_get_setting" + ) as post, mock.patch.object( + transports.ResourceSettingsServiceRestInterceptor, "pre_get_setting" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = resource_settings.GetSettingRequest.pb( + resource_settings.GetSettingRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = resource_settings.Setting.to_json( + resource_settings.Setting() + ) + + request = resource_settings.GetSettingRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = resource_settings.Setting() + + client.get_setting( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_get_setting_rest_bad_request( + transport: str = "rest", request_type=resource_settings.GetSettingRequest +): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"name": "organizations/sample1/settings/sample2"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.get_setting(request) + + +def test_get_setting_rest_flattened(): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resource_settings.Setting() + + # get arguments that satisfy an http rule for this method + sample_request = {"name": "organizations/sample1/settings/sample2"} + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = resource_settings.Setting.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_setting(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1/{name=organizations/*/settings/*}" % client.transport._host, args[1] + ) + + +def test_get_setting_rest_flattened_error(transport: str = "rest"): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_setting( + resource_settings.GetSettingRequest(), + name="name_value", + ) + + +def test_get_setting_rest_error(): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + resource_settings.UpdateSettingRequest, + dict, + ], +) +def test_update_setting_rest(request_type): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"setting": {"name": "organizations/sample1/settings/sample2"}} + request_init["setting"] = { + "name": "organizations/sample1/settings/sample2", + "metadata": { + "display_name": "display_name_value", + "description": "description_value", + "read_only": True, + "data_type": 1, + "default_value": { + "boolean_value": True, + "string_value": "string_value_value", + "string_set_value": {"values": ["values_value1", "values_value2"]}, + "enum_value": {"value": "value_value"}, + }, + }, + "local_value": {}, + "effective_value": {}, + "etag": "etag_value", + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resource_settings.Setting( + name="name_value", + etag="etag_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = resource_settings.Setting.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.update_setting(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, resource_settings.Setting) + assert response.name == "name_value" + assert response.etag == "etag_value" + + +def test_update_setting_rest_required_fields( + request_type=resource_settings.UpdateSettingRequest, +): + transport_class = transports.ResourceSettingsServiceRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson( + pb_request, + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).update_setting._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).update_setting._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = resource_settings.Setting() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "patch", + "query_params": pb_request, + } + transcode_result["body"] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + pb_return_value = resource_settings.Setting.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.update_setting(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_update_setting_rest_unset_required_fields(): + transport = transports.ResourceSettingsServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.update_setting._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("setting",))) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_setting_rest_interceptors(null_interceptor): + transport = transports.ResourceSettingsServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.ResourceSettingsServiceRestInterceptor(), + ) + client = ResourceSettingsServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.ResourceSettingsServiceRestInterceptor, "post_update_setting" + ) as post, mock.patch.object( + transports.ResourceSettingsServiceRestInterceptor, "pre_update_setting" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = resource_settings.UpdateSettingRequest.pb( + resource_settings.UpdateSettingRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = resource_settings.Setting.to_json( + resource_settings.Setting() + ) + + request = resource_settings.UpdateSettingRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = resource_settings.Setting() + + client.update_setting( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_setting_rest_bad_request( + transport: str = "rest", request_type=resource_settings.UpdateSettingRequest +): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"setting": {"name": "organizations/sample1/settings/sample2"}} + request_init["setting"] = { + "name": "organizations/sample1/settings/sample2", + "metadata": { + "display_name": "display_name_value", + "description": "description_value", + "read_only": True, + "data_type": 1, + "default_value": { + "boolean_value": True, + "string_value": "string_value_value", + "string_set_value": {"values": ["values_value1", "values_value2"]}, + "enum_value": {"value": "value_value"}, + }, + }, + "local_value": {}, + "effective_value": {}, + "etag": "etag_value", + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.update_setting(request) + + +def test_update_setting_rest_error(): + client = ResourceSettingsServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + def test_credentials_transport_error(): # It is an error to provide credentials and a transport instance. transport = transports.ResourceSettingsServiceGrpcTransport( @@ -1596,6 +2497,7 @@ def test_transport_get_channel(): [ transports.ResourceSettingsServiceGrpcTransport, transports.ResourceSettingsServiceGrpcAsyncIOTransport, + transports.ResourceSettingsServiceRestTransport, ], ) def test_transport_adc(transport_class): @@ -1610,6 +2512,7 @@ def test_transport_adc(transport_class): "transport_name", [ "grpc", + "rest", ], ) def test_transport_kind(transport_name): @@ -1741,6 +2644,7 @@ def test_resource_settings_service_transport_auth_adc(transport_class): [ transports.ResourceSettingsServiceGrpcTransport, transports.ResourceSettingsServiceGrpcAsyncIOTransport, + transports.ResourceSettingsServiceRestTransport, ], ) def test_resource_settings_service_transport_auth_gdch_credentials(transport_class): @@ -1842,11 +2746,23 @@ def test_resource_settings_service_grpc_transport_client_cert_source_for_mtls( ) +def test_resource_settings_service_http_transport_client_cert_source_for_mtls(): + cred = ga_credentials.AnonymousCredentials() + with mock.patch( + "google.auth.transport.requests.AuthorizedSession.configure_mtls_channel" + ) as mock_configure_mtls_channel: + transports.ResourceSettingsServiceRestTransport( + credentials=cred, client_cert_source_for_mtls=client_cert_source_callback + ) + mock_configure_mtls_channel.assert_called_once_with(client_cert_source_callback) + + @pytest.mark.parametrize( "transport_name", [ "grpc", "grpc_asyncio", + "rest", ], ) def test_resource_settings_service_host_no_port(transport_name): @@ -1857,7 +2773,11 @@ def test_resource_settings_service_host_no_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("resourcesettings.googleapis.com:443") + assert client.transport._host == ( + "resourcesettings.googleapis.com:443" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://resourcesettings.googleapis.com" + ) @pytest.mark.parametrize( @@ -1865,6 +2785,7 @@ def test_resource_settings_service_host_no_port(transport_name): [ "grpc", "grpc_asyncio", + "rest", ], ) def test_resource_settings_service_host_with_port(transport_name): @@ -1875,7 +2796,39 @@ def test_resource_settings_service_host_with_port(transport_name): ), transport=transport_name, ) - assert client.transport._host == ("resourcesettings.googleapis.com:8000") + assert client.transport._host == ( + "resourcesettings.googleapis.com:8000" + if transport_name in ["grpc", "grpc_asyncio"] + else "https://resourcesettings.googleapis.com:8000" + ) + + +@pytest.mark.parametrize( + "transport_name", + [ + "rest", + ], +) +def test_resource_settings_service_client_transport_session_collision(transport_name): + creds1 = ga_credentials.AnonymousCredentials() + creds2 = ga_credentials.AnonymousCredentials() + client1 = ResourceSettingsServiceClient( + credentials=creds1, + transport=transport_name, + ) + client2 = ResourceSettingsServiceClient( + credentials=creds2, + transport=transport_name, + ) + session1 = client1.transport.list_settings._session + session2 = client2.transport.list_settings._session + assert session1 != session2 + session1 = client1.transport.get_setting._session + session2 = client2.transport.get_setting._session + assert session1 != session2 + session1 = client1.transport.update_setting._session + session2 = client2.transport.update_setting._session + assert session1 != session2 def test_resource_settings_service_grpc_transport_channel(): @@ -2169,6 +3122,7 @@ async def test_transport_close_async(): def test_transport_close(): transports = { + "rest": "_session", "grpc": "_grpc_channel", } @@ -2186,6 +3140,7 @@ def test_transport_close(): def test_client_ctx(): transports = [ + "rest", "grpc", ] for transport in transports: From b987c785f56fefd3b09ac5d930dfeecc961e74c2 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:59:32 -0800 Subject: [PATCH 6/6] chore(main): release 1.7.0 (#162) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ google/cloud/resourcesettings/gapic_version.py | 2 +- google/cloud/resourcesettings_v1/gapic_version.py | 2 +- .../snippet_metadata_google.cloud.resourcesettings.v1.json | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 093be7e..64e0684 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.6.1" + ".": "1.7.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b5c8b0..f53afff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.7.0](https://github.com/googleapis/python-resource-settings/compare/v1.6.1...v1.7.0) (2023-02-16) + + +### Features + +* Enable "rest" transport in Python for services supporting numeric enums ([#161](https://github.com/googleapis/python-resource-settings/issues/161)) ([6a98eb5](https://github.com/googleapis/python-resource-settings/commit/6a98eb582064c411324eb1c11e6da8e33bb14057)) + ## [1.6.1](https://github.com/googleapis/python-resource-settings/compare/v1.6.0...v1.6.1) (2023-01-20) diff --git a/google/cloud/resourcesettings/gapic_version.py b/google/cloud/resourcesettings/gapic_version.py index b4028ab..f033c61 100644 --- a/google/cloud/resourcesettings/gapic_version.py +++ b/google/cloud/resourcesettings/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.6.1" # {x-release-please-version} +__version__ = "1.7.0" # {x-release-please-version} diff --git a/google/cloud/resourcesettings_v1/gapic_version.py b/google/cloud/resourcesettings_v1/gapic_version.py index b4028ab..f033c61 100644 --- a/google/cloud/resourcesettings_v1/gapic_version.py +++ b/google/cloud/resourcesettings_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.6.1" # {x-release-please-version} +__version__ = "1.7.0" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json index 3465a96..250e330 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.resourcesettings.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-resource-settings", - "version": "0.1.0" + "version": "1.7.0" }, "snippets": [ {