From d4329aaffe59859df2c2f1ff10894eaa547ce7df Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 14:12:54 +0000 Subject: [PATCH] chore: use gapic-generator-python 0.62.1 (#121) - [ ] Regenerate this pull request now. fix: resolve DuplicateCredentialArgs error when using credentials_file committer: parthea PiperOrigin-RevId: 425964861 Source-Link: https://github.com/googleapis/googleapis/commit/84b1a5a4f6fb2d04905be58e586b8a7a4310a8cf Source-Link: https://github.com/googleapis/googleapis-gen/commit/4fb761bbd8506ac156f49bac5f18306aa8eb3aa8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZiNzYxYmJkODUwNmFjMTU2ZjQ5YmFjNWYxODMwNmFhOGViM2FhOCJ9 --- .../artifact_registry/async_client.py | 6 +- .../services/artifact_registry/client.py | 6 +- .../artifact_registry/transports/grpc.py | 5 +- .../transports/grpc_asyncio.py | 5 +- .../artifactregistry_v1/types/artifact.py | 3 +- .../artifactregistry_v1/types/repository.py | 3 +- .../artifact_registry/async_client.py | 40 ++++----- .../services/artifact_registry/client.py | 40 ++++----- .../artifact_registry/transports/grpc.py | 7 +- .../transports/grpc_asyncio.py | 7 +- .../artifactregistry_v1beta2/types/file.py | 3 +- .../artifactregistry_v1beta2/types/package.py | 3 +- .../types/repository.py | 3 +- .../artifactregistry_v1beta2/types/tag.py | 4 +- .../artifactregistry_v1beta2/types/version.py | 3 +- .../test_artifact_registry.py | 82 +++++++++++++++++- .../test_artifact_registry.py | 83 ++++++++++++++++++- 17 files changed, 231 insertions(+), 72 deletions(-) diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py b/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py index e7da848..c31e8fe 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py @@ -259,7 +259,7 @@ async def list_docker_images( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -339,7 +339,7 @@ async def list_repositories( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -416,7 +416,7 @@ async def get_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/client.py b/google/cloud/artifactregistry_v1/services/artifact_registry/client.py index 2e7c819..ba85f00 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/client.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/client.py @@ -473,7 +473,7 @@ def list_docker_images( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -553,7 +553,7 @@ def list_repositories( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -630,7 +630,7 @@ def get_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc.py b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc.py index 219e294..4c8e301 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc.py @@ -171,8 +171,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc_asyncio.py b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc_asyncio.py index fce847e..c2dfc94 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc_asyncio.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc_asyncio.py @@ -216,8 +216,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/artifactregistry_v1/types/artifact.py b/google/cloud/artifactregistry_v1/types/artifact.py index aa4a20f..27e6ecc 100644 --- a/google/cloud/artifactregistry_v1/types/artifact.py +++ b/google/cloud/artifactregistry_v1/types/artifact.py @@ -48,8 +48,7 @@ class DockerImage(proto.Message): uri (str): Required. URL to access the image. Example: - us-west4-docker.pkg.dev/test-project/test- - repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf + us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf tags (Sequence[str]): Tags attached to this image. image_size_bytes (int): diff --git a/google/cloud/artifactregistry_v1/types/repository.py b/google/cloud/artifactregistry_v1/types/repository.py index 767886a..c8c3575 100644 --- a/google/cloud/artifactregistry_v1/types/repository.py +++ b/google/cloud/artifactregistry_v1/types/repository.py @@ -35,8 +35,7 @@ class Repository(proto.Message): Attributes: name (str): The name of the repository, for example: - "projects/p1/locations/us- - central1/repositories/repo1". + "projects/p1/locations/us-central1/repositories/repo1". format_ (google.cloud.artifactregistry_v1.types.Repository.Format): The format of packages that are stored in the repository. diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py index 14b04ce..34aed82 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py @@ -417,7 +417,7 @@ async def list_repositories( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -503,7 +503,7 @@ async def get_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -604,7 +604,7 @@ async def create_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, repository, repository_id]) if request is not None and has_flattened_params: @@ -695,7 +695,7 @@ async def update_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([repository, update_mask]) if request is not None and has_flattened_params: @@ -785,7 +785,7 @@ async def delete_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -874,7 +874,7 @@ async def list_packages( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -957,7 +957,7 @@ async def get_package( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1049,7 +1049,7 @@ async def delete_package( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1138,7 +1138,7 @@ async def list_versions( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -1224,7 +1224,7 @@ async def get_version( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1316,7 +1316,7 @@ async def delete_version( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1405,7 +1405,7 @@ async def list_files( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -1489,7 +1489,7 @@ async def get_file( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1570,7 +1570,7 @@ async def list_tags( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -1654,7 +1654,7 @@ async def get_tag( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1748,7 +1748,7 @@ async def create_tag( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, tag, tag_id]) if request is not None and has_flattened_params: @@ -1833,7 +1833,7 @@ async def update_tag( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([tag, update_mask]) if request is not None and has_flattened_params: @@ -1897,7 +1897,7 @@ async def delete_tag( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2246,7 +2246,7 @@ async def get_project_settings( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2322,7 +2322,7 @@ async def update_project_settings( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_settings, update_mask]) if request is not None and has_flattened_params: diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py index 31d26f5..075f977 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py @@ -711,7 +711,7 @@ def list_repositories( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -788,7 +788,7 @@ def get_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -880,7 +880,7 @@ def create_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, repository, repository_id]) if request is not None and has_flattened_params: @@ -971,7 +971,7 @@ def update_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([repository, update_mask]) if request is not None and has_flattened_params: @@ -1061,7 +1061,7 @@ def delete_repository( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1141,7 +1141,7 @@ def list_packages( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -1215,7 +1215,7 @@ def get_package( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1298,7 +1298,7 @@ def delete_package( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1378,7 +1378,7 @@ def list_versions( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -1455,7 +1455,7 @@ def get_version( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1538,7 +1538,7 @@ def delete_version( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1618,7 +1618,7 @@ def list_files( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -1693,7 +1693,7 @@ def get_file( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1765,7 +1765,7 @@ def list_tags( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -1840,7 +1840,7 @@ def get_tag( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1925,7 +1925,7 @@ def create_tag( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, tag, tag_id]) if request is not None and has_flattened_params: @@ -2010,7 +2010,7 @@ def update_tag( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([tag, update_mask]) if request is not None and has_flattened_params: @@ -2074,7 +2074,7 @@ def delete_tag( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2402,7 +2402,7 @@ def get_project_settings( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2478,7 +2478,7 @@ def update_project_settings( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_settings, update_mask]) if request is not None and has_flattened_params: diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc.py index e4076b5..3786476 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc.py @@ -185,8 +185,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -259,7 +262,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsClient(self.grpc_channel) diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc_asyncio.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc_asyncio.py index 864a54c..099aa69 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc_asyncio.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc_asyncio.py @@ -230,8 +230,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -261,7 +264,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( self.grpc_channel diff --git a/google/cloud/artifactregistry_v1beta2/types/file.py b/google/cloud/artifactregistry_v1beta2/types/file.py index 40f1c85..02db193 100644 --- a/google/cloud/artifactregistry_v1beta2/types/file.py +++ b/google/cloud/artifactregistry_v1beta2/types/file.py @@ -57,8 +57,7 @@ class File(proto.Message): Attributes: name (str): The name of the file, for example: - "projects/p1/locations/us- - central1/repositories/repo1/files/a%2Fb%2Fc.txt". + "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt". If the file ID part contains slashes, they are escaped. size_bytes (int): diff --git a/google/cloud/artifactregistry_v1beta2/types/package.py b/google/cloud/artifactregistry_v1beta2/types/package.py index fe6f5f7..e587693 100644 --- a/google/cloud/artifactregistry_v1beta2/types/package.py +++ b/google/cloud/artifactregistry_v1beta2/types/package.py @@ -36,8 +36,7 @@ class Package(proto.Message): Attributes: name (str): The name of the package, for example: - "projects/p1/locations/us- - central1/repositories/repo1/packages/pkg1". + "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1". display_name (str): The display name of the package. create_time (google.protobuf.timestamp_pb2.Timestamp): diff --git a/google/cloud/artifactregistry_v1beta2/types/repository.py b/google/cloud/artifactregistry_v1beta2/types/repository.py index 7c7a5a6..ff8550b 100644 --- a/google/cloud/artifactregistry_v1beta2/types/repository.py +++ b/google/cloud/artifactregistry_v1beta2/types/repository.py @@ -47,8 +47,7 @@ class Repository(proto.Message): This field is a member of `oneof`_ ``format_config``. name (str): The name of the repository, for example: - "projects/p1/locations/us- - central1/repositories/repo1". + "projects/p1/locations/us-central1/repositories/repo1". format_ (google.cloud.artifactregistry_v1beta2.types.Repository.Format): The format of packages that are stored in the repository. diff --git a/google/cloud/artifactregistry_v1beta2/types/tag.py b/google/cloud/artifactregistry_v1beta2/types/tag.py index 26f7aa9..5c8a098 100644 --- a/google/cloud/artifactregistry_v1beta2/types/tag.py +++ b/google/cloud/artifactregistry_v1beta2/types/tag.py @@ -45,8 +45,8 @@ class Tag(proto.Message): [a-zA-Z0-9-._~:@], anything else must be URL encoded. version (str): The name of the version the tag refers to, - for example: "projects/p1/locations/us- - central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" + for example: + "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/sha256:5243811" If the package or version ID parts contain slashes, the slashes are escaped. """ diff --git a/google/cloud/artifactregistry_v1beta2/types/version.py b/google/cloud/artifactregistry_v1beta2/types/version.py index ded39e6..7dd0606 100644 --- a/google/cloud/artifactregistry_v1beta2/types/version.py +++ b/google/cloud/artifactregistry_v1beta2/types/version.py @@ -50,8 +50,7 @@ class Version(proto.Message): Attributes: name (str): The name of the version, for example: - "projects/p1/locations/us- - central1/repositories/repo1/packages/pkg1/versions/art1". + "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/art1". If the package or version ID parts contain slashes, the slashes are escaped. description (str): diff --git a/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py b/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py index 59c7011..c85c974 100644 --- a/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py +++ b/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py @@ -525,21 +525,28 @@ def test_artifact_registry_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (ArtifactRegistryClient, transports.ArtifactRegistryGrpcTransport, "grpc"), + ( + ArtifactRegistryClient, + transports.ArtifactRegistryGrpcTransport, + "grpc", + grpc_helpers, + ), ( ArtifactRegistryAsyncClient, transports.ArtifactRegistryGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_artifact_registry_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -575,6 +582,75 @@ def test_artifact_registry_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + ArtifactRegistryClient, + transports.ArtifactRegistryGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + ArtifactRegistryAsyncClient, + transports.ArtifactRegistryGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_artifact_registry_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "artifactregistry.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + scopes=None, + default_host="artifactregistry.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [artifact.ListDockerImagesRequest, dict,]) def test_list_docker_images(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( diff --git a/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py b/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py index 1ef4a3e..2c786f8 100644 --- a/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py +++ b/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import operation from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 from google.api_core import path_template @@ -544,21 +545,28 @@ def test_artifact_registry_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (ArtifactRegistryClient, transports.ArtifactRegistryGrpcTransport, "grpc"), + ( + ArtifactRegistryClient, + transports.ArtifactRegistryGrpcTransport, + "grpc", + grpc_helpers, + ), ( ArtifactRegistryAsyncClient, transports.ArtifactRegistryGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_artifact_registry_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -594,6 +602,75 @@ def test_artifact_registry_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + ArtifactRegistryClient, + transports.ArtifactRegistryGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + ArtifactRegistryAsyncClient, + transports.ArtifactRegistryGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_artifact_registry_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "artifactregistry.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + ), + scopes=None, + default_host="artifactregistry.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "request_type", [apt_artifact.ImportAptArtifactsRequest, dict,] )