diff --git a/.coveragerc b/.coveragerc index c68a962..0cb2d57 100644 --- a/.coveragerc +++ b/.coveragerc @@ -10,8 +10,3 @@ exclude_lines = pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 237a647..fccaa8e 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:6244cdf9848ec661b48e5b626123ee9f6f8eb80adc9d42d7cd3c243d4ddaea79 + digest: sha256:3bf87e47c2173d7eed42714589dc4da2c07c3268610f1e47f8e1a30decbfc7f1 diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 7323c42..f8137d0 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -68,7 +68,7 @@ RUN wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz # Extract files RUN tar -xvf Python-3.9.13.tgz -# Install python 3.9.11 +# Install python 3.9.13 RUN ./Python-3.9.13/configure --enable-optimizations RUN make altinstall diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in index 7718391..cbd7e77 100644 --- a/.kokoro/requirements.in +++ b/.kokoro/requirements.in @@ -5,4 +5,6 @@ typing-extensions twine wheel setuptools -nox \ No newline at end of file +nox +charset-normalizer<3 +click<8.1.0 diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 12bfbf4..05dc467 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -20,9 +20,9 @@ cachetools==5.2.0 \ --hash=sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757 \ --hash=sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db # via google-auth -certifi==2022.9.24 \ - --hash=sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14 \ - --hash=sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382 +certifi==2022.12.7 \ + --hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \ + --hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18 # via requests cffi==1.15.1 \ --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ @@ -93,11 +93,14 @@ cffi==1.15.1 \ charset-normalizer==2.1.1 \ --hash=sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845 \ --hash=sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f - # via requests -click==8.1.3 \ - --hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \ - --hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48 # via + # -r requirements.in + # requests +click==8.0.4 \ + --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ + --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb + # via + # -r requirements.in # gcp-docuploader # gcp-releasetool colorlog==6.7.0 \ @@ -156,9 +159,9 @@ gcp-docuploader==0.6.4 \ --hash=sha256:01486419e24633af78fd0167db74a2763974765ee8078ca6eb6964d0ebd388af \ --hash=sha256:70861190c123d907b3b067da896265ead2eeb9263969d6955c9e0bb091b5ccbf # via -r requirements.in -gcp-releasetool==1.9.1 \ - --hash=sha256:952f4055d5d986b070ae2a71c4410b250000f9cc5a1e26398fcd55a5bbc5a15f \ - --hash=sha256:d0d3c814a97c1a237517e837d8cfa668ced8df4b882452578ecef4a4e79c583b +gcp-releasetool==1.10.0 \ + --hash=sha256:72a38ca91b59c24f7e699e9227c90cbe4dd71b789383cb0164b088abae294c83 \ + --hash=sha256:8c7c99320208383d4bb2b808c6880eb7a81424afe7cdba3c8d84b25f4f0e097d # via -r requirements.in google-api-core==2.10.2 \ --hash=sha256:10c06f7739fe57781f87523375e8e1a3a4674bf6392cd6131a3222182b971320 \ @@ -166,9 +169,9 @@ google-api-core==2.10.2 \ # via # google-cloud-core # google-cloud-storage -google-auth==2.14.0 \ - --hash=sha256:1ad5b0e6eba5f69645971abb3d2c197537d5914070a8c6d30299dfdb07c5c700 \ - --hash=sha256:cf24817855d874ede2efd071aa22125445f555de1685b739a9782fcf408c2a3d +google-auth==2.14.1 \ + --hash=sha256:ccaa901f31ad5cbb562615eb8b664b3dd0bf5404a67618e642307f00613eda4d \ + --hash=sha256:f5d8701633bebc12e0deea4df8abd8aff31c28b355360597f7f2ee60f2e4d016 # via # gcp-releasetool # google-api-core @@ -178,9 +181,9 @@ google-cloud-core==2.3.2 \ --hash=sha256:8417acf6466be2fa85123441696c4badda48db314c607cf1e5d543fa8bdc22fe \ --hash=sha256:b9529ee7047fd8d4bf4a2182de619154240df17fbe60ead399078c1ae152af9a # via google-cloud-storage -google-cloud-storage==2.5.0 \ - --hash=sha256:19a26c66c317ce542cea0830b7e787e8dac2588b6bfa4d3fd3b871ba16305ab0 \ - --hash=sha256:382f34b91de2212e3c2e7b40ec079d27ee2e3dbbae99b75b1bcd8c63063ce235 +google-cloud-storage==2.6.0 \ + --hash=sha256:104ca28ae61243b637f2f01455cc8a05e8f15a2a18ced96cb587241cdd3820f5 \ + --hash=sha256:4ad0415ff61abdd8bb2ae81c1f8f7ec7d91a1011613f2db87c614c550f97bfe9 # via gcp-docuploader google-crc32c==1.5.0 \ --hash=sha256:024894d9d3cfbc5943f8f230e23950cd4906b2fe004c72e29b209420a1e6b05a \ @@ -256,9 +259,9 @@ google-resumable-media==2.4.0 \ --hash=sha256:2aa004c16d295c8f6c33b2b4788ba59d366677c0a25ae7382436cb30f776deaa \ --hash=sha256:8d5518502f92b9ecc84ac46779bd4f09694ecb3ba38a3e7ca737a86d15cbca1f # via google-cloud-storage -googleapis-common-protos==1.56.4 \ - --hash=sha256:8eb2cbc91b69feaf23e32452a7ae60e791e09967d81d4fcc7fc388182d1bd394 \ - --hash=sha256:c25873c47279387cfdcbdafa36149887901d36202cb645a0e4f29686bf6e4417 +googleapis-common-protos==1.57.0 \ + --hash=sha256:27a849d6205838fb6cc3c1c21cb9800707a661bb21c6ce7fb13e99eb1f8a0c46 \ + --hash=sha256:a9f4a1d7f6d9809657b7f1316a1aa527f6664891531bcfcc13b6696e685f443c # via google-api-core idna==3.4 \ --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ @@ -269,6 +272,7 @@ importlib-metadata==5.0.0 \ --hash=sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43 # via # -r requirements.in + # keyring # twine jaraco-classes==3.2.3 \ --hash=sha256:2353de3288bc6b82120752201c6b1c1a14b058267fa424ed5ce5984e3b922158 \ @@ -284,9 +288,9 @@ jinja2==3.1.2 \ --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ --hash=sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61 # via gcp-releasetool -keyring==23.9.3 \ - --hash=sha256:69732a15cb1433bdfbc3b980a8a36a04878a6cfd7cb99f497b573f31618001c0 \ - --hash=sha256:69b01dd83c42f590250fe7a1f503fc229b14de83857314b1933a3ddbf595c4a5 +keyring==23.11.0 \ + --hash=sha256:3dd30011d555f1345dec2c262f0153f2f0ca6bca041fb1dc4588349bb4c0ac1e \ + --hash=sha256:ad192263e2cdd5f12875dedc2da13534359a7e760e77f8d04b50968a821c2361 # via # gcp-releasetool # twine @@ -350,9 +354,9 @@ pkginfo==1.8.3 \ --hash=sha256:848865108ec99d4901b2f7e84058b6e7660aae8ae10164e015a6dcf5b242a594 \ --hash=sha256:a84da4318dd86f870a9447a8c98340aa06216bfc6f2b7bdc4b8766984ae1867c # via twine -platformdirs==2.5.2 \ - --hash=sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788 \ - --hash=sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19 +platformdirs==2.5.4 \ + --hash=sha256:1006647646d80f16130f052404c6b901e80ee4ed6bef6792e1f238a8969106f7 \ + --hash=sha256:af0276409f9a02373d540bf8480021a048711d572745aef4b7842dad245eba10 # via virtualenv protobuf==3.20.3 \ --hash=sha256:03038ac1cfbc41aa21f6afcbcd357281d7521b4157926f30ebecc8d4ea59dcb7 \ @@ -381,7 +385,6 @@ protobuf==3.20.3 \ # gcp-docuploader # gcp-releasetool # google-api-core - # googleapis-common-protos py==1.11.0 \ --hash=sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719 \ --hash=sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378 @@ -476,17 +479,17 @@ urllib3==1.26.12 \ # via # requests # twine -virtualenv==20.16.6 \ - --hash=sha256:186ca84254abcbde98180fd17092f9628c5fe742273c02724972a1d8a2035108 \ - --hash=sha256:530b850b523c6449406dfba859d6345e48ef19b8439606c5d74d7d3c9e14d76e +virtualenv==20.16.7 \ + --hash=sha256:8691e3ff9387f743e00f6bb20f70121f5e4f596cae754531f2b3b3a1b1ac696e \ + --hash=sha256:efd66b00386fdb7dbe4822d172303f40cd05e50e01740b19ea42425cbe653e29 # via nox webencodings==0.5.1 \ --hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \ --hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923 # via bleach -wheel==0.37.1 \ - --hash=sha256:4bdcd7d840138086126cd09254dc6195fb4fc6f01c050a1d7236f2630db1d22a \ - --hash=sha256:e9a504e793efbca1b8e0e9cb979a249cf4a0a7b5b8c9e8b65a5e39d49529c1c4 +wheel==0.38.4 \ + --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ + --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 # via -r requirements.in zipp==3.10.0 \ --hash=sha256:4fcb6f278987a6605757302a6e40e896257570d11c51628968ccb2a47e80c6c1 \ @@ -494,7 +497,7 @@ zipp==3.10.0 \ # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -setuptools==65.5.0 \ - --hash=sha256:512e5536220e38146176efb833d4a62aa726b7bbff82cfbc8ba9eaa3996e0b17 \ - --hash=sha256:f62ea9da9ed6289bfe868cd6845968a2c854d1427f8548d52cae02a42b4f0356 +setuptools==65.5.1 \ + --hash=sha256:d0b9a8433464d5800cbe05094acf5c6d52a91bfac9b52bcfc4d41382be5d5d31 \ + --hash=sha256:e197a19aa8ec9722928f2206f8de752def0e4c9fc6953527360d1c36d94ddb2f # via -r requirements.in diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46d2371..5405cc8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: rev: 22.3.0 hooks: - id: black -- repo: https://gitlab.com/pycqa/flake8 +- repo: https://github.com/pycqa/flake8 rev: 3.9.2 hooks: - id: flake8 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f1c1e58..210d290 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.0" + ".": "0.5.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 16eeeee..1686769 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.5.1](https://github.com/googleapis/python-apigee-registry/compare/v0.5.0...v0.5.1) (2022-12-14) + + +### Bug Fixes + +* **deps:** Require google-api-core >=1.34.0, >=2.11.0 ([f1fd8d9](https://github.com/googleapis/python-apigee-registry/commit/f1fd8d9ee3920f4e9e68e2a8000dee98db2b95ac)) +* Drop usage of pkg_resources ([f1fd8d9](https://github.com/googleapis/python-apigee-registry/commit/f1fd8d9ee3920f4e9e68e2a8000dee98db2b95ac)) +* Fix timeout default values ([f1fd8d9](https://github.com/googleapis/python-apigee-registry/commit/f1fd8d9ee3920f4e9e68e2a8000dee98db2b95ac)) + + +### Documentation + +* **samples:** Snippetgen should call await on the operation coroutine before calling result ([f1fd8d9](https://github.com/googleapis/python-apigee-registry/commit/f1fd8d9ee3920f4e9e68e2a8000dee98db2b95ac)) + ## [0.5.0](https://github.com/googleapis/python-apigee-registry/compare/v0.4.0...v0.5.0) (2022-11-16) diff --git a/google/cloud/apigee_registry/gapic_version.py b/google/cloud/apigee_registry/gapic_version.py index 371eb6b..f501366 100644 --- a/google/cloud/apigee_registry/gapic_version.py +++ b/google/cloud/apigee_registry/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.5.0" # {x-release-please-version} +__version__ = "0.5.1" # {x-release-please-version} diff --git a/google/cloud/apigee_registry_v1/gapic_version.py b/google/cloud/apigee_registry_v1/gapic_version.py new file mode 100644 index 0000000..f501366 --- /dev/null +++ b/google/cloud/apigee_registry_v1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- 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. +# +__version__ = "0.5.1" # {x-release-please-version} diff --git a/google/cloud/apigee_registry_v1/services/provisioning/async_client.py b/google/cloud/apigee_registry_v1/services/provisioning/async_client.py index 3cde044..7eaf599 100644 --- a/google/cloud/apigee_registry_v1/services/provisioning/async_client.py +++ b/google/cloud/apigee_registry_v1/services/provisioning/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.apigee_registry_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -229,7 +230,7 @@ async def create_instance( instance: Optional[provisioning_service.Instance] = None, instance_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Provisions instance resources for the Registry. @@ -264,7 +265,7 @@ async def sample_create_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -369,7 +370,7 @@ async def delete_instance( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the Registry instance. @@ -399,7 +400,7 @@ async def sample_delete_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -492,7 +493,7 @@ async def get_instance( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> provisioning_service.Instance: r"""Gets details of a single Instance. @@ -594,7 +595,7 @@ async def list_operations( request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -648,7 +649,7 @@ async def get_operation( request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -702,7 +703,7 @@ async def delete_operation( request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -757,7 +758,7 @@ async def cancel_operation( request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -811,7 +812,7 @@ async def set_iam_policy( request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -931,7 +932,7 @@ async def get_iam_policy( request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1052,7 +1053,7 @@ async def test_iam_permissions( request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -1111,7 +1112,7 @@ async def get_location( request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1165,7 +1166,7 @@ async def list_locations( request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1221,14 +1222,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-apigee-registry", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("ProvisioningAsyncClient",) diff --git a/google/cloud/apigee_registry_v1/services/provisioning/client.py b/google/cloud/apigee_registry_v1/services/provisioning/client.py index 1ebe369..a76d3b3 100644 --- a/google/cloud/apigee_registry_v1/services/provisioning/client.py +++ b/google/cloud/apigee_registry_v1/services/provisioning/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.apigee_registry_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -369,9 +370,6 @@ def __init__( transport (Union[str, ProvisioningTransport]): The transport to use. If set to None, a transport is chosen automatically. - NOTE: "rest" transport functionality is currently in a - beta state (preview). We welcome your feedback via an - issue in this library's source repository. client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the @@ -463,7 +461,7 @@ def create_instance( instance: Optional[provisioning_service.Instance] = None, instance_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Provisions instance resources for the Registry. @@ -603,7 +601,7 @@ def delete_instance( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes the Registry instance. @@ -726,7 +724,7 @@ def get_instance( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> provisioning_service.Instance: r"""Gets details of a single Instance. @@ -841,7 +839,7 @@ def list_operations( request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -895,7 +893,7 @@ def get_operation( request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -949,7 +947,7 @@ def delete_operation( request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -1004,7 +1002,7 @@ def cancel_operation( request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -1058,7 +1056,7 @@ def set_iam_policy( request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1178,7 +1176,7 @@ def get_iam_policy( request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1299,7 +1297,7 @@ def test_iam_permissions( request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -1358,7 +1356,7 @@ def get_location( request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1412,7 +1410,7 @@ def list_locations( request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1462,14 +1460,9 @@ def list_locations( return response -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-apigee-registry", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("ProvisioningClient",) diff --git a/google/cloud/apigee_registry_v1/services/provisioning/transports/base.py b/google/cloud/apigee_registry_v1/services/provisioning/transports/base.py index 9591300..84e8fb2 100644 --- a/google/cloud/apigee_registry_v1/services/provisioning/transports/base.py +++ b/google/cloud/apigee_registry_v1/services/provisioning/transports/base.py @@ -27,18 +27,13 @@ from google.iam.v1 import policy_pb2 # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.apigee_registry_v1 import gapic_version as package_version from google.cloud.apigee_registry_v1.types import provisioning_service -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-apigee-registry", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class ProvisioningTransport(abc.ABC): diff --git a/google/cloud/apigee_registry_v1/services/provisioning/transports/rest.py b/google/cloud/apigee_registry_v1/services/provisioning/transports/rest.py index 39436b4..bfc3dc1 100644 --- a/google/cloud/apigee_registry_v1/services/provisioning/transports/rest.py +++ b/google/cloud/apigee_registry_v1/services/provisioning/transports/rest.py @@ -75,26 +75,29 @@ class ProvisioningRestInterceptor: .. code-block:: python class MyCustomProvisioningInterceptor(ProvisioningRestInterceptor): - def pre_create_instance(request, metadata): + def pre_create_instance(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_create_instance(response): + def post_create_instance(self, response): logging.log(f"Received response: {response}") + return response - def pre_delete_instance(request, metadata): + def pre_delete_instance(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_delete_instance(response): + def post_delete_instance(self, response): logging.log(f"Received response: {response}") + return response - def pre_get_instance(request, metadata): + def pre_get_instance(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_instance(response): + def post_get_instance(self, response): logging.log(f"Received response: {response}") + return response transport = ProvisioningRestTransport(interceptor=MyCustomProvisioningInterceptor()) client = ProvisioningClient(transport=transport) @@ -398,9 +401,6 @@ class ProvisioningRestTransport(ProvisioningTransport): It sends JSON representations of protocol buffers over HTTP/1.1 - NOTE: This REST transport functionality is currently in a beta - state (preview). We welcome your feedback via an issue in this - library's source repository. Thank you! """ def __init__( @@ -420,39 +420,35 @@ def __init__( ) -> None: """Instantiate the transport. - NOTE: This REST transport functionality is currently in a beta - state (preview). We welcome your feedback via a GitHub issue in - this library's repository. Thank you! - - 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. + 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. @@ -527,6 +523,7 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: credentials=self._credentials, scopes=self._scopes, http_options=http_options, + path_prefix="v1", ) self._operations_client = operations_v1.AbstractOperationsClient( @@ -595,7 +592,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -605,11 +602,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -691,11 +690,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -777,11 +778,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" diff --git a/google/cloud/apigee_registry_v1/services/registry/async_client.py b/google/cloud/apigee_registry_v1/services/registry/async_client.py index f8fa6db..6f2a47b 100644 --- a/google/cloud/apigee_registry_v1/services/registry/async_client.py +++ b/google/cloud/apigee_registry_v1/services/registry/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.apigee_registry_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -230,7 +231,7 @@ async def list_apis( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApisAsyncPager: r"""Returns matching APIs. @@ -355,7 +356,7 @@ async def get_api( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Api: r"""Returns a specified API. @@ -471,7 +472,7 @@ async def create_api( api: Optional[registry_models.Api] = None, api_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Api: r"""Creates a specified API. @@ -608,7 +609,7 @@ async def update_api( api: Optional[registry_models.Api] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Api: r"""Used to modify a specified API. @@ -735,7 +736,7 @@ async def delete_api( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified API and all of the resources that @@ -837,7 +838,7 @@ async def list_api_versions( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiVersionsAsyncPager: r"""Returns matching versions. @@ -962,7 +963,7 @@ async def get_api_version( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiVersion: r"""Returns a specified version. @@ -1078,7 +1079,7 @@ async def create_api_version( api_version: Optional[registry_models.ApiVersion] = None, api_version_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiVersion: r"""Creates a specified version. @@ -1217,7 +1218,7 @@ async def update_api_version( api_version: Optional[registry_models.ApiVersion] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiVersion: r"""Used to modify a specified version. @@ -1348,7 +1349,7 @@ async def delete_api_version( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified version and all of the resources @@ -1451,7 +1452,7 @@ async def list_api_specs( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiSpecsAsyncPager: r"""Returns matching specs. @@ -1577,7 +1578,7 @@ async def get_api_spec( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Returns a specified spec. @@ -1704,7 +1705,7 @@ async def get_api_spec_contents( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> httpbody_pb2.HttpBody: r"""Returns the contents of a specified spec. If specs are stored @@ -1868,7 +1869,7 @@ async def create_api_spec( api_spec: Optional[registry_models.ApiSpec] = None, api_spec_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Creates a specified spec. @@ -2017,7 +2018,7 @@ async def update_api_spec( api_spec: Optional[registry_models.ApiSpec] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Used to modify a specified spec. @@ -2158,7 +2159,7 @@ async def delete_api_spec( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified spec, all revisions, and all @@ -2261,7 +2262,7 @@ async def tag_api_spec_revision( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Adds a tag to a specified revision of a spec. @@ -2368,7 +2369,7 @@ async def list_api_spec_revisions( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiSpecRevisionsAsyncPager: r"""Lists all revisions of a spec. @@ -2475,7 +2476,7 @@ async def rollback_api_spec( request: Optional[Union[registry_service.RollbackApiSpecRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Sets the current revision to a specified prior @@ -2572,7 +2573,7 @@ async def delete_api_spec_revision( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Deletes a revision of a spec. @@ -2703,7 +2704,7 @@ async def list_api_deployments( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiDeploymentsAsyncPager: r"""Returns matching deployments. @@ -2830,7 +2831,7 @@ async def get_api_deployment( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Returns a specified deployment. @@ -2955,7 +2956,7 @@ async def create_api_deployment( api_deployment: Optional[registry_models.ApiDeployment] = None, api_deployment_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Creates a specified deployment. @@ -3102,7 +3103,7 @@ async def update_api_deployment( api_deployment: Optional[registry_models.ApiDeployment] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Used to modify a specified deployment. @@ -3241,7 +3242,7 @@ async def delete_api_deployment( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified deployment, all revisions, and @@ -3345,7 +3346,7 @@ async def tag_api_deployment_revision( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Adds a tag to a specified revision of a @@ -3448,7 +3449,7 @@ async def list_api_deployment_revisions( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiDeploymentRevisionsAsyncPager: r"""Lists all revisions of a deployment. @@ -3557,7 +3558,7 @@ async def rollback_api_deployment( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Sets the current revision to a specified prior @@ -3650,7 +3651,7 @@ async def delete_api_deployment_revision( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Deletes a revision of a deployment. @@ -3774,7 +3775,7 @@ async def list_artifacts( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListArtifactsAsyncPager: r"""Returns matching artifacts. @@ -3899,7 +3900,7 @@ async def get_artifact( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Artifact: r"""Returns a specified artifact. @@ -4023,7 +4024,7 @@ async def get_artifact_contents( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> httpbody_pb2.HttpBody: r"""Returns the contents of a specified artifact. If artifacts are @@ -4186,7 +4187,7 @@ async def create_artifact( artifact: Optional[registry_models.Artifact] = None, artifact_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Artifact: r"""Creates a specified artifact. @@ -4331,7 +4332,7 @@ async def replace_artifact( *, artifact: Optional[registry_models.Artifact] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Artifact: r"""Used to replace a specified artifact. @@ -4456,7 +4457,7 @@ async def delete_artifact( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified artifact. @@ -4556,7 +4557,7 @@ async def list_operations( request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -4610,7 +4611,7 @@ async def get_operation( request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -4664,7 +4665,7 @@ async def delete_operation( request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -4719,7 +4720,7 @@ async def cancel_operation( request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -4773,7 +4774,7 @@ async def set_iam_policy( request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4893,7 +4894,7 @@ async def get_iam_policy( request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -5014,7 +5015,7 @@ async def test_iam_permissions( request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -5073,7 +5074,7 @@ async def get_location( request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5127,7 +5128,7 @@ async def list_locations( request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5183,14 +5184,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-apigee-registry", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("RegistryAsyncClient",) diff --git a/google/cloud/apigee_registry_v1/services/registry/client.py b/google/cloud/apigee_registry_v1/services/registry/client.py index a2eddc9..1eaae90 100644 --- a/google/cloud/apigee_registry_v1/services/registry/client.py +++ b/google/cloud/apigee_registry_v1/services/registry/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.apigee_registry_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -466,9 +467,6 @@ def __init__( transport (Union[str, RegistryTransport]): The transport to use. If set to None, a transport is chosen automatically. - NOTE: "rest" transport functionality is currently in a - beta state (preview). We welcome your feedback via an - issue in this library's source repository. client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the @@ -556,7 +554,7 @@ def list_apis( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApisPager: r"""Returns matching APIs. @@ -669,7 +667,7 @@ def get_api( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Api: r"""Returns a specified API. @@ -773,7 +771,7 @@ def create_api( api: Optional[registry_models.Api] = None, api_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Api: r"""Creates a specified API. @@ -898,7 +896,7 @@ def update_api( api: Optional[registry_models.Api] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Api: r"""Used to modify a specified API. @@ -1013,7 +1011,7 @@ def delete_api( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified API and all of the resources that @@ -1103,7 +1101,7 @@ def list_api_versions( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiVersionsPager: r"""Returns matching versions. @@ -1216,7 +1214,7 @@ def get_api_version( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiVersion: r"""Returns a specified version. @@ -1320,7 +1318,7 @@ def create_api_version( api_version: Optional[registry_models.ApiVersion] = None, api_version_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiVersion: r"""Creates a specified version. @@ -1447,7 +1445,7 @@ def update_api_version( api_version: Optional[registry_models.ApiVersion] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiVersion: r"""Used to modify a specified version. @@ -1566,7 +1564,7 @@ def delete_api_version( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified version and all of the resources @@ -1657,7 +1655,7 @@ def list_api_specs( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiSpecsPager: r"""Returns matching specs. @@ -1771,7 +1769,7 @@ def get_api_spec( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Returns a specified spec. @@ -1886,7 +1884,7 @@ def get_api_spec_contents( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> httpbody_pb2.HttpBody: r"""Returns the contents of a specified spec. If specs are stored @@ -2038,7 +2036,7 @@ def create_api_spec( api_spec: Optional[registry_models.ApiSpec] = None, api_spec_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Creates a specified spec. @@ -2175,7 +2173,7 @@ def update_api_spec( api_spec: Optional[registry_models.ApiSpec] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Used to modify a specified spec. @@ -2304,7 +2302,7 @@ def delete_api_spec( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified spec, all revisions, and all @@ -2395,7 +2393,7 @@ def tag_api_spec_revision( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Adds a tag to a specified revision of a spec. @@ -2491,7 +2489,7 @@ def list_api_spec_revisions( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiSpecRevisionsPager: r"""Lists all revisions of a spec. @@ -2587,7 +2585,7 @@ def rollback_api_spec( request: Optional[Union[registry_service.RollbackApiSpecRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Sets the current revision to a specified prior @@ -2685,7 +2683,7 @@ def delete_api_spec_revision( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiSpec: r"""Deletes a revision of a spec. @@ -2804,7 +2802,7 @@ def list_api_deployments( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiDeploymentsPager: r"""Returns matching deployments. @@ -2919,7 +2917,7 @@ def get_api_deployment( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Returns a specified deployment. @@ -3032,7 +3030,7 @@ def create_api_deployment( api_deployment: Optional[registry_models.ApiDeployment] = None, api_deployment_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Creates a specified deployment. @@ -3167,7 +3165,7 @@ def update_api_deployment( api_deployment: Optional[registry_models.ApiDeployment] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Used to modify a specified deployment. @@ -3294,7 +3292,7 @@ def delete_api_deployment( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified deployment, all revisions, and @@ -3386,7 +3384,7 @@ def tag_api_deployment_revision( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Adds a tag to a specified revision of a @@ -3480,7 +3478,7 @@ def list_api_deployment_revisions( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListApiDeploymentRevisionsPager: r"""Lists all revisions of a deployment. @@ -3580,7 +3578,7 @@ def rollback_api_deployment( ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Sets the current revision to a specified prior @@ -3674,7 +3672,7 @@ def delete_api_deployment_revision( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.ApiDeployment: r"""Deletes a revision of a deployment. @@ -3788,7 +3786,7 @@ def list_artifacts( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListArtifactsPager: r"""Returns matching artifacts. @@ -3901,7 +3899,7 @@ def get_artifact( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Artifact: r"""Returns a specified artifact. @@ -4013,7 +4011,7 @@ def get_artifact_contents( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> httpbody_pb2.HttpBody: r"""Returns the contents of a specified artifact. If artifacts are @@ -4164,7 +4162,7 @@ def create_artifact( artifact: Optional[registry_models.Artifact] = None, artifact_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Artifact: r"""Creates a specified artifact. @@ -4297,7 +4295,7 @@ def replace_artifact( *, artifact: Optional[registry_models.Artifact] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> registry_models.Artifact: r"""Used to replace a specified artifact. @@ -4410,7 +4408,7 @@ def delete_artifact( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Removes a specified artifact. @@ -4511,7 +4509,7 @@ def list_operations( request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -4565,7 +4563,7 @@ def get_operation( request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -4619,7 +4617,7 @@ def delete_operation( request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -4674,7 +4672,7 @@ def cancel_operation( request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -4728,7 +4726,7 @@ def set_iam_policy( request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4848,7 +4846,7 @@ def get_iam_policy( request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4969,7 +4967,7 @@ def test_iam_permissions( request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -5028,7 +5026,7 @@ def get_location( request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5082,7 +5080,7 @@ def list_locations( request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5132,14 +5130,9 @@ def list_locations( return response -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-apigee-registry", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("RegistryClient",) diff --git a/google/cloud/apigee_registry_v1/services/registry/transports/base.py b/google/cloud/apigee_registry_v1/services/registry/transports/base.py index 225642d..c40973c 100644 --- a/google/cloud/apigee_registry_v1/services/registry/transports/base.py +++ b/google/cloud/apigee_registry_v1/services/registry/transports/base.py @@ -29,18 +29,13 @@ from google.longrunning import operations_pb2 from google.oauth2 import service_account # type: ignore from google.protobuf import empty_pb2 # type: ignore -import pkg_resources +from google.cloud.apigee_registry_v1 import gapic_version as package_version from google.cloud.apigee_registry_v1.types import registry_models, registry_service -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-apigee-registry", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class RegistryTransport(abc.ABC): diff --git a/google/cloud/apigee_registry_v1/services/registry/transports/rest.py b/google/cloud/apigee_registry_v1/services/registry/transports/rest.py index fbc9bae..ef32ad4 100644 --- a/google/cloud/apigee_registry_v1/services/registry/transports/rest.py +++ b/google/cloud/apigee_registry_v1/services/registry/transports/rest.py @@ -70,235 +70,265 @@ class RegistryRestInterceptor: .. code-block:: python class MyCustomRegistryInterceptor(RegistryRestInterceptor): - def pre_create_api(request, metadata): + def pre_create_api(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_create_api(response): + def post_create_api(self, response): logging.log(f"Received response: {response}") + return response - def pre_create_api_deployment(request, metadata): + def pre_create_api_deployment(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_create_api_deployment(response): + def post_create_api_deployment(self, response): logging.log(f"Received response: {response}") + return response - def pre_create_api_spec(request, metadata): + def pre_create_api_spec(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_create_api_spec(response): + def post_create_api_spec(self, response): logging.log(f"Received response: {response}") + return response - def pre_create_api_version(request, metadata): + def pre_create_api_version(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_create_api_version(response): + def post_create_api_version(self, response): logging.log(f"Received response: {response}") + return response - def pre_create_artifact(request, metadata): + def pre_create_artifact(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_create_artifact(response): + def post_create_artifact(self, response): logging.log(f"Received response: {response}") + return response - def pre_delete_api(request, metadata): + def pre_delete_api(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def pre_delete_api_deployment(request, metadata): + def pre_delete_api_deployment(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def pre_delete_api_deployment_revision(request, metadata): + def pre_delete_api_deployment_revision(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_delete_api_deployment_revision(response): + def post_delete_api_deployment_revision(self, response): logging.log(f"Received response: {response}") + return response - def pre_delete_api_spec(request, metadata): + def pre_delete_api_spec(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def pre_delete_api_spec_revision(request, metadata): + def pre_delete_api_spec_revision(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_delete_api_spec_revision(response): + def post_delete_api_spec_revision(self, response): logging.log(f"Received response: {response}") + return response - def pre_delete_api_version(request, metadata): + def pre_delete_api_version(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def pre_delete_artifact(request, metadata): + def pre_delete_artifact(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def pre_get_api(request, metadata): + def pre_get_api(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_api(response): + def post_get_api(self, response): logging.log(f"Received response: {response}") + return response - def pre_get_api_deployment(request, metadata): + def pre_get_api_deployment(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_api_deployment(response): + def post_get_api_deployment(self, response): logging.log(f"Received response: {response}") + return response - def pre_get_api_spec(request, metadata): + def pre_get_api_spec(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_api_spec(response): + def post_get_api_spec(self, response): logging.log(f"Received response: {response}") + return response - def pre_get_api_spec_contents(request, metadata): + def pre_get_api_spec_contents(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_api_spec_contents(response): + def post_get_api_spec_contents(self, response): logging.log(f"Received response: {response}") + return response - def pre_get_api_version(request, metadata): + def pre_get_api_version(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_api_version(response): + def post_get_api_version(self, response): logging.log(f"Received response: {response}") + return response - def pre_get_artifact(request, metadata): + def pre_get_artifact(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_artifact(response): + def post_get_artifact(self, response): logging.log(f"Received response: {response}") + return response - def pre_get_artifact_contents(request, metadata): + def pre_get_artifact_contents(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_artifact_contents(response): + def post_get_artifact_contents(self, response): logging.log(f"Received response: {response}") + return response - def pre_list_api_deployment_revisions(request, metadata): + def pre_list_api_deployment_revisions(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_api_deployment_revisions(response): + def post_list_api_deployment_revisions(self, response): logging.log(f"Received response: {response}") + return response - def pre_list_api_deployments(request, metadata): + def pre_list_api_deployments(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_api_deployments(response): + def post_list_api_deployments(self, response): logging.log(f"Received response: {response}") + return response - def pre_list_apis(request, metadata): + def pre_list_apis(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_apis(response): + def post_list_apis(self, response): logging.log(f"Received response: {response}") + return response - def pre_list_api_spec_revisions(request, metadata): + def pre_list_api_spec_revisions(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_api_spec_revisions(response): + def post_list_api_spec_revisions(self, response): logging.log(f"Received response: {response}") + return response - def pre_list_api_specs(request, metadata): + def pre_list_api_specs(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_api_specs(response): + def post_list_api_specs(self, response): logging.log(f"Received response: {response}") + return response - def pre_list_api_versions(request, metadata): + def pre_list_api_versions(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_api_versions(response): + def post_list_api_versions(self, response): logging.log(f"Received response: {response}") + return response - def pre_list_artifacts(request, metadata): + def pre_list_artifacts(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_artifacts(response): + def post_list_artifacts(self, response): logging.log(f"Received response: {response}") + return response - def pre_replace_artifact(request, metadata): + def pre_replace_artifact(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_replace_artifact(response): + def post_replace_artifact(self, response): logging.log(f"Received response: {response}") + return response - def pre_rollback_api_deployment(request, metadata): + def pre_rollback_api_deployment(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_rollback_api_deployment(response): + def post_rollback_api_deployment(self, response): logging.log(f"Received response: {response}") + return response - def pre_rollback_api_spec(request, metadata): + def pre_rollback_api_spec(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_rollback_api_spec(response): + def post_rollback_api_spec(self, response): logging.log(f"Received response: {response}") + return response - def pre_tag_api_deployment_revision(request, metadata): + def pre_tag_api_deployment_revision(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_tag_api_deployment_revision(response): + def post_tag_api_deployment_revision(self, response): logging.log(f"Received response: {response}") + return response - def pre_tag_api_spec_revision(request, metadata): + def pre_tag_api_spec_revision(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_tag_api_spec_revision(response): + def post_tag_api_spec_revision(self, response): logging.log(f"Received response: {response}") + return response - def pre_update_api(request, metadata): + def pre_update_api(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_update_api(response): + def post_update_api(self, response): logging.log(f"Received response: {response}") + return response - def pre_update_api_deployment(request, metadata): + def pre_update_api_deployment(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_update_api_deployment(response): + def post_update_api_deployment(self, response): logging.log(f"Received response: {response}") + return response - def pre_update_api_spec(request, metadata): + def pre_update_api_spec(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_update_api_spec(response): + def post_update_api_spec(self, response): logging.log(f"Received response: {response}") + return response - def pre_update_api_version(request, metadata): + def pre_update_api_version(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_update_api_version(response): + def post_update_api_version(self, response): logging.log(f"Received response: {response}") + return response transport = RegistryRestTransport(interceptor=MyCustomRegistryInterceptor()) client = RegistryClient(transport=transport) @@ -1287,9 +1317,6 @@ class RegistryRestTransport(RegistryTransport): It sends JSON representations of protocol buffers over HTTP/1.1 - NOTE: This REST transport functionality is currently in a beta - state (preview). We welcome your feedback via an issue in this - library's source repository. Thank you! """ def __init__( @@ -1309,39 +1336,35 @@ def __init__( ) -> None: """Instantiate the transport. - NOTE: This REST transport functionality is currently in a beta - state (preview). We welcome your feedback via a GitHub issue in - this library's repository. Thank you! - - 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. + 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. @@ -1431,7 +1454,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1441,11 +1464,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -1539,7 +1564,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1549,11 +1574,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -1648,7 +1675,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1658,11 +1685,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -1748,7 +1777,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1758,11 +1787,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -1874,7 +1905,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1884,11 +1915,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -1965,11 +1998,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2041,11 +2076,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2131,11 +2168,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2211,11 +2250,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2305,11 +2346,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2387,11 +2430,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2475,11 +2520,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2554,11 +2601,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2649,11 +2698,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2747,11 +2798,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2884,11 +2937,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -2971,11 +3026,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3082,11 +3139,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3235,11 +3294,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3326,11 +3387,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3416,11 +3479,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3500,11 +3565,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3590,11 +3657,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3674,11 +3743,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3760,11 +3831,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3860,11 +3933,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -3975,7 +4050,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -3985,11 +4060,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -4081,7 +4158,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4091,11 +4168,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -4190,7 +4269,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4200,11 +4279,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -4297,7 +4378,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4307,11 +4388,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -4408,7 +4491,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4418,11 +4501,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -4504,7 +4589,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4514,11 +4599,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -4610,7 +4697,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4620,11 +4707,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -4717,7 +4806,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4727,11 +4816,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" @@ -4815,7 +4906,7 @@ def __call__( body = json_format.MessageToJson( transcoded_request["body"], including_default_value_fields=False, - use_integers_for_enums=False, + use_integers_for_enums=True, ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4825,11 +4916,13 @@ def __call__( json_format.MessageToJson( transcoded_request["query_params"], including_default_value_fields=False, - use_integers_for_enums=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" diff --git a/release-please-config.json b/release-please-config.json index 0c259b5..c2433dc 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,6 +5,7 @@ "release-type": "python", "extra-files": [ "google/cloud/apigee_registry/gapic_version.py", + "google/cloud/apigee_registry_v1/gapic_version.py", { "type": "json", "path": "samples/generated_samples/snippet_metadata_google.cloud.apigeeregistry.v1.json", diff --git a/samples/generated_samples/apigeeregistry_v1_generated_provisioning_create_instance_async.py b/samples/generated_samples/apigeeregistry_v1_generated_provisioning_create_instance_async.py index f0bdf5f..f6d04a0 100644 --- a/samples/generated_samples/apigeeregistry_v1_generated_provisioning_create_instance_async.py +++ b/samples/generated_samples/apigeeregistry_v1_generated_provisioning_create_instance_async.py @@ -53,7 +53,7 @@ async def sample_create_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/apigeeregistry_v1_generated_provisioning_delete_instance_async.py b/samples/generated_samples/apigeeregistry_v1_generated_provisioning_delete_instance_async.py index ad6a2ff..a038007 100644 --- a/samples/generated_samples/apigeeregistry_v1_generated_provisioning_delete_instance_async.py +++ b/samples/generated_samples/apigeeregistry_v1_generated_provisioning_delete_instance_async.py @@ -48,7 +48,7 @@ async def sample_delete_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/snippet_metadata_google.cloud.apigeeregistry.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.apigeeregistry.v1.json index d2b05db..a6683ed 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.apigeeregistry.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.apigeeregistry.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-apigee-registry", - "version": "0.5.0" + "version": "0.5.1" }, "snippets": [ { diff --git a/setup.py b/setup.py index 87e6e87..6bdd33e 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev", diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 883a87a..2beecf9 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -4,7 +4,7 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.33.2 +google-api-core==1.34.0 proto-plus==1.22.0 protobuf==3.19.5 grpc-google-iam-v1==0.12.4 diff --git a/tests/unit/gapic/apigee_registry_v1/test_provisioning.py b/tests/unit/gapic/apigee_registry_v1/test_provisioning.py index 4e618a5..e71f4c2 100644 --- a/tests/unit/gapic/apigee_registry_v1/test_provisioning.py +++ b/tests/unit/gapic/apigee_registry_v1/test_provisioning.py @@ -1550,6 +1550,7 @@ def test_create_instance_rest_required_fields( "instanceId", "", ), + ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -1836,7 +1837,7 @@ def test_delete_instance_rest_required_fields( response = client.delete_instance(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -2110,7 +2111,7 @@ def test_get_instance_rest_required_fields( response = client.get_instance(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params diff --git a/tests/unit/gapic/apigee_registry_v1/test_registry.py b/tests/unit/gapic/apigee_registry_v1/test_registry.py index 76c5a4b..26201af 100644 --- a/tests/unit/gapic/apigee_registry_v1/test_registry.py +++ b/tests/unit/gapic/apigee_registry_v1/test_registry.py @@ -10635,7 +10635,7 @@ def test_list_apis_rest_required_fields(request_type=registry_service.ListApisRe response = client.list_apis(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -10972,7 +10972,7 @@ def test_get_api_rest_required_fields(request_type=registry_service.GetApiReques response = client.get_api(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -11270,6 +11270,7 @@ def test_create_api_rest_required_fields( "apiId", "", ), + ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -11583,7 +11584,7 @@ def test_update_api_rest_required_fields( response = client.update_api(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -11866,7 +11867,7 @@ def test_delete_api_rest_required_fields( response = client.delete_api(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -12130,7 +12131,7 @@ def test_list_api_versions_rest_required_fields( response = client.list_api_versions(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -12470,7 +12471,7 @@ def test_get_api_version_rest_required_fields( response = client.get_api_version(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -12771,6 +12772,7 @@ def test_create_api_version_rest_required_fields( "apiVersionId", "", ), + ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -13083,7 +13085,7 @@ def test_update_api_version_rest_required_fields( response = client.update_api_version(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -13375,7 +13377,7 @@ def test_delete_api_version_rest_required_fields( response = client.delete_api_version(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -13646,7 +13648,7 @@ def test_list_api_specs_rest_required_fields( response = client.list_api_specs(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -14002,7 +14004,7 @@ def test_get_api_spec_rest_required_fields( response = client.get_api_spec(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -14276,7 +14278,7 @@ def test_get_api_spec_contents_rest_required_fields( response = client.get_api_spec_contents(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -14593,6 +14595,7 @@ def test_create_api_spec_rest_required_fields( "apiSpecId", "", ), + ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -14931,7 +14934,7 @@ def test_update_api_spec_rest_required_fields( response = client.update_api_spec(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -15229,7 +15232,7 @@ def test_delete_api_spec_rest_required_fields( response = client.delete_api_spec(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -15513,7 +15516,7 @@ def test_tag_api_spec_revision_rest_required_fields( response = client.tag_api_spec_revision(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -15744,7 +15747,7 @@ def test_list_api_spec_revisions_rest_required_fields( response = client.list_api_spec_revisions(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -16048,7 +16051,7 @@ def test_rollback_api_spec_rest_required_fields( response = client.rollback_api_spec(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -16286,7 +16289,7 @@ def test_delete_api_spec_revision_rest_required_fields( response = client.delete_api_spec_revision(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -16566,7 +16569,7 @@ def test_list_api_deployments_rest_required_fields( response = client.list_api_deployments(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -16916,7 +16919,7 @@ def test_get_api_deployment_rest_required_fields( response = client.get_api_deployment(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -17233,6 +17236,7 @@ def test_create_api_deployment_rest_required_fields( "apiDeploymentId", "", ), + ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -17567,7 +17571,7 @@ def test_update_api_deployment_rest_required_fields( response = client.update_api_deployment(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -17865,7 +17869,7 @@ def test_delete_api_deployment_rest_required_fields( response = client.delete_api_deployment(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -18149,7 +18153,7 @@ def test_tag_api_deployment_revision_rest_required_fields( response = client.tag_api_deployment_revision(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -18383,7 +18387,7 @@ def test_list_api_deployment_revisions_rest_required_fields( response = client.list_api_deployment_revisions(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -18691,7 +18695,7 @@ def test_rollback_api_deployment_rest_required_fields( response = client.rollback_api_deployment(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -18929,7 +18933,7 @@ def test_delete_api_deployment_revision_rest_required_fields( response = client.delete_api_deployment_revision(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -19210,7 +19214,7 @@ def test_list_artifacts_rest_required_fields( response = client.list_artifacts(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -19549,7 +19553,7 @@ def test_get_artifact_rest_required_fields( response = client.get_artifact(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -19818,7 +19822,7 @@ def test_get_artifact_contents_rest_required_fields( response = client.get_artifact_contents(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -20116,6 +20120,7 @@ def test_create_artifact_rest_required_fields( "artifactId", "", ), + ("$alt", "json;enum-encoding=int"), ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -20418,7 +20423,7 @@ def test_replace_artifact_rest_required_fields( response = client.replace_artifact(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params @@ -20691,7 +20696,7 @@ def test_delete_artifact_rest_required_fields( response = client.delete_artifact(request) - expected_params = [] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params