diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..64f82d6 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd +# created: 2022-04-21T15:43:16.246106921Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..41bff0b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# 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. +requestsize: + enabled: true diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e..6def37a 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4141e6e..d84dda2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [1.2.0](https://github.com/googleapis/python-artifact-registry/compare/v1.1.2...v1.2.0) (2022-04-21) + + +### Features + +* AuditConfig for IAM v1 ([c22893b](https://github.com/googleapis/python-artifact-registry/commit/c22893b8e671fea8416ff1e6a4f23aa03e201e74)) +* promote v1beta2 features to v1 ([#138](https://github.com/googleapis/python-artifact-registry/issues/138)) ([842c107](https://github.com/googleapis/python-artifact-registry/commit/842c107cb6f6705c3228495ce43653414801af9f)) + + +### Bug Fixes + +* **deps:** require grpc-google-iam-v1 >=0.12.4 ([c22893b](https://github.com/googleapis/python-artifact-registry/commit/c22893b8e671fea8416ff1e6a4f23aa03e201e74)) + ### [1.1.2](https://github.com/googleapis/python-artifact-registry/compare/v1.1.1...v1.1.2) (2022-03-05) diff --git a/docs/conf.py b/docs/conf.py index a63b7cf..9c4baa5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/artifactregistry/__init__.py b/google/cloud/artifactregistry/__init__.py index b1a71a8..8356f5e 100644 --- a/google/cloud/artifactregistry/__init__.py +++ b/google/cloud/artifactregistry/__init__.py @@ -14,29 +14,132 @@ # limitations under the License. # +from google.cloud.artifactregistry_v1.services.artifact_registry.async_client import ( + ArtifactRegistryAsyncClient, +) from google.cloud.artifactregistry_v1.services.artifact_registry.client import ( ArtifactRegistryClient, ) -from google.cloud.artifactregistry_v1.services.artifact_registry.async_client import ( - ArtifactRegistryAsyncClient, +from google.cloud.artifactregistry_v1.types.apt_artifact import ( + AptArtifact, + ImportAptArtifactsErrorInfo, + ImportAptArtifactsGcsSource, + ImportAptArtifactsMetadata, + ImportAptArtifactsRequest, + ImportAptArtifactsResponse, +) +from google.cloud.artifactregistry_v1.types.artifact import ( + DockerImage, + GetDockerImageRequest, + ListDockerImagesRequest, + ListDockerImagesResponse, +) +from google.cloud.artifactregistry_v1.types.file import ( + File, + GetFileRequest, + Hash, + ListFilesRequest, + ListFilesResponse, +) +from google.cloud.artifactregistry_v1.types.package import ( + DeletePackageRequest, + GetPackageRequest, + ListPackagesRequest, + ListPackagesResponse, + Package, +) +from google.cloud.artifactregistry_v1.types.repository import ( + CreateRepositoryRequest, + DeleteRepositoryRequest, + GetRepositoryRequest, + ListRepositoriesRequest, + ListRepositoriesResponse, + Repository, + UpdateRepositoryRequest, +) +from google.cloud.artifactregistry_v1.types.service import OperationMetadata +from google.cloud.artifactregistry_v1.types.settings import ( + GetProjectSettingsRequest, + ProjectSettings, + UpdateProjectSettingsRequest, +) +from google.cloud.artifactregistry_v1.types.tag import ( + CreateTagRequest, + DeleteTagRequest, + GetTagRequest, + ListTagsRequest, + ListTagsResponse, + Tag, + UpdateTagRequest, +) +from google.cloud.artifactregistry_v1.types.version import ( + DeleteVersionRequest, + GetVersionRequest, + ListVersionsRequest, + ListVersionsResponse, + Version, + VersionView, +) +from google.cloud.artifactregistry_v1.types.yum_artifact import ( + ImportYumArtifactsErrorInfo, + ImportYumArtifactsGcsSource, + ImportYumArtifactsMetadata, + ImportYumArtifactsRequest, + ImportYumArtifactsResponse, + YumArtifact, ) - -from google.cloud.artifactregistry_v1.types.artifact import DockerImage -from google.cloud.artifactregistry_v1.types.artifact import ListDockerImagesRequest -from google.cloud.artifactregistry_v1.types.artifact import ListDockerImagesResponse -from google.cloud.artifactregistry_v1.types.repository import GetRepositoryRequest -from google.cloud.artifactregistry_v1.types.repository import ListRepositoriesRequest -from google.cloud.artifactregistry_v1.types.repository import ListRepositoriesResponse -from google.cloud.artifactregistry_v1.types.repository import Repository __all__ = ( "ArtifactRegistryClient", "ArtifactRegistryAsyncClient", + "AptArtifact", + "ImportAptArtifactsErrorInfo", + "ImportAptArtifactsGcsSource", + "ImportAptArtifactsMetadata", + "ImportAptArtifactsRequest", + "ImportAptArtifactsResponse", "DockerImage", + "GetDockerImageRequest", "ListDockerImagesRequest", "ListDockerImagesResponse", + "File", + "GetFileRequest", + "Hash", + "ListFilesRequest", + "ListFilesResponse", + "DeletePackageRequest", + "GetPackageRequest", + "ListPackagesRequest", + "ListPackagesResponse", + "Package", + "CreateRepositoryRequest", + "DeleteRepositoryRequest", "GetRepositoryRequest", "ListRepositoriesRequest", "ListRepositoriesResponse", "Repository", + "UpdateRepositoryRequest", + "OperationMetadata", + "GetProjectSettingsRequest", + "ProjectSettings", + "UpdateProjectSettingsRequest", + "CreateTagRequest", + "DeleteTagRequest", + "GetTagRequest", + "ListTagsRequest", + "ListTagsResponse", + "Tag", + "UpdateTagRequest", + "DeleteVersionRequest", + "GetVersionRequest", + "ListVersionsRequest", + "ListVersionsResponse", + "Version", + "VersionView", + "ImportYumArtifactsErrorInfo", + "ImportYumArtifactsGcsSource", + "ImportYumArtifactsMetadata", + "ImportYumArtifactsRequest", + "ImportYumArtifactsResponse", + "YumArtifact", ) diff --git a/google/cloud/artifactregistry_v1/__init__.py b/google/cloud/artifactregistry_v1/__init__.py index 3d1bd38..dfa23c7 100644 --- a/google/cloud/artifactregistry_v1/__init__.py +++ b/google/cloud/artifactregistry_v1/__init__.py @@ -14,25 +14,124 @@ # limitations under the License. # -from .services.artifact_registry import ArtifactRegistryClient -from .services.artifact_registry import ArtifactRegistryAsyncClient - -from .types.artifact import DockerImage -from .types.artifact import ListDockerImagesRequest -from .types.artifact import ListDockerImagesResponse -from .types.repository import GetRepositoryRequest -from .types.repository import ListRepositoriesRequest -from .types.repository import ListRepositoriesResponse -from .types.repository import Repository +from .services.artifact_registry import ( + ArtifactRegistryAsyncClient, + ArtifactRegistryClient, +) +from .types.apt_artifact import ( + AptArtifact, + ImportAptArtifactsErrorInfo, + ImportAptArtifactsGcsSource, + ImportAptArtifactsMetadata, + ImportAptArtifactsRequest, + ImportAptArtifactsResponse, +) +from .types.artifact import ( + DockerImage, + GetDockerImageRequest, + ListDockerImagesRequest, + ListDockerImagesResponse, +) +from .types.file import File, GetFileRequest, Hash, ListFilesRequest, ListFilesResponse +from .types.package import ( + DeletePackageRequest, + GetPackageRequest, + ListPackagesRequest, + ListPackagesResponse, + Package, +) +from .types.repository import ( + CreateRepositoryRequest, + DeleteRepositoryRequest, + GetRepositoryRequest, + ListRepositoriesRequest, + ListRepositoriesResponse, + Repository, + UpdateRepositoryRequest, +) +from .types.service import OperationMetadata +from .types.settings import ( + GetProjectSettingsRequest, + ProjectSettings, + UpdateProjectSettingsRequest, +) +from .types.tag import ( + CreateTagRequest, + DeleteTagRequest, + GetTagRequest, + ListTagsRequest, + ListTagsResponse, + Tag, + UpdateTagRequest, +) +from .types.version import ( + DeleteVersionRequest, + GetVersionRequest, + ListVersionsRequest, + ListVersionsResponse, + Version, + VersionView, +) +from .types.yum_artifact import ( + ImportYumArtifactsErrorInfo, + ImportYumArtifactsGcsSource, + ImportYumArtifactsMetadata, + ImportYumArtifactsRequest, + ImportYumArtifactsResponse, + YumArtifact, +) __all__ = ( "ArtifactRegistryAsyncClient", + "AptArtifact", "ArtifactRegistryClient", + "CreateRepositoryRequest", + "CreateTagRequest", + "DeletePackageRequest", + "DeleteRepositoryRequest", + "DeleteTagRequest", + "DeleteVersionRequest", "DockerImage", + "File", + "GetDockerImageRequest", + "GetFileRequest", + "GetPackageRequest", + "GetProjectSettingsRequest", "GetRepositoryRequest", + "GetTagRequest", + "GetVersionRequest", + "Hash", + "ImportAptArtifactsErrorInfo", + "ImportAptArtifactsGcsSource", + "ImportAptArtifactsMetadata", + "ImportAptArtifactsRequest", + "ImportAptArtifactsResponse", + "ImportYumArtifactsErrorInfo", + "ImportYumArtifactsGcsSource", + "ImportYumArtifactsMetadata", + "ImportYumArtifactsRequest", + "ImportYumArtifactsResponse", "ListDockerImagesRequest", "ListDockerImagesResponse", + "ListFilesRequest", + "ListFilesResponse", + "ListPackagesRequest", + "ListPackagesResponse", "ListRepositoriesRequest", "ListRepositoriesResponse", + "ListTagsRequest", + "ListTagsResponse", + "ListVersionsRequest", + "ListVersionsResponse", + "OperationMetadata", + "Package", + "ProjectSettings", "Repository", + "Tag", + "UpdateProjectSettingsRequest", + "UpdateRepositoryRequest", + "UpdateTagRequest", + "Version", + "VersionView", + "YumArtifact", ) diff --git a/google/cloud/artifactregistry_v1/gapic_metadata.json b/google/cloud/artifactregistry_v1/gapic_metadata.json index 3f25998..b2daf4f 100644 --- a/google/cloud/artifactregistry_v1/gapic_metadata.json +++ b/google/cloud/artifactregistry_v1/gapic_metadata.json @@ -10,40 +10,280 @@ "grpc": { "libraryClient": "ArtifactRegistryClient", "rpcs": { + "CreateRepository": { + "methods": [ + "create_repository" + ] + }, + "CreateTag": { + "methods": [ + "create_tag" + ] + }, + "DeletePackage": { + "methods": [ + "delete_package" + ] + }, + "DeleteRepository": { + "methods": [ + "delete_repository" + ] + }, + "DeleteTag": { + "methods": [ + "delete_tag" + ] + }, + "DeleteVersion": { + "methods": [ + "delete_version" + ] + }, + "GetDockerImage": { + "methods": [ + "get_docker_image" + ] + }, + "GetFile": { + "methods": [ + "get_file" + ] + }, + "GetIamPolicy": { + "methods": [ + "get_iam_policy" + ] + }, + "GetPackage": { + "methods": [ + "get_package" + ] + }, + "GetProjectSettings": { + "methods": [ + "get_project_settings" + ] + }, "GetRepository": { "methods": [ "get_repository" ] }, + "GetTag": { + "methods": [ + "get_tag" + ] + }, + "GetVersion": { + "methods": [ + "get_version" + ] + }, + "ImportAptArtifacts": { + "methods": [ + "import_apt_artifacts" + ] + }, + "ImportYumArtifacts": { + "methods": [ + "import_yum_artifacts" + ] + }, "ListDockerImages": { "methods": [ "list_docker_images" ] }, + "ListFiles": { + "methods": [ + "list_files" + ] + }, + "ListPackages": { + "methods": [ + "list_packages" + ] + }, "ListRepositories": { "methods": [ "list_repositories" ] + }, + "ListTags": { + "methods": [ + "list_tags" + ] + }, + "ListVersions": { + "methods": [ + "list_versions" + ] + }, + "SetIamPolicy": { + "methods": [ + "set_iam_policy" + ] + }, + "TestIamPermissions": { + "methods": [ + "test_iam_permissions" + ] + }, + "UpdateProjectSettings": { + "methods": [ + "update_project_settings" + ] + }, + "UpdateRepository": { + "methods": [ + "update_repository" + ] + }, + "UpdateTag": { + "methods": [ + "update_tag" + ] } } }, "grpc-async": { "libraryClient": "ArtifactRegistryAsyncClient", "rpcs": { + "CreateRepository": { + "methods": [ + "create_repository" + ] + }, + "CreateTag": { + "methods": [ + "create_tag" + ] + }, + "DeletePackage": { + "methods": [ + "delete_package" + ] + }, + "DeleteRepository": { + "methods": [ + "delete_repository" + ] + }, + "DeleteTag": { + "methods": [ + "delete_tag" + ] + }, + "DeleteVersion": { + "methods": [ + "delete_version" + ] + }, + "GetDockerImage": { + "methods": [ + "get_docker_image" + ] + }, + "GetFile": { + "methods": [ + "get_file" + ] + }, + "GetIamPolicy": { + "methods": [ + "get_iam_policy" + ] + }, + "GetPackage": { + "methods": [ + "get_package" + ] + }, + "GetProjectSettings": { + "methods": [ + "get_project_settings" + ] + }, "GetRepository": { "methods": [ "get_repository" ] }, + "GetTag": { + "methods": [ + "get_tag" + ] + }, + "GetVersion": { + "methods": [ + "get_version" + ] + }, + "ImportAptArtifacts": { + "methods": [ + "import_apt_artifacts" + ] + }, + "ImportYumArtifacts": { + "methods": [ + "import_yum_artifacts" + ] + }, "ListDockerImages": { "methods": [ "list_docker_images" ] }, + "ListFiles": { + "methods": [ + "list_files" + ] + }, + "ListPackages": { + "methods": [ + "list_packages" + ] + }, "ListRepositories": { "methods": [ "list_repositories" ] + }, + "ListTags": { + "methods": [ + "list_tags" + ] + }, + "ListVersions": { + "methods": [ + "list_versions" + ] + }, + "SetIamPolicy": { + "methods": [ + "set_iam_policy" + ] + }, + "TestIamPermissions": { + "methods": [ + "test_iam_permissions" + ] + }, + "UpdateProjectSettings": { + "methods": [ + "update_project_settings" + ] + }, + "UpdateRepository": { + "methods": [ + "update_repository" + ] + }, + "UpdateTag": { + "methods": [ + "update_tag" + ] } } } diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/__init__.py b/google/cloud/artifactregistry_v1/services/artifact_registry/__init__.py index 8dfff60..bbe70dd 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/__init__.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import ArtifactRegistryClient from .async_client import ArtifactRegistryAsyncClient +from .client import ArtifactRegistryClient __all__ = ( "ArtifactRegistryClient", 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 3e00c17..fb2d22b 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/async_client.py @@ -16,28 +16,42 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.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 try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import struct_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.artifactregistry_v1.services.artifact_registry import pagers -from google.cloud.artifactregistry_v1.types import artifact +from google.cloud.artifactregistry_v1.types import apt_artifact, artifact, file, package from google.cloud.artifactregistry_v1.types import repository -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ArtifactRegistryTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ArtifactRegistryGrpcAsyncIOTransport +from google.cloud.artifactregistry_v1.types import repository as gda_repository +from google.cloud.artifactregistry_v1.types import service, settings +from google.cloud.artifactregistry_v1.types import tag +from google.cloud.artifactregistry_v1.types import tag as gda_tag +from google.cloud.artifactregistry_v1.types import version, yum_artifact + from .client import ArtifactRegistryClient +from .transports.base import DEFAULT_CLIENT_INFO, ArtifactRegistryTransport +from .transports.grpc_asyncio import ArtifactRegistryGrpcAsyncIOTransport class ArtifactRegistryAsyncClient: @@ -61,12 +75,30 @@ class ArtifactRegistryAsyncClient: DEFAULT_ENDPOINT = ArtifactRegistryClient.DEFAULT_ENDPOINT DEFAULT_MTLS_ENDPOINT = ArtifactRegistryClient.DEFAULT_MTLS_ENDPOINT + apt_artifact_path = staticmethod(ArtifactRegistryClient.apt_artifact_path) + parse_apt_artifact_path = staticmethod( + ArtifactRegistryClient.parse_apt_artifact_path + ) docker_image_path = staticmethod(ArtifactRegistryClient.docker_image_path) parse_docker_image_path = staticmethod( ArtifactRegistryClient.parse_docker_image_path ) + file_path = staticmethod(ArtifactRegistryClient.file_path) + parse_file_path = staticmethod(ArtifactRegistryClient.parse_file_path) + project_settings_path = staticmethod(ArtifactRegistryClient.project_settings_path) + parse_project_settings_path = staticmethod( + ArtifactRegistryClient.parse_project_settings_path + ) repository_path = staticmethod(ArtifactRegistryClient.repository_path) parse_repository_path = staticmethod(ArtifactRegistryClient.parse_repository_path) + tag_path = staticmethod(ArtifactRegistryClient.tag_path) + parse_tag_path = staticmethod(ArtifactRegistryClient.parse_tag_path) + version_path = staticmethod(ArtifactRegistryClient.version_path) + parse_version_path = staticmethod(ArtifactRegistryClient.parse_version_path) + yum_artifact_path = staticmethod(ArtifactRegistryClient.yum_artifact_path) + parse_yum_artifact_path = staticmethod( + ArtifactRegistryClient.parse_yum_artifact_path + ) common_billing_account_path = staticmethod( ArtifactRegistryClient.common_billing_account_path ) @@ -310,12 +342,299 @@ def sample_list_docker_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListDockerImagesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_docker_image( + self, + request: Union[artifact.GetDockerImageRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> artifact.DockerImage: + r"""Gets a docker image. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_docker_image(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetDockerImageRequest( + name="name_value", + ) + + # Make the request + response = client.get_docker_image(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetDockerImageRequest, dict]): + The request object. The request to get docker images. + name (:class:`str`): + Required. The name of the docker + images. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.DockerImage: + DockerImage represents a docker artifact. + The following fields are returned as untyped metadata + in the Version resource, using camelcase keys (i.e. + metadata.imageSizeBytes): \* imageSizeBytes \* + mediaType \* buildTime + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = artifact.GetDockerImageRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_docker_image, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def import_apt_artifacts( + self, + request: Union[apt_artifact.ImportAptArtifactsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Imports Apt artifacts. The returned Operation will + complete once the resources are imported. Package, + Version, and File resources are created based on the + imported artifacts. Imported artifacts that conflict + with existing resources are ignored. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_import_apt_artifacts(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ImportAptArtifactsRequest( + ) + + # Make the request + operation = client.import_apt_artifacts(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ImportAptArtifactsRequest, dict]): + The request object. The request to import new apt + artifacts. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.artifactregistry_v1.types.ImportAptArtifactsResponse` + The response message from importing APT artifacts. + + """ + # Create or coerce a protobuf request object. + request = apt_artifact.ImportAptArtifactsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.import_apt_artifacts, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + apt_artifact.ImportAptArtifactsResponse, + metadata_type=apt_artifact.ImportAptArtifactsMetadata, + ) + + # Done; return the response. + return response + + async def import_yum_artifacts( + self, + request: Union[yum_artifact.ImportYumArtifactsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Imports Yum (RPM) artifacts. The returned Operation + will complete once the resources are imported. Package, + Version, and File resources are created based on the + imported artifacts. Imported artifacts that conflict + with existing resources are ignored. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_import_yum_artifacts(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ImportYumArtifactsRequest( + ) + + # Make the request + operation = client.import_yum_artifacts(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ImportYumArtifactsRequest, dict]): + The request object. The request to import new yum + artifacts. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.artifactregistry_v1.types.ImportYumArtifactsResponse` + The response message from importing YUM artifacts. + + """ + # Create or coerce a protobuf request object. + request = yum_artifact.ImportYumArtifactsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.import_yum_artifacts, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + yum_artifact.ImportYumArtifactsResponse, + metadata_type=yum_artifact.ImportYumArtifactsMetadata, ) # Done; return the response. @@ -410,12 +729,20 @@ def sample_list_repositories(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListRepositoriesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -506,7 +833,2249 @@ def sample_get_repository(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_repository( + self, + request: Union[gda_repository.CreateRepositoryRequest, dict] = None, + *, + parent: str = None, + repository: gda_repository.Repository = None, + repository_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates a repository. The returned Operation will + finish once the repository has been created. Its + response will be the created Repository. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_create_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.CreateRepositoryRequest( + parent="parent_value", + ) + + # Make the request + operation = client.create_repository(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.CreateRepositoryRequest, dict]): + The request object. The request to create a new + repository. + parent (:class:`str`): + Required. The name of the parent + resource where the repository will be + created. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + repository (:class:`google.cloud.artifactregistry_v1.types.Repository`): + The repository to be created. + This corresponds to the ``repository`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + repository_id (:class:`str`): + The repository id to use for this + repository. + + This corresponds to the ``repository_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.artifactregistry_v1.types.Repository` + A Repository for storing artifacts with a specific + format. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gda_repository.CreateRepositoryRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if repository is not None: + request.repository = repository + if repository_id is not None: + request.repository_id = repository_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_repository, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + gda_repository.Repository, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def update_repository( + self, + request: Union[gda_repository.UpdateRepositoryRequest, dict] = None, + *, + repository: gda_repository.Repository = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gda_repository.Repository: + r"""Updates a repository. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_update_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateRepositoryRequest( + ) + + # Make the request + response = client.update_repository(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.UpdateRepositoryRequest, dict]): + The request object. The request to update a repository. + repository (:class:`google.cloud.artifactregistry_v1.types.Repository`): + The repository that replaces the + resource on the server. + + This corresponds to the ``repository`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + The update mask applies to the resource. For the + ``FieldMask`` definition, see + https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Repository: + A Repository for storing artifacts + with a specific format. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gda_repository.UpdateRepositoryRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if repository is not None: + request.repository = repository + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_repository, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("repository.name", request.repository.name),) + ), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_repository( + self, + request: Union[repository.DeleteRepositoryRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes a repository and all of its contents. The + returned Operation will finish once the repository has + been deleted. It will not have any Operation metadata + and will return a google.protobuf.Empty response. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_delete_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteRepositoryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_repository(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.DeleteRepositoryRequest, dict]): + The request object. The request to delete a repository. + name (:class:`str`): + Required. The name of the repository + to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + The JSON representation for Empty is empty JSON + object {}. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = repository.DeleteRepositoryRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_repository, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def list_packages( + self, + request: Union[package.ListPackagesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPackagesAsyncPager: + r"""Lists packages. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_packages(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListPackagesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_packages(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListPackagesRequest, dict]): + The request object. The request to list packages. + parent (:class:`str`): + Required. The name of the parent + resource whose packages will be listed. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListPackagesAsyncPager: + The response from listing packages. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = package.ListPackagesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_packages, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListPackagesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_package( + self, + request: Union[package.GetPackageRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> package.Package: + r"""Gets a package. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_package(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetPackageRequest( + name="name_value", + ) + + # Make the request + response = client.get_package(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetPackageRequest, dict]): + The request object. The request to retrieve a package. + name (:class:`str`): + Required. The name of the package to + retrieve. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Package: + Packages are named collections of + versions. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = package.GetPackageRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_package, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_package( + self, + request: Union[package.DeletePackageRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes a package and all of its versions and tags. + The returned operation will complete once the package + has been deleted. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_delete_package(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeletePackageRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_package(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.DeletePackageRequest, dict]): + The request object. The request to delete a package. + name (:class:`str`): + Required. The name of the package to + delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + The JSON representation for Empty is empty JSON + object {}. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = package.DeletePackageRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_package, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def list_versions( + self, + request: Union[version.ListVersionsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListVersionsAsyncPager: + r"""Lists versions. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_versions(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListVersionsRequest( + ) + + # Make the request + page_result = client.list_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListVersionsRequest, dict]): + The request object. The request to list versions. + parent (:class:`str`): + The name of the parent resource whose + versions will be listed. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListVersionsAsyncPager: + The response from listing versions. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = version.ListVersionsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_versions, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListVersionsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_version( + self, + request: Union[version.GetVersionRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> version.Version: + r"""Gets a version + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_version(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetVersionRequest( + ) + + # Make the request + response = client.get_version(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetVersionRequest, dict]): + The request object. The request to retrieve a version. + name (:class:`str`): + The name of the version to retrieve. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Version: + The body of a version resource. A + version resource represents a collection + of components, such as files and other + data. This may correspond to a version + in many package management schemes. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = version.GetVersionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_version, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_version( + self, + request: Union[version.DeleteVersionRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Deletes a version and all of its content. The + returned operation will complete once the version has + been deleted. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_delete_version(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteVersionRequest( + ) + + # Make the request + operation = client.delete_version(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.DeleteVersionRequest, dict]): + The request object. The request to delete a version. + name (:class:`str`): + The name of the version to delete. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + The JSON representation for Empty is empty JSON + object {}. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = version.DeleteVersionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_version, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + async def list_files( + self, + request: Union[file.ListFilesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListFilesAsyncPager: + r"""Lists files. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_files(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListFilesRequest( + ) + + # Make the request + page_result = client.list_files(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListFilesRequest, dict]): + The request object. The request to list files. + parent (:class:`str`): + The name of the repository whose + files will be listed. For example: + "projects/p1/locations/us-central1/repositories/repo1 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListFilesAsyncPager: + The response from listing files. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = file.ListFilesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_files, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListFilesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_file( + self, + request: Union[file.GetFileRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> file.File: + r"""Gets a file. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_file(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetFileRequest( + ) + + # Make the request + response = client.get_file(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetFileRequest, dict]): + The request object. The request to retrieve a file. + name (:class:`str`): + The name of the file to retrieve. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.File: + Files store content that is + potentially associated with Packages or + Versions. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = file.GetFileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_file, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def list_tags( + self, + request: Union[tag.ListTagsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTagsAsyncPager: + r"""Lists tags. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_tags(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListTagsRequest( + ) + + # Make the request + page_result = client.list_tags(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListTagsRequest, dict]): + The request object. The request to list tags. + parent (:class:`str`): + The name of the parent resource whose + tags will be listed. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListTagsAsyncPager: + The response from listing tags. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = tag.ListTagsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_tags, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListTagsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_tag( + self, + request: Union[tag.GetTagRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> tag.Tag: + r"""Gets a tag. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetTagRequest( + ) + + # Make the request + response = client.get_tag(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetTagRequest, dict]): + The request object. The request to retrieve a tag. + name (:class:`str`): + The name of the tag to retrieve. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Tag: + Tags point to a version and represent + an alternative name that can be used to + access the version. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = tag.GetTagRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_tag, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_tag( + self, + request: Union[gda_tag.CreateTagRequest, dict] = None, + *, + parent: str = None, + tag: gda_tag.Tag = None, + tag_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gda_tag.Tag: + r"""Creates a tag. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_create_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.CreateTagRequest( + ) + + # Make the request + response = client.create_tag(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.CreateTagRequest, dict]): + The request object. The request to create a new tag. + parent (:class:`str`): + The name of the parent resource where + the tag will be created. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + tag (:class:`google.cloud.artifactregistry_v1.types.Tag`): + The tag to be created. + This corresponds to the ``tag`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + tag_id (:class:`str`): + The tag id to use for this + repository. + + This corresponds to the ``tag_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Tag: + Tags point to a version and represent + an alternative name that can be used to + access the version. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gda_tag.CreateTagRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if tag is not None: + request.tag = tag + if tag_id is not None: + request.tag_id = tag_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_tag, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_tag( + self, + request: Union[gda_tag.UpdateTagRequest, dict] = None, + *, + tag: gda_tag.Tag = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gda_tag.Tag: + r"""Updates a tag. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_update_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateTagRequest( + ) + + # Make the request + response = client.update_tag(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.UpdateTagRequest, dict]): + The request object. The request to create or update a + tag. + tag (:class:`google.cloud.artifactregistry_v1.types.Tag`): + The tag that replaces the resource on + the server. + + This corresponds to the ``tag`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + The update mask applies to the resource. For the + ``FieldMask`` definition, see + https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Tag: + Tags point to a version and represent + an alternative name that can be used to + access the version. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = gda_tag.UpdateTagRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if tag is not None: + request.tag = tag + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_tag, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("tag.name", request.tag.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_tag( + self, + request: Union[tag.DeleteTagRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a tag. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_delete_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteTagRequest( + ) + + # Make the request + client.delete_tag(request=request) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.DeleteTagRequest, dict]): + The request object. The request to delete a tag. + name (:class:`str`): + The name of the tag to delete. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = tag.DeleteTagRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_tag, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def set_iam_policy( + self, + request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> policy_pb2.Policy: + r"""Updates the IAM policy for a given resource. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore + + def sample_set_iam_policy(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.SetIamPolicyRequest( + resource="resource_value", + ) + + # Make the request + response = client.set_iam_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]): + The request object. Request message for `SetIamPolicy` + method. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.iam.v1.policy_pb2.Policy: + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud resources. + + A Policy is a collection of bindings. A binding binds + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** + + { + "bindings": [ + { + "role": + "roles/resourcemanager.organizationAdmin", + "members": [ "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + + }, { "role": + "roles/resourcemanager.organizationViewer", + "members": [ "user:eve@example.com" ], + "condition": { "title": "expirable access", + "description": "Does not grant access after + Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } + + ], "etag": "BwWWja0YfJA=", "version": 3 + + } + + **YAML example:** + + bindings: - members: - user:\ mike@example.com - + group:\ admins@example.com - domain:google.com - + serviceAccount:\ my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - + members: - user:\ eve@example.com role: + roles/resourcemanager.organizationViewer + condition: title: expirable access description: + Does not grant access after Sep 2020 expression: + request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 + + For a description of IAM and its features, see the + [IAM + documentation](\ https://cloud.google.com/iam/docs/). + + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.SetIamPolicyRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.set_iam_policy, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_iam_policy( + self, + request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> policy_pb2.Policy: + r"""Gets the IAM policy for a given resource. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore + + def sample_get_iam_policy(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.GetIamPolicyRequest( + resource="resource_value", + ) + + # Make the request + response = client.get_iam_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]): + The request object. Request message for `GetIamPolicy` + method. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.iam.v1.policy_pb2.Policy: + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud resources. + + A Policy is a collection of bindings. A binding binds + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** + + { + "bindings": [ + { + "role": + "roles/resourcemanager.organizationAdmin", + "members": [ "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + + }, { "role": + "roles/resourcemanager.organizationViewer", + "members": [ "user:eve@example.com" ], + "condition": { "title": "expirable access", + "description": "Does not grant access after + Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } + + ], "etag": "BwWWja0YfJA=", "version": 3 + + } + + **YAML example:** + + bindings: - members: - user:\ mike@example.com - + group:\ admins@example.com - domain:google.com - + serviceAccount:\ my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - + members: - user:\ eve@example.com role: + roles/resourcemanager.organizationViewer + condition: title: expirable access description: + Does not grant access after Sep 2020 expression: + request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 + + For a description of IAM and its features, see the + [IAM + documentation](\ https://cloud.google.com/iam/docs/). + + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.GetIamPolicyRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_iam_policy, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def test_iam_permissions( + self, + request: Union[iam_policy_pb2.TestIamPermissionsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> iam_policy_pb2.TestIamPermissionsResponse: + r"""Tests if the caller has a list of permissions on a + resource. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore + + def sample_test_iam_permissions(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.TestIamPermissionsRequest( + resource="resource_value", + permissions=['permissions_value_1', 'permissions_value_2'], + ) + + # Make the request + response = client.test_iam_permissions(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]): + The request object. Request message for + `TestIamPermissions` method. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse: + Response message for TestIamPermissions method. + """ + # Create or coerce a protobuf request object. + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + if isinstance(request, dict): + request = iam_policy_pb2.TestIamPermissionsRequest(**request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.test_iam_permissions, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_project_settings( + self, + request: Union[settings.GetProjectSettingsRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> settings.ProjectSettings: + r"""Retrieves the Settings for the Project. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_project_settings(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetProjectSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.get_project_settings(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetProjectSettingsRequest, dict]): + The request object. Gets the redirection status for a + project. + name (:class:`str`): + Required. The name of the + projectSettings resource. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.ProjectSettings: + The Artifact Registry settings that + apply to a Project. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = settings.GetProjectSettingsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_project_settings, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def update_project_settings( + self, + request: Union[settings.UpdateProjectSettingsRequest, dict] = None, + *, + project_settings: settings.ProjectSettings = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> settings.ProjectSettings: + r"""Updates the Settings for the Project. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_update_project_settings(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateProjectSettingsRequest( + ) + + # Make the request + response = client.update_project_settings(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.UpdateProjectSettingsRequest, dict]): + The request object. Sets the settings of the project. + project_settings (:class:`google.cloud.artifactregistry_v1.types.ProjectSettings`): + The project settings. + This corresponds to the ``project_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Field mask to support partial + updates. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.ProjectSettings: + The Artifact Registry settings that + apply to a Project. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = settings.UpdateProjectSettingsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_settings is not None: + request.project_settings = project_settings + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_project_settings, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("project_settings.name", request.project_settings.name),) + ), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/client.py b/google/cloud/artifactregistry_v1/services/artifact_registry/client.py index 90426ee..992a1d7 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/client.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/client.py @@ -16,29 +16,43 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.api_core import operation # type: ignore +from google.api_core import operation_async # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import struct_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.artifactregistry_v1.services.artifact_registry import pagers -from google.cloud.artifactregistry_v1.types import artifact +from google.cloud.artifactregistry_v1.types import apt_artifact, artifact, file, package from google.cloud.artifactregistry_v1.types import repository -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ArtifactRegistryTransport, DEFAULT_CLIENT_INFO +from google.cloud.artifactregistry_v1.types import repository as gda_repository +from google.cloud.artifactregistry_v1.types import service, settings +from google.cloud.artifactregistry_v1.types import tag +from google.cloud.artifactregistry_v1.types import tag as gda_tag +from google.cloud.artifactregistry_v1.types import version, yum_artifact + +from .transports.base import DEFAULT_CLIENT_INFO, ArtifactRegistryTransport from .transports.grpc import ArtifactRegistryGrpcTransport from .transports.grpc_asyncio import ArtifactRegistryGrpcAsyncIOTransport @@ -57,7 +71,10 @@ class ArtifactRegistryClientMeta(type): _transport_registry["grpc"] = ArtifactRegistryGrpcTransport _transport_registry["grpc_asyncio"] = ArtifactRegistryGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ArtifactRegistryTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ArtifactRegistryTransport]: """Returns an appropriate transport class. Args: @@ -174,9 +191,36 @@ def transport(self) -> ArtifactRegistryTransport: """ return self._transport + @staticmethod + def apt_artifact_path( + project: str, + location: str, + repository: str, + apt_artifact: str, + ) -> str: + """Returns a fully-qualified apt_artifact string.""" + return "projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}".format( + project=project, + location=location, + repository=repository, + apt_artifact=apt_artifact, + ) + + @staticmethod + def parse_apt_artifact_path(path: str) -> Dict[str, str]: + """Parses a apt_artifact path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/repositories/(?P.+?)/aptArtifacts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def docker_image_path( - project: str, location: str, repository: str, docker_image: str, + project: str, + location: str, + repository: str, + docker_image: str, ) -> str: """Returns a fully-qualified docker_image string.""" return "projects/{project}/locations/{location}/repositories/{repository}/dockerImages/{docker_image}".format( @@ -196,10 +240,57 @@ def parse_docker_image_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def repository_path(project: str, location: str, repository: str,) -> str: + def file_path( + project: str, + location: str, + repository: str, + file: str, + ) -> str: + """Returns a fully-qualified file string.""" + return "projects/{project}/locations/{location}/repositories/{repository}/files/{file}".format( + project=project, + location=location, + repository=repository, + file=file, + ) + + @staticmethod + def parse_file_path(path: str) -> Dict[str, str]: + """Parses a file path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/repositories/(?P.+?)/files/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def project_settings_path( + project: str, + ) -> str: + """Returns a fully-qualified project_settings string.""" + return "projects/{project}/projectSettings".format( + project=project, + ) + + @staticmethod + def parse_project_settings_path(path: str) -> Dict[str, str]: + """Parses a project_settings path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/projectSettings$", path) + return m.groupdict() if m else {} + + @staticmethod + def repository_path( + project: str, + location: str, + repository: str, + ) -> str: """Returns a fully-qualified repository string.""" - return "projects/{project}/locations/{location}/repositories/{repository}".format( - project=project, location=location, repository=repository, + return ( + "projects/{project}/locations/{location}/repositories/{repository}".format( + project=project, + location=location, + repository=repository, + ) ) @staticmethod @@ -212,7 +303,85 @@ def parse_repository_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def tag_path( + project: str, + location: str, + repository: str, + package: str, + tag: str, + ) -> str: + """Returns a fully-qualified tag string.""" + return "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}".format( + project=project, + location=location, + repository=repository, + package=package, + tag=tag, + ) + + @staticmethod + def parse_tag_path(path: str) -> Dict[str, str]: + """Parses a tag path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/repositories/(?P.+?)/packages/(?P.+?)/tags/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def version_path( + project: str, + location: str, + repository: str, + package: str, + version: str, + ) -> str: + """Returns a fully-qualified version string.""" + return "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}".format( + project=project, + location=location, + repository=repository, + package=package, + version=version, + ) + + @staticmethod + def parse_version_path(path: str) -> Dict[str, str]: + """Parses a version path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/repositories/(?P.+?)/packages/(?P.+?)/versions/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def yum_artifact_path( + project: str, + location: str, + repository: str, + yum_artifact: str, + ) -> str: + """Returns a fully-qualified yum_artifact string.""" + return "projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}".format( + project=project, + location=location, + repository=repository, + yum_artifact=yum_artifact, + ) + + @staticmethod + def parse_yum_artifact_path(path: str) -> Dict[str, str]: + """Parses a yum_artifact path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/repositories/(?P.+?)/yumArtifacts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -225,9 +394,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -236,9 +409,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -247,9 +424,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -258,10 +439,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -524,57 +709,63 @@ def sample_list_docker_images(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListDockerImagesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. return response - def list_repositories( + def get_docker_image( self, - request: Union[repository.ListRepositoriesRequest, dict] = None, + request: Union[artifact.GetDockerImageRequest, dict] = None, *, - parent: str = None, + name: str = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListRepositoriesPager: - r"""Lists repositories. + ) -> artifact.DockerImage: + r"""Gets a docker image. .. code-block:: python from google.cloud import artifactregistry_v1 - def sample_list_repositories(): + def sample_get_docker_image(): # Create a client client = artifactregistry_v1.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1.ListRepositoriesRequest( - parent="parent_value", + request = artifactregistry_v1.GetDockerImageRequest( + name="name_value", ) # Make the request - page_result = client.list_repositories(request=request) + response = client.get_docker_image(request=request) # Handle the response - for response in page_result: - print(response) + print(response) Args: - request (Union[google.cloud.artifactregistry_v1.types.ListRepositoriesRequest, dict]): - The request object. The request to list repositories. - parent (str): - Required. The name of the parent - resource whose repositories will be - listed. + request (Union[google.cloud.artifactregistry_v1.types.GetDockerImageRequest, dict]): + The request object. The request to get docker images. + name (str): + Required. The name of the docker + images. - This corresponds to the ``parent`` field + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -584,18 +775,18 @@ def sample_list_repositories(): sent along with the request as metadata. Returns: - google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListRepositoriesPager: - The response from listing - repositories. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.cloud.artifactregistry_v1.types.DockerImage: + DockerImage represents a docker artifact. + The following fields are returned as untyped metadata + in the Version resource, using camelcase keys (i.e. + metadata.imageSizeBytes): \* imageSizeBytes \* + mediaType \* buildTime """ # Create or coerce a protobuf request object. # 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]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -603,19 +794,103 @@ def sample_list_repositories(): ) # Minor optimization to avoid making a copy if the user passes - # in a repository.ListRepositoriesRequest. + # in a artifact.GetDockerImageRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, repository.ListRepositoriesRequest): - request = repository.ListRepositoriesRequest(request) + if not isinstance(request, artifact.GetDockerImageRequest): + request = artifact.GetDockerImageRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_repositories] + rpc = self._transport._wrapped_methods[self._transport.get_docker_image] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def import_apt_artifacts( + self, + request: Union[apt_artifact.ImportAptArtifactsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Imports Apt artifacts. The returned Operation will + complete once the resources are imported. Package, + Version, and File resources are created based on the + imported artifacts. Imported artifacts that conflict + with existing resources are ignored. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_import_apt_artifacts(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ImportAptArtifactsRequest( + ) + + # Make the request + operation = client.import_apt_artifacts(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ImportAptArtifactsRequest, dict]): + The request object. The request to import new apt + artifacts. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.artifactregistry_v1.types.ImportAptArtifactsResponse` + The response message from importing APT artifacts. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a apt_artifact.ImportAptArtifactsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, apt_artifact.ImportAptArtifactsRequest): + request = apt_artifact.ImportAptArtifactsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.import_apt_artifacts] # Certain fields should be provided within the metadata header; # add these here. @@ -624,58 +899,64 @@ def sample_list_repositories(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListRepositoriesPager( - method=rpc, request=request, response=response, metadata=metadata, + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + apt_artifact.ImportAptArtifactsResponse, + metadata_type=apt_artifact.ImportAptArtifactsMetadata, ) # Done; return the response. return response - def get_repository( + def import_yum_artifacts( self, - request: Union[repository.GetRepositoryRequest, dict] = None, + request: Union[yum_artifact.ImportYumArtifactsRequest, dict] = None, *, - name: str = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> repository.Repository: - r"""Gets a repository. + ) -> operation.Operation: + r"""Imports Yum (RPM) artifacts. The returned Operation + will complete once the resources are imported. Package, + Version, and File resources are created based on the + imported artifacts. Imported artifacts that conflict + with existing resources are ignored. .. code-block:: python from google.cloud import artifactregistry_v1 - def sample_get_repository(): + def sample_import_yum_artifacts(): # Create a client client = artifactregistry_v1.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1.GetRepositoryRequest( - name="name_value", + request = artifactregistry_v1.ImportYumArtifactsRequest( ) # Make the request - response = client.get_repository(request=request) + operation = client.import_yum_artifacts(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() # Handle the response print(response) Args: - request (Union[google.cloud.artifactregistry_v1.types.GetRepositoryRequest, dict]): - The request object. The request to retrieve a - repository. - name (str): - Required. The name of the repository - to retrieve. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + request (Union[google.cloud.artifactregistry_v1.types.ImportYumArtifactsRequest, dict]): + The request object. The request to import new yum + artifacts. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -683,44 +964,2484 @@ def sample_get_repository(): sent along with the request as metadata. Returns: - google.cloud.artifactregistry_v1.types.Repository: - A Repository for storing artifacts - with a specific format. + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.artifactregistry_v1.types.ImportYumArtifactsResponse` + The response message from importing YUM artifacts. """ # Create or coerce a protobuf request object. - # 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: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - # Minor optimization to avoid making a copy if the user passes - # in a repository.GetRepositoryRequest. + # in a yum_artifact.ImportYumArtifactsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, repository.GetRepositoryRequest): - request = repository.GetRepositoryRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + if not isinstance(request, yum_artifact.ImportYumArtifactsRequest): + request = yum_artifact.ImportYumArtifactsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_repository] + rpc = self._transport._wrapped_methods[self._transport.import_yum_artifacts] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + yum_artifact.ImportYumArtifactsResponse, + metadata_type=yum_artifact.ImportYumArtifactsMetadata, + ) + + # Done; return the response. + return response + + def list_repositories( + self, + request: Union[repository.ListRepositoriesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListRepositoriesPager: + r"""Lists repositories. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_repositories(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListRepositoriesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_repositories(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListRepositoriesRequest, dict]): + The request object. The request to list repositories. + parent (str): + Required. The name of the parent + resource whose repositories will be + listed. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListRepositoriesPager: + The response from listing + repositories. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a repository.ListRepositoriesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, repository.ListRepositoriesRequest): + request = repository.ListRepositoriesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_repositories] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListRepositoriesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_repository( + self, + request: Union[repository.GetRepositoryRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> repository.Repository: + r"""Gets a repository. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetRepositoryRequest( + name="name_value", + ) + + # Make the request + response = client.get_repository(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetRepositoryRequest, dict]): + The request object. The request to retrieve a + repository. + name (str): + Required. The name of the repository + to retrieve. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Repository: + A Repository for storing artifacts + with a specific format. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a repository.GetRepositoryRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, repository.GetRepositoryRequest): + request = repository.GetRepositoryRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_repository] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_repository( + self, + request: Union[gda_repository.CreateRepositoryRequest, dict] = None, + *, + parent: str = None, + repository: gda_repository.Repository = None, + repository_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates a repository. The returned Operation will + finish once the repository has been created. Its + response will be the created Repository. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_create_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.CreateRepositoryRequest( + parent="parent_value", + ) + + # Make the request + operation = client.create_repository(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.CreateRepositoryRequest, dict]): + The request object. The request to create a new + repository. + parent (str): + Required. The name of the parent + resource where the repository will be + created. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + repository (google.cloud.artifactregistry_v1.types.Repository): + The repository to be created. + This corresponds to the ``repository`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + repository_id (str): + The repository id to use for this + repository. + + This corresponds to the ``repository_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:`google.cloud.artifactregistry_v1.types.Repository` + A Repository for storing artifacts with a specific + format. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gda_repository.CreateRepositoryRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gda_repository.CreateRepositoryRequest): + request = gda_repository.CreateRepositoryRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if repository is not None: + request.repository = repository + if repository_id is not None: + request.repository_id = repository_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_repository] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + gda_repository.Repository, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def update_repository( + self, + request: Union[gda_repository.UpdateRepositoryRequest, dict] = None, + *, + repository: gda_repository.Repository = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gda_repository.Repository: + r"""Updates a repository. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_update_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateRepositoryRequest( + ) + + # Make the request + response = client.update_repository(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.UpdateRepositoryRequest, dict]): + The request object. The request to update a repository. + repository (google.cloud.artifactregistry_v1.types.Repository): + The repository that replaces the + resource on the server. + + This corresponds to the ``repository`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + The update mask applies to the resource. For the + ``FieldMask`` definition, see + https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Repository: + A Repository for storing artifacts + with a specific format. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gda_repository.UpdateRepositoryRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gda_repository.UpdateRepositoryRequest): + request = gda_repository.UpdateRepositoryRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if repository is not None: + request.repository = repository + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_repository] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("repository.name", request.repository.name),) + ), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_repository( + self, + request: Union[repository.DeleteRepositoryRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes a repository and all of its contents. The + returned Operation will finish once the repository has + been deleted. It will not have any Operation metadata + and will return a google.protobuf.Empty response. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_delete_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteRepositoryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_repository(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.DeleteRepositoryRequest, dict]): + The request object. The request to delete a repository. + name (str): + Required. The name of the repository + to delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + The JSON representation for Empty is empty JSON + object {}. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a repository.DeleteRepositoryRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, repository.DeleteRepositoryRequest): + request = repository.DeleteRepositoryRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_repository] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def list_packages( + self, + request: Union[package.ListPackagesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListPackagesPager: + r"""Lists packages. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_packages(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListPackagesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_packages(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListPackagesRequest, dict]): + The request object. The request to list packages. + parent (str): + Required. The name of the parent + resource whose packages will be listed. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListPackagesPager: + The response from listing packages. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a package.ListPackagesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, package.ListPackagesRequest): + request = package.ListPackagesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_packages] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListPackagesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_package( + self, + request: Union[package.GetPackageRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> package.Package: + r"""Gets a package. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_package(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetPackageRequest( + name="name_value", + ) + + # Make the request + response = client.get_package(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetPackageRequest, dict]): + The request object. The request to retrieve a package. + name (str): + Required. The name of the package to + retrieve. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Package: + Packages are named collections of + versions. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a package.GetPackageRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, package.GetPackageRequest): + request = package.GetPackageRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_package] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_package( + self, + request: Union[package.DeletePackageRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes a package and all of its versions and tags. + The returned operation will complete once the package + has been deleted. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_delete_package(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeletePackageRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_package(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.DeletePackageRequest, dict]): + The request object. The request to delete a package. + name (str): + Required. The name of the package to + delete. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + The JSON representation for Empty is empty JSON + object {}. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a package.DeletePackageRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, package.DeletePackageRequest): + request = package.DeletePackageRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_package] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def list_versions( + self, + request: Union[version.ListVersionsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListVersionsPager: + r"""Lists versions. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_versions(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListVersionsRequest( + ) + + # Make the request + page_result = client.list_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListVersionsRequest, dict]): + The request object. The request to list versions. + parent (str): + The name of the parent resource whose + versions will be listed. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListVersionsPager: + The response from listing versions. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a version.ListVersionsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, version.ListVersionsRequest): + request = version.ListVersionsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_versions] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListVersionsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_version( + self, + request: Union[version.GetVersionRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> version.Version: + r"""Gets a version + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_version(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetVersionRequest( + ) + + # Make the request + response = client.get_version(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetVersionRequest, dict]): + The request object. The request to retrieve a version. + name (str): + The name of the version to retrieve. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Version: + The body of a version resource. A + version resource represents a collection + of components, such as files and other + data. This may correspond to a version + in many package management schemes. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a version.GetVersionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, version.GetVersionRequest): + request = version.GetVersionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_version] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_version( + self, + request: Union[version.DeleteVersionRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Deletes a version and all of its content. The + returned operation will complete once the version has + been deleted. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_delete_version(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteVersionRequest( + ) + + # Make the request + operation = client.delete_version(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.DeleteVersionRequest, dict]): + The request object. The request to delete a version. + name (str): + The name of the version to delete. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.api_core.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); + + } + + The JSON representation for Empty is empty JSON + object {}. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a version.DeleteVersionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, version.DeleteVersionRequest): + request = version.DeleteVersionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_version] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + empty_pb2.Empty, + metadata_type=service.OperationMetadata, + ) + + # Done; return the response. + return response + + def list_files( + self, + request: Union[file.ListFilesRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListFilesPager: + r"""Lists files. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_files(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListFilesRequest( + ) + + # Make the request + page_result = client.list_files(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListFilesRequest, dict]): + The request object. The request to list files. + parent (str): + The name of the repository whose + files will be listed. For example: + "projects/p1/locations/us-central1/repositories/repo1 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListFilesPager: + The response from listing files. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a file.ListFilesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, file.ListFilesRequest): + request = file.ListFilesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_files] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListFilesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_file( + self, + request: Union[file.GetFileRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> file.File: + r"""Gets a file. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_file(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetFileRequest( + ) + + # Make the request + response = client.get_file(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetFileRequest, dict]): + The request object. The request to retrieve a file. + name (str): + The name of the file to retrieve. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.File: + Files store content that is + potentially associated with Packages or + Versions. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a file.GetFileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, file.GetFileRequest): + request = file.GetFileRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_file] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def list_tags( + self, + request: Union[tag.ListTagsRequest, dict] = None, + *, + parent: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTagsPager: + r"""Lists tags. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_list_tags(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListTagsRequest( + ) + + # Make the request + page_result = client.list_tags(request=request) + + # Handle the response + for response in page_result: + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.ListTagsRequest, dict]): + The request object. The request to list tags. + parent (str): + The name of the parent resource whose + tags will be listed. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListTagsPager: + The response from listing tags. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a tag.ListTagsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, tag.ListTagsRequest): + request = tag.ListTagsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_tags] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListTagsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_tag( + self, + request: Union[tag.GetTagRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> tag.Tag: + r"""Gets a tag. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetTagRequest( + ) + + # Make the request + response = client.get_tag(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetTagRequest, dict]): + The request object. The request to retrieve a tag. + name (str): + The name of the tag to retrieve. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Tag: + Tags point to a version and represent + an alternative name that can be used to + access the version. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a tag.GetTagRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, tag.GetTagRequest): + request = tag.GetTagRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_tag] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_tag( + self, + request: Union[gda_tag.CreateTagRequest, dict] = None, + *, + parent: str = None, + tag: gda_tag.Tag = None, + tag_id: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gda_tag.Tag: + r"""Creates a tag. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_create_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.CreateTagRequest( + ) + + # Make the request + response = client.create_tag(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.CreateTagRequest, dict]): + The request object. The request to create a new tag. + parent (str): + The name of the parent resource where + the tag will be created. + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + tag (google.cloud.artifactregistry_v1.types.Tag): + The tag to be created. + This corresponds to the ``tag`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + tag_id (str): + The tag id to use for this + repository. + + This corresponds to the ``tag_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Tag: + Tags point to a version and represent + an alternative name that can be used to + access the version. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gda_tag.CreateTagRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gda_tag.CreateTagRequest): + request = gda_tag.CreateTagRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if tag is not None: + request.tag = tag + if tag_id is not None: + request.tag_id = tag_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_tag] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_tag( + self, + request: Union[gda_tag.UpdateTagRequest, dict] = None, + *, + tag: gda_tag.Tag = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gda_tag.Tag: + r"""Updates a tag. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_update_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateTagRequest( + ) + + # Make the request + response = client.update_tag(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.UpdateTagRequest, dict]): + The request object. The request to create or update a + tag. + tag (google.cloud.artifactregistry_v1.types.Tag): + The tag that replaces the resource on + the server. + + This corresponds to the ``tag`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + The update mask applies to the resource. For the + ``FieldMask`` definition, see + https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.Tag: + Tags point to a version and represent + an alternative name that can be used to + access the version. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a gda_tag.UpdateTagRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, gda_tag.UpdateTagRequest): + request = gda_tag.UpdateTagRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if tag is not None: + request.tag = tag + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_tag] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("tag.name", request.tag.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_tag( + self, + request: Union[tag.DeleteTagRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a tag. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_delete_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteTagRequest( + ) + + # Make the request + client.delete_tag(request=request) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.DeleteTagRequest, dict]): + The request object. The request to delete a tag. + name (str): + The name of the tag to delete. + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a tag.DeleteTagRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, tag.DeleteTagRequest): + request = tag.DeleteTagRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_tag] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def set_iam_policy( + self, + request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> policy_pb2.Policy: + r"""Updates the IAM policy for a given resource. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore + + def sample_set_iam_policy(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.SetIamPolicyRequest( + resource="resource_value", + ) + + # Make the request + response = client.set_iam_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]): + The request object. Request message for `SetIamPolicy` + method. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.iam.v1.policy_pb2.Policy: + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud resources. + + A Policy is a collection of bindings. A binding binds + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** + + { + "bindings": [ + { + "role": + "roles/resourcemanager.organizationAdmin", + "members": [ "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + + }, { "role": + "roles/resourcemanager.organizationViewer", + "members": [ "user:eve@example.com" ], + "condition": { "title": "expirable access", + "description": "Does not grant access after + Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } + + ], "etag": "BwWWja0YfJA=", "version": 3 + + } + + **YAML example:** + + bindings: - members: - user:\ mike@example.com - + group:\ admins@example.com - domain:google.com - + serviceAccount:\ my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - + members: - user:\ eve@example.com role: + roles/resourcemanager.organizationViewer + condition: title: expirable access description: + Does not grant access after Sep 2020 expression: + request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 + + For a description of IAM and its features, see the + [IAM + documentation](\ https://cloud.google.com/iam/docs/). + + """ + # Create or coerce a protobuf request object. + if isinstance(request, dict): + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + request = iam_policy_pb2.SetIamPolicyRequest(**request) + elif not request: + # Null request, just make one. + request = iam_policy_pb2.SetIamPolicyRequest() + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.set_iam_policy] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_iam_policy( + self, + request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> policy_pb2.Policy: + r"""Gets the IAM policy for a given resource. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore + + def sample_get_iam_policy(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.GetIamPolicyRequest( + resource="resource_value", + ) + + # Make the request + response = client.get_iam_policy(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]): + The request object. Request message for `GetIamPolicy` + method. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.iam.v1.policy_pb2.Policy: + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud resources. + + A Policy is a collection of bindings. A binding binds + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** + + { + "bindings": [ + { + "role": + "roles/resourcemanager.organizationAdmin", + "members": [ "user:mike@example.com", + "group:admins@example.com", + "domain:google.com", + "serviceAccount:my-project-id@appspot.gserviceaccount.com" + ] + + }, { "role": + "roles/resourcemanager.organizationViewer", + "members": [ "user:eve@example.com" ], + "condition": { "title": "expirable access", + "description": "Does not grant access after + Sep 2020", "expression": "request.time < + timestamp('2020-10-01T00:00:00.000Z')", } } + + ], "etag": "BwWWja0YfJA=", "version": 3 + + } + + **YAML example:** + + bindings: - members: - user:\ mike@example.com - + group:\ admins@example.com - domain:google.com - + serviceAccount:\ my-project-id@appspot.gserviceaccount.com + role: roles/resourcemanager.organizationAdmin - + members: - user:\ eve@example.com role: + roles/resourcemanager.organizationViewer + condition: title: expirable access description: + Does not grant access after Sep 2020 expression: + request.time < + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 + + For a description of IAM and its features, see the + [IAM + documentation](\ https://cloud.google.com/iam/docs/). + + """ + # Create or coerce a protobuf request object. + if isinstance(request, dict): + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + request = iam_policy_pb2.GetIamPolicyRequest(**request) + elif not request: + # Null request, just make one. + request = iam_policy_pb2.GetIamPolicyRequest() + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_iam_policy] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def test_iam_permissions( + self, + request: Union[iam_policy_pb2.TestIamPermissionsRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> iam_policy_pb2.TestIamPermissionsResponse: + r"""Tests if the caller has a list of permissions on a + resource. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore + + def sample_test_iam_permissions(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.TestIamPermissionsRequest( + resource="resource_value", + permissions=['permissions_value_1', 'permissions_value_2'], + ) + + # Make the request + response = client.test_iam_permissions(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]): + The request object. Request message for + `TestIamPermissions` method. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse: + Response message for TestIamPermissions method. + """ + # Create or coerce a protobuf request object. + if isinstance(request, dict): + # The request isn't a proto-plus wrapped type, + # so it must be constructed via keyword expansion. + request = iam_policy_pb2.TestIamPermissionsRequest(**request) + elif not request: + # Null request, just make one. + request = iam_policy_pb2.TestIamPermissionsRequest() + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_project_settings( + self, + request: Union[settings.GetProjectSettingsRequest, dict] = None, + *, + name: str = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> settings.ProjectSettings: + r"""Retrieves the Settings for the Project. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_get_project_settings(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetProjectSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.get_project_settings(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.GetProjectSettingsRequest, dict]): + The request object. Gets the redirection status for a + project. + name (str): + Required. The name of the + projectSettings resource. + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.ProjectSettings: + The Artifact Registry settings that + apply to a Project. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a settings.GetProjectSettingsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, settings.GetProjectSettingsRequest): + request = settings.GetProjectSettingsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_project_settings] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + + def update_project_settings( + self, + request: Union[settings.UpdateProjectSettingsRequest, dict] = None, + *, + project_settings: settings.ProjectSettings = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> settings.ProjectSettings: + r"""Updates the Settings for the Project. + + .. code-block:: python + + from google.cloud import artifactregistry_v1 + + def sample_update_project_settings(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateProjectSettingsRequest( + ) + + # Make the request + response = client.update_project_settings(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.cloud.artifactregistry_v1.types.UpdateProjectSettingsRequest, dict]): + The request object. Sets the settings of the project. + project_settings (google.cloud.artifactregistry_v1.types.ProjectSettings): + The project settings. + This corresponds to the ``project_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Field mask to support partial + updates. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.cloud.artifactregistry_v1.types.ProjectSettings: + The Artifact Registry settings that + apply to a Project. + + """ + # Create or coerce a protobuf request object. + # 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: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a settings.UpdateProjectSettingsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, settings.UpdateProjectSettingsRequest): + request = settings.UpdateProjectSettingsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if project_settings is not None: + request.project_settings = project_settings + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_project_settings] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("project_settings.name", request.project_settings.name),) + ), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/pagers.py b/google/cloud/artifactregistry_v1/services/artifact_registry/pagers.py index 15d574b..8c46275 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/pagers.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/pagers.py @@ -18,14 +18,20 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.artifactregistry_v1.types import artifact -from google.cloud.artifactregistry_v1.types import repository +from google.cloud.artifactregistry_v1.types import ( + artifact, + file, + package, + repository, + tag, + version, +) class ListDockerImagesPager: @@ -282,3 +288,515 @@ async def async_generator(): def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListPackagesPager: + """A pager for iterating through ``list_packages`` requests. + + This class thinly wraps an initial + :class:`google.cloud.artifactregistry_v1.types.ListPackagesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``packages`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListPackages`` requests and continue to iterate + through the ``packages`` field on the + corresponding responses. + + All the usual :class:`google.cloud.artifactregistry_v1.types.ListPackagesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., package.ListPackagesResponse], + request: package.ListPackagesRequest, + response: package.ListPackagesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.artifactregistry_v1.types.ListPackagesRequest): + The initial request object. + response (google.cloud.artifactregistry_v1.types.ListPackagesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = package.ListPackagesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[package.ListPackagesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[package.Package]: + for page in self.pages: + yield from page.packages + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListPackagesAsyncPager: + """A pager for iterating through ``list_packages`` requests. + + This class thinly wraps an initial + :class:`google.cloud.artifactregistry_v1.types.ListPackagesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``packages`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListPackages`` requests and continue to iterate + through the ``packages`` field on the + corresponding responses. + + All the usual :class:`google.cloud.artifactregistry_v1.types.ListPackagesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[package.ListPackagesResponse]], + request: package.ListPackagesRequest, + response: package.ListPackagesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.artifactregistry_v1.types.ListPackagesRequest): + The initial request object. + response (google.cloud.artifactregistry_v1.types.ListPackagesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = package.ListPackagesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[package.ListPackagesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterator[package.Package]: + async def async_generator(): + async for page in self.pages: + for response in page.packages: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListVersionsPager: + """A pager for iterating through ``list_versions`` requests. + + This class thinly wraps an initial + :class:`google.cloud.artifactregistry_v1.types.ListVersionsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``versions`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListVersions`` requests and continue to iterate + through the ``versions`` field on the + corresponding responses. + + All the usual :class:`google.cloud.artifactregistry_v1.types.ListVersionsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., version.ListVersionsResponse], + request: version.ListVersionsRequest, + response: version.ListVersionsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.artifactregistry_v1.types.ListVersionsRequest): + The initial request object. + response (google.cloud.artifactregistry_v1.types.ListVersionsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = version.ListVersionsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[version.ListVersionsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[version.Version]: + for page in self.pages: + yield from page.versions + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListVersionsAsyncPager: + """A pager for iterating through ``list_versions`` requests. + + This class thinly wraps an initial + :class:`google.cloud.artifactregistry_v1.types.ListVersionsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``versions`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListVersions`` requests and continue to iterate + through the ``versions`` field on the + corresponding responses. + + All the usual :class:`google.cloud.artifactregistry_v1.types.ListVersionsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[version.ListVersionsResponse]], + request: version.ListVersionsRequest, + response: version.ListVersionsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.artifactregistry_v1.types.ListVersionsRequest): + The initial request object. + response (google.cloud.artifactregistry_v1.types.ListVersionsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = version.ListVersionsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[version.ListVersionsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterator[version.Version]: + async def async_generator(): + async for page in self.pages: + for response in page.versions: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListFilesPager: + """A pager for iterating through ``list_files`` requests. + + This class thinly wraps an initial + :class:`google.cloud.artifactregistry_v1.types.ListFilesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``files`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListFiles`` requests and continue to iterate + through the ``files`` field on the + corresponding responses. + + All the usual :class:`google.cloud.artifactregistry_v1.types.ListFilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., file.ListFilesResponse], + request: file.ListFilesRequest, + response: file.ListFilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.artifactregistry_v1.types.ListFilesRequest): + The initial request object. + response (google.cloud.artifactregistry_v1.types.ListFilesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = file.ListFilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[file.ListFilesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[file.File]: + for page in self.pages: + yield from page.files + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListFilesAsyncPager: + """A pager for iterating through ``list_files`` requests. + + This class thinly wraps an initial + :class:`google.cloud.artifactregistry_v1.types.ListFilesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``files`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListFiles`` requests and continue to iterate + through the ``files`` field on the + corresponding responses. + + All the usual :class:`google.cloud.artifactregistry_v1.types.ListFilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[file.ListFilesResponse]], + request: file.ListFilesRequest, + response: file.ListFilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.artifactregistry_v1.types.ListFilesRequest): + The initial request object. + response (google.cloud.artifactregistry_v1.types.ListFilesResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = file.ListFilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[file.ListFilesResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterator[file.File]: + async def async_generator(): + async for page in self.pages: + for response in page.files: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListTagsPager: + """A pager for iterating through ``list_tags`` requests. + + This class thinly wraps an initial + :class:`google.cloud.artifactregistry_v1.types.ListTagsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``tags`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListTags`` requests and continue to iterate + through the ``tags`` field on the + corresponding responses. + + All the usual :class:`google.cloud.artifactregistry_v1.types.ListTagsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., tag.ListTagsResponse], + request: tag.ListTagsRequest, + response: tag.ListTagsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.artifactregistry_v1.types.ListTagsRequest): + The initial request object. + response (google.cloud.artifactregistry_v1.types.ListTagsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = tag.ListTagsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[tag.ListTagsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterator[tag.Tag]: + for page in self.pages: + yield from page.tags + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListTagsAsyncPager: + """A pager for iterating through ``list_tags`` requests. + + This class thinly wraps an initial + :class:`google.cloud.artifactregistry_v1.types.ListTagsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``tags`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListTags`` requests and continue to iterate + through the ``tags`` field on the + corresponding responses. + + All the usual :class:`google.cloud.artifactregistry_v1.types.ListTagsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[tag.ListTagsResponse]], + request: tag.ListTagsRequest, + response: tag.ListTagsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.cloud.artifactregistry_v1.types.ListTagsRequest): + The initial request object. + response (google.cloud.artifactregistry_v1.types.ListTagsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = tag.ListTagsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterator[tag.ListTagsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterator[tag.Tag]: + async def async_generator(): + async for page in self.pages: + for response in page.tags: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/__init__.py b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/__init__.py index e77bf1e..d7b62c0 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/__init__.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import ArtifactRegistryGrpcTransport from .grpc_asyncio import ArtifactRegistryGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ArtifactRegistryTransport]] _transport_registry["grpc"] = ArtifactRegistryGrpcTransport diff --git a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/base.py b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/base.py index 89996c1..7511ad9 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/base.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/base.py @@ -15,18 +15,27 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +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 +from google.protobuf import empty_pb2 # type: ignore +import pkg_resources -from google.cloud.artifactregistry_v1.types import artifact +from google.cloud.artifactregistry_v1.types import apt_artifact, artifact, file, package from google.cloud.artifactregistry_v1.types import repository +from google.cloud.artifactregistry_v1.types import repository as gda_repository +from google.cloud.artifactregistry_v1.types import settings +from google.cloud.artifactregistry_v1.types import tag +from google.cloud.artifactregistry_v1.types import tag as gda_tag +from google.cloud.artifactregistry_v1.types import version, yum_artifact try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -84,6 +93,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -125,25 +135,156 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_docker_images: gapic_v1.method.wrap_method( - self.list_docker_images, default_timeout=None, client_info=client_info, + self.list_docker_images, + default_timeout=None, + client_info=client_info, + ), + self.get_docker_image: gapic_v1.method.wrap_method( + self.get_docker_image, + default_timeout=None, + client_info=client_info, + ), + self.import_apt_artifacts: gapic_v1.method.wrap_method( + self.import_apt_artifacts, + default_timeout=None, + client_info=client_info, + ), + self.import_yum_artifacts: gapic_v1.method.wrap_method( + self.import_yum_artifacts, + default_timeout=None, + client_info=client_info, ), self.list_repositories: gapic_v1.method.wrap_method( - self.list_repositories, default_timeout=None, client_info=client_info, + self.list_repositories, + default_timeout=None, + client_info=client_info, ), self.get_repository: gapic_v1.method.wrap_method( - self.get_repository, default_timeout=None, client_info=client_info, + self.get_repository, + default_timeout=None, + client_info=client_info, + ), + self.create_repository: gapic_v1.method.wrap_method( + self.create_repository, + default_timeout=None, + client_info=client_info, + ), + self.update_repository: gapic_v1.method.wrap_method( + self.update_repository, + default_timeout=None, + client_info=client_info, + ), + self.delete_repository: gapic_v1.method.wrap_method( + self.delete_repository, + default_timeout=None, + client_info=client_info, + ), + self.list_packages: gapic_v1.method.wrap_method( + self.list_packages, + default_timeout=None, + client_info=client_info, + ), + self.get_package: gapic_v1.method.wrap_method( + self.get_package, + default_timeout=None, + client_info=client_info, + ), + self.delete_package: gapic_v1.method.wrap_method( + self.delete_package, + default_timeout=None, + client_info=client_info, + ), + self.list_versions: gapic_v1.method.wrap_method( + self.list_versions, + default_timeout=None, + client_info=client_info, + ), + self.get_version: gapic_v1.method.wrap_method( + self.get_version, + default_timeout=None, + client_info=client_info, + ), + self.delete_version: gapic_v1.method.wrap_method( + self.delete_version, + default_timeout=None, + client_info=client_info, + ), + self.list_files: gapic_v1.method.wrap_method( + self.list_files, + default_timeout=None, + client_info=client_info, + ), + self.get_file: gapic_v1.method.wrap_method( + self.get_file, + default_timeout=None, + client_info=client_info, + ), + self.list_tags: gapic_v1.method.wrap_method( + self.list_tags, + default_timeout=None, + client_info=client_info, + ), + self.get_tag: gapic_v1.method.wrap_method( + self.get_tag, + default_timeout=None, + client_info=client_info, + ), + self.create_tag: gapic_v1.method.wrap_method( + self.create_tag, + default_timeout=None, + client_info=client_info, + ), + self.update_tag: gapic_v1.method.wrap_method( + self.update_tag, + default_timeout=None, + client_info=client_info, + ), + self.delete_tag: gapic_v1.method.wrap_method( + self.delete_tag, + default_timeout=None, + client_info=client_info, + ), + self.set_iam_policy: gapic_v1.method.wrap_method( + self.set_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.get_iam_policy: gapic_v1.method.wrap_method( + self.get_iam_policy, + default_timeout=None, + client_info=client_info, + ), + self.test_iam_permissions: gapic_v1.method.wrap_method( + self.test_iam_permissions, + default_timeout=None, + client_info=client_info, + ), + self.get_project_settings: gapic_v1.method.wrap_method( + self.get_project_settings, + default_timeout=None, + client_info=client_info, + ), + self.update_project_settings: gapic_v1.method.wrap_method( + self.update_project_settings, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() + @property + def operations_client(self): + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + @property def list_docker_images( self, @@ -156,6 +297,33 @@ def list_docker_images( ]: raise NotImplementedError() + @property + def get_docker_image( + self, + ) -> Callable[ + [artifact.GetDockerImageRequest], + Union[artifact.DockerImage, Awaitable[artifact.DockerImage]], + ]: + raise NotImplementedError() + + @property + def import_apt_artifacts( + self, + ) -> Callable[ + [apt_artifact.ImportAptArtifactsRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def import_yum_artifacts( + self, + ) -> Callable[ + [yum_artifact.ImportYumArtifactsRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + @property def list_repositories( self, @@ -177,5 +345,190 @@ def get_repository( ]: raise NotImplementedError() + @property + def create_repository( + self, + ) -> Callable[ + [gda_repository.CreateRepositoryRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def update_repository( + self, + ) -> Callable[ + [gda_repository.UpdateRepositoryRequest], + Union[gda_repository.Repository, Awaitable[gda_repository.Repository]], + ]: + raise NotImplementedError() + + @property + def delete_repository( + self, + ) -> Callable[ + [repository.DeleteRepositoryRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def list_packages( + self, + ) -> Callable[ + [package.ListPackagesRequest], + Union[package.ListPackagesResponse, Awaitable[package.ListPackagesResponse]], + ]: + raise NotImplementedError() + + @property + def get_package( + self, + ) -> Callable[ + [package.GetPackageRequest], Union[package.Package, Awaitable[package.Package]] + ]: + raise NotImplementedError() + + @property + def delete_package( + self, + ) -> Callable[ + [package.DeletePackageRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def list_versions( + self, + ) -> Callable[ + [version.ListVersionsRequest], + Union[version.ListVersionsResponse, Awaitable[version.ListVersionsResponse]], + ]: + raise NotImplementedError() + + @property + def get_version( + self, + ) -> Callable[ + [version.GetVersionRequest], Union[version.Version, Awaitable[version.Version]] + ]: + raise NotImplementedError() + + @property + def delete_version( + self, + ) -> Callable[ + [version.DeleteVersionRequest], + Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]], + ]: + raise NotImplementedError() + + @property + def list_files( + self, + ) -> Callable[ + [file.ListFilesRequest], + Union[file.ListFilesResponse, Awaitable[file.ListFilesResponse]], + ]: + raise NotImplementedError() + + @property + def get_file( + self, + ) -> Callable[[file.GetFileRequest], Union[file.File, Awaitable[file.File]]]: + raise NotImplementedError() + + @property + def list_tags( + self, + ) -> Callable[ + [tag.ListTagsRequest], + Union[tag.ListTagsResponse, Awaitable[tag.ListTagsResponse]], + ]: + raise NotImplementedError() + + @property + def get_tag( + self, + ) -> Callable[[tag.GetTagRequest], Union[tag.Tag, Awaitable[tag.Tag]]]: + raise NotImplementedError() + + @property + def create_tag( + self, + ) -> Callable[ + [gda_tag.CreateTagRequest], Union[gda_tag.Tag, Awaitable[gda_tag.Tag]] + ]: + raise NotImplementedError() + + @property + def update_tag( + self, + ) -> Callable[ + [gda_tag.UpdateTagRequest], Union[gda_tag.Tag, Awaitable[gda_tag.Tag]] + ]: + raise NotImplementedError() + + @property + def delete_tag( + self, + ) -> Callable[ + [tag.DeleteTagRequest], Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]] + ]: + raise NotImplementedError() + + @property + def set_iam_policy( + self, + ) -> Callable[ + [iam_policy_pb2.SetIamPolicyRequest], + Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]], + ]: + raise NotImplementedError() + + @property + def get_iam_policy( + self, + ) -> Callable[ + [iam_policy_pb2.GetIamPolicyRequest], + Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]], + ]: + raise NotImplementedError() + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], + Union[ + iam_policy_pb2.TestIamPermissionsResponse, + Awaitable[iam_policy_pb2.TestIamPermissionsResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_project_settings( + self, + ) -> Callable[ + [settings.GetProjectSettingsRequest], + Union[settings.ProjectSettings, Awaitable[settings.ProjectSettings]], + ]: + raise NotImplementedError() + + @property + def update_project_settings( + self, + ) -> Callable[ + [settings.UpdateProjectSettingsRequest], + Union[settings.ProjectSettings, Awaitable[settings.ProjectSettings]], + ]: + raise NotImplementedError() + + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ArtifactRegistryTransport",) 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 e98898c..67e4392 100644 --- a/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc.py +++ b/google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc.py @@ -13,20 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore -from google.cloud.artifactregistry_v1.types import artifact +from google.cloud.artifactregistry_v1.types import apt_artifact, artifact, file, package from google.cloud.artifactregistry_v1.types import repository -from .base import ArtifactRegistryTransport, DEFAULT_CLIENT_INFO +from google.cloud.artifactregistry_v1.types import repository as gda_repository +from google.cloud.artifactregistry_v1.types import settings +from google.cloud.artifactregistry_v1.types import tag +from google.cloud.artifactregistry_v1.types import tag as gda_tag +from google.cloud.artifactregistry_v1.types import version, yum_artifact + +from .base import DEFAULT_CLIENT_INFO, ArtifactRegistryTransport class ArtifactRegistryGrpcTransport(ArtifactRegistryTransport): @@ -123,6 +131,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -237,10 +246,23 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # 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) + + # Return the client from cache. + return self._operations_client + @property def list_docker_images( self, @@ -269,6 +291,92 @@ def list_docker_images( ) return self._stubs["list_docker_images"] + @property + def get_docker_image( + self, + ) -> Callable[[artifact.GetDockerImageRequest], artifact.DockerImage]: + r"""Return a callable for the get docker image method over gRPC. + + Gets a docker image. + + Returns: + Callable[[~.GetDockerImageRequest], + ~.DockerImage]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_docker_image" not in self._stubs: + self._stubs["get_docker_image"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetDockerImage", + request_serializer=artifact.GetDockerImageRequest.serialize, + response_deserializer=artifact.DockerImage.deserialize, + ) + return self._stubs["get_docker_image"] + + @property + def import_apt_artifacts( + self, + ) -> Callable[[apt_artifact.ImportAptArtifactsRequest], operations_pb2.Operation]: + r"""Return a callable for the import apt artifacts method over gRPC. + + Imports Apt artifacts. The returned Operation will + complete once the resources are imported. Package, + Version, and File resources are created based on the + imported artifacts. Imported artifacts that conflict + with existing resources are ignored. + + Returns: + Callable[[~.ImportAptArtifactsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "import_apt_artifacts" not in self._stubs: + self._stubs["import_apt_artifacts"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ImportAptArtifacts", + request_serializer=apt_artifact.ImportAptArtifactsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["import_apt_artifacts"] + + @property + def import_yum_artifacts( + self, + ) -> Callable[[yum_artifact.ImportYumArtifactsRequest], operations_pb2.Operation]: + r"""Return a callable for the import yum artifacts method over gRPC. + + Imports Yum (RPM) artifacts. The returned Operation + will complete once the resources are imported. Package, + Version, and File resources are created based on the + imported artifacts. Imported artifacts that conflict + with existing resources are ignored. + + Returns: + Callable[[~.ImportYumArtifactsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "import_yum_artifacts" not in self._stubs: + self._stubs["import_yum_artifacts"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ImportYumArtifacts", + request_serializer=yum_artifact.ImportYumArtifactsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["import_yum_artifacts"] + @property def list_repositories( self, @@ -323,8 +431,553 @@ def get_repository( ) return self._stubs["get_repository"] + @property + def create_repository( + self, + ) -> Callable[[gda_repository.CreateRepositoryRequest], operations_pb2.Operation]: + r"""Return a callable for the create repository method over gRPC. + + Creates a repository. The returned Operation will + finish once the repository has been created. Its + response will be the created Repository. + + Returns: + Callable[[~.CreateRepositoryRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_repository" not in self._stubs: + self._stubs["create_repository"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/CreateRepository", + request_serializer=gda_repository.CreateRepositoryRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["create_repository"] + + @property + def update_repository( + self, + ) -> Callable[[gda_repository.UpdateRepositoryRequest], gda_repository.Repository]: + r"""Return a callable for the update repository method over gRPC. + + Updates a repository. + + Returns: + Callable[[~.UpdateRepositoryRequest], + ~.Repository]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_repository" not in self._stubs: + self._stubs["update_repository"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/UpdateRepository", + request_serializer=gda_repository.UpdateRepositoryRequest.serialize, + response_deserializer=gda_repository.Repository.deserialize, + ) + return self._stubs["update_repository"] + + @property + def delete_repository( + self, + ) -> Callable[[repository.DeleteRepositoryRequest], operations_pb2.Operation]: + r"""Return a callable for the delete repository method over gRPC. + + Deletes a repository and all of its contents. The + returned Operation will finish once the repository has + been deleted. It will not have any Operation metadata + and will return a google.protobuf.Empty response. + + Returns: + Callable[[~.DeleteRepositoryRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_repository" not in self._stubs: + self._stubs["delete_repository"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/DeleteRepository", + request_serializer=repository.DeleteRepositoryRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["delete_repository"] + + @property + def list_packages( + self, + ) -> Callable[[package.ListPackagesRequest], package.ListPackagesResponse]: + r"""Return a callable for the list packages method over gRPC. + + Lists packages. + + Returns: + Callable[[~.ListPackagesRequest], + ~.ListPackagesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_packages" not in self._stubs: + self._stubs["list_packages"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ListPackages", + request_serializer=package.ListPackagesRequest.serialize, + response_deserializer=package.ListPackagesResponse.deserialize, + ) + return self._stubs["list_packages"] + + @property + def get_package(self) -> Callable[[package.GetPackageRequest], package.Package]: + r"""Return a callable for the get package method over gRPC. + + Gets a package. + + Returns: + Callable[[~.GetPackageRequest], + ~.Package]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_package" not in self._stubs: + self._stubs["get_package"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetPackage", + request_serializer=package.GetPackageRequest.serialize, + response_deserializer=package.Package.deserialize, + ) + return self._stubs["get_package"] + + @property + def delete_package( + self, + ) -> Callable[[package.DeletePackageRequest], operations_pb2.Operation]: + r"""Return a callable for the delete package method over gRPC. + + Deletes a package and all of its versions and tags. + The returned operation will complete once the package + has been deleted. + + Returns: + Callable[[~.DeletePackageRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_package" not in self._stubs: + self._stubs["delete_package"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/DeletePackage", + request_serializer=package.DeletePackageRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["delete_package"] + + @property + def list_versions( + self, + ) -> Callable[[version.ListVersionsRequest], version.ListVersionsResponse]: + r"""Return a callable for the list versions method over gRPC. + + Lists versions. + + Returns: + Callable[[~.ListVersionsRequest], + ~.ListVersionsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_versions" not in self._stubs: + self._stubs["list_versions"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ListVersions", + request_serializer=version.ListVersionsRequest.serialize, + response_deserializer=version.ListVersionsResponse.deserialize, + ) + return self._stubs["list_versions"] + + @property + def get_version(self) -> Callable[[version.GetVersionRequest], version.Version]: + r"""Return a callable for the get version method over gRPC. + + Gets a version + + Returns: + Callable[[~.GetVersionRequest], + ~.Version]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_version" not in self._stubs: + self._stubs["get_version"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetVersion", + request_serializer=version.GetVersionRequest.serialize, + response_deserializer=version.Version.deserialize, + ) + return self._stubs["get_version"] + + @property + def delete_version( + self, + ) -> Callable[[version.DeleteVersionRequest], operations_pb2.Operation]: + r"""Return a callable for the delete version method over gRPC. + + Deletes a version and all of its content. The + returned operation will complete once the version has + been deleted. + + Returns: + Callable[[~.DeleteVersionRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_version" not in self._stubs: + self._stubs["delete_version"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/DeleteVersion", + request_serializer=version.DeleteVersionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["delete_version"] + + @property + def list_files(self) -> Callable[[file.ListFilesRequest], file.ListFilesResponse]: + r"""Return a callable for the list files method over gRPC. + + Lists files. + + Returns: + Callable[[~.ListFilesRequest], + ~.ListFilesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_files" not in self._stubs: + self._stubs["list_files"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ListFiles", + request_serializer=file.ListFilesRequest.serialize, + response_deserializer=file.ListFilesResponse.deserialize, + ) + return self._stubs["list_files"] + + @property + def get_file(self) -> Callable[[file.GetFileRequest], file.File]: + r"""Return a callable for the get file method over gRPC. + + Gets a file. + + Returns: + Callable[[~.GetFileRequest], + ~.File]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_file" not in self._stubs: + self._stubs["get_file"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetFile", + request_serializer=file.GetFileRequest.serialize, + response_deserializer=file.File.deserialize, + ) + return self._stubs["get_file"] + + @property + def list_tags(self) -> Callable[[tag.ListTagsRequest], tag.ListTagsResponse]: + r"""Return a callable for the list tags method over gRPC. + + Lists tags. + + Returns: + Callable[[~.ListTagsRequest], + ~.ListTagsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_tags" not in self._stubs: + self._stubs["list_tags"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ListTags", + request_serializer=tag.ListTagsRequest.serialize, + response_deserializer=tag.ListTagsResponse.deserialize, + ) + return self._stubs["list_tags"] + + @property + def get_tag(self) -> Callable[[tag.GetTagRequest], tag.Tag]: + r"""Return a callable for the get tag method over gRPC. + + Gets a tag. + + Returns: + Callable[[~.GetTagRequest], + ~.Tag]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_tag" not in self._stubs: + self._stubs["get_tag"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetTag", + request_serializer=tag.GetTagRequest.serialize, + response_deserializer=tag.Tag.deserialize, + ) + return self._stubs["get_tag"] + + @property + def create_tag(self) -> Callable[[gda_tag.CreateTagRequest], gda_tag.Tag]: + r"""Return a callable for the create tag method over gRPC. + + Creates a tag. + + Returns: + Callable[[~.CreateTagRequest], + ~.Tag]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_tag" not in self._stubs: + self._stubs["create_tag"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/CreateTag", + request_serializer=gda_tag.CreateTagRequest.serialize, + response_deserializer=gda_tag.Tag.deserialize, + ) + return self._stubs["create_tag"] + + @property + def update_tag(self) -> Callable[[gda_tag.UpdateTagRequest], gda_tag.Tag]: + r"""Return a callable for the update tag method over gRPC. + + Updates a tag. + + Returns: + Callable[[~.UpdateTagRequest], + ~.Tag]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_tag" not in self._stubs: + self._stubs["update_tag"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/UpdateTag", + request_serializer=gda_tag.UpdateTagRequest.serialize, + response_deserializer=gda_tag.Tag.deserialize, + ) + return self._stubs["update_tag"] + + @property + def delete_tag(self) -> Callable[[tag.DeleteTagRequest], empty_pb2.Empty]: + r"""Return a callable for the delete tag method over gRPC. + + Deletes a tag. + + Returns: + Callable[[~.DeleteTagRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_tag" not in self._stubs: + self._stubs["delete_tag"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/DeleteTag", + request_serializer=tag.DeleteTagRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_tag"] + + @property + def set_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the set iam policy method over gRPC. + + Updates the IAM policy for a given resource. + + Returns: + Callable[[~.SetIamPolicyRequest], + ~.Policy]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "set_iam_policy" not in self._stubs: + self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/SetIamPolicy", + request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["set_iam_policy"] + + @property + def get_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]: + r"""Return a callable for the get iam policy method over gRPC. + + Gets the IAM policy for a given resource. + + Returns: + Callable[[~.GetIamPolicyRequest], + ~.Policy]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_iam_policy" not in self._stubs: + self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetIamPolicy", + request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["get_iam_policy"] + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], + iam_policy_pb2.TestIamPermissionsResponse, + ]: + r"""Return a callable for the test iam permissions method over gRPC. + + Tests if the caller has a list of permissions on a + resource. + + Returns: + Callable[[~.TestIamPermissionsRequest], + ~.TestIamPermissionsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "test_iam_permissions" not in self._stubs: + self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/TestIamPermissions", + request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, + response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, + ) + return self._stubs["test_iam_permissions"] + + @property + def get_project_settings( + self, + ) -> Callable[[settings.GetProjectSettingsRequest], settings.ProjectSettings]: + r"""Return a callable for the get project settings method over gRPC. + + Retrieves the Settings for the Project. + + Returns: + Callable[[~.GetProjectSettingsRequest], + ~.ProjectSettings]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_project_settings" not in self._stubs: + self._stubs["get_project_settings"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetProjectSettings", + request_serializer=settings.GetProjectSettingsRequest.serialize, + response_deserializer=settings.ProjectSettings.deserialize, + ) + return self._stubs["get_project_settings"] + + @property + def update_project_settings( + self, + ) -> Callable[[settings.UpdateProjectSettingsRequest], settings.ProjectSettings]: + r"""Return a callable for the update project settings method over gRPC. + + Updates the Settings for the Project. + + Returns: + Callable[[~.UpdateProjectSettingsRequest], + ~.ProjectSettings]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_project_settings" not in self._stubs: + self._stubs["update_project_settings"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/UpdateProjectSettings", + request_serializer=settings.UpdateProjectSettingsRequest.serialize, + response_deserializer=settings.ProjectSettings.deserialize, + ) + return self._stubs["update_project_settings"] + def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ArtifactRegistryGrpcTransport",) 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 b76ae2a..acf60e4 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 @@ -13,20 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.artifactregistry_v1.types import artifact +from google.cloud.artifactregistry_v1.types import apt_artifact, artifact, file, package from google.cloud.artifactregistry_v1.types import repository -from .base import ArtifactRegistryTransport, DEFAULT_CLIENT_INFO +from google.cloud.artifactregistry_v1.types import repository as gda_repository +from google.cloud.artifactregistry_v1.types import settings +from google.cloud.artifactregistry_v1.types import tag +from google.cloud.artifactregistry_v1.types import tag as gda_tag +from google.cloud.artifactregistry_v1.types import version, yum_artifact + +from .base import DEFAULT_CLIENT_INFO, ArtifactRegistryTransport from .grpc import ArtifactRegistryGrpcTransport @@ -169,6 +177,7 @@ def __init__( self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} + self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -243,6 +252,22 @@ def grpc_channel(self) -> aio.Channel: # Return the channel from cache. return self._grpc_channel + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # 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 + ) + + # Return the client from cache. + return self._operations_client + @property def list_docker_images( self, @@ -271,6 +296,96 @@ def list_docker_images( ) return self._stubs["list_docker_images"] + @property + def get_docker_image( + self, + ) -> Callable[[artifact.GetDockerImageRequest], Awaitable[artifact.DockerImage]]: + r"""Return a callable for the get docker image method over gRPC. + + Gets a docker image. + + Returns: + Callable[[~.GetDockerImageRequest], + Awaitable[~.DockerImage]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_docker_image" not in self._stubs: + self._stubs["get_docker_image"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetDockerImage", + request_serializer=artifact.GetDockerImageRequest.serialize, + response_deserializer=artifact.DockerImage.deserialize, + ) + return self._stubs["get_docker_image"] + + @property + def import_apt_artifacts( + self, + ) -> Callable[ + [apt_artifact.ImportAptArtifactsRequest], Awaitable[operations_pb2.Operation] + ]: + r"""Return a callable for the import apt artifacts method over gRPC. + + Imports Apt artifacts. The returned Operation will + complete once the resources are imported. Package, + Version, and File resources are created based on the + imported artifacts. Imported artifacts that conflict + with existing resources are ignored. + + Returns: + Callable[[~.ImportAptArtifactsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "import_apt_artifacts" not in self._stubs: + self._stubs["import_apt_artifacts"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ImportAptArtifacts", + request_serializer=apt_artifact.ImportAptArtifactsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["import_apt_artifacts"] + + @property + def import_yum_artifacts( + self, + ) -> Callable[ + [yum_artifact.ImportYumArtifactsRequest], Awaitable[operations_pb2.Operation] + ]: + r"""Return a callable for the import yum artifacts method over gRPC. + + Imports Yum (RPM) artifacts. The returned Operation + will complete once the resources are imported. Package, + Version, and File resources are created based on the + imported artifacts. Imported artifacts that conflict + with existing resources are ignored. + + Returns: + Callable[[~.ImportYumArtifactsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "import_yum_artifacts" not in self._stubs: + self._stubs["import_yum_artifacts"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ImportYumArtifacts", + request_serializer=yum_artifact.ImportYumArtifactsRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["import_yum_artifacts"] + @property def list_repositories( self, @@ -326,6 +441,575 @@ def get_repository( ) return self._stubs["get_repository"] + @property + def create_repository( + self, + ) -> Callable[ + [gda_repository.CreateRepositoryRequest], Awaitable[operations_pb2.Operation] + ]: + r"""Return a callable for the create repository method over gRPC. + + Creates a repository. The returned Operation will + finish once the repository has been created. Its + response will be the created Repository. + + Returns: + Callable[[~.CreateRepositoryRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_repository" not in self._stubs: + self._stubs["create_repository"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/CreateRepository", + request_serializer=gda_repository.CreateRepositoryRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["create_repository"] + + @property + def update_repository( + self, + ) -> Callable[ + [gda_repository.UpdateRepositoryRequest], Awaitable[gda_repository.Repository] + ]: + r"""Return a callable for the update repository method over gRPC. + + Updates a repository. + + Returns: + Callable[[~.UpdateRepositoryRequest], + Awaitable[~.Repository]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_repository" not in self._stubs: + self._stubs["update_repository"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/UpdateRepository", + request_serializer=gda_repository.UpdateRepositoryRequest.serialize, + response_deserializer=gda_repository.Repository.deserialize, + ) + return self._stubs["update_repository"] + + @property + def delete_repository( + self, + ) -> Callable[ + [repository.DeleteRepositoryRequest], Awaitable[operations_pb2.Operation] + ]: + r"""Return a callable for the delete repository method over gRPC. + + Deletes a repository and all of its contents. The + returned Operation will finish once the repository has + been deleted. It will not have any Operation metadata + and will return a google.protobuf.Empty response. + + Returns: + Callable[[~.DeleteRepositoryRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_repository" not in self._stubs: + self._stubs["delete_repository"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/DeleteRepository", + request_serializer=repository.DeleteRepositoryRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["delete_repository"] + + @property + def list_packages( + self, + ) -> Callable[ + [package.ListPackagesRequest], Awaitable[package.ListPackagesResponse] + ]: + r"""Return a callable for the list packages method over gRPC. + + Lists packages. + + Returns: + Callable[[~.ListPackagesRequest], + Awaitable[~.ListPackagesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_packages" not in self._stubs: + self._stubs["list_packages"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ListPackages", + request_serializer=package.ListPackagesRequest.serialize, + response_deserializer=package.ListPackagesResponse.deserialize, + ) + return self._stubs["list_packages"] + + @property + def get_package( + self, + ) -> Callable[[package.GetPackageRequest], Awaitable[package.Package]]: + r"""Return a callable for the get package method over gRPC. + + Gets a package. + + Returns: + Callable[[~.GetPackageRequest], + Awaitable[~.Package]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_package" not in self._stubs: + self._stubs["get_package"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetPackage", + request_serializer=package.GetPackageRequest.serialize, + response_deserializer=package.Package.deserialize, + ) + return self._stubs["get_package"] + + @property + def delete_package( + self, + ) -> Callable[[package.DeletePackageRequest], Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete package method over gRPC. + + Deletes a package and all of its versions and tags. + The returned operation will complete once the package + has been deleted. + + Returns: + Callable[[~.DeletePackageRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_package" not in self._stubs: + self._stubs["delete_package"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/DeletePackage", + request_serializer=package.DeletePackageRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["delete_package"] + + @property + def list_versions( + self, + ) -> Callable[ + [version.ListVersionsRequest], Awaitable[version.ListVersionsResponse] + ]: + r"""Return a callable for the list versions method over gRPC. + + Lists versions. + + Returns: + Callable[[~.ListVersionsRequest], + Awaitable[~.ListVersionsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_versions" not in self._stubs: + self._stubs["list_versions"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ListVersions", + request_serializer=version.ListVersionsRequest.serialize, + response_deserializer=version.ListVersionsResponse.deserialize, + ) + return self._stubs["list_versions"] + + @property + def get_version( + self, + ) -> Callable[[version.GetVersionRequest], Awaitable[version.Version]]: + r"""Return a callable for the get version method over gRPC. + + Gets a version + + Returns: + Callable[[~.GetVersionRequest], + Awaitable[~.Version]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_version" not in self._stubs: + self._stubs["get_version"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetVersion", + request_serializer=version.GetVersionRequest.serialize, + response_deserializer=version.Version.deserialize, + ) + return self._stubs["get_version"] + + @property + def delete_version( + self, + ) -> Callable[[version.DeleteVersionRequest], Awaitable[operations_pb2.Operation]]: + r"""Return a callable for the delete version method over gRPC. + + Deletes a version and all of its content. The + returned operation will complete once the version has + been deleted. + + Returns: + Callable[[~.DeleteVersionRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_version" not in self._stubs: + self._stubs["delete_version"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/DeleteVersion", + request_serializer=version.DeleteVersionRequest.serialize, + response_deserializer=operations_pb2.Operation.FromString, + ) + return self._stubs["delete_version"] + + @property + def list_files( + self, + ) -> Callable[[file.ListFilesRequest], Awaitable[file.ListFilesResponse]]: + r"""Return a callable for the list files method over gRPC. + + Lists files. + + Returns: + Callable[[~.ListFilesRequest], + Awaitable[~.ListFilesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_files" not in self._stubs: + self._stubs["list_files"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ListFiles", + request_serializer=file.ListFilesRequest.serialize, + response_deserializer=file.ListFilesResponse.deserialize, + ) + return self._stubs["list_files"] + + @property + def get_file(self) -> Callable[[file.GetFileRequest], Awaitable[file.File]]: + r"""Return a callable for the get file method over gRPC. + + Gets a file. + + Returns: + Callable[[~.GetFileRequest], + Awaitable[~.File]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_file" not in self._stubs: + self._stubs["get_file"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetFile", + request_serializer=file.GetFileRequest.serialize, + response_deserializer=file.File.deserialize, + ) + return self._stubs["get_file"] + + @property + def list_tags( + self, + ) -> Callable[[tag.ListTagsRequest], Awaitable[tag.ListTagsResponse]]: + r"""Return a callable for the list tags method over gRPC. + + Lists tags. + + Returns: + Callable[[~.ListTagsRequest], + Awaitable[~.ListTagsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_tags" not in self._stubs: + self._stubs["list_tags"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/ListTags", + request_serializer=tag.ListTagsRequest.serialize, + response_deserializer=tag.ListTagsResponse.deserialize, + ) + return self._stubs["list_tags"] + + @property + def get_tag(self) -> Callable[[tag.GetTagRequest], Awaitable[tag.Tag]]: + r"""Return a callable for the get tag method over gRPC. + + Gets a tag. + + Returns: + Callable[[~.GetTagRequest], + Awaitable[~.Tag]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_tag" not in self._stubs: + self._stubs["get_tag"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetTag", + request_serializer=tag.GetTagRequest.serialize, + response_deserializer=tag.Tag.deserialize, + ) + return self._stubs["get_tag"] + + @property + def create_tag( + self, + ) -> Callable[[gda_tag.CreateTagRequest], Awaitable[gda_tag.Tag]]: + r"""Return a callable for the create tag method over gRPC. + + Creates a tag. + + Returns: + Callable[[~.CreateTagRequest], + Awaitable[~.Tag]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_tag" not in self._stubs: + self._stubs["create_tag"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/CreateTag", + request_serializer=gda_tag.CreateTagRequest.serialize, + response_deserializer=gda_tag.Tag.deserialize, + ) + return self._stubs["create_tag"] + + @property + def update_tag( + self, + ) -> Callable[[gda_tag.UpdateTagRequest], Awaitable[gda_tag.Tag]]: + r"""Return a callable for the update tag method over gRPC. + + Updates a tag. + + Returns: + Callable[[~.UpdateTagRequest], + Awaitable[~.Tag]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_tag" not in self._stubs: + self._stubs["update_tag"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/UpdateTag", + request_serializer=gda_tag.UpdateTagRequest.serialize, + response_deserializer=gda_tag.Tag.deserialize, + ) + return self._stubs["update_tag"] + + @property + def delete_tag( + self, + ) -> Callable[[tag.DeleteTagRequest], Awaitable[empty_pb2.Empty]]: + r"""Return a callable for the delete tag method over gRPC. + + Deletes a tag. + + Returns: + Callable[[~.DeleteTagRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_tag" not in self._stubs: + self._stubs["delete_tag"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/DeleteTag", + request_serializer=tag.DeleteTagRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_tag"] + + @property + def set_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], Awaitable[policy_pb2.Policy]]: + r"""Return a callable for the set iam policy method over gRPC. + + Updates the IAM policy for a given resource. + + Returns: + Callable[[~.SetIamPolicyRequest], + Awaitable[~.Policy]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "set_iam_policy" not in self._stubs: + self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/SetIamPolicy", + request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["set_iam_policy"] + + @property + def get_iam_policy( + self, + ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], Awaitable[policy_pb2.Policy]]: + r"""Return a callable for the get iam policy method over gRPC. + + Gets the IAM policy for a given resource. + + Returns: + Callable[[~.GetIamPolicyRequest], + Awaitable[~.Policy]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_iam_policy" not in self._stubs: + self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetIamPolicy", + request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, + response_deserializer=policy_pb2.Policy.FromString, + ) + return self._stubs["get_iam_policy"] + + @property + def test_iam_permissions( + self, + ) -> Callable[ + [iam_policy_pb2.TestIamPermissionsRequest], + Awaitable[iam_policy_pb2.TestIamPermissionsResponse], + ]: + r"""Return a callable for the test iam permissions method over gRPC. + + Tests if the caller has a list of permissions on a + resource. + + Returns: + Callable[[~.TestIamPermissionsRequest], + Awaitable[~.TestIamPermissionsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "test_iam_permissions" not in self._stubs: + self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/TestIamPermissions", + request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, + response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, + ) + return self._stubs["test_iam_permissions"] + + @property + def get_project_settings( + self, + ) -> Callable[ + [settings.GetProjectSettingsRequest], Awaitable[settings.ProjectSettings] + ]: + r"""Return a callable for the get project settings method over gRPC. + + Retrieves the Settings for the Project. + + Returns: + Callable[[~.GetProjectSettingsRequest], + Awaitable[~.ProjectSettings]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_project_settings" not in self._stubs: + self._stubs["get_project_settings"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/GetProjectSettings", + request_serializer=settings.GetProjectSettingsRequest.serialize, + response_deserializer=settings.ProjectSettings.deserialize, + ) + return self._stubs["get_project_settings"] + + @property + def update_project_settings( + self, + ) -> Callable[ + [settings.UpdateProjectSettingsRequest], Awaitable[settings.ProjectSettings] + ]: + r"""Return a callable for the update project settings method over gRPC. + + Updates the Settings for the Project. + + Returns: + Callable[[~.UpdateProjectSettingsRequest], + Awaitable[~.ProjectSettings]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_project_settings" not in self._stubs: + self._stubs["update_project_settings"] = self.grpc_channel.unary_unary( + "/google.devtools.artifactregistry.v1.ArtifactRegistry/UpdateProjectSettings", + request_serializer=settings.UpdateProjectSettingsRequest.serialize, + response_deserializer=settings.ProjectSettings.deserialize, + ) + return self._stubs["update_project_settings"] + def close(self): return self.grpc_channel.close() diff --git a/google/cloud/artifactregistry_v1/types/__init__.py b/google/cloud/artifactregistry_v1/types/__init__.py index 4df78bc..e439f7a 100644 --- a/google/cloud/artifactregistry_v1/types/__init__.py +++ b/google/cloud/artifactregistry_v1/types/__init__.py @@ -13,24 +13,118 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from .apt_artifact import ( + AptArtifact, + ImportAptArtifactsErrorInfo, + ImportAptArtifactsGcsSource, + ImportAptArtifactsMetadata, + ImportAptArtifactsRequest, + ImportAptArtifactsResponse, +) from .artifact import ( DockerImage, + GetDockerImageRequest, ListDockerImagesRequest, ListDockerImagesResponse, ) +from .file import File, GetFileRequest, Hash, ListFilesRequest, ListFilesResponse +from .package import ( + DeletePackageRequest, + GetPackageRequest, + ListPackagesRequest, + ListPackagesResponse, + Package, +) from .repository import ( + CreateRepositoryRequest, + DeleteRepositoryRequest, GetRepositoryRequest, ListRepositoriesRequest, ListRepositoriesResponse, Repository, + UpdateRepositoryRequest, +) +from .service import OperationMetadata +from .settings import ( + GetProjectSettingsRequest, + ProjectSettings, + UpdateProjectSettingsRequest, +) +from .tag import ( + CreateTagRequest, + DeleteTagRequest, + GetTagRequest, + ListTagsRequest, + ListTagsResponse, + Tag, + UpdateTagRequest, +) +from .version import ( + DeleteVersionRequest, + GetVersionRequest, + ListVersionsRequest, + ListVersionsResponse, + Version, + VersionView, +) +from .yum_artifact import ( + ImportYumArtifactsErrorInfo, + ImportYumArtifactsGcsSource, + ImportYumArtifactsMetadata, + ImportYumArtifactsRequest, + ImportYumArtifactsResponse, + YumArtifact, ) __all__ = ( + "AptArtifact", + "ImportAptArtifactsErrorInfo", + "ImportAptArtifactsGcsSource", + "ImportAptArtifactsMetadata", + "ImportAptArtifactsRequest", + "ImportAptArtifactsResponse", "DockerImage", + "GetDockerImageRequest", "ListDockerImagesRequest", "ListDockerImagesResponse", + "File", + "GetFileRequest", + "Hash", + "ListFilesRequest", + "ListFilesResponse", + "DeletePackageRequest", + "GetPackageRequest", + "ListPackagesRequest", + "ListPackagesResponse", + "Package", + "CreateRepositoryRequest", + "DeleteRepositoryRequest", "GetRepositoryRequest", "ListRepositoriesRequest", "ListRepositoriesResponse", "Repository", + "UpdateRepositoryRequest", + "OperationMetadata", + "GetProjectSettingsRequest", + "ProjectSettings", + "UpdateProjectSettingsRequest", + "CreateTagRequest", + "DeleteTagRequest", + "GetTagRequest", + "ListTagsRequest", + "ListTagsResponse", + "Tag", + "UpdateTagRequest", + "DeleteVersionRequest", + "GetVersionRequest", + "ListVersionsRequest", + "ListVersionsResponse", + "Version", + "VersionView", + "ImportYumArtifactsErrorInfo", + "ImportYumArtifactsGcsSource", + "ImportYumArtifactsMetadata", + "ImportYumArtifactsRequest", + "ImportYumArtifactsResponse", + "YumArtifact", ) diff --git a/google/cloud/artifactregistry_v1/types/apt_artifact.py b/google/cloud/artifactregistry_v1/types/apt_artifact.py new file mode 100644 index 0000000..2b88b42 --- /dev/null +++ b/google/cloud/artifactregistry_v1/types/apt_artifact.py @@ -0,0 +1,195 @@ +# -*- 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. +# +from google.rpc import status_pb2 # type: ignore +import proto # type: ignore + +__protobuf__ = proto.module( + package="google.devtools.artifactregistry.v1", + manifest={ + "AptArtifact", + "ImportAptArtifactsGcsSource", + "ImportAptArtifactsRequest", + "ImportAptArtifactsErrorInfo", + "ImportAptArtifactsResponse", + "ImportAptArtifactsMetadata", + }, +) + + +class AptArtifact(proto.Message): + r"""A detailed representation of an Apt artifact. Information in + the record is derived from the archive's control file. See + https://www.debian.org/doc/debian-policy/ch-controlfields.html + + Attributes: + name (str): + Output only. The Artifact Registry resource + name of the artifact. + package_name (str): + Output only. The Apt package name of the + artifact. + package_type (google.cloud.artifactregistry_v1.types.AptArtifact.PackageType): + Output only. An artifact is a binary or + source package. + architecture (str): + Output only. Operating system architecture of + the artifact. + component (str): + Output only. Repository component of the + artifact. + control_file (bytes): + Output only. Contents of the artifact's + control metadata file. + """ + + class PackageType(proto.Enum): + r"""Package type is either binary or source.""" + PACKAGE_TYPE_UNSPECIFIED = 0 + BINARY = 1 + SOURCE = 2 + + name = proto.Field( + proto.STRING, + number=1, + ) + package_name = proto.Field( + proto.STRING, + number=2, + ) + package_type = proto.Field( + proto.ENUM, + number=3, + enum=PackageType, + ) + architecture = proto.Field( + proto.STRING, + number=4, + ) + component = proto.Field( + proto.STRING, + number=5, + ) + control_file = proto.Field( + proto.BYTES, + number=6, + ) + + +class ImportAptArtifactsGcsSource(proto.Message): + r"""Google Cloud Storage location where the artifacts currently + reside. + + Attributes: + uris (Sequence[str]): + Cloud Storage paths URI (e.g., gs://my_bucket//my_object). + use_wildcards (bool): + Supports URI wildcards for matching multiple + objects from a single URI. + """ + + uris = proto.RepeatedField( + proto.STRING, + number=1, + ) + use_wildcards = proto.Field( + proto.BOOL, + number=2, + ) + + +class ImportAptArtifactsRequest(proto.Message): + r"""The request to import new apt artifacts. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + gcs_source (google.cloud.artifactregistry_v1.types.ImportAptArtifactsGcsSource): + Google Cloud Storage location where input + content is located. + + This field is a member of `oneof`_ ``source``. + parent (str): + The name of the parent resource where the + artifacts will be imported. + """ + + gcs_source = proto.Field( + proto.MESSAGE, + number=2, + oneof="source", + message="ImportAptArtifactsGcsSource", + ) + parent = proto.Field( + proto.STRING, + number=1, + ) + + +class ImportAptArtifactsErrorInfo(proto.Message): + r"""Error information explaining why a package was not imported. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + gcs_source (google.cloud.artifactregistry_v1.types.ImportAptArtifactsGcsSource): + Google Cloud Storage location requested. + + This field is a member of `oneof`_ ``source``. + error (google.rpc.status_pb2.Status): + The detailed error status. + """ + + gcs_source = proto.Field( + proto.MESSAGE, + number=1, + oneof="source", + message="ImportAptArtifactsGcsSource", + ) + error = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, + ) + + +class ImportAptArtifactsResponse(proto.Message): + r"""The response message from importing APT artifacts. + + Attributes: + apt_artifacts (Sequence[google.cloud.artifactregistry_v1.types.AptArtifact]): + The Apt artifacts imported. + errors (Sequence[google.cloud.artifactregistry_v1.types.ImportAptArtifactsErrorInfo]): + Detailed error info for packages that were + not imported. + """ + + apt_artifacts = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="AptArtifact", + ) + errors = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="ImportAptArtifactsErrorInfo", + ) + + +class ImportAptArtifactsMetadata(proto.Message): + r"""The operation metadata for importing artifacts.""" + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/artifact.py b/google/cloud/artifactregistry_v1/types/artifact.py index 5f532fe..7ffb6c7 100644 --- a/google/cloud/artifactregistry_v1/types/artifact.py +++ b/google/cloud/artifactregistry_v1/types/artifact.py @@ -13,14 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1", - manifest={"DockerImage", "ListDockerImagesRequest", "ListDockerImagesResponse",}, + manifest={ + "DockerImage", + "ListDockerImagesRequest", + "ListDockerImagesResponse", + "GetDockerImageRequest", + }, ) @@ -74,13 +77,36 @@ class DockerImage(proto.Message): the JavaScript Date constructor. """ - name = proto.Field(proto.STRING, number=1,) - uri = proto.Field(proto.STRING, number=2,) - tags = proto.RepeatedField(proto.STRING, number=3,) - image_size_bytes = proto.Field(proto.INT64, number=4,) - upload_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - media_type = proto.Field(proto.STRING, number=6,) - build_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + uri = proto.Field( + proto.STRING, + number=2, + ) + tags = proto.RepeatedField( + proto.STRING, + number=3, + ) + image_size_bytes = proto.Field( + proto.INT64, + number=4, + ) + upload_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + media_type = proto.Field( + proto.STRING, + number=6, + ) + build_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) class ListDockerImagesRequest(proto.Message): @@ -97,9 +123,18 @@ class ListDockerImagesRequest(proto.Message): request, if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListDockerImagesResponse(proto.Message): @@ -118,8 +153,29 @@ class ListDockerImagesResponse(proto.Message): def raw_page(self): return self - docker_images = proto.RepeatedField(proto.MESSAGE, number=1, message="DockerImage",) - next_page_token = proto.Field(proto.STRING, number=2,) + docker_images = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="DockerImage", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class GetDockerImageRequest(proto.Message): + r"""The request to get docker images. + + Attributes: + name (str): + Required. The name of the docker images. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/file.py b/google/cloud/artifactregistry_v1/types/file.py new file mode 100644 index 0000000..9c234e6 --- /dev/null +++ b/google/cloud/artifactregistry_v1/types/file.py @@ -0,0 +1,204 @@ +# -*- 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. +# +from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore + +__protobuf__ = proto.module( + package="google.devtools.artifactregistry.v1", + manifest={ + "Hash", + "File", + "ListFilesRequest", + "ListFilesResponse", + "GetFileRequest", + }, +) + + +class Hash(proto.Message): + r"""A hash of file content. + + Attributes: + type_ (google.cloud.artifactregistry_v1.types.Hash.HashType): + The algorithm used to compute the hash value. + value (bytes): + The hash value. + """ + + class HashType(proto.Enum): + r"""The algorithm used to compute the hash.""" + HASH_TYPE_UNSPECIFIED = 0 + SHA256 = 1 + MD5 = 2 + + type_ = proto.Field( + proto.ENUM, + number=1, + enum=HashType, + ) + value = proto.Field( + proto.BYTES, + number=2, + ) + + +class File(proto.Message): + r"""Files store content that is potentially associated with + Packages or Versions. + + Attributes: + name (str): + The name of the file, for example: + "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): + The size of the File in bytes. + hashes (Sequence[google.cloud.artifactregistry_v1.types.Hash]): + The hashes of the file content. + create_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the File was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the File was last updated. + owner (str): + The name of the Package or Version that owns + this file, if any. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + size_bytes = proto.Field( + proto.INT64, + number=3, + ) + hashes = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Hash", + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + owner = proto.Field( + proto.STRING, + number=7, + ) + + +class ListFilesRequest(proto.Message): + r"""The request to list files. + + Attributes: + parent (str): + The name of the repository whose files will + be listed. For example: + "projects/p1/locations/us-central1/repositories/repo1 + filter (str): + An expression for filtering the results of the request. + Filter rules are case insensitive. The fields eligible for + filtering are: + + - ``name`` + - ``owner`` + + An example of using a filter: + + - ``name="projects/p1/locations/us-central1/repositories/repo1/files/a/b/*"`` + --> Files with an ID starting with "a/b/". + - ``owner="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"`` + --> Files owned by the version ``1.0`` in package + ``pkg1``. + page_size (int): + The maximum number of files to return. + page_token (str): + The next_page_token value returned from a previous list + request, if any. + order_by (str): + The field to order the results by. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) + + +class ListFilesResponse(proto.Message): + r"""The response from listing files. + + Attributes: + files (Sequence[google.cloud.artifactregistry_v1.types.File]): + The files returned. + next_page_token (str): + The token to retrieve the next page of files, + or empty if there are no more files to return. + """ + + @property + def raw_page(self): + return self + + files = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="File", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class GetFileRequest(proto.Message): + r"""The request to retrieve a file. + + Attributes: + name (str): + The name of the file to retrieve. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/package.py b/google/cloud/artifactregistry_v1/types/package.py new file mode 100644 index 0000000..31517b6 --- /dev/null +++ b/google/cloud/artifactregistry_v1/types/package.py @@ -0,0 +1,155 @@ +# -*- 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. +# +from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore + +__protobuf__ = proto.module( + package="google.devtools.artifactregistry.v1", + manifest={ + "Package", + "ListPackagesRequest", + "ListPackagesResponse", + "GetPackageRequest", + "DeletePackageRequest", + }, +) + + +class Package(proto.Message): + r"""Packages are named collections of versions. + + Attributes: + name (str): + The name of the package, for example: + "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1". + If the package ID part contains slashes, the + slashes are escaped. + display_name (str): + The display name of the package. + create_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the package was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the package was last updated. + This includes publishing a new version of the + package. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + + +class ListPackagesRequest(proto.Message): + r"""The request to list packages. + + Attributes: + parent (str): + Required. The name of the parent resource + whose packages will be listed. + page_size (int): + The maximum number of packages to return. + Maximum page size is 1,000. + page_token (str): + The next_page_token value returned from a previous list + request, if any. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + + +class ListPackagesResponse(proto.Message): + r"""The response from listing packages. + + Attributes: + packages (Sequence[google.cloud.artifactregistry_v1.types.Package]): + The packages returned. + next_page_token (str): + The token to retrieve the next page of + packages, or empty if there are no more packages + to return. + """ + + @property + def raw_page(self): + return self + + packages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Package", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class GetPackageRequest(proto.Message): + r"""The request to retrieve a package. + + Attributes: + name (str): + Required. The name of the package to + retrieve. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class DeletePackageRequest(proto.Message): + r"""The request to delete a package. + + Attributes: + name (str): + Required. The name of the package to delete. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/repository.py b/google/cloud/artifactregistry_v1/types/repository.py index 429db58..0e7b1c4 100644 --- a/google/cloud/artifactregistry_v1/types/repository.py +++ b/google/cloud/artifactregistry_v1/types/repository.py @@ -13,10 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - +from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1", @@ -25,6 +24,9 @@ "ListRepositoriesRequest", "ListRepositoriesResponse", "GetRepositoryRequest", + "CreateRepositoryRequest", + "UpdateRepositoryRequest", + "DeleteRepositoryRequest", }, ) @@ -32,7 +34,15 @@ class Repository(proto.Message): r"""A Repository for storing artifacts with a specific format. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: + maven_config (google.cloud.artifactregistry_v1.types.Repository.MavenRepositoryConfig): + Maven repository config contains repository + level configuration for the repositories of + maven type. + + 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". @@ -42,7 +52,7 @@ class Repository(proto.Message): description (str): The user-provided description of the repository. - labels (Sequence[google.cloud.artifactregistry_v1.types.Repository.LabelsEntry]): + labels (Mapping[str, str]): Labels with user-defined metadata. This field may contain up to 64 entries. Label keys and values may be no longer than 63 @@ -57,7 +67,7 @@ class Repository(proto.Message): updated. kms_key_name (str): The Cloud KMS resource name of the customer managed - encryption key that’s used to encrypt the contents of the + encryption key that's used to encrypt the contents of the Repository. Has the form: ``projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key``. This value may not be changed after the Repository has been @@ -74,13 +84,74 @@ class Format(proto.Enum): YUM = 6 PYTHON = 8 - name = proto.Field(proto.STRING, number=1,) - format_ = proto.Field(proto.ENUM, number=2, enum=Format,) - description = proto.Field(proto.STRING, number=3,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) - kms_key_name = proto.Field(proto.STRING, number=8,) + class MavenRepositoryConfig(proto.Message): + r"""MavenRepositoryConfig is maven related repository details. + Provides additional configuration details for repositories of + the maven format type. + + Attributes: + allow_snapshot_overwrites (bool): + The repository with this flag will allow + publishing the same snapshot versions. + version_policy (google.cloud.artifactregistry_v1.types.Repository.MavenRepositoryConfig.VersionPolicy): + Version policy defines the versions that the + registry will accept. + """ + + class VersionPolicy(proto.Enum): + r"""VersionPolicy is the version policy for the repository.""" + VERSION_POLICY_UNSPECIFIED = 0 + RELEASE = 1 + SNAPSHOT = 2 + + allow_snapshot_overwrites = proto.Field( + proto.BOOL, + number=1, + ) + version_policy = proto.Field( + proto.ENUM, + number=2, + enum="Repository.MavenRepositoryConfig.VersionPolicy", + ) + + maven_config = proto.Field( + proto.MESSAGE, + number=9, + oneof="format_config", + message=MavenRepositoryConfig, + ) + name = proto.Field( + proto.STRING, + number=1, + ) + format_ = proto.Field( + proto.ENUM, + number=2, + enum=Format, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + kms_key_name = proto.Field( + proto.STRING, + number=8, + ) class ListRepositoriesRequest(proto.Message): @@ -92,14 +163,24 @@ class ListRepositoriesRequest(proto.Message): whose repositories will be listed. page_size (int): The maximum number of repositories to return. + Maximum page size is 1,000. page_token (str): The next_page_token value returned from a previous list request, if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListRepositoriesResponse(proto.Message): @@ -118,8 +199,15 @@ class ListRepositoriesResponse(proto.Message): def raw_page(self): return self - repositories = proto.RepeatedField(proto.MESSAGE, number=1, message="Repository",) - next_page_token = proto.Field(proto.STRING, number=2,) + repositories = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Repository", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetRepositoryRequest(proto.Message): @@ -131,7 +219,78 @@ class GetRepositoryRequest(proto.Message): retrieve. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateRepositoryRequest(proto.Message): + r"""The request to create a new repository. + + Attributes: + parent (str): + Required. The name of the parent resource + where the repository will be created. + repository_id (str): + The repository id to use for this repository. + repository (google.cloud.artifactregistry_v1.types.Repository): + The repository to be created. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + repository_id = proto.Field( + proto.STRING, + number=2, + ) + repository = proto.Field( + proto.MESSAGE, + number=3, + message="Repository", + ) + + +class UpdateRepositoryRequest(proto.Message): + r"""The request to update a repository. + + Attributes: + repository (google.cloud.artifactregistry_v1.types.Repository): + The repository that replaces the resource on + the server. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + The update mask applies to the resource. For the + ``FieldMask`` definition, see + https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + """ + + repository = proto.Field( + proto.MESSAGE, + number=1, + message="Repository", + ) + update_mask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + + +class DeleteRepositoryRequest(proto.Message): + r"""The request to delete a repository. + + Attributes: + name (str): + Required. The name of the repository to + delete. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/service.py b/google/cloud/artifactregistry_v1/types/service.py index ffcdc54..cd5234a 100644 --- a/google/cloud/artifactregistry_v1/types/service.py +++ b/google/cloud/artifactregistry_v1/types/service.py @@ -13,9 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import proto # type: ignore +__protobuf__ = proto.module( + package="google.devtools.artifactregistry.v1", + manifest={ + "OperationMetadata", + }, +) -__protobuf__ = proto.module(package="google.devtools.artifactregistry.v1", manifest={},) + +class OperationMetadata(proto.Message): + r"""Metadata type for longrunning-operations, currently empty.""" __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/settings.py b/google/cloud/artifactregistry_v1/types/settings.py new file mode 100644 index 0000000..bf3cab5 --- /dev/null +++ b/google/cloud/artifactregistry_v1/types/settings.py @@ -0,0 +1,100 @@ +# -*- 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. +# +from google.protobuf import field_mask_pb2 # type: ignore +import proto # type: ignore + +__protobuf__ = proto.module( + package="google.devtools.artifactregistry.v1", + manifest={ + "ProjectSettings", + "GetProjectSettingsRequest", + "UpdateProjectSettingsRequest", + }, +) + + +class ProjectSettings(proto.Message): + r"""The Artifact Registry settings that apply to a Project. + + Attributes: + name (str): + The name of the project's settings. + Always of the form: + projects/{project-id}/projectSettings + + In update request: never set + In response: always set + legacy_redirection_state (google.cloud.artifactregistry_v1.types.ProjectSettings.RedirectionState): + The redirection state of the legacy + repositories in this project. + """ + + class RedirectionState(proto.Enum): + r"""The possible redirection states for legacy repositories.""" + REDIRECTION_STATE_UNSPECIFIED = 0 + REDIRECTION_FROM_GCR_IO_DISABLED = 1 + REDIRECTION_FROM_GCR_IO_ENABLED = 2 + REDIRECTION_FROM_GCR_IO_FINALIZED = 3 + + name = proto.Field( + proto.STRING, + number=1, + ) + legacy_redirection_state = proto.Field( + proto.ENUM, + number=2, + enum=RedirectionState, + ) + + +class GetProjectSettingsRequest(proto.Message): + r"""Gets the redirection status for a project. + + Attributes: + name (str): + Required. The name of the projectSettings + resource. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class UpdateProjectSettingsRequest(proto.Message): + r"""Sets the settings of the project. + + Attributes: + project_settings (google.cloud.artifactregistry_v1.types.ProjectSettings): + The project settings. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Field mask to support partial updates. + """ + + project_settings = proto.Field( + proto.MESSAGE, + number=2, + message="ProjectSettings", + ) + update_mask = proto.Field( + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/tag.py b/google/cloud/artifactregistry_v1/types/tag.py new file mode 100644 index 0000000..53c1a16 --- /dev/null +++ b/google/cloud/artifactregistry_v1/types/tag.py @@ -0,0 +1,214 @@ +# -*- 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. +# +from google.protobuf import field_mask_pb2 # type: ignore +import proto # type: ignore + +__protobuf__ = proto.module( + package="google.devtools.artifactregistry.v1", + manifest={ + "Tag", + "ListTagsRequest", + "ListTagsResponse", + "GetTagRequest", + "CreateTagRequest", + "UpdateTagRequest", + "DeleteTagRequest", + }, +) + + +class Tag(proto.Message): + r"""Tags point to a version and represent an alternative name + that can be used to access the version. + + Attributes: + name (str): + The name of the tag, for example: + "projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/tags/tag1". + If the package part contains slashes, the slashes are + escaped. The tag part can only have characters in + [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" + If the package or version ID parts contain + slashes, the slashes are escaped. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.STRING, + number=2, + ) + + +class ListTagsRequest(proto.Message): + r"""The request to list tags. + + Attributes: + parent (str): + The name of the parent resource whose tags + will be listed. + filter (str): + An expression for filtering the results of the request. + Filter rules are case insensitive. The fields eligible for + filtering are: + + - ``version`` + + An example of using a filter: + + - ``version="projects/p1/locations/us-central1/repositories/repo1/packages/pkg1/versions/1.0"`` + --> Tags that are applied to the version ``1.0`` in + package ``pkg1``. + page_size (int): + The maximum number of tags to return. Maximum + page size is 10,000. + page_token (str): + The next_page_token value returned from a previous list + request, if any. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + + +class ListTagsResponse(proto.Message): + r"""The response from listing tags. + + Attributes: + tags (Sequence[google.cloud.artifactregistry_v1.types.Tag]): + The tags returned. + next_page_token (str): + The token to retrieve the next page of tags, + or empty if there are no more tags to return. + """ + + @property + def raw_page(self): + return self + + tags = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Tag", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class GetTagRequest(proto.Message): + r"""The request to retrieve a tag. + + Attributes: + name (str): + The name of the tag to retrieve. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateTagRequest(proto.Message): + r"""The request to create a new tag. + + Attributes: + parent (str): + The name of the parent resource where the tag + will be created. + tag_id (str): + The tag id to use for this repository. + tag (google.cloud.artifactregistry_v1.types.Tag): + The tag to be created. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + tag_id = proto.Field( + proto.STRING, + number=2, + ) + tag = proto.Field( + proto.MESSAGE, + number=3, + message="Tag", + ) + + +class UpdateTagRequest(proto.Message): + r"""The request to create or update a tag. + + Attributes: + tag (google.cloud.artifactregistry_v1.types.Tag): + The tag that replaces the resource on the + server. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + The update mask applies to the resource. For the + ``FieldMask`` definition, see + https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + """ + + tag = proto.Field( + proto.MESSAGE, + number=1, + message="Tag", + ) + update_mask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + + +class DeleteTagRequest(proto.Message): + r"""The request to delete a tag. + + Attributes: + name (str): + The name of the tag to delete. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/version.py b/google/cloud/artifactregistry_v1/types/version.py new file mode 100644 index 0000000..79288c0 --- /dev/null +++ b/google/cloud/artifactregistry_v1/types/version.py @@ -0,0 +1,218 @@ +# -*- 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. +# +from google.protobuf import struct_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore + +from google.cloud.artifactregistry_v1.types import tag + +__protobuf__ = proto.module( + package="google.devtools.artifactregistry.v1", + manifest={ + "VersionView", + "Version", + "ListVersionsRequest", + "ListVersionsResponse", + "GetVersionRequest", + "DeleteVersionRequest", + }, +) + + +class VersionView(proto.Enum): + r"""The view, which determines what version information is + returned in a response. + """ + VERSION_VIEW_UNSPECIFIED = 0 + BASIC = 1 + FULL = 2 + + +class Version(proto.Message): + r"""The body of a version resource. A version resource represents + a collection of components, such as files and other data. This + may correspond to a version in many package management schemes. + + Attributes: + name (str): + The name of the version, for example: + "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): + Optional. Description of the version, as + specified in its metadata. + create_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the version was created. + update_time (google.protobuf.timestamp_pb2.Timestamp): + The time when the version was last updated. + related_tags (Sequence[google.cloud.artifactregistry_v1.types.Tag]): + Output only. A list of related tags. Will + contain up to 100 tags that reference this + version. + metadata (google.protobuf.struct_pb2.Struct): + Output only. Repository-specific Metadata stored against + this version. The fields returned are defined by the + underlying repository-specific resource. Currently, the only + resource in use is + [DockerImage][google.devtools.artifactregistry.v1.DockerImage] + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + related_tags = proto.RepeatedField( + proto.MESSAGE, + number=7, + message=tag.Tag, + ) + metadata = proto.Field( + proto.MESSAGE, + number=8, + message=struct_pb2.Struct, + ) + + +class ListVersionsRequest(proto.Message): + r"""The request to list versions. + + Attributes: + parent (str): + The name of the parent resource whose + versions will be listed. + page_size (int): + The maximum number of versions to return. + Maximum page size is 1,000. + page_token (str): + The next_page_token value returned from a previous list + request, if any. + view (google.cloud.artifactregistry_v1.types.VersionView): + The view that should be returned in the + response. + order_by (str): + Optional. The field to order the results by. + """ + + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum="VersionView", + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) + + +class ListVersionsResponse(proto.Message): + r"""The response from listing versions. + + Attributes: + versions (Sequence[google.cloud.artifactregistry_v1.types.Version]): + The versions returned. + next_page_token (str): + The token to retrieve the next page of + versions, or empty if there are no more versions + to return. + """ + + @property + def raw_page(self): + return self + + versions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Version", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) + + +class GetVersionRequest(proto.Message): + r"""The request to retrieve a version. + + Attributes: + name (str): + The name of the version to retrieve. + view (google.cloud.artifactregistry_v1.types.VersionView): + The view that should be returned in the + response. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum="VersionView", + ) + + +class DeleteVersionRequest(proto.Message): + r"""The request to delete a version. + + Attributes: + name (str): + The name of the version to delete. + force (bool): + By default, a version that is tagged may not + be deleted. If force=true, the version and any + tags pointing to the version are deleted. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1/types/yum_artifact.py b/google/cloud/artifactregistry_v1/types/yum_artifact.py new file mode 100644 index 0000000..4922b5f --- /dev/null +++ b/google/cloud/artifactregistry_v1/types/yum_artifact.py @@ -0,0 +1,179 @@ +# -*- 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. +# +from google.rpc import status_pb2 # type: ignore +import proto # type: ignore + +__protobuf__ = proto.module( + package="google.devtools.artifactregistry.v1", + manifest={ + "YumArtifact", + "ImportYumArtifactsGcsSource", + "ImportYumArtifactsRequest", + "ImportYumArtifactsErrorInfo", + "ImportYumArtifactsResponse", + "ImportYumArtifactsMetadata", + }, +) + + +class YumArtifact(proto.Message): + r"""A detailed representation of a Yum artifact. + + Attributes: + name (str): + Output only. The Artifact Registry resource + name of the artifact. + package_name (str): + Output only. The yum package name of the + artifact. + package_type (google.cloud.artifactregistry_v1.types.YumArtifact.PackageType): + Output only. An artifact is a binary or + source package. + architecture (str): + Output only. Operating system architecture of + the artifact. + """ + + class PackageType(proto.Enum): + r"""Package type is either binary or source.""" + PACKAGE_TYPE_UNSPECIFIED = 0 + BINARY = 1 + SOURCE = 2 + + name = proto.Field( + proto.STRING, + number=1, + ) + package_name = proto.Field( + proto.STRING, + number=2, + ) + package_type = proto.Field( + proto.ENUM, + number=3, + enum=PackageType, + ) + architecture = proto.Field( + proto.STRING, + number=4, + ) + + +class ImportYumArtifactsGcsSource(proto.Message): + r"""Google Cloud Storage location where the artifacts currently + reside. + + Attributes: + uris (Sequence[str]): + Cloud Storage paths URI (e.g., gs://my_bucket//my_object). + use_wildcards (bool): + Supports URI wildcards for matching multiple + objects from a single URI. + """ + + uris = proto.RepeatedField( + proto.STRING, + number=1, + ) + use_wildcards = proto.Field( + proto.BOOL, + number=2, + ) + + +class ImportYumArtifactsRequest(proto.Message): + r"""The request to import new yum artifacts. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + gcs_source (google.cloud.artifactregistry_v1.types.ImportYumArtifactsGcsSource): + Google Cloud Storage location where input + content is located. + + This field is a member of `oneof`_ ``source``. + parent (str): + The name of the parent resource where the + artifacts will be imported. + """ + + gcs_source = proto.Field( + proto.MESSAGE, + number=2, + oneof="source", + message="ImportYumArtifactsGcsSource", + ) + parent = proto.Field( + proto.STRING, + number=1, + ) + + +class ImportYumArtifactsErrorInfo(proto.Message): + r"""Error information explaining why a package was not imported. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + gcs_source (google.cloud.artifactregistry_v1.types.ImportYumArtifactsGcsSource): + Google Cloud Storage location requested. + + This field is a member of `oneof`_ ``source``. + error (google.rpc.status_pb2.Status): + The detailed error status. + """ + + gcs_source = proto.Field( + proto.MESSAGE, + number=1, + oneof="source", + message="ImportYumArtifactsGcsSource", + ) + error = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, + ) + + +class ImportYumArtifactsResponse(proto.Message): + r"""The response message from importing YUM artifacts. + + Attributes: + yum_artifacts (Sequence[google.cloud.artifactregistry_v1.types.YumArtifact]): + The yum artifacts imported. + errors (Sequence[google.cloud.artifactregistry_v1.types.ImportYumArtifactsErrorInfo]): + Detailed error info for packages that were + not imported. + """ + + yum_artifacts = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="YumArtifact", + ) + errors = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="ImportYumArtifactsErrorInfo", + ) + + +class ImportYumArtifactsMetadata(proto.Message): + r"""The operation metadata for importing artifacts.""" + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1beta2/__init__.py b/google/cloud/artifactregistry_v1beta2/__init__.py index f074db0..83a2a83 100644 --- a/google/cloud/artifactregistry_v1beta2/__init__.py +++ b/google/cloud/artifactregistry_v1beta2/__init__.py @@ -14,55 +14,66 @@ # limitations under the License. # -from .services.artifact_registry import ArtifactRegistryClient -from .services.artifact_registry import ArtifactRegistryAsyncClient - -from .types.apt_artifact import AptArtifact -from .types.apt_artifact import ImportAptArtifactsErrorInfo -from .types.apt_artifact import ImportAptArtifactsGcsSource -from .types.apt_artifact import ImportAptArtifactsMetadata -from .types.apt_artifact import ImportAptArtifactsRequest -from .types.apt_artifact import ImportAptArtifactsResponse -from .types.file import File -from .types.file import GetFileRequest -from .types.file import Hash -from .types.file import ListFilesRequest -from .types.file import ListFilesResponse -from .types.package import DeletePackageRequest -from .types.package import GetPackageRequest -from .types.package import ListPackagesRequest -from .types.package import ListPackagesResponse -from .types.package import Package -from .types.repository import CreateRepositoryRequest -from .types.repository import DeleteRepositoryRequest -from .types.repository import GetRepositoryRequest -from .types.repository import ListRepositoriesRequest -from .types.repository import ListRepositoriesResponse -from .types.repository import Repository -from .types.repository import UpdateRepositoryRequest +from .services.artifact_registry import ( + ArtifactRegistryAsyncClient, + ArtifactRegistryClient, +) +from .types.apt_artifact import ( + AptArtifact, + ImportAptArtifactsErrorInfo, + ImportAptArtifactsGcsSource, + ImportAptArtifactsMetadata, + ImportAptArtifactsRequest, + ImportAptArtifactsResponse, +) +from .types.file import File, GetFileRequest, Hash, ListFilesRequest, ListFilesResponse +from .types.package import ( + DeletePackageRequest, + GetPackageRequest, + ListPackagesRequest, + ListPackagesResponse, + Package, +) +from .types.repository import ( + CreateRepositoryRequest, + DeleteRepositoryRequest, + GetRepositoryRequest, + ListRepositoriesRequest, + ListRepositoriesResponse, + Repository, + UpdateRepositoryRequest, +) from .types.service import OperationMetadata -from .types.settings import GetProjectSettingsRequest -from .types.settings import ProjectSettings -from .types.settings import UpdateProjectSettingsRequest -from .types.tag import CreateTagRequest -from .types.tag import DeleteTagRequest -from .types.tag import GetTagRequest -from .types.tag import ListTagsRequest -from .types.tag import ListTagsResponse -from .types.tag import Tag -from .types.tag import UpdateTagRequest -from .types.version import DeleteVersionRequest -from .types.version import GetVersionRequest -from .types.version import ListVersionsRequest -from .types.version import ListVersionsResponse -from .types.version import Version -from .types.version import VersionView -from .types.yum_artifact import ImportYumArtifactsErrorInfo -from .types.yum_artifact import ImportYumArtifactsGcsSource -from .types.yum_artifact import ImportYumArtifactsMetadata -from .types.yum_artifact import ImportYumArtifactsRequest -from .types.yum_artifact import ImportYumArtifactsResponse -from .types.yum_artifact import YumArtifact +from .types.settings import ( + GetProjectSettingsRequest, + ProjectSettings, + UpdateProjectSettingsRequest, +) +from .types.tag import ( + CreateTagRequest, + DeleteTagRequest, + GetTagRequest, + ListTagsRequest, + ListTagsResponse, + Tag, + UpdateTagRequest, +) +from .types.version import ( + DeleteVersionRequest, + GetVersionRequest, + ListVersionsRequest, + ListVersionsResponse, + Version, + VersionView, +) +from .types.yum_artifact import ( + ImportYumArtifactsErrorInfo, + ImportYumArtifactsGcsSource, + ImportYumArtifactsMetadata, + ImportYumArtifactsRequest, + ImportYumArtifactsResponse, + YumArtifact, +) __all__ = ( "ArtifactRegistryAsyncClient", diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/__init__.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/__init__.py index 8dfff60..bbe70dd 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/__init__.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import ArtifactRegistryClient from .async_client import ArtifactRegistryAsyncClient +from .client import ArtifactRegistryClient __all__ = ( "ArtifactRegistryClient", 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 760d353..89ea79e 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/async_client.py @@ -16,15 +16,15 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.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 try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,27 +33,25 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.artifactregistry_v1beta2.services.artifact_registry import pagers -from google.cloud.artifactregistry_v1beta2.types import apt_artifact -from google.cloud.artifactregistry_v1beta2.types import file -from google.cloud.artifactregistry_v1beta2.types import package -from google.cloud.artifactregistry_v1beta2.types import repository -from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository -from google.cloud.artifactregistry_v1beta2.types import service -from google.cloud.artifactregistry_v1beta2.types import settings -from google.cloud.artifactregistry_v1beta2.types import tag -from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag -from google.cloud.artifactregistry_v1beta2.types import version -from google.cloud.artifactregistry_v1beta2.types import yum_artifact from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import struct_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ArtifactRegistryTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ArtifactRegistryGrpcAsyncIOTransport + +from google.cloud.artifactregistry_v1beta2.services.artifact_registry import pagers +from google.cloud.artifactregistry_v1beta2.types import apt_artifact, file, package +from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository +from google.cloud.artifactregistry_v1beta2.types import repository +from google.cloud.artifactregistry_v1beta2.types import service, settings +from google.cloud.artifactregistry_v1beta2.types import tag +from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag +from google.cloud.artifactregistry_v1beta2.types import version, yum_artifact + from .client import ArtifactRegistryClient +from .transports.base import DEFAULT_CLIENT_INFO, ArtifactRegistryTransport +from .transports.grpc_asyncio import ArtifactRegistryGrpcAsyncIOTransport class ArtifactRegistryAsyncClient: @@ -265,7 +263,6 @@ async def import_apt_artifacts( imported artifacts. Imported artifacts that conflict with existing resources are ignored. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -325,7 +322,12 @@ def sample_import_apt_artifacts(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -352,7 +354,6 @@ async def import_yum_artifacts( imported artifacts. Imported artifacts that conflict with existing resources are ignored. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -412,7 +413,12 @@ def sample_import_yum_artifacts(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -523,12 +529,20 @@ def sample_list_repositories(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListRepositoriesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -628,7 +642,12 @@ def sample_get_repository(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -648,7 +667,6 @@ async def create_repository( finish once the repository has been created. Its response will be the created Repository. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -748,7 +766,12 @@ def sample_create_repository(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -857,7 +880,12 @@ def sample_update_repository(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -876,7 +904,6 @@ async def delete_repository( been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -976,7 +1003,12 @@ def sample_delete_repository(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1084,12 +1116,20 @@ def sample_list_packages(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListPackagesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1185,7 +1225,12 @@ def sample_get_package(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1203,7 +1248,6 @@ async def delete_package( The returned operation will complete once the package has been deleted. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -1300,7 +1344,12 @@ def sample_delete_package(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1408,12 +1457,20 @@ def sample_list_versions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListVersionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1512,7 +1569,12 @@ def sample_get_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1530,7 +1592,6 @@ async def delete_version( returned operation will complete once the version has been deleted. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -1627,7 +1688,12 @@ def sample_delete_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1736,12 +1802,20 @@ def sample_list_files(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListFilesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1838,7 +1912,12 @@ def sample_get_file(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1938,12 +2017,20 @@ def sample_list_tags(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListTagsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2040,7 +2127,12 @@ def sample_get_tag(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2147,7 +2239,12 @@ def sample_create_tag(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2248,7 +2345,12 @@ def sample_update_tag(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2335,7 +2437,10 @@ def sample_delete_tag(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def set_iam_policy( @@ -2351,13 +2456,14 @@ async def set_iam_policy( .. code-block:: python from google.cloud import artifactregistry_v1beta2 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_set_iam_policy(): # Create a client client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) @@ -2379,21 +2485,26 @@ def sample_set_iam_policy(): Returns: google.iam.v1.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. It is used to - specify access control policies for Cloud Platform - resources. + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds - one or more members to a single role. Members can be - user accounts, service accounts, Google groups, and - domains (such as G Suite). A role is a named list of - permissions (defined by IAM or configured by users). - A binding can optionally specify a condition, which - is a logic expression that further constrains the - role binding based on attributes about the request - and/or target resource. - - **JSON Example** + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** { "bindings": [ @@ -2408,17 +2519,17 @@ def sample_set_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } - ] + ], "etag": "BwWWja0YfJA=", "version": 3 } - **YAML Example** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -2429,11 +2540,12 @@ def sample_set_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -2457,7 +2569,12 @@ def sample_set_iam_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2475,13 +2592,14 @@ async def get_iam_policy( .. code-block:: python from google.cloud import artifactregistry_v1beta2 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_get_iam_policy(): # Create a client client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) @@ -2503,21 +2621,26 @@ def sample_get_iam_policy(): Returns: google.iam.v1.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. It is used to - specify access control policies for Cloud Platform - resources. + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds - one or more members to a single role. Members can be - user accounts, service accounts, Google groups, and - domains (such as G Suite). A role is a named list of - permissions (defined by IAM or configured by users). - A binding can optionally specify a condition, which - is a logic expression that further constrains the - role binding based on attributes about the request - and/or target resource. - - **JSON Example** + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** { "bindings": [ @@ -2532,17 +2655,17 @@ def sample_get_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } - ] + ], "etag": "BwWWja0YfJA=", "version": 3 } - **YAML Example** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -2553,11 +2676,12 @@ def sample_get_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -2590,7 +2714,12 @@ def sample_get_iam_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2606,17 +2735,17 @@ async def test_iam_permissions( r"""Tests if the caller has a list of permissions on a resource. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_test_iam_permissions(): # Create a client client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) @@ -2662,7 +2791,12 @@ def sample_test_iam_permissions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2752,7 +2886,12 @@ def sample_get_project_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2850,7 +2989,12 @@ def sample_update_project_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py index 9d16fb2..3ac8e60 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,25 +36,23 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.artifactregistry_v1beta2.services.artifact_registry import pagers -from google.cloud.artifactregistry_v1beta2.types import apt_artifact -from google.cloud.artifactregistry_v1beta2.types import file -from google.cloud.artifactregistry_v1beta2.types import package -from google.cloud.artifactregistry_v1beta2.types import repository -from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository -from google.cloud.artifactregistry_v1beta2.types import service -from google.cloud.artifactregistry_v1beta2.types import settings -from google.cloud.artifactregistry_v1beta2.types import tag -from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag -from google.cloud.artifactregistry_v1beta2.types import version -from google.cloud.artifactregistry_v1beta2.types import yum_artifact from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import struct_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ArtifactRegistryTransport, DEFAULT_CLIENT_INFO + +from google.cloud.artifactregistry_v1beta2.services.artifact_registry import pagers +from google.cloud.artifactregistry_v1beta2.types import apt_artifact, file, package +from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository +from google.cloud.artifactregistry_v1beta2.types import repository +from google.cloud.artifactregistry_v1beta2.types import service, settings +from google.cloud.artifactregistry_v1beta2.types import tag +from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag +from google.cloud.artifactregistry_v1beta2.types import version, yum_artifact + +from .transports.base import DEFAULT_CLIENT_INFO, ArtifactRegistryTransport from .transports.grpc import ArtifactRegistryGrpcTransport from .transports.grpc_asyncio import ArtifactRegistryGrpcAsyncIOTransport @@ -73,7 +71,10 @@ class ArtifactRegistryClientMeta(type): _transport_registry["grpc"] = ArtifactRegistryGrpcTransport _transport_registry["grpc_asyncio"] = ArtifactRegistryGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ArtifactRegistryTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ArtifactRegistryTransport]: """Returns an appropriate transport class. Args: @@ -192,7 +193,10 @@ def transport(self) -> ArtifactRegistryTransport: @staticmethod def apt_artifact_path( - project: str, location: str, repository: str, apt_artifact: str, + project: str, + location: str, + repository: str, + apt_artifact: str, ) -> str: """Returns a fully-qualified apt_artifact string.""" return "projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}".format( @@ -212,10 +216,18 @@ def parse_apt_artifact_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def file_path(project: str, location: str, repository: str, file: str,) -> str: + def file_path( + project: str, + location: str, + repository: str, + file: str, + ) -> str: """Returns a fully-qualified file string.""" return "projects/{project}/locations/{location}/repositories/{repository}/files/{file}".format( - project=project, location=location, repository=repository, file=file, + project=project, + location=location, + repository=repository, + file=file, ) @staticmethod @@ -228,9 +240,13 @@ def parse_file_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def project_settings_path(project: str,) -> str: + def project_settings_path( + project: str, + ) -> str: """Returns a fully-qualified project_settings string.""" - return "projects/{project}/projectSettings".format(project=project,) + return "projects/{project}/projectSettings".format( + project=project, + ) @staticmethod def parse_project_settings_path(path: str) -> Dict[str, str]: @@ -239,10 +255,18 @@ def parse_project_settings_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def repository_path(project: str, location: str, repository: str,) -> str: + def repository_path( + project: str, + location: str, + repository: str, + ) -> str: """Returns a fully-qualified repository string.""" - return "projects/{project}/locations/{location}/repositories/{repository}".format( - project=project, location=location, repository=repository, + return ( + "projects/{project}/locations/{location}/repositories/{repository}".format( + project=project, + location=location, + repository=repository, + ) ) @staticmethod @@ -256,7 +280,11 @@ def parse_repository_path(path: str) -> Dict[str, str]: @staticmethod def tag_path( - project: str, location: str, repository: str, package: str, tag: str, + project: str, + location: str, + repository: str, + package: str, + tag: str, ) -> str: """Returns a fully-qualified tag string.""" return "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}".format( @@ -278,7 +306,11 @@ def parse_tag_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, repository: str, package: str, version: str, + project: str, + location: str, + repository: str, + package: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}".format( @@ -300,7 +332,10 @@ def parse_version_path(path: str) -> Dict[str, str]: @staticmethod def yum_artifact_path( - project: str, location: str, repository: str, yum_artifact: str, + project: str, + location: str, + repository: str, + yum_artifact: str, ) -> str: """Returns a fully-qualified yum_artifact string.""" return "projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}".format( @@ -320,7 +355,9 @@ def parse_yum_artifact_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -333,9 +370,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -344,9 +385,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -355,9 +400,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -366,10 +415,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -557,7 +610,6 @@ def import_apt_artifacts( imported artifacts. Imported artifacts that conflict with existing resources are ignored. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -618,7 +670,12 @@ def sample_import_apt_artifacts(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -645,7 +702,6 @@ def import_yum_artifacts( imported artifacts. Imported artifacts that conflict with existing resources are ignored. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -706,7 +762,12 @@ def sample_import_yum_artifacts(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -808,12 +869,20 @@ def sample_list_repositories(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListRepositoriesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -904,7 +973,12 @@ def sample_get_repository(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -924,7 +998,6 @@ def create_repository( finish once the repository has been created. Its response will be the created Repository. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -1024,7 +1097,12 @@ def sample_create_repository(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1133,7 +1211,12 @@ def sample_update_repository(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1152,7 +1235,6 @@ def delete_repository( been deleted. It will not have any Operation metadata and will return a google.protobuf.Empty response. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -1243,7 +1325,12 @@ def sample_delete_repository(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1342,12 +1429,20 @@ def sample_list_packages(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPackagesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1434,7 +1529,12 @@ def sample_get_package(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1452,7 +1552,6 @@ def delete_package( The returned operation will complete once the package has been deleted. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -1540,7 +1639,12 @@ def sample_delete_package(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1639,12 +1743,20 @@ def sample_list_versions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListVersionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1734,7 +1846,12 @@ def sample_get_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1752,7 +1869,6 @@ def delete_version( returned operation will complete once the version has been deleted. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 @@ -1840,7 +1956,12 @@ def sample_delete_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1940,12 +2061,20 @@ def sample_list_files(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListFilesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2033,7 +2162,12 @@ def sample_get_file(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2124,12 +2258,20 @@ def sample_list_tags(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListTagsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2217,7 +2359,12 @@ def sample_get_tag(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2324,7 +2471,12 @@ def sample_create_tag(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2425,7 +2577,12 @@ def sample_update_tag(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2503,7 +2660,10 @@ def sample_delete_tag(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def set_iam_policy( @@ -2519,13 +2679,14 @@ def set_iam_policy( .. code-block:: python from google.cloud import artifactregistry_v1beta2 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_set_iam_policy(): # Create a client client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) @@ -2547,21 +2708,26 @@ def sample_set_iam_policy(): Returns: google.iam.v1.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. It is used to - specify access control policies for Cloud Platform - resources. + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds - one or more members to a single role. Members can be - user accounts, service accounts, Google groups, and - domains (such as G Suite). A role is a named list of - permissions (defined by IAM or configured by users). - A binding can optionally specify a condition, which - is a logic expression that further constrains the - role binding based on attributes about the request - and/or target resource. - - **JSON Example** + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** { "bindings": [ @@ -2576,17 +2742,17 @@ def sample_set_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } - ] + ], "etag": "BwWWja0YfJA=", "version": 3 } - **YAML Example** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -2597,11 +2763,12 @@ def sample_set_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -2624,7 +2791,12 @@ def sample_set_iam_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2642,13 +2814,14 @@ def get_iam_policy( .. code-block:: python from google.cloud import artifactregistry_v1beta2 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_get_iam_policy(): # Create a client client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) @@ -2670,21 +2843,26 @@ def sample_get_iam_policy(): Returns: google.iam.v1.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. It is used to - specify access control policies for Cloud Platform - resources. + An Identity and Access Management (IAM) policy, which specifies access + controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds - one or more members to a single role. Members can be - user accounts, service accounts, Google groups, and - domains (such as G Suite). A role is a named list of - permissions (defined by IAM or configured by users). - A binding can optionally specify a condition, which - is a logic expression that further constrains the - role binding based on attributes about the request - and/or target resource. - - **JSON Example** + one or more members, or principals, to a single role. + Principals can be user accounts, service accounts, + Google groups, and domains (such as G Suite). A role + is a named list of permissions; each role can be an + IAM predefined role or a user-created custom role. + + For some types of Google Cloud resources, a binding + can also specify a condition, which is a logical + expression that allows access to a resource only if + the expression evaluates to true. A condition can add + constraints based on attributes of the request, the + resource, or both. To learn which resources support + conditions in their IAM policies, see the [IAM + documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies). + + **JSON example:** { "bindings": [ @@ -2699,17 +2877,17 @@ def sample_get_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } - ] + ], "etag": "BwWWja0YfJA=", "version": 3 } - **YAML Example** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -2720,11 +2898,12 @@ def sample_get_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -2747,7 +2926,12 @@ def sample_get_iam_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2763,17 +2947,17 @@ def test_iam_permissions( r"""Tests if the caller has a list of permissions on a resource. - .. code-block:: python from google.cloud import artifactregistry_v1beta2 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_test_iam_permissions(): # Create a client client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) @@ -2818,7 +3002,12 @@ def sample_test_iam_permissions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2908,7 +3097,12 @@ def sample_get_project_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -3006,7 +3200,12 @@ def sample_update_project_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/pagers.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/pagers.py index 14eab22..10ef22d 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/pagers.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/pagers.py @@ -18,17 +18,19 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.artifactregistry_v1beta2.types import file -from google.cloud.artifactregistry_v1beta2.types import package -from google.cloud.artifactregistry_v1beta2.types import repository -from google.cloud.artifactregistry_v1beta2.types import tag -from google.cloud.artifactregistry_v1beta2.types import version +from google.cloud.artifactregistry_v1beta2.types import ( + file, + package, + repository, + tag, + version, +) class ListRepositoriesPager: diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/__init__.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/__init__.py index e77bf1e..d7b62c0 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/__init__.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import ArtifactRegistryGrpcTransport from .grpc_asyncio import ArtifactRegistryGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ArtifactRegistryTransport]] _transport_registry["grpc"] = ArtifactRegistryGrpcTransport diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/base.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/base.py index 032228c..cc94dbe 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/base.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/base.py @@ -15,31 +15,27 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +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 +from google.protobuf import empty_pb2 # type: ignore +import pkg_resources -from google.cloud.artifactregistry_v1beta2.types import apt_artifact -from google.cloud.artifactregistry_v1beta2.types import file -from google.cloud.artifactregistry_v1beta2.types import package -from google.cloud.artifactregistry_v1beta2.types import repository +from google.cloud.artifactregistry_v1beta2.types import apt_artifact, file, package from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository +from google.cloud.artifactregistry_v1beta2.types import repository from google.cloud.artifactregistry_v1beta2.types import settings from google.cloud.artifactregistry_v1beta2.types import tag from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag -from google.cloud.artifactregistry_v1beta2.types import version -from google.cloud.artifactregistry_v1beta2.types import yum_artifact -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore +from google.cloud.artifactregistry_v1beta2.types import version, yum_artifact try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -97,6 +93,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -176,10 +173,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_repository: gapic_v1.method.wrap_method( - self.create_repository, default_timeout=30.0, client_info=client_info, + self.create_repository, + default_timeout=30.0, + client_info=client_info, ), self.update_repository: gapic_v1.method.wrap_method( - self.update_repository, default_timeout=30.0, client_info=client_info, + self.update_repository, + default_timeout=30.0, + client_info=client_info, ), self.delete_repository: gapic_v1.method.wrap_method( self.delete_repository, @@ -336,10 +337,14 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_tag: gapic_v1.method.wrap_method( - self.create_tag, default_timeout=30.0, client_info=client_info, + self.create_tag, + default_timeout=30.0, + client_info=client_info, ), self.update_tag: gapic_v1.method.wrap_method( - self.update_tag, default_timeout=30.0, client_info=client_info, + self.update_tag, + default_timeout=30.0, + client_info=client_info, ), self.delete_tag: gapic_v1.method.wrap_method( self.delete_tag, @@ -356,7 +361,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.set_iam_policy: gapic_v1.method.wrap_method( - self.set_iam_policy, default_timeout=None, client_info=client_info, + self.set_iam_policy, + default_timeout=None, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( self.get_iam_policy, @@ -392,9 +399,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -623,5 +630,9 @@ def update_project_settings( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ArtifactRegistryTransport",) 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 daf1362..9481f02 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/transports/grpc.py @@ -13,33 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore -from google.cloud.artifactregistry_v1beta2.types import apt_artifact -from google.cloud.artifactregistry_v1beta2.types import file -from google.cloud.artifactregistry_v1beta2.types import package -from google.cloud.artifactregistry_v1beta2.types import repository +from google.cloud.artifactregistry_v1beta2.types import apt_artifact, file, package from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository +from google.cloud.artifactregistry_v1beta2.types import repository from google.cloud.artifactregistry_v1beta2.types import settings from google.cloud.artifactregistry_v1beta2.types import tag from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag -from google.cloud.artifactregistry_v1beta2.types import version -from google.cloud.artifactregistry_v1beta2.types import yum_artifact -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from .base import ArtifactRegistryTransport, DEFAULT_CLIENT_INFO +from google.cloud.artifactregistry_v1beta2.types import version, yum_artifact + +from .base import DEFAULT_CLIENT_INFO, ArtifactRegistryTransport class ArtifactRegistryGrpcTransport(ArtifactRegistryTransport): @@ -251,8 +246,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -927,5 +921,9 @@ def update_project_settings( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ArtifactRegistryGrpcTransport",) 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 1eee729..9ace043 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 @@ -13,33 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 # type: ignore +from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.artifactregistry_v1beta2.types import apt_artifact -from google.cloud.artifactregistry_v1beta2.types import file -from google.cloud.artifactregistry_v1beta2.types import package -from google.cloud.artifactregistry_v1beta2.types import repository +from google.cloud.artifactregistry_v1beta2.types import apt_artifact, file, package from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository +from google.cloud.artifactregistry_v1beta2.types import repository from google.cloud.artifactregistry_v1beta2.types import settings from google.cloud.artifactregistry_v1beta2.types import tag from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag -from google.cloud.artifactregistry_v1beta2.types import version -from google.cloud.artifactregistry_v1beta2.types import yum_artifact -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from google.longrunning import operations_pb2 # type: ignore -from google.protobuf import empty_pb2 # type: ignore -from .base import ArtifactRegistryTransport, DEFAULT_CLIENT_INFO +from google.cloud.artifactregistry_v1beta2.types import version, yum_artifact + +from .base import DEFAULT_CLIENT_INFO, ArtifactRegistryTransport from .grpc import ArtifactRegistryGrpcTransport diff --git a/google/cloud/artifactregistry_v1beta2/types/__init__.py b/google/cloud/artifactregistry_v1beta2/types/__init__.py index 88e0294..82edf21 100644 --- a/google/cloud/artifactregistry_v1beta2/types/__init__.py +++ b/google/cloud/artifactregistry_v1beta2/types/__init__.py @@ -21,13 +21,7 @@ ImportAptArtifactsRequest, ImportAptArtifactsResponse, ) -from .file import ( - File, - GetFileRequest, - Hash, - ListFilesRequest, - ListFilesResponse, -) +from .file import File, GetFileRequest, Hash, ListFilesRequest, ListFilesResponse from .package import ( DeletePackageRequest, GetPackageRequest, diff --git a/google/cloud/artifactregistry_v1beta2/types/apt_artifact.py b/google/cloud/artifactregistry_v1beta2/types/apt_artifact.py index 49563d2..5b69d36 100644 --- a/google/cloud/artifactregistry_v1beta2/types/apt_artifact.py +++ b/google/cloud/artifactregistry_v1beta2/types/apt_artifact.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.rpc import status_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1beta2", @@ -63,12 +61,31 @@ class PackageType(proto.Enum): BINARY = 1 SOURCE = 2 - name = proto.Field(proto.STRING, number=1,) - package_name = proto.Field(proto.STRING, number=2,) - package_type = proto.Field(proto.ENUM, number=3, enum=PackageType,) - architecture = proto.Field(proto.STRING, number=4,) - component = proto.Field(proto.STRING, number=5,) - control_file = proto.Field(proto.BYTES, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + package_name = proto.Field( + proto.STRING, + number=2, + ) + package_type = proto.Field( + proto.ENUM, + number=3, + enum=PackageType, + ) + architecture = proto.Field( + proto.STRING, + number=4, + ) + component = proto.Field( + proto.STRING, + number=5, + ) + control_file = proto.Field( + proto.BYTES, + number=6, + ) class ImportAptArtifactsGcsSource(proto.Message): @@ -83,8 +100,14 @@ class ImportAptArtifactsGcsSource(proto.Message): objects from a single URI. """ - uris = proto.RepeatedField(proto.STRING, number=1,) - use_wildcards = proto.Field(proto.BOOL, number=2,) + uris = proto.RepeatedField( + proto.STRING, + number=1, + ) + use_wildcards = proto.Field( + proto.BOOL, + number=2, + ) class ImportAptArtifactsRequest(proto.Message): @@ -104,9 +127,15 @@ class ImportAptArtifactsRequest(proto.Message): """ gcs_source = proto.Field( - proto.MESSAGE, number=2, oneof="source", message="ImportAptArtifactsGcsSource", + proto.MESSAGE, + number=2, + oneof="source", + message="ImportAptArtifactsGcsSource", + ) + parent = proto.Field( + proto.STRING, + number=1, ) - parent = proto.Field(proto.STRING, number=1,) class ImportAptArtifactsErrorInfo(proto.Message): @@ -124,9 +153,16 @@ class ImportAptArtifactsErrorInfo(proto.Message): """ gcs_source = proto.Field( - proto.MESSAGE, number=1, oneof="source", message="ImportAptArtifactsGcsSource", + proto.MESSAGE, + number=1, + oneof="source", + message="ImportAptArtifactsGcsSource", + ) + error = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, ) - error = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,) class ImportAptArtifactsResponse(proto.Message): @@ -140,15 +176,20 @@ class ImportAptArtifactsResponse(proto.Message): not imported. """ - apt_artifacts = proto.RepeatedField(proto.MESSAGE, number=1, message="AptArtifact",) + apt_artifacts = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="AptArtifact", + ) errors = proto.RepeatedField( - proto.MESSAGE, number=2, message="ImportAptArtifactsErrorInfo", + proto.MESSAGE, + number=2, + message="ImportAptArtifactsErrorInfo", ) class ImportAptArtifactsMetadata(proto.Message): - r"""The operation metadata for importing artifacts. - """ + r"""The operation metadata for importing artifacts.""" __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1beta2/types/file.py b/google/cloud/artifactregistry_v1beta2/types/file.py index da05528..7bf3ef2 100644 --- a/google/cloud/artifactregistry_v1beta2/types/file.py +++ b/google/cloud/artifactregistry_v1beta2/types/file.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1beta2", @@ -46,8 +44,15 @@ class HashType(proto.Enum): SHA256 = 1 MD5 = 2 - type_ = proto.Field(proto.ENUM, number=1, enum=HashType,) - value = proto.Field(proto.BYTES, number=2,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=HashType, + ) + value = proto.Field( + proto.BYTES, + number=2, + ) class File(proto.Message): @@ -73,12 +78,33 @@ class File(proto.Message): this file, if any. """ - name = proto.Field(proto.STRING, number=1,) - size_bytes = proto.Field(proto.INT64, number=3,) - hashes = proto.RepeatedField(proto.MESSAGE, number=4, message="Hash",) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) - owner = proto.Field(proto.STRING, number=7,) + name = proto.Field( + proto.STRING, + number=1, + ) + size_bytes = proto.Field( + proto.INT64, + number=3, + ) + hashes = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Hash", + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + owner = proto.Field( + proto.STRING, + number=7, + ) class ListFilesRequest(proto.Message): @@ -111,10 +137,22 @@ class ListFilesRequest(proto.Message): request, if any. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=4,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListFilesResponse(proto.Message): @@ -132,8 +170,15 @@ class ListFilesResponse(proto.Message): def raw_page(self): return self - files = proto.RepeatedField(proto.MESSAGE, number=1, message="File",) - next_page_token = proto.Field(proto.STRING, number=2,) + files = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="File", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetFileRequest(proto.Message): @@ -144,7 +189,10 @@ class GetFileRequest(proto.Message): The name of the file to retrieve. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1beta2/types/package.py b/google/cloud/artifactregistry_v1beta2/types/package.py index ceec425..bfdc9e1 100644 --- a/google/cloud/artifactregistry_v1beta2/types/package.py +++ b/google/cloud/artifactregistry_v1beta2/types/package.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1beta2", @@ -47,10 +45,24 @@ class Package(proto.Message): package. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) class ListPackagesRequest(proto.Message): @@ -68,9 +80,18 @@ class ListPackagesRequest(proto.Message): request, if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListPackagesResponse(proto.Message): @@ -89,8 +110,15 @@ class ListPackagesResponse(proto.Message): def raw_page(self): return self - packages = proto.RepeatedField(proto.MESSAGE, number=1, message="Package",) - next_page_token = proto.Field(proto.STRING, number=2,) + packages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Package", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetPackageRequest(proto.Message): @@ -101,7 +129,10 @@ class GetPackageRequest(proto.Message): The name of the package to retrieve. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DeletePackageRequest(proto.Message): @@ -112,7 +143,10 @@ class DeletePackageRequest(proto.Message): The name of the package to delete. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1beta2/types/repository.py b/google/cloud/artifactregistry_v1beta2/types/repository.py index 0ccb68d..9c45a42 100644 --- a/google/cloud/artifactregistry_v1beta2/types/repository.py +++ b/google/cloud/artifactregistry_v1beta2/types/repository.py @@ -13,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1beta2", @@ -54,7 +52,7 @@ class Repository(proto.Message): description (str): The user-provided description of the repository. - labels (Sequence[google.cloud.artifactregistry_v1beta2.types.Repository.LabelsEntry]): + labels (Mapping[str, str]): Labels with user-defined metadata. This field may contain up to 64 entries. Label keys and values may be no longer than 63 @@ -106,21 +104,54 @@ class VersionPolicy(proto.Enum): RELEASE = 1 SNAPSHOT = 2 - allow_snapshot_overwrites = proto.Field(proto.BOOL, number=1,) + allow_snapshot_overwrites = proto.Field( + proto.BOOL, + number=1, + ) version_policy = proto.Field( - proto.ENUM, number=2, enum="Repository.MavenRepositoryConfig.VersionPolicy", + proto.ENUM, + number=2, + enum="Repository.MavenRepositoryConfig.VersionPolicy", ) maven_config = proto.Field( - proto.MESSAGE, number=9, oneof="format_config", message=MavenRepositoryConfig, + proto.MESSAGE, + number=9, + oneof="format_config", + message=MavenRepositoryConfig, + ) + name = proto.Field( + proto.STRING, + number=1, + ) + format_ = proto.Field( + proto.ENUM, + number=2, + enum=Format, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + kms_key_name = proto.Field( + proto.STRING, + number=8, ) - name = proto.Field(proto.STRING, number=1,) - format_ = proto.Field(proto.ENUM, number=2, enum=Format,) - description = proto.Field(proto.STRING, number=3,) - labels = proto.MapField(proto.STRING, proto.STRING, number=4,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) - kms_key_name = proto.Field(proto.STRING, number=8,) class ListRepositoriesRequest(proto.Message): @@ -138,9 +169,18 @@ class ListRepositoriesRequest(proto.Message): request, if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListRepositoriesResponse(proto.Message): @@ -159,8 +199,15 @@ class ListRepositoriesResponse(proto.Message): def raw_page(self): return self - repositories = proto.RepeatedField(proto.MESSAGE, number=1, message="Repository",) - next_page_token = proto.Field(proto.STRING, number=2,) + repositories = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Repository", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetRepositoryRequest(proto.Message): @@ -172,7 +219,10 @@ class GetRepositoryRequest(proto.Message): retrieve. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateRepositoryRequest(proto.Message): @@ -188,9 +238,19 @@ class CreateRepositoryRequest(proto.Message): The repository to be created. """ - parent = proto.Field(proto.STRING, number=1,) - repository_id = proto.Field(proto.STRING, number=2,) - repository = proto.Field(proto.MESSAGE, number=3, message="Repository",) + parent = proto.Field( + proto.STRING, + number=1, + ) + repository_id = proto.Field( + proto.STRING, + number=2, + ) + repository = proto.Field( + proto.MESSAGE, + number=3, + message="Repository", + ) class UpdateRepositoryRequest(proto.Message): @@ -206,9 +266,15 @@ class UpdateRepositoryRequest(proto.Message): https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask """ - repository = proto.Field(proto.MESSAGE, number=1, message="Repository",) + repository = proto.Field( + proto.MESSAGE, + number=1, + message="Repository", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -221,7 +287,10 @@ class DeleteRepositoryRequest(proto.Message): delete. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1beta2/types/service.py b/google/cloud/artifactregistry_v1beta2/types/service.py index 1d7b0c3..7cfcc91 100644 --- a/google/cloud/artifactregistry_v1beta2/types/service.py +++ b/google/cloud/artifactregistry_v1beta2/types/service.py @@ -15,15 +15,16 @@ # import proto # type: ignore - __protobuf__ = proto.module( - package="google.devtools.artifactregistry.v1beta2", manifest={"OperationMetadata",}, + package="google.devtools.artifactregistry.v1beta2", + manifest={ + "OperationMetadata", + }, ) class OperationMetadata(proto.Message): - r"""Metadata type for longrunning-operations, currently empty. - """ + r"""Metadata type for longrunning-operations, currently empty.""" __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1beta2/types/settings.py b/google/cloud/artifactregistry_v1beta2/types/settings.py index 7b2c687..7022a10 100644 --- a/google/cloud/artifactregistry_v1beta2/types/settings.py +++ b/google/cloud/artifactregistry_v1beta2/types/settings.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import field_mask_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1beta2", @@ -51,8 +49,15 @@ class RedirectionState(proto.Enum): REDIRECTION_FROM_GCR_IO_ENABLED = 2 REDIRECTION_FROM_GCR_IO_FINALIZED = 3 - name = proto.Field(proto.STRING, number=1,) - legacy_redirection_state = proto.Field(proto.ENUM, number=2, enum=RedirectionState,) + name = proto.Field( + proto.STRING, + number=1, + ) + legacy_redirection_state = proto.Field( + proto.ENUM, + number=2, + enum=RedirectionState, + ) class GetProjectSettingsRequest(proto.Message): @@ -64,7 +69,10 @@ class GetProjectSettingsRequest(proto.Message): resource. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateProjectSettingsRequest(proto.Message): @@ -77,9 +85,15 @@ class UpdateProjectSettingsRequest(proto.Message): Field mask to support partial updates. """ - project_settings = proto.Field(proto.MESSAGE, number=2, message="ProjectSettings",) + project_settings = proto.Field( + proto.MESSAGE, + number=2, + message="ProjectSettings", + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) diff --git a/google/cloud/artifactregistry_v1beta2/types/tag.py b/google/cloud/artifactregistry_v1beta2/types/tag.py index 802443e..6119aad 100644 --- a/google/cloud/artifactregistry_v1beta2/types/tag.py +++ b/google/cloud/artifactregistry_v1beta2/types/tag.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import field_mask_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1beta2", @@ -51,8 +49,14 @@ class Tag(proto.Message): slashes, the slashes are escaped. """ - name = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.STRING, + number=2, + ) class ListTagsRequest(proto.Message): @@ -82,10 +86,22 @@ class ListTagsRequest(proto.Message): request, if any. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=4,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListTagsResponse(proto.Message): @@ -103,8 +119,15 @@ class ListTagsResponse(proto.Message): def raw_page(self): return self - tags = proto.RepeatedField(proto.MESSAGE, number=1, message="Tag",) - next_page_token = proto.Field(proto.STRING, number=2,) + tags = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Tag", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetTagRequest(proto.Message): @@ -115,7 +138,10 @@ class GetTagRequest(proto.Message): The name of the tag to retrieve. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateTagRequest(proto.Message): @@ -131,9 +157,19 @@ class CreateTagRequest(proto.Message): The tag to be created. """ - parent = proto.Field(proto.STRING, number=1,) - tag_id = proto.Field(proto.STRING, number=2,) - tag = proto.Field(proto.MESSAGE, number=3, message="Tag",) + parent = proto.Field( + proto.STRING, + number=1, + ) + tag_id = proto.Field( + proto.STRING, + number=2, + ) + tag = proto.Field( + proto.MESSAGE, + number=3, + message="Tag", + ) class UpdateTagRequest(proto.Message): @@ -149,9 +185,15 @@ class UpdateTagRequest(proto.Message): https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask """ - tag = proto.Field(proto.MESSAGE, number=1, message="Tag",) + tag = proto.Field( + proto.MESSAGE, + number=1, + message="Tag", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -163,7 +205,10 @@ class DeleteTagRequest(proto.Message): The name of the tag to delete. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1beta2/types/version.py b/google/cloud/artifactregistry_v1beta2/types/version.py index 671d117..e67762b 100644 --- a/google/cloud/artifactregistry_v1beta2/types/version.py +++ b/google/cloud/artifactregistry_v1beta2/types/version.py @@ -13,12 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.artifactregistry_v1beta2.types import tag from google.protobuf import struct_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore +from google.cloud.artifactregistry_v1beta2.types import tag __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1beta2", @@ -72,12 +71,34 @@ class Version(proto.Message): [DockerImage][google.devtools.artifactregistry.v1.DockerImage] """ - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=3,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) - related_tags = proto.RepeatedField(proto.MESSAGE, number=7, message=tag.Tag,) - metadata = proto.Field(proto.MESSAGE, number=8, message=struct_pb2.Struct,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + related_tags = proto.RepeatedField( + proto.MESSAGE, + number=7, + message=tag.Tag, + ) + metadata = proto.Field( + proto.MESSAGE, + number=8, + message=struct_pb2.Struct, + ) class ListVersionsRequest(proto.Message): @@ -100,11 +121,27 @@ class ListVersionsRequest(proto.Message): Optional. The field to order the results by. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - view = proto.Field(proto.ENUM, number=4, enum="VersionView",) - order_by = proto.Field(proto.STRING, number=5,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum="VersionView", + ) + order_by = proto.Field( + proto.STRING, + number=5, + ) class ListVersionsResponse(proto.Message): @@ -123,8 +160,15 @@ class ListVersionsResponse(proto.Message): def raw_page(self): return self - versions = proto.RepeatedField(proto.MESSAGE, number=1, message="Version",) - next_page_token = proto.Field(proto.STRING, number=2,) + versions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Version", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetVersionRequest(proto.Message): @@ -138,8 +182,15 @@ class GetVersionRequest(proto.Message): response. """ - name = proto.Field(proto.STRING, number=1,) - view = proto.Field(proto.ENUM, number=2, enum="VersionView",) + name = proto.Field( + proto.STRING, + number=1, + ) + view = proto.Field( + proto.ENUM, + number=2, + enum="VersionView", + ) class DeleteVersionRequest(proto.Message): @@ -154,8 +205,14 @@ class DeleteVersionRequest(proto.Message): tags pointing to the version are deleted. """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/artifactregistry_v1beta2/types/yum_artifact.py b/google/cloud/artifactregistry_v1beta2/types/yum_artifact.py index dd22c8e..41804fd 100644 --- a/google/cloud/artifactregistry_v1beta2/types/yum_artifact.py +++ b/google/cloud/artifactregistry_v1beta2/types/yum_artifact.py @@ -13,10 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.rpc import status_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.devtools.artifactregistry.v1beta2", @@ -55,10 +53,23 @@ class PackageType(proto.Enum): BINARY = 1 SOURCE = 2 - name = proto.Field(proto.STRING, number=1,) - package_name = proto.Field(proto.STRING, number=2,) - package_type = proto.Field(proto.ENUM, number=3, enum=PackageType,) - architecture = proto.Field(proto.STRING, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + package_name = proto.Field( + proto.STRING, + number=2, + ) + package_type = proto.Field( + proto.ENUM, + number=3, + enum=PackageType, + ) + architecture = proto.Field( + proto.STRING, + number=4, + ) class ImportYumArtifactsGcsSource(proto.Message): @@ -73,8 +84,14 @@ class ImportYumArtifactsGcsSource(proto.Message): objects from a single URI. """ - uris = proto.RepeatedField(proto.STRING, number=1,) - use_wildcards = proto.Field(proto.BOOL, number=2,) + uris = proto.RepeatedField( + proto.STRING, + number=1, + ) + use_wildcards = proto.Field( + proto.BOOL, + number=2, + ) class ImportYumArtifactsRequest(proto.Message): @@ -94,9 +111,15 @@ class ImportYumArtifactsRequest(proto.Message): """ gcs_source = proto.Field( - proto.MESSAGE, number=2, oneof="source", message="ImportYumArtifactsGcsSource", + proto.MESSAGE, + number=2, + oneof="source", + message="ImportYumArtifactsGcsSource", + ) + parent = proto.Field( + proto.STRING, + number=1, ) - parent = proto.Field(proto.STRING, number=1,) class ImportYumArtifactsErrorInfo(proto.Message): @@ -114,9 +137,16 @@ class ImportYumArtifactsErrorInfo(proto.Message): """ gcs_source = proto.Field( - proto.MESSAGE, number=1, oneof="source", message="ImportYumArtifactsGcsSource", + proto.MESSAGE, + number=1, + oneof="source", + message="ImportYumArtifactsGcsSource", + ) + error = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, ) - error = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,) class ImportYumArtifactsResponse(proto.Message): @@ -130,15 +160,20 @@ class ImportYumArtifactsResponse(proto.Message): not imported. """ - yum_artifacts = proto.RepeatedField(proto.MESSAGE, number=1, message="YumArtifact",) + yum_artifacts = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="YumArtifact", + ) errors = proto.RepeatedField( - proto.MESSAGE, number=2, message="ImportYumArtifactsErrorInfo", + proto.MESSAGE, + number=2, + message="ImportYumArtifactsErrorInfo", ) class ImportYumArtifactsMetadata(proto.Message): - r"""The operation metadata for importing artifacts. - """ + r"""The operation metadata for importing artifacts.""" __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..7c1742d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,19 +17,45 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +83,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +95,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +127,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +185,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,13 +236,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_repository_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_repository_async.py new file mode 100644 index 0000000..b675e1f --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_repository_async.py @@ -0,0 +1,49 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRepository +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async] +from google.cloud import artifactregistry_v1 + + +async def sample_create_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.CreateRepositoryRequest( + parent="parent_value", + ) + + # Make the request + operation = client.create_repository(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_repository_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_repository_sync.py new file mode 100644 index 0000000..2abdc2d --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_repository_sync.py @@ -0,0 +1,49 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateRepository +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_sync] +from google.cloud import artifactregistry_v1 + + +def sample_create_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.CreateRepositoryRequest( + parent="parent_value", + ) + + # Make the request + operation = client.create_repository(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_tag_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_tag_async.py new file mode 100644 index 0000000..442040c --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_tag_async.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateTag +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async] +from google.cloud import artifactregistry_v1 + + +async def sample_create_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.CreateTagRequest( + ) + + # Make the request + response = await client.create_tag(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_tag_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_tag_sync.py new file mode 100644 index 0000000..8635ddc --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_create_tag_sync.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateTag +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_CreateTag_sync] +from google.cloud import artifactregistry_v1 + + +def sample_create_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.CreateTagRequest( + ) + + # Make the request + response = client.create_tag(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_CreateTag_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_package_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_package_async.py new file mode 100644 index 0000000..9d6b2f0 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_package_async.py @@ -0,0 +1,49 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeletePackage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async] +from google.cloud import artifactregistry_v1 + + +async def sample_delete_package(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeletePackageRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_package(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_package_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_package_sync.py new file mode 100644 index 0000000..a885ecc --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_package_sync.py @@ -0,0 +1,49 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeletePackage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_sync] +from google.cloud import artifactregistry_v1 + + +def sample_delete_package(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeletePackageRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_package(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_repository_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_repository_async.py new file mode 100644 index 0000000..453920b --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_repository_async.py @@ -0,0 +1,49 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteRepository +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async] +from google.cloud import artifactregistry_v1 + + +async def sample_delete_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteRepositoryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_repository(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_repository_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_repository_sync.py new file mode 100644 index 0000000..b9303b0 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_repository_sync.py @@ -0,0 +1,49 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteRepository +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_sync] +from google.cloud import artifactregistry_v1 + + +def sample_delete_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteRepositoryRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_repository(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_tag_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_tag_async.py new file mode 100644 index 0000000..7e7428c --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_tag_async.py @@ -0,0 +1,42 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteTag +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async] +from google.cloud import artifactregistry_v1 + + +async def sample_delete_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteTagRequest( + ) + + # Make the request + await client.delete_tag(request=request) + + +# [END artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_tag_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_tag_sync.py new file mode 100644 index 0000000..54b14a4 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_tag_sync.py @@ -0,0 +1,42 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteTag +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_sync] +from google.cloud import artifactregistry_v1 + + +def sample_delete_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteTagRequest( + ) + + # Make the request + client.delete_tag(request=request) + + +# [END artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_version_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_version_async.py new file mode 100644 index 0000000..5ac814f --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_version_async.py @@ -0,0 +1,48 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteVersion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async] +from google.cloud import artifactregistry_v1 + + +async def sample_delete_version(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteVersionRequest( + ) + + # Make the request + operation = client.delete_version(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_version_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_version_sync.py new file mode 100644 index 0000000..f7c6aed --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_delete_version_sync.py @@ -0,0 +1,48 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteVersion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_sync] +from google.cloud import artifactregistry_v1 + + +def sample_delete_version(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.DeleteVersionRequest( + ) + + # Make the request + operation = client.delete_version(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_docker_image_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_docker_image_async.py new file mode 100644 index 0000000..39ab1a2 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_docker_image_async.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetDockerImage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async] +from google.cloud import artifactregistry_v1 + + +async def sample_get_docker_image(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetDockerImageRequest( + name="name_value", + ) + + # Make the request + response = await client.get_docker_image(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_docker_image_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_docker_image_sync.py new file mode 100644 index 0000000..714e1d5 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_docker_image_sync.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetDockerImage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_sync] +from google.cloud import artifactregistry_v1 + + +def sample_get_docker_image(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetDockerImageRequest( + name="name_value", + ) + + # Make the request + response = client.get_docker_image(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_file_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_file_async.py new file mode 100644 index 0000000..09b4105 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_file_async.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetFile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetFile_async] +from google.cloud import artifactregistry_v1 + + +async def sample_get_file(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetFileRequest( + ) + + # Make the request + response = await client.get_file(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetFile_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_file_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_file_sync.py new file mode 100644 index 0000000..74011e7 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_file_sync.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetFile +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetFile_sync] +from google.cloud import artifactregistry_v1 + + +def sample_get_file(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetFileRequest( + ) + + # Make the request + response = client.get_file(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetFile_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_iam_policy_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_iam_policy_async.py new file mode 100644 index 0000000..bc67489 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_iam_policy_async.py @@ -0,0 +1,46 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetIamPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetIamPolicy_async] +from google.cloud import artifactregistry_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore + + +async def sample_get_iam_policy(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = iam_policy_pb2.GetIamPolicyRequest( + resource="resource_value", + ) + + # Make the request + response = await client.get_iam_policy(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetIamPolicy_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_iam_policy_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_iam_policy_sync.py new file mode 100644 index 0000000..0f6654c --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_iam_policy_sync.py @@ -0,0 +1,46 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetIamPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetIamPolicy_sync] +from google.cloud import artifactregistry_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore + + +def sample_get_iam_policy(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.GetIamPolicyRequest( + resource="resource_value", + ) + + # Make the request + response = client.get_iam_policy(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetIamPolicy_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_package_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_package_async.py new file mode 100644 index 0000000..3572039 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_package_async.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPackage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async] +from google.cloud import artifactregistry_v1 + + +async def sample_get_package(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetPackageRequest( + name="name_value", + ) + + # Make the request + response = await client.get_package(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_package_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_package_sync.py new file mode 100644 index 0000000..8ecccee --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_package_sync.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPackage +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetPackage_sync] +from google.cloud import artifactregistry_v1 + + +def sample_get_package(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetPackageRequest( + name="name_value", + ) + + # Make the request + response = client.get_package(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetPackage_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_project_settings_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_project_settings_async.py new file mode 100644 index 0000000..cdaeb22 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_project_settings_async.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetProjectSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async] +from google.cloud import artifactregistry_v1 + + +async def sample_get_project_settings(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetProjectSettingsRequest( + name="name_value", + ) + + # Make the request + response = await client.get_project_settings(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_project_settings_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_project_settings_sync.py new file mode 100644 index 0000000..3b7ea3b --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_project_settings_sync.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetProjectSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_sync] +from google.cloud import artifactregistry_v1 + + +def sample_get_project_settings(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetProjectSettingsRequest( + name="name_value", + ) + + # Make the request + response = client.get_project_settings(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_tag_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_tag_async.py new file mode 100644 index 0000000..ee248ff --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_tag_async.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetTag +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetTag_async] +from google.cloud import artifactregistry_v1 + + +async def sample_get_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetTagRequest( + ) + + # Make the request + response = await client.get_tag(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetTag_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_tag_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_tag_sync.py new file mode 100644 index 0000000..87a8f3a --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_tag_sync.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetTag +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetTag_sync] +from google.cloud import artifactregistry_v1 + + +def sample_get_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetTagRequest( + ) + + # Make the request + response = client.get_tag(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetTag_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_version_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_version_async.py new file mode 100644 index 0000000..347fff5 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_version_async.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetVersion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async] +from google.cloud import artifactregistry_v1 + + +async def sample_get_version(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetVersionRequest( + ) + + # Make the request + response = await client.get_version(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_version_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_version_sync.py new file mode 100644 index 0000000..4194df3 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_get_version_sync.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetVersion +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_GetVersion_sync] +from google.cloud import artifactregistry_v1 + + +def sample_get_version(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.GetVersionRequest( + ) + + # Make the request + response = client.get_version(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_GetVersion_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_async.py new file mode 100644 index 0000000..6c5bc3a --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_async.py @@ -0,0 +1,48 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ImportAptArtifacts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async] +from google.cloud import artifactregistry_v1 + + +async def sample_import_apt_artifacts(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ImportAptArtifactsRequest( + ) + + # Make the request + operation = client.import_apt_artifacts(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_sync.py new file mode 100644 index 0000000..43c15d9 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_sync.py @@ -0,0 +1,48 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ImportAptArtifacts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_sync] +from google.cloud import artifactregistry_v1 + + +def sample_import_apt_artifacts(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ImportAptArtifactsRequest( + ) + + # Make the request + operation = client.import_apt_artifacts(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_async.py new file mode 100644 index 0000000..780076f --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_async.py @@ -0,0 +1,48 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ImportYumArtifacts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async] +from google.cloud import artifactregistry_v1 + + +async def sample_import_yum_artifacts(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ImportYumArtifactsRequest( + ) + + # Make the request + operation = client.import_yum_artifacts(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_sync.py new file mode 100644 index 0000000..ef8ee65 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_sync.py @@ -0,0 +1,48 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ImportYumArtifacts +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_sync] +from google.cloud import artifactregistry_v1 + + +def sample_import_yum_artifacts(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ImportYumArtifactsRequest( + ) + + # Make the request + operation = client.import_yum_artifacts(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_files_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_files_async.py new file mode 100644 index 0000000..1b8ae18 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_files_async.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListFiles +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async] +from google.cloud import artifactregistry_v1 + + +async def sample_list_files(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListFilesRequest( + ) + + # Make the request + page_result = client.list_files(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_files_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_files_sync.py new file mode 100644 index 0000000..9529ae9 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_files_sync.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListFiles +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ListFiles_sync] +from google.cloud import artifactregistry_v1 + + +def sample_list_files(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListFilesRequest( + ) + + # Make the request + page_result = client.list_files(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ListFiles_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_packages_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_packages_async.py new file mode 100644 index 0000000..6cd692a --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_packages_async.py @@ -0,0 +1,46 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPackages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async] +from google.cloud import artifactregistry_v1 + + +async def sample_list_packages(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListPackagesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_packages(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_packages_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_packages_sync.py new file mode 100644 index 0000000..34586ed --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_packages_sync.py @@ -0,0 +1,46 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListPackages +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ListPackages_sync] +from google.cloud import artifactregistry_v1 + + +def sample_list_packages(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListPackagesRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_packages(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ListPackages_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_tags_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_tags_async.py new file mode 100644 index 0000000..175c843 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_tags_async.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTags +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ListTags_async] +from google.cloud import artifactregistry_v1 + + +async def sample_list_tags(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListTagsRequest( + ) + + # Make the request + page_result = client.list_tags(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ListTags_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_tags_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_tags_sync.py new file mode 100644 index 0000000..672dedb --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_tags_sync.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTags +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ListTags_sync] +from google.cloud import artifactregistry_v1 + + +def sample_list_tags(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListTagsRequest( + ) + + # Make the request + page_result = client.list_tags(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ListTags_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_versions_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_versions_async.py new file mode 100644 index 0000000..fab469b --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_versions_async.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListVersions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async] +from google.cloud import artifactregistry_v1 + + +async def sample_list_versions(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListVersionsRequest( + ) + + # Make the request + page_result = client.list_versions(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_versions_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_versions_sync.py new file mode 100644 index 0000000..73d05d1 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_list_versions_sync.py @@ -0,0 +1,45 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListVersions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_ListVersions_sync] +from google.cloud import artifactregistry_v1 + + +def sample_list_versions(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.ListVersionsRequest( + ) + + # Make the request + page_result = client.list_versions(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_ListVersions_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_set_iam_policy_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_set_iam_policy_async.py new file mode 100644 index 0000000..0ec0736 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_set_iam_policy_async.py @@ -0,0 +1,46 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for SetIamPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_SetIamPolicy_async] +from google.cloud import artifactregistry_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore + + +async def sample_set_iam_policy(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = iam_policy_pb2.SetIamPolicyRequest( + resource="resource_value", + ) + + # Make the request + response = await client.set_iam_policy(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_SetIamPolicy_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_set_iam_policy_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_set_iam_policy_sync.py new file mode 100644 index 0000000..71262fe --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_set_iam_policy_sync.py @@ -0,0 +1,46 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for SetIamPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_SetIamPolicy_sync] +from google.cloud import artifactregistry_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore + + +def sample_set_iam_policy(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.SetIamPolicyRequest( + resource="resource_value", + ) + + # Make the request + response = client.set_iam_policy(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_SetIamPolicy_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_test_iam_permissions_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_test_iam_permissions_async.py new file mode 100644 index 0000000..f0756d6 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_test_iam_permissions_async.py @@ -0,0 +1,47 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TestIamPermissions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_TestIamPermissions_async] +from google.cloud import artifactregistry_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore + + +async def sample_test_iam_permissions(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = iam_policy_pb2.TestIamPermissionsRequest( + resource="resource_value", + permissions=['permissions_value_1', 'permissions_value_2'], + ) + + # Make the request + response = await client.test_iam_permissions(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_TestIamPermissions_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_test_iam_permissions_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_test_iam_permissions_sync.py new file mode 100644 index 0000000..be78619 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_test_iam_permissions_sync.py @@ -0,0 +1,47 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for TestIamPermissions +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_TestIamPermissions_sync] +from google.cloud import artifactregistry_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore + + +def sample_test_iam_permissions(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = iam_policy_pb2.TestIamPermissionsRequest( + resource="resource_value", + permissions=['permissions_value_1', 'permissions_value_2'], + ) + + # Make the request + response = client.test_iam_permissions(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_TestIamPermissions_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_project_settings_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_project_settings_async.py new file mode 100644 index 0000000..352a829 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_project_settings_async.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateProjectSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async] +from google.cloud import artifactregistry_v1 + + +async def sample_update_project_settings(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateProjectSettingsRequest( + ) + + # Make the request + response = await client.update_project_settings(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_project_settings_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_project_settings_sync.py new file mode 100644 index 0000000..718e0c2 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_project_settings_sync.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateProjectSettings +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_sync] +from google.cloud import artifactregistry_v1 + + +def sample_update_project_settings(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateProjectSettingsRequest( + ) + + # Make the request + response = client.update_project_settings(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_repository_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_repository_async.py new file mode 100644 index 0000000..3dc938a --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_repository_async.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateRepository +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async] +from google.cloud import artifactregistry_v1 + + +async def sample_update_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateRepositoryRequest( + ) + + # Make the request + response = await client.update_repository(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_repository_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_repository_sync.py new file mode 100644 index 0000000..c449778 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_repository_sync.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateRepository +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_sync] +from google.cloud import artifactregistry_v1 + + +def sample_update_repository(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateRepositoryRequest( + ) + + # Make the request + response = client.update_repository(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_sync] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_tag_async.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_tag_async.py new file mode 100644 index 0000000..53cee06 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_tag_async.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateTag +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async] +from google.cloud import artifactregistry_v1 + + +async def sample_update_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryAsyncClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateTagRequest( + ) + + # Make the request + response = await client.update_tag(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async] diff --git a/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_tag_sync.py b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_tag_sync.py new file mode 100644 index 0000000..30428f2 --- /dev/null +++ b/samples/generated_samples/artifactregistry_v1_generated_artifact_registry_update_tag_sync.py @@ -0,0 +1,44 @@ +# -*- 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateTag +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-artifact-registry + + +# [START artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_sync] +from google.cloud import artifactregistry_v1 + + +def sample_update_tag(): + # Create a client + client = artifactregistry_v1.ArtifactRegistryClient() + + # Initialize request argument(s) + request = artifactregistry_v1.UpdateTagRequest( + ) + + # Make the request + response = client.update_tag(request=request) + + # Handle the response + print(response) + +# [END artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_sync] diff --git a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_async.py b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_async.py index 1e0a3c0..7418327 100644 --- a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_async.py +++ b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_async.py @@ -25,6 +25,7 @@ # [START artifactregistry_v1beta2_generated_ArtifactRegistry_GetIamPolicy_async] from google.cloud import artifactregistry_v1beta2 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_get_iam_policy(): @@ -32,7 +33,7 @@ async def sample_get_iam_policy(): client = artifactregistry_v1beta2.ArtifactRegistryAsyncClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_sync.py b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_sync.py index 3329b9a..cb7fc8d 100644 --- a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_sync.py +++ b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_sync.py @@ -25,6 +25,7 @@ # [START artifactregistry_v1beta2_generated_ArtifactRegistry_GetIamPolicy_sync] from google.cloud import artifactregistry_v1beta2 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_get_iam_policy(): @@ -32,7 +33,7 @@ def sample_get_iam_policy(): client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_async.py b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_async.py index 75c8288..2963b9f 100644 --- a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_async.py +++ b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_async.py @@ -25,6 +25,7 @@ # [START artifactregistry_v1beta2_generated_ArtifactRegistry_SetIamPolicy_async] from google.cloud import artifactregistry_v1beta2 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_set_iam_policy(): @@ -32,7 +33,7 @@ async def sample_set_iam_policy(): client = artifactregistry_v1beta2.ArtifactRegistryAsyncClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_sync.py b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_sync.py index 690192c..1b8a2c8 100644 --- a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_sync.py +++ b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_sync.py @@ -25,6 +25,7 @@ # [START artifactregistry_v1beta2_generated_ArtifactRegistry_SetIamPolicy_sync] from google.cloud import artifactregistry_v1beta2 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_set_iam_policy(): @@ -32,7 +33,7 @@ def sample_set_iam_policy(): client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_async.py b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_async.py index bed5f7d..1e51061 100644 --- a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_async.py +++ b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_async.py @@ -25,6 +25,7 @@ # [START artifactregistry_v1beta2_generated_ArtifactRegistry_TestIamPermissions_async] from google.cloud import artifactregistry_v1beta2 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_test_iam_permissions(): @@ -32,7 +33,7 @@ async def sample_test_iam_permissions(): client = artifactregistry_v1beta2.ArtifactRegistryAsyncClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) diff --git a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_sync.py b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_sync.py index a2de066..db0eaee 100644 --- a/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_sync.py +++ b/samples/generated_samples/artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_sync.py @@ -25,6 +25,7 @@ # [START artifactregistry_v1beta2_generated_ArtifactRegistry_TestIamPermissions_sync] from google.cloud import artifactregistry_v1beta2 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_test_iam_permissions(): @@ -32,7 +33,7 @@ def sample_test_iam_permissions(): client = artifactregistry_v1beta2.ArtifactRegistryClient() # Initialize request argument(s) - request = artifactregistry_v1beta2.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) diff --git a/samples/generated_samples/snippet_metadata_artifactregistry_v1.json b/samples/generated_samples/snippet_metadata_artifactregistry_v1.json index 0c93a71..f7215a5 100644 --- a/samples/generated_samples/snippet_metadata_artifactregistry_v1.json +++ b/samples/generated_samples/snippet_metadata_artifactregistry_v1.json @@ -1,25 +1,78 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.devtools.artifactregistry.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-artifact-registry" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.create_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", "shortName": "ArtifactRegistry" }, - "shortName": "GetRepository" - } + "shortName": "CreateRepository" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.CreateRepositoryRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "repository", + "type": "google.cloud.artifactregistry_v1.types.Repository" + }, + { + "name": "repository_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_repository" }, - "file": "artifactregistry_v1_generated_artifact_registry_get_repository_async.py", - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async", + "description": "Sample for CreateRepository", + "file": "artifactregistry_v1_generated_artifact_registry_create_repository_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_async", "segments": [ { - "end": 44, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 48, "start": 27, "type": "SHORT" }, @@ -34,36 +87,80 @@ "type": "REQUEST_INITIALIZATION" }, { - "end": 41, + "end": 45, "start": 39, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 49, + "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1_generated_artifact_registry_create_repository_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.create_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", "shortName": "ArtifactRegistry" }, - "shortName": "GetRepository" - } + "shortName": "CreateRepository" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.CreateRepositoryRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "repository", + "type": "google.cloud.artifactregistry_v1.types.Repository" + }, + { + "name": "repository_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_repository" }, - "file": "artifactregistry_v1_generated_artifact_registry_get_repository_sync.py", - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetRepository_sync", + "description": "Sample for CreateRepository", + "file": "artifactregistry_v1_generated_artifact_registry_create_repository_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_CreateRepository_sync", "segments": [ { - "end": 44, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 48, "start": 27, "type": "SHORT" }, @@ -78,37 +175,250 @@ "type": "REQUEST_INITIALIZATION" }, { - "end": 41, + "end": 45, "start": 39, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 49, + "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1_generated_artifact_registry_create_repository_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.create_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateTag", "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", "shortName": "ArtifactRegistry" }, - "shortName": "ListDockerImages" + "shortName": "CreateTag" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.CreateTagRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "tag", + "type": "google.cloud.artifactregistry_v1.types.Tag" + }, + { + "name": "tag_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Tag", + "shortName": "create_tag" + }, + "description": "Sample for CreateTag", + "file": "artifactregistry_v1_generated_artifact_registry_create_tag_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_CreateTag_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" } + ], + "title": "artifactregistry_v1_generated_artifact_registry_create_tag_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.create_tag", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.CreateTag", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "CreateTag" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.CreateTagRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "tag", + "type": "google.cloud.artifactregistry_v1.types.Tag" + }, + { + "name": "tag_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Tag", + "shortName": "create_tag" }, - "file": "artifactregistry_v1_generated_artifact_registry_list_docker_images_async.py", - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async", + "description": "Sample for CreateTag", + "file": "artifactregistry_v1_generated_artifact_registry_create_tag_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_CreateTag_sync", "segments": [ { - "end": 45, + "end": 43, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_create_tag_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.delete_package", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeletePackage", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "DeletePackage" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.DeletePackageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_package" + }, + "description": "Sample for DeletePackage", + "file": "artifactregistry_v1_generated_artifact_registry_delete_package_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, "start": 27, "type": "SHORT" }, @@ -123,36 +433,72 @@ "type": "REQUEST_INITIALIZATION" }, { - "end": 41, + "end": 45, "start": 39, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 42, + "end": 49, + "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1_generated_artifact_registry_delete_package_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.delete_package", "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeletePackage", "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", "shortName": "ArtifactRegistry" }, - "shortName": "ListDockerImages" - } + "shortName": "DeletePackage" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.DeletePackageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_package" }, - "file": "artifactregistry_v1_generated_artifact_registry_list_docker_images_sync.py", - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_sync", + "description": "Sample for DeletePackage", + "file": "artifactregistry_v1_generated_artifact_registry_delete_package_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeletePackage_sync", "segments": [ { - "end": 45, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 48, "start": 27, "type": "SHORT" }, @@ -167,37 +513,73 @@ "type": "REQUEST_INITIALIZATION" }, { - "end": 41, + "end": 45, "start": 39, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 42, + "end": 49, + "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1_generated_artifact_registry_delete_package_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.delete_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", "shortName": "ArtifactRegistry" }, - "shortName": "ListRepositories" - } + "shortName": "DeleteRepository" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.DeleteRepositoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_repository" }, - "file": "artifactregistry_v1_generated_artifact_registry_list_repositories_async.py", - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async", + "description": "Sample for DeleteRepository", + "file": "artifactregistry_v1_generated_artifact_registry_delete_repository_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_async", "segments": [ { - "end": 45, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 48, "start": 27, "type": "SHORT" }, @@ -212,36 +594,72 @@ "type": "REQUEST_INITIALIZATION" }, { - "end": 41, + "end": 45, "start": 39, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 42, + "end": 49, + "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1_generated_artifact_registry_delete_repository_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.delete_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", "shortName": "ArtifactRegistry" }, - "shortName": "ListRepositories" - } + "shortName": "DeleteRepository" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.DeleteRepositoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_repository" }, - "file": "artifactregistry_v1_generated_artifact_registry_list_repositories_sync.py", - "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_sync", + "description": "Sample for DeleteRepository", + "file": "artifactregistry_v1_generated_artifact_registry_delete_repository_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteRepository_sync", "segments": [ { - "end": 45, + "end": 48, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 48, "start": 27, "type": "SHORT" }, @@ -256,16 +674,3698 @@ "type": "REQUEST_INITIALIZATION" }, { - "end": 41, + "end": 45, "start": 39, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 42, + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_delete_repository_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.delete_tag", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteTag", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "DeleteTag" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.DeleteTagRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_tag" + }, + "description": "Sample for DeleteTag", + "file": "artifactregistry_v1_generated_artifact_registry_delete_tag_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_async", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_delete_tag_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.delete_tag", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteTag", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "DeleteTag" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.DeleteTagRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_tag" + }, + "description": "Sample for DeleteTag", + "file": "artifactregistry_v1_generated_artifact_registry_delete_tag_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteTag_sync", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_delete_tag_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.delete_version", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteVersion", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "DeleteVersion" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.DeleteVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_version" + }, + "description": "Sample for DeleteVersion", + "file": "artifactregistry_v1_generated_artifact_registry_delete_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_delete_version_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.delete_version", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.DeleteVersion", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "DeleteVersion" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.DeleteVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_version" + }, + "description": "Sample for DeleteVersion", + "file": "artifactregistry_v1_generated_artifact_registry_delete_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_DeleteVersion_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_delete_version_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.get_docker_image", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetDockerImage", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetDockerImage" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetDockerImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.DockerImage", + "shortName": "get_docker_image" + }, + "description": "Sample for GetDockerImage", + "file": "artifactregistry_v1_generated_artifact_registry_get_docker_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_docker_image_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.get_docker_image", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetDockerImage", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetDockerImage" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetDockerImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.DockerImage", + "shortName": "get_docker_image" + }, + "description": "Sample for GetDockerImage", + "file": "artifactregistry_v1_generated_artifact_registry_get_docker_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetDockerImage_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_docker_image_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.get_file", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetFile", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetFile" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetFileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.File", + "shortName": "get_file" + }, + "description": "Sample for GetFile", + "file": "artifactregistry_v1_generated_artifact_registry_get_file_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetFile_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_file_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.get_file", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetFile", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetFile" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetFileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.File", + "shortName": "get_file" + }, + "description": "Sample for GetFile", + "file": "artifactregistry_v1_generated_artifact_registry_get_file_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetFile_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_file_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.get_iam_policy", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetIamPolicy", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetIamPolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.GetIamPolicyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "get_iam_policy" + }, + "description": "Sample for GetIamPolicy", + "file": "artifactregistry_v1_generated_artifact_registry_get_iam_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetIamPolicy_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 34, + "start": 32, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 35, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_iam_policy_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.get_iam_policy", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetIamPolicy", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetIamPolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.GetIamPolicyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "get_iam_policy" + }, + "description": "Sample for GetIamPolicy", + "file": "artifactregistry_v1_generated_artifact_registry_get_iam_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetIamPolicy_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 34, + "start": 32, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 35, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_iam_policy_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.get_package", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPackage", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetPackage" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetPackageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Package", + "shortName": "get_package" + }, + "description": "Sample for GetPackage", + "file": "artifactregistry_v1_generated_artifact_registry_get_package_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetPackage_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_package_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.get_package", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetPackage", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetPackage" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetPackageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Package", + "shortName": "get_package" + }, + "description": "Sample for GetPackage", + "file": "artifactregistry_v1_generated_artifact_registry_get_package_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetPackage_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_package_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.get_project_settings", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetProjectSettings", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetProjectSettings" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetProjectSettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.ProjectSettings", + "shortName": "get_project_settings" + }, + "description": "Sample for GetProjectSettings", + "file": "artifactregistry_v1_generated_artifact_registry_get_project_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_project_settings_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.get_project_settings", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetProjectSettings", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetProjectSettings" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetProjectSettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.ProjectSettings", + "shortName": "get_project_settings" + }, + "description": "Sample for GetProjectSettings", + "file": "artifactregistry_v1_generated_artifact_registry_get_project_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetProjectSettings_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_project_settings_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.get_repository", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetRepository", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetRepository" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetRepositoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Repository", + "shortName": "get_repository" + }, + "description": "Sample for GetRepository", + "file": "artifactregistry_v1_generated_artifact_registry_get_repository_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetRepository_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_repository_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.get_repository", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetRepository", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetRepository" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetRepositoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Repository", + "shortName": "get_repository" + }, + "description": "Sample for GetRepository", + "file": "artifactregistry_v1_generated_artifact_registry_get_repository_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetRepository_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_repository_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.get_tag", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetTag", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetTag" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetTagRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Tag", + "shortName": "get_tag" + }, + "description": "Sample for GetTag", + "file": "artifactregistry_v1_generated_artifact_registry_get_tag_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetTag_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_tag_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.get_tag", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetTag", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetTag" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetTagRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Tag", + "shortName": "get_tag" + }, + "description": "Sample for GetTag", + "file": "artifactregistry_v1_generated_artifact_registry_get_tag_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetTag_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_tag_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.get_version", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVersion", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetVersion" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Version", + "shortName": "get_version" + }, + "description": "Sample for GetVersion", + "file": "artifactregistry_v1_generated_artifact_registry_get_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetVersion_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_version_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.get_version", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.GetVersion", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "GetVersion" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.GetVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Version", + "shortName": "get_version" + }, + "description": "Sample for GetVersion", + "file": "artifactregistry_v1_generated_artifact_registry_get_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_GetVersion_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_get_version_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.import_apt_artifacts", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportAptArtifacts", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ImportAptArtifacts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ImportAptArtifactsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_apt_artifacts" + }, + "description": "Sample for ImportAptArtifacts", + "file": "artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.import_apt_artifacts", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportAptArtifacts", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ImportAptArtifacts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ImportAptArtifactsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_apt_artifacts" + }, + "description": "Sample for ImportAptArtifacts", + "file": "artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ImportAptArtifacts_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_import_apt_artifacts_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.import_yum_artifacts", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportYumArtifacts", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ImportYumArtifacts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ImportYumArtifactsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_yum_artifacts" + }, + "description": "Sample for ImportYumArtifacts", + "file": "artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.import_yum_artifacts", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ImportYumArtifacts", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ImportYumArtifacts" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ImportYumArtifactsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_yum_artifacts" + }, + "description": "Sample for ImportYumArtifacts", + "file": "artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ImportYumArtifacts_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_import_yum_artifacts_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.list_docker_images", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListDockerImages", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListDockerImages" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListDockerImagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListDockerImagesAsyncPager", + "shortName": "list_docker_images" + }, + "description": "Sample for ListDockerImages", + "file": "artifactregistry_v1_generated_artifact_registry_list_docker_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_docker_images_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.list_docker_images", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListDockerImages", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListDockerImages" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListDockerImagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListDockerImagesPager", + "shortName": "list_docker_images" + }, + "description": "Sample for ListDockerImages", + "file": "artifactregistry_v1_generated_artifact_registry_list_docker_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListDockerImages_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_docker_images_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.list_files", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListFiles", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListFiles" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListFilesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListFilesAsyncPager", + "shortName": "list_files" + }, + "description": "Sample for ListFiles", + "file": "artifactregistry_v1_generated_artifact_registry_list_files_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListFiles_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_files_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.list_files", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListFiles", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListFiles" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListFilesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListFilesPager", + "shortName": "list_files" + }, + "description": "Sample for ListFiles", + "file": "artifactregistry_v1_generated_artifact_registry_list_files_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListFiles_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_files_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.list_packages", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPackages", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListPackages" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListPackagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListPackagesAsyncPager", + "shortName": "list_packages" + }, + "description": "Sample for ListPackages", + "file": "artifactregistry_v1_generated_artifact_registry_list_packages_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListPackages_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_packages_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.list_packages", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListPackages", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListPackages" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListPackagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListPackagesPager", + "shortName": "list_packages" + }, + "description": "Sample for ListPackages", + "file": "artifactregistry_v1_generated_artifact_registry_list_packages_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListPackages_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_packages_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.list_repositories", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListRepositories", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListRepositories" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListRepositoriesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListRepositoriesAsyncPager", + "shortName": "list_repositories" + }, + "description": "Sample for ListRepositories", + "file": "artifactregistry_v1_generated_artifact_registry_list_repositories_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_repositories_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.list_repositories", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListRepositories", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListRepositories" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListRepositoriesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListRepositoriesPager", + "shortName": "list_repositories" + }, + "description": "Sample for ListRepositories", + "file": "artifactregistry_v1_generated_artifact_registry_list_repositories_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListRepositories_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_repositories_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.list_tags", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListTags", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListTags" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListTagsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListTagsAsyncPager", + "shortName": "list_tags" + }, + "description": "Sample for ListTags", + "file": "artifactregistry_v1_generated_artifact_registry_list_tags_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListTags_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_tags_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.list_tags", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListTags", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListTags" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListTagsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListTagsPager", + "shortName": "list_tags" + }, + "description": "Sample for ListTags", + "file": "artifactregistry_v1_generated_artifact_registry_list_tags_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListTags_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_tags_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.list_versions", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListVersions", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListVersions" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListVersionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListVersionsAsyncPager", + "shortName": "list_versions" + }, + "description": "Sample for ListVersions", + "file": "artifactregistry_v1_generated_artifact_registry_list_versions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListVersions_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_versions_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.list_versions", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.ListVersions", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "ListVersions" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.ListVersionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.services.artifact_registry.pagers.ListVersionsPager", + "shortName": "list_versions" + }, + "description": "Sample for ListVersions", + "file": "artifactregistry_v1_generated_artifact_registry_list_versions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_ListVersions_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_list_versions_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.set_iam_policy", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.SetIamPolicy", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "SetIamPolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.SetIamPolicyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "set_iam_policy" + }, + "description": "Sample for SetIamPolicy", + "file": "artifactregistry_v1_generated_artifact_registry_set_iam_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_SetIamPolicy_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 34, + "start": 32, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 35, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_set_iam_policy_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.set_iam_policy", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.SetIamPolicy", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "SetIamPolicy" + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.SetIamPolicyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "set_iam_policy" + }, + "description": "Sample for SetIamPolicy", + "file": "artifactregistry_v1_generated_artifact_registry_set_iam_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_SetIamPolicy_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 34, + "start": 32, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 35, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_set_iam_policy_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.test_iam_permissions", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.TestIamPermissions", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "TestIamPermissions" + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse", + "shortName": "test_iam_permissions" + }, + "description": "Sample for TestIamPermissions", + "file": "artifactregistry_v1_generated_artifact_registry_test_iam_permissions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_TestIamPermissions_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 34, + "start": 32, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 40, + "start": 35, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 43, + "start": 41, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "start": 44, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_test_iam_permissions_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.test_iam_permissions", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.TestIamPermissions", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "TestIamPermissions" + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse", + "shortName": "test_iam_permissions" + }, + "description": "Sample for TestIamPermissions", + "file": "artifactregistry_v1_generated_artifact_registry_test_iam_permissions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_TestIamPermissions_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 34, + "start": 32, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 40, + "start": 35, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 43, + "start": 41, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "start": 44, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_test_iam_permissions_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.update_project_settings", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateProjectSettings", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "UpdateProjectSettings" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.UpdateProjectSettingsRequest" + }, + { + "name": "project_settings", + "type": "google.cloud.artifactregistry_v1.types.ProjectSettings" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.ProjectSettings", + "shortName": "update_project_settings" + }, + "description": "Sample for UpdateProjectSettings", + "file": "artifactregistry_v1_generated_artifact_registry_update_project_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_update_project_settings_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.update_project_settings", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateProjectSettings", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "UpdateProjectSettings" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.UpdateProjectSettingsRequest" + }, + { + "name": "project_settings", + "type": "google.cloud.artifactregistry_v1.types.ProjectSettings" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.ProjectSettings", + "shortName": "update_project_settings" + }, + "description": "Sample for UpdateProjectSettings", + "file": "artifactregistry_v1_generated_artifact_registry_update_project_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateProjectSettings_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_update_project_settings_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.update_repository", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateRepository", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "UpdateRepository" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.UpdateRepositoryRequest" + }, + { + "name": "repository", + "type": "google.cloud.artifactregistry_v1.types.Repository" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Repository", + "shortName": "update_repository" + }, + "description": "Sample for UpdateRepository", + "file": "artifactregistry_v1_generated_artifact_registry_update_repository_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_update_repository_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.update_repository", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateRepository", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "UpdateRepository" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.UpdateRepositoryRequest" + }, + { + "name": "repository", + "type": "google.cloud.artifactregistry_v1.types.Repository" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Repository", + "shortName": "update_repository" + }, + "description": "Sample for UpdateRepository", + "file": "artifactregistry_v1_generated_artifact_registry_update_repository_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateRepository_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_update_repository_sync.py" + }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryAsyncClient.update_tag", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateTag", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "UpdateTag" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.UpdateTagRequest" + }, + { + "name": "tag", + "type": "google.cloud.artifactregistry_v1.types.Tag" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Tag", + "shortName": "update_tag" + }, + "description": "Sample for UpdateTag", + "file": "artifactregistry_v1_generated_artifact_registry_update_tag_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ], + "title": "artifactregistry_v1_generated_artifact_registry_update_tag_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1.ArtifactRegistryClient.update_tag", + "method": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry.UpdateTag", + "service": { + "fullName": "google.devtools.artifactregistry.v1.ArtifactRegistry", + "shortName": "ArtifactRegistry" + }, + "shortName": "UpdateTag" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1.types.UpdateTagRequest" + }, + { + "name": "tag", + "type": "google.cloud.artifactregistry_v1.types.Tag" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1.types.Tag", + "shortName": "update_tag" + }, + "description": "Sample for UpdateTag", + "file": "artifactregistry_v1_generated_artifact_registry_update_tag_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "artifactregistry_v1_generated_ArtifactRegistry_UpdateTag_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1_generated_artifact_registry_update_tag_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_artifactregistry_v1beta2.json b/samples/generated_samples/snippet_metadata_artifactregistry_v1beta2.json index 37a35d2..59f580e 100644 --- a/samples/generated_samples/snippet_metadata_artifactregistry_v1beta2.json +++ b/samples/generated_samples/snippet_metadata_artifactregistry_v1beta2.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.devtools.artifactregistry.v1beta2", + "version": "v1beta2" + } + ], + "language": "PYTHON", + "name": "google-cloud-artifact-registry" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.create_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "CreateRepository" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.CreateRepositoryRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "repository", + "type": "google.cloud.artifactregistry_v1beta2.types.Repository" + }, + { + "name": "repository_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_repository" }, + "description": "Sample for CreateRepository", "file": "artifactregistry_v1beta2_generated_artifact_registry_create_repository_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_create_repository_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.create_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "CreateRepository" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.CreateRepositoryRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "repository", + "type": "google.cloud.artifactregistry_v1beta2.types.Repository" + }, + { + "name": "repository_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_repository" }, + "description": "Sample for CreateRepository", "file": "artifactregistry_v1beta2_generated_artifact_registry_create_repository_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_CreateRepository_sync", "segments": [ { @@ -87,19 +184,63 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_create_repository_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.create_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateTag", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "CreateTag" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.CreateTagRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "tag", + "type": "google.cloud.artifactregistry_v1beta2.types.Tag" + }, + { + "name": "tag_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Tag", + "shortName": "create_tag" }, + "description": "Sample for CreateTag", "file": "artifactregistry_v1beta2_generated_artifact_registry_create_tag_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_async", "segments": [ { @@ -132,18 +273,62 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_create_tag_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.create_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.CreateTag", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "CreateTag" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.CreateTagRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "tag", + "type": "google.cloud.artifactregistry_v1beta2.types.Tag" + }, + { + "name": "tag_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Tag", + "shortName": "create_tag" }, + "description": "Sample for CreateTag", "file": "artifactregistry_v1beta2_generated_artifact_registry_create_tag_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_CreateTag_sync", "segments": [ { @@ -176,19 +361,55 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_create_tag_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.delete_package", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeletePackage", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "DeletePackage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.DeletePackageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_package" }, + "description": "Sample for DeletePackage", "file": "artifactregistry_v1beta2_generated_artifact_registry_delete_package_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_async", "segments": [ { @@ -221,18 +442,54 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_delete_package_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.delete_package", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeletePackage", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "DeletePackage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.DeletePackageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_package" }, + "description": "Sample for DeletePackage", "file": "artifactregistry_v1beta2_generated_artifact_registry_delete_package_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeletePackage_sync", "segments": [ { @@ -265,19 +522,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_delete_package_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.delete_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "DeleteRepository" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.DeleteRepositoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_repository" }, + "description": "Sample for DeleteRepository", "file": "artifactregistry_v1beta2_generated_artifact_registry_delete_repository_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_async", "segments": [ { @@ -310,18 +603,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_delete_repository_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.delete_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "DeleteRepository" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.DeleteRepositoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_repository" }, + "description": "Sample for DeleteRepository", "file": "artifactregistry_v1beta2_generated_artifact_registry_delete_repository_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteRepository_sync", "segments": [ { @@ -354,19 +683,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_delete_repository_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.delete_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteTag", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "DeleteTag" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.DeleteTagRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_tag" }, + "description": "Sample for DeleteTag", "file": "artifactregistry_v1beta2_generated_artifact_registry_delete_tag_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_async", "segments": [ { @@ -397,18 +761,53 @@ "end": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_delete_tag_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.delete_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteTag", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "DeleteTag" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.DeleteTagRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_tag" }, + "description": "Sample for DeleteTag", "file": "artifactregistry_v1beta2_generated_artifact_registry_delete_tag_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteTag_sync", "segments": [ { @@ -439,19 +838,55 @@ "end": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_delete_tag_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.delete_version", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteVersion", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "DeleteVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.DeleteVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_version" }, + "description": "Sample for DeleteVersion", "file": "artifactregistry_v1beta2_generated_artifact_registry_delete_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_async", "segments": [ { @@ -484,18 +919,54 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_delete_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.delete_version", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.DeleteVersion", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "DeleteVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.DeleteVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_version" }, + "description": "Sample for DeleteVersion", "file": "artifactregistry_v1beta2_generated_artifact_registry_delete_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_DeleteVersion_sync", "segments": [ { @@ -528,19 +999,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_delete_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.get_file", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetFile", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetFile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetFileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.File", + "shortName": "get_file" }, + "description": "Sample for GetFile", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_file_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_async", "segments": [ { @@ -573,18 +1080,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_file_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.get_file", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetFile", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetFile" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetFileRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.File", + "shortName": "get_file" }, + "description": "Sample for GetFile", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_file_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetFile_sync", "segments": [ { @@ -617,108 +1160,208 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_file_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.get_iam_policy", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetIamPolicy", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.GetIamPolicyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "get_iam_policy" }, + "description": "Sample for GetIamPolicy", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetIamPolicy_async", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.get_iam_policy", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetIamPolicy", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.GetIamPolicyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "get_iam_policy" }, + "description": "Sample for GetIamPolicy", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetIamPolicy_sync", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_iam_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.get_package", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetPackage", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetPackage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetPackageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Package", + "shortName": "get_package" }, + "description": "Sample for GetPackage", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_package_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_async", "segments": [ { @@ -751,18 +1394,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_package_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.get_package", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetPackage", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetPackage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetPackageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Package", + "shortName": "get_package" }, + "description": "Sample for GetPackage", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_package_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetPackage_sync", "segments": [ { @@ -795,19 +1474,55 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_package_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.get_project_settings", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetProjectSettings", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetProjectSettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetProjectSettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.ProjectSettings", + "shortName": "get_project_settings" }, + "description": "Sample for GetProjectSettings", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_project_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_async", "segments": [ { @@ -840,18 +1555,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_project_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.get_project_settings", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetProjectSettings", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetProjectSettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetProjectSettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.ProjectSettings", + "shortName": "get_project_settings" }, + "description": "Sample for GetProjectSettings", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_project_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetProjectSettings_sync", "segments": [ { @@ -884,19 +1635,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_project_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.get_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetRepository" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetRepositoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Repository", + "shortName": "get_repository" }, + "description": "Sample for GetRepository", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_repository_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_async", "segments": [ { @@ -929,18 +1716,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_repository_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.get_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetRepository" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetRepositoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Repository", + "shortName": "get_repository" }, + "description": "Sample for GetRepository", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_repository_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetRepository_sync", "segments": [ { @@ -973,19 +1796,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_repository_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.get_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetTag", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetTag" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetTagRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Tag", + "shortName": "get_tag" }, + "description": "Sample for GetTag", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_tag_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_async", "segments": [ { @@ -1018,18 +1877,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_tag_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.get_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetTag", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetTag" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetTagRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Tag", + "shortName": "get_tag" }, + "description": "Sample for GetTag", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_tag_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetTag_sync", "segments": [ { @@ -1062,19 +1957,55 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_tag_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.get_version", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetVersion", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Version", + "shortName": "get_version" }, + "description": "Sample for GetVersion", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_async", "segments": [ { @@ -1107,18 +2038,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.get_version", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.GetVersion", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "GetVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.GetVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Version", + "shortName": "get_version" }, + "description": "Sample for GetVersion", "file": "artifactregistry_v1beta2_generated_artifact_registry_get_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_GetVersion_sync", "segments": [ { @@ -1151,19 +2118,51 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_get_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.import_apt_artifacts", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportAptArtifacts", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ImportAptArtifacts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ImportAptArtifactsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_apt_artifacts" }, + "description": "Sample for ImportAptArtifacts", "file": "artifactregistry_v1beta2_generated_artifact_registry_import_apt_artifacts_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_async", "segments": [ { @@ -1196,18 +2195,50 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_import_apt_artifacts_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.import_apt_artifacts", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportAptArtifacts", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ImportAptArtifacts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ImportAptArtifactsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_apt_artifacts" }, + "description": "Sample for ImportAptArtifacts", "file": "artifactregistry_v1beta2_generated_artifact_registry_import_apt_artifacts_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ImportAptArtifacts_sync", "segments": [ { @@ -1240,19 +2271,51 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_import_apt_artifacts_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.import_yum_artifacts", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportYumArtifacts", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ImportYumArtifacts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ImportYumArtifactsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_yum_artifacts" }, + "description": "Sample for ImportYumArtifacts", "file": "artifactregistry_v1beta2_generated_artifact_registry_import_yum_artifacts_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_async", "segments": [ { @@ -1285,18 +2348,50 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_import_yum_artifacts_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.import_yum_artifacts", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ImportYumArtifacts", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ImportYumArtifacts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ImportYumArtifactsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_yum_artifacts" }, + "description": "Sample for ImportYumArtifacts", "file": "artifactregistry_v1beta2_generated_artifact_registry_import_yum_artifacts_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ImportYumArtifacts_sync", "segments": [ { @@ -1329,19 +2424,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_import_yum_artifacts_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.list_files", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListFiles", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListFilesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListFilesAsyncPager", + "shortName": "list_files" }, + "description": "Sample for ListFiles", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_files_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_async", "segments": [ { @@ -1374,18 +2505,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_files_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.list_files", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListFiles", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListFilesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListFilesPager", + "shortName": "list_files" }, + "description": "Sample for ListFiles", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_files_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListFiles_sync", "segments": [ { @@ -1418,19 +2585,55 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_files_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.list_packages", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListPackages", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListPackages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListPackagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListPackagesAsyncPager", + "shortName": "list_packages" }, + "description": "Sample for ListPackages", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_packages_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_async", "segments": [ { @@ -1463,18 +2666,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_packages_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.list_packages", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListPackages", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListPackages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListPackagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListPackagesPager", + "shortName": "list_packages" }, + "description": "Sample for ListPackages", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_packages_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListPackages_sync", "segments": [ { @@ -1507,19 +2746,55 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_packages_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.list_repositories", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListRepositories", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListRepositories" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListRepositoriesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListRepositoriesAsyncPager", + "shortName": "list_repositories" }, + "description": "Sample for ListRepositories", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_repositories_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_async", "segments": [ { @@ -1552,18 +2827,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_repositories_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.list_repositories", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListRepositories", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListRepositories" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListRepositoriesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListRepositoriesPager", + "shortName": "list_repositories" }, + "description": "Sample for ListRepositories", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_repositories_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListRepositories_sync", "segments": [ { @@ -1596,19 +2907,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_repositories_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.list_tags", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListTags", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListTags" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListTagsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListTagsAsyncPager", + "shortName": "list_tags" }, + "description": "Sample for ListTags", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_tags_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_async", "segments": [ { @@ -1641,18 +2988,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_tags_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.list_tags", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListTags", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListTags" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListTagsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListTagsPager", + "shortName": "list_tags" }, + "description": "Sample for ListTags", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_tags_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListTags_sync", "segments": [ { @@ -1685,19 +3068,55 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_tags_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.list_versions", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListVersions", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListVersionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListVersionsAsyncPager", + "shortName": "list_versions" }, + "description": "Sample for ListVersions", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_versions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_async", "segments": [ { @@ -1730,18 +3149,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_versions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.list_versions", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.ListVersions", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "ListVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.ListVersionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.services.artifact_registry.pagers.ListVersionsPager", + "shortName": "list_versions" }, + "description": "Sample for ListVersions", "file": "artifactregistry_v1beta2_generated_artifact_registry_list_versions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_ListVersions_sync", "segments": [ { @@ -1774,197 +3229,365 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_list_versions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.set_iam_policy", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.SetIamPolicy", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "SetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.SetIamPolicyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "set_iam_policy" }, + "description": "Sample for SetIamPolicy", "file": "artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_SetIamPolicy_async", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.set_iam_policy", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.SetIamPolicy", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "SetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.SetIamPolicyRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "set_iam_policy" }, + "description": "Sample for SetIamPolicy", "file": "artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_SetIamPolicy_sync", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_set_iam_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.test_iam_permissions", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.TestIamPermissions", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "TestIamPermissions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse", + "shortName": "test_iam_permissions" }, + "description": "Sample for TestIamPermissions", "file": "artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_TestIamPermissions_async", "segments": [ { - "end": 45, + "end": 46, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 46, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 39, - "start": 34, + "end": 40, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 42, - "start": 40, + "end": 43, + "start": 41, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 43, + "end": 47, + "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.test_iam_permissions", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.TestIamPermissions", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "TestIamPermissions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse", + "shortName": "test_iam_permissions" }, + "description": "Sample for TestIamPermissions", "file": "artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_TestIamPermissions_sync", "segments": [ { - "end": 45, + "end": 46, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 46, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 39, - "start": 34, + "end": 40, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 42, - "start": 40, + "end": 43, + "start": 41, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 43, + "end": 47, + "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_test_iam_permissions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.update_project_settings", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateProjectSettings", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "UpdateProjectSettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.UpdateProjectSettingsRequest" + }, + { + "name": "project_settings", + "type": "google.cloud.artifactregistry_v1beta2.types.ProjectSettings" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.ProjectSettings", + "shortName": "update_project_settings" }, + "description": "Sample for UpdateProjectSettings", "file": "artifactregistry_v1beta2_generated_artifact_registry_update_project_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_async", "segments": [ { @@ -1997,18 +3620,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_update_project_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.update_project_settings", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateProjectSettings", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "UpdateProjectSettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.UpdateProjectSettingsRequest" + }, + { + "name": "project_settings", + "type": "google.cloud.artifactregistry_v1beta2.types.ProjectSettings" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.ProjectSettings", + "shortName": "update_project_settings" }, + "description": "Sample for UpdateProjectSettings", "file": "artifactregistry_v1beta2_generated_artifact_registry_update_project_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateProjectSettings_sync", "segments": [ { @@ -2041,19 +3704,59 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_update_project_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.update_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "UpdateRepository" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.UpdateRepositoryRequest" + }, + { + "name": "repository", + "type": "google.cloud.artifactregistry_v1beta2.types.Repository" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Repository", + "shortName": "update_repository" }, + "description": "Sample for UpdateRepository", "file": "artifactregistry_v1beta2_generated_artifact_registry_update_repository_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_async", "segments": [ { @@ -2086,18 +3789,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_update_repository_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.update_repository", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateRepository", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "UpdateRepository" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.UpdateRepositoryRequest" + }, + { + "name": "repository", + "type": "google.cloud.artifactregistry_v1beta2.types.Repository" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Repository", + "shortName": "update_repository" }, + "description": "Sample for UpdateRepository", "file": "artifactregistry_v1beta2_generated_artifact_registry_update_repository_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateRepository_sync", "segments": [ { @@ -2130,19 +3873,59 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_update_repository_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient", + "shortName": "ArtifactRegistryAsyncClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryAsyncClient.update_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateTag", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "UpdateTag" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.UpdateTagRequest" + }, + { + "name": "tag", + "type": "google.cloud.artifactregistry_v1beta2.types.Tag" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Tag", + "shortName": "update_tag" }, + "description": "Sample for UpdateTag", "file": "artifactregistry_v1beta2_generated_artifact_registry_update_tag_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_async", "segments": [ { @@ -2175,18 +3958,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_update_tag_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient", + "shortName": "ArtifactRegistryClient" + }, + "fullName": "google.cloud.artifactregistry_v1beta2.ArtifactRegistryClient.update_tag", "method": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry.UpdateTag", "service": { + "fullName": "google.devtools.artifactregistry.v1beta2.ArtifactRegistry", "shortName": "ArtifactRegistry" }, "shortName": "UpdateTag" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.artifactregistry_v1beta2.types.UpdateTagRequest" + }, + { + "name": "tag", + "type": "google.cloud.artifactregistry_v1beta2.types.Tag" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.artifactregistry_v1beta2.types.Tag", + "shortName": "update_tag" }, + "description": "Sample for UpdateTag", "file": "artifactregistry_v1beta2_generated_artifact_registry_update_tag_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "artifactregistry_v1beta2_generated_ArtifactRegistry_UpdateTag_sync", "segments": [ { @@ -2219,7 +4042,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "artifactregistry_v1beta2_generated_artifact_registry_update_tag_sync.py" } ] } diff --git a/scripts/fixup_artifactregistry_v1_keywords.py b/scripts/fixup_artifactregistry_v1_keywords.py index 737a9ab..a6403ff 100644 --- a/scripts/fixup_artifactregistry_v1_keywords.py +++ b/scripts/fixup_artifactregistry_v1_keywords.py @@ -39,9 +39,33 @@ def partition( class artifactregistryCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'create_repository': ('parent', 'repository_id', 'repository', ), + 'create_tag': ('parent', 'tag_id', 'tag', ), + 'delete_package': ('name', ), + 'delete_repository': ('name', ), + 'delete_tag': ('name', ), + 'delete_version': ('name', 'force', ), + 'get_docker_image': ('name', ), + 'get_file': ('name', ), + 'get_iam_policy': ('resource', 'options', ), + 'get_package': ('name', ), + 'get_project_settings': ('name', ), 'get_repository': ('name', ), + 'get_tag': ('name', ), + 'get_version': ('name', 'view', ), + 'import_apt_artifacts': ('gcs_source', 'parent', ), + 'import_yum_artifacts': ('gcs_source', 'parent', ), 'list_docker_images': ('parent', 'page_size', 'page_token', ), + 'list_files': ('parent', 'filter', 'page_size', 'page_token', 'order_by', ), + 'list_packages': ('parent', 'page_size', 'page_token', ), 'list_repositories': ('parent', 'page_size', 'page_token', ), + 'list_tags': ('parent', 'filter', 'page_size', 'page_token', ), + 'list_versions': ('parent', 'page_size', 'page_token', 'view', 'order_by', ), + 'set_iam_policy': ('resource', 'policy', 'update_mask', ), + 'test_iam_permissions': ('resource', 'permissions', ), + 'update_project_settings': ('project_settings', 'update_mask', ), + 'update_repository': ('repository', 'update_mask', ), + 'update_tag': ('tag', 'update_mask', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: diff --git a/scripts/fixup_artifactregistry_v1beta2_keywords.py b/scripts/fixup_artifactregistry_v1beta2_keywords.py index 76931af..0c0f46f 100644 --- a/scripts/fixup_artifactregistry_v1beta2_keywords.py +++ b/scripts/fixup_artifactregistry_v1beta2_keywords.py @@ -59,7 +59,7 @@ class artifactregistryCallTransformer(cst.CSTTransformer): 'list_repositories': ('parent', 'page_size', 'page_token', ), 'list_tags': ('parent', 'filter', 'page_size', 'page_token', ), 'list_versions': ('parent', 'page_size', 'page_token', 'view', 'order_by', ), - 'set_iam_policy': ('resource', 'policy', ), + 'set_iam_policy': ('resource', 'policy', 'update_mask', ), 'test_iam_permissions': ('resource', 'permissions', ), 'update_project_settings': ('project_settings', 'update_mask', ), 'update_repository': ('repository', 'update_mask', ), diff --git a/setup.py b/setup.py index eac5995..957b8ca 100644 --- a/setup.py +++ b/setup.py @@ -17,10 +17,11 @@ import io import os + import setuptools # type: ignore name = "google-cloud-artifact-registry" -version = "1.1.2" +version = "1.2.0" description = "Artifact Registry API client library" release_status = "Development Status :: 5 - Production/Stable" url = "https://github.com/googleapis/python-artifact-registry" @@ -30,7 +31,7 @@ # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", "proto-plus >= 1.15.0", - "grpc-google-iam-v1", + "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", ] package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 3e570a0..a8cc045 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -20,5 +20,5 @@ # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 google-api-core==1.31.5 -grpc-google-iam-v1==0.12.3 +grpc-google-iam-v1==0.12.4 proto-plus==1.15.0 diff --git a/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py b/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py index 9111ce3..de16a2a 100644 --- a/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py +++ b/tests/unit/gapic/artifactregistry_v1/test_artifact_registry.py @@ -13,37 +13,52 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os -import mock - -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule - +import os +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -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 path_template +from google.api_core import operation_async # type: ignore +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import options_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import struct_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.type import expr_pb2 # type: ignore +import grpc +from grpc.experimental import aio +import mock +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.artifactregistry_v1.services.artifact_registry import ( ArtifactRegistryAsyncClient, -) -from google.cloud.artifactregistry_v1.services.artifact_registry import ( ArtifactRegistryClient, + pagers, + transports, ) -from google.cloud.artifactregistry_v1.services.artifact_registry import pagers -from google.cloud.artifactregistry_v1.services.artifact_registry import transports -from google.cloud.artifactregistry_v1.types import artifact +from google.cloud.artifactregistry_v1.types import apt_artifact, artifact, file, package from google.cloud.artifactregistry_v1.types import repository -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +from google.cloud.artifactregistry_v1.types import repository as gda_repository +from google.cloud.artifactregistry_v1.types import service, settings +from google.cloud.artifactregistry_v1.types import tag +from google.cloud.artifactregistry_v1.types import tag as gda_tag +from google.cloud.artifactregistry_v1.types import version, yum_artifact def client_cert_source_callback(): @@ -92,20 +107,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ArtifactRegistryClient, ArtifactRegistryAsyncClient,] + "client_class,transport_name", + [ + (ArtifactRegistryClient, "grpc"), + (ArtifactRegistryAsyncClient, "grpc_asyncio"), + ], ) -def test_artifact_registry_client_from_service_account_info(client_class): +def test_artifact_registry_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "artifactregistry.googleapis.com:443" + assert client.transport._host == ("artifactregistry.googleapis.com:443") @pytest.mark.parametrize( @@ -134,23 +155,33 @@ def test_artifact_registry_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ArtifactRegistryClient, ArtifactRegistryAsyncClient,] + "client_class,transport_name", + [ + (ArtifactRegistryClient, "grpc"), + (ArtifactRegistryAsyncClient, "grpc_asyncio"), + ], ) -def test_artifact_registry_client_from_service_account_file(client_class): +def test_artifact_registry_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "artifactregistry.googleapis.com:443" + assert client.transport._host == ("artifactregistry.googleapis.com:443") def test_artifact_registry_client_get_transport_class(): @@ -508,7 +539,9 @@ def test_artifact_registry_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -651,10 +684,17 @@ def test_artifact_registry_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [artifact.ListDockerImagesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + artifact.ListDockerImagesRequest, + dict, + ], +) def test_list_docker_images(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -685,7 +725,8 @@ def test_list_docker_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -703,7 +744,8 @@ async def test_list_docker_images_async( transport: str = "grpc_asyncio", request_type=artifact.ListDockerImagesRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -716,7 +758,9 @@ async def test_list_docker_images_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - artifact.ListDockerImagesResponse(next_page_token="next_page_token_value",) + artifact.ListDockerImagesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_docker_images(request) @@ -736,7 +780,9 @@ async def test_list_docker_images_async_from_dict(): def test_list_docker_images_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -758,7 +804,10 @@ def test_list_docker_images_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -789,11 +838,16 @@ async def test_list_docker_images_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_docker_images_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -803,7 +857,9 @@ def test_list_docker_images_flattened(): call.return_value = artifact.ListDockerImagesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_docker_images(parent="parent_value",) + client.list_docker_images( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -815,13 +871,16 @@ def test_list_docker_images_flattened(): def test_list_docker_images_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_docker_images( - artifact.ListDockerImagesRequest(), parent="parent_value", + artifact.ListDockerImagesRequest(), + parent="parent_value", ) @@ -843,7 +902,9 @@ async def test_list_docker_images_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_docker_images(parent="parent_value",) + response = await client.list_docker_images( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -864,13 +925,15 @@ async def test_list_docker_images_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_docker_images( - artifact.ListDockerImagesRequest(), parent="parent_value", + artifact.ListDockerImagesRequest(), + parent="parent_value", ) def test_list_docker_images_pager(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -887,12 +950,21 @@ def test_list_docker_images_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - artifact.ListDockerImagesResponse(docker_images=[], next_page_token="def",), artifact.ListDockerImagesResponse( - docker_images=[artifact.DockerImage(),], next_page_token="ghi", + docker_images=[], + next_page_token="def", + ), + artifact.ListDockerImagesResponse( + docker_images=[ + artifact.DockerImage(), + ], + next_page_token="ghi", ), artifact.ListDockerImagesResponse( - docker_images=[artifact.DockerImage(), artifact.DockerImage(),], + docker_images=[ + artifact.DockerImage(), + artifact.DockerImage(), + ], ), RuntimeError, ) @@ -912,7 +984,8 @@ def test_list_docker_images_pager(transport_name: str = "grpc"): def test_list_docker_images_pages(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -929,12 +1002,21 @@ def test_list_docker_images_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - artifact.ListDockerImagesResponse(docker_images=[], next_page_token="def",), artifact.ListDockerImagesResponse( - docker_images=[artifact.DockerImage(),], next_page_token="ghi", + docker_images=[], + next_page_token="def", + ), + artifact.ListDockerImagesResponse( + docker_images=[ + artifact.DockerImage(), + ], + next_page_token="ghi", ), artifact.ListDockerImagesResponse( - docker_images=[artifact.DockerImage(), artifact.DockerImage(),], + docker_images=[ + artifact.DockerImage(), + artifact.DockerImage(), + ], ), RuntimeError, ) @@ -965,19 +1047,30 @@ async def test_list_docker_images_async_pager(): ], next_page_token="abc", ), - artifact.ListDockerImagesResponse(docker_images=[], next_page_token="def",), artifact.ListDockerImagesResponse( - docker_images=[artifact.DockerImage(),], next_page_token="ghi", + docker_images=[], + next_page_token="def", + ), + artifact.ListDockerImagesResponse( + docker_images=[ + artifact.DockerImage(), + ], + next_page_token="ghi", ), artifact.ListDockerImagesResponse( - docker_images=[artifact.DockerImage(), artifact.DockerImage(),], + docker_images=[ + artifact.DockerImage(), + artifact.DockerImage(), + ], ), RuntimeError, ) - async_pager = await client.list_docker_images(request={},) + async_pager = await client.list_docker_images( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1006,26 +1099,44 @@ async def test_list_docker_images_async_pages(): ], next_page_token="abc", ), - artifact.ListDockerImagesResponse(docker_images=[], next_page_token="def",), artifact.ListDockerImagesResponse( - docker_images=[artifact.DockerImage(),], next_page_token="ghi", + docker_images=[], + next_page_token="def", + ), + artifact.ListDockerImagesResponse( + docker_images=[ + artifact.DockerImage(), + ], + next_page_token="ghi", ), artifact.ListDockerImagesResponse( - docker_images=[artifact.DockerImage(), artifact.DockerImage(),], + docker_images=[ + artifact.DockerImage(), + artifact.DockerImage(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_docker_images(request={})).pages: + async for page_ in ( + await client.list_docker_images(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [repository.ListRepositoriesRequest, dict,]) -def test_list_repositories(request_type, transport: str = "grpc"): +@pytest.mark.parametrize( + "request_type", + [ + artifact.GetDockerImageRequest, + dict, + ], +) +def test_get_docker_image(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1033,48 +1144,54 @@ def test_list_repositories(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_repositories), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_docker_image), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = repository.ListRepositoriesResponse( - next_page_token="next_page_token_value", + call.return_value = artifact.DockerImage( + name="name_value", + uri="uri_value", + tags=["tags_value"], + image_size_bytes=1699, + media_type="media_type_value", ) - response = client.list_repositories(request) + response = client.get_docker_image(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == repository.ListRepositoriesRequest() + assert args[0] == artifact.GetDockerImageRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListRepositoriesPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, artifact.DockerImage) + assert response.name == "name_value" + assert response.uri == "uri_value" + assert response.tags == ["tags_value"] + assert response.image_size_bytes == 1699 + assert response.media_type == "media_type_value" -def test_list_repositories_empty_call(): +def test_get_docker_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_repositories), "__call__" - ) as call: - client.list_repositories() + with mock.patch.object(type(client.transport.get_docker_image), "__call__") as call: + client.get_docker_image() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repository.ListRepositoriesRequest() + assert args[0] == artifact.GetDockerImageRequest() @pytest.mark.asyncio -async def test_list_repositories_async( - transport: str = "grpc_asyncio", request_type=repository.ListRepositoriesRequest +async def test_get_docker_image_async( + transport: str = "grpc_asyncio", request_type=artifact.GetDockerImageRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1082,47 +1199,53 @@ async def test_list_repositories_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_repositories), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_docker_image), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - repository.ListRepositoriesResponse( - next_page_token="next_page_token_value", + artifact.DockerImage( + name="name_value", + uri="uri_value", + tags=["tags_value"], + image_size_bytes=1699, + media_type="media_type_value", ) ) - response = await client.list_repositories(request) + response = await client.get_docker_image(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == repository.ListRepositoriesRequest() + assert args[0] == artifact.GetDockerImageRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListRepositoriesAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, artifact.DockerImage) + assert response.name == "name_value" + assert response.uri == "uri_value" + assert response.tags == ["tags_value"] + assert response.image_size_bytes == 1699 + assert response.media_type == "media_type_value" @pytest.mark.asyncio -async def test_list_repositories_async_from_dict(): - await test_list_repositories_async(request_type=dict) +async def test_get_docker_image_async_from_dict(): + await test_get_docker_image_async(request_type=dict) -def test_list_repositories_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) +def test_get_docker_image_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = repository.ListRepositoriesRequest() + request = artifact.GetDockerImageRequest() - request.parent = "parent/value" + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_repositories), "__call__" - ) as call: - call.return_value = repository.ListRepositoriesResponse() - client.list_repositories(request) + with mock.patch.object(type(client.transport.get_docker_image), "__call__") as call: + call.return_value = artifact.DockerImage() + client.get_docker_image(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -1131,29 +1254,30 @@ def test_list_repositories_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_repositories_field_headers_async(): +async def test_get_docker_image_field_headers_async(): client = ArtifactRegistryAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = repository.ListRepositoriesRequest() + request = artifact.GetDockerImageRequest() - request.parent = "parent/value" + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_repositories), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_docker_image), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - repository.ListRepositoriesResponse() + artifact.DockerImage() ) - await client.list_repositories(request) + await client.get_docker_image(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -1162,73 +1286,81 @@ async def test_list_repositories_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] -def test_list_repositories_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) +def test_get_docker_image_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_repositories), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_docker_image), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = repository.ListRepositoriesResponse() + call.return_value = artifact.DockerImage() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_repositories(parent="parent_value",) + client.get_docker_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_repositories_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) +def test_get_docker_image_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_repositories( - repository.ListRepositoriesRequest(), parent="parent_value", + client.get_docker_image( + artifact.GetDockerImageRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_repositories_flattened_async(): +async def test_get_docker_image_flattened_async(): client = ArtifactRegistryAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_repositories), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_docker_image), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = repository.ListRepositoriesResponse() + call.return_value = artifact.DockerImage() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - repository.ListRepositoriesResponse() + artifact.DockerImage() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_repositories(parent="parent_value",) + response = await client.get_docker_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_repositories_flattened_error_async(): +async def test_get_docker_image_flattened_error_async(): client = ArtifactRegistryAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -1236,177 +1368,6392 @@ async def test_list_repositories_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_repositories( - repository.ListRepositoriesRequest(), parent="parent_value", + await client.get_docker_image( + artifact.GetDockerImageRequest(), + name="name_value", ) -def test_list_repositories_pager(transport_name: str = "grpc"): +@pytest.mark.parametrize( + "request_type", + [ + apt_artifact.ImportAptArtifactsRequest, + dict, + ], +) +def test_import_apt_artifacts(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_repositories), "__call__" + type(client.transport.import_apt_artifacts), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - repository.ListRepositoriesResponse( - repositories=[ - repository.Repository(), - repository.Repository(), - repository.Repository(), - ], - next_page_token="abc", - ), - repository.ListRepositoriesResponse( - repositories=[], next_page_token="def", - ), - repository.ListRepositoriesResponse( - repositories=[repository.Repository(),], next_page_token="ghi", - ), - repository.ListRepositoriesResponse( - repositories=[repository.Repository(), repository.Repository(),], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_repositories(request={}) + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + response = client.import_apt_artifacts(request) - assert pager._metadata == metadata + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == apt_artifact.ImportAptArtifactsRequest() - results = [i for i in pager] - assert len(results) == 6 - assert all(isinstance(i, repository.Repository) for i in results) + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) -def test_list_repositories_pages(transport_name: str = "grpc"): +def test_import_apt_artifacts_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_repositories), "__call__" + type(client.transport.import_apt_artifacts), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - repository.ListRepositoriesResponse( - repositories=[ - repository.Repository(), - repository.Repository(), - repository.Repository(), - ], - next_page_token="abc", - ), - repository.ListRepositoriesResponse( - repositories=[], next_page_token="def", - ), - repository.ListRepositoriesResponse( - repositories=[repository.Repository(),], next_page_token="ghi", + client.import_apt_artifacts() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == apt_artifact.ImportAptArtifactsRequest() + + +@pytest.mark.asyncio +async def test_import_apt_artifacts_async( + transport: str = "grpc_asyncio", request_type=apt_artifact.ImportAptArtifactsRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_apt_artifacts), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + response = await client.import_apt_artifacts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == apt_artifact.ImportAptArtifactsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_import_apt_artifacts_async_from_dict(): + await test_import_apt_artifacts_async(request_type=dict) + + +def test_import_apt_artifacts_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = apt_artifact.ImportAptArtifactsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_apt_artifacts), "__call__" + ) as call: + call.return_value = operations_pb2.Operation(name="operations/op") + client.import_apt_artifacts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_import_apt_artifacts_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = apt_artifact.ImportAptArtifactsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_apt_artifacts), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + await client.import_apt_artifacts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.parametrize( + "request_type", + [ + yum_artifact.ImportYumArtifactsRequest, + dict, + ], +) +def test_import_yum_artifacts(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_yum_artifacts), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + response = client.import_yum_artifacts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == yum_artifact.ImportYumArtifactsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_import_yum_artifacts_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_yum_artifacts), "__call__" + ) as call: + client.import_yum_artifacts() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == yum_artifact.ImportYumArtifactsRequest() + + +@pytest.mark.asyncio +async def test_import_yum_artifacts_async( + transport: str = "grpc_asyncio", request_type=yum_artifact.ImportYumArtifactsRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_yum_artifacts), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + response = await client.import_yum_artifacts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == yum_artifact.ImportYumArtifactsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_import_yum_artifacts_async_from_dict(): + await test_import_yum_artifacts_async(request_type=dict) + + +def test_import_yum_artifacts_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = yum_artifact.ImportYumArtifactsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_yum_artifacts), "__call__" + ) as call: + call.return_value = operations_pb2.Operation(name="operations/op") + client.import_yum_artifacts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_import_yum_artifacts_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = yum_artifact.ImportYumArtifactsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.import_yum_artifacts), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + await client.import_yum_artifacts(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.parametrize( + "request_type", + [ + repository.ListRepositoriesRequest, + dict, + ], +) +def test_list_repositories(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = repository.ListRepositoriesResponse( + next_page_token="next_page_token_value", + ) + response = client.list_repositories(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == repository.ListRepositoriesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListRepositoriesPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_repositories_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + client.list_repositories() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == repository.ListRepositoriesRequest() + + +@pytest.mark.asyncio +async def test_list_repositories_async( + transport: str = "grpc_asyncio", request_type=repository.ListRepositoriesRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + repository.ListRepositoriesResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_repositories(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == repository.ListRepositoriesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListRepositoriesAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_repositories_async_from_dict(): + await test_list_repositories_async(request_type=dict) + + +def test_list_repositories_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = repository.ListRepositoriesRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + call.return_value = repository.ListRepositoriesResponse() + client.list_repositories(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_repositories_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = repository.ListRepositoriesRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + repository.ListRepositoriesResponse() + ) + await client.list_repositories(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +def test_list_repositories_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = repository.ListRepositoriesResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_repositories( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +def test_list_repositories_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_repositories( + repository.ListRepositoriesRequest(), + parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_repositories_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = repository.ListRepositoriesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + repository.ListRepositoriesResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_repositories( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_list_repositories_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_repositories( + repository.ListRepositoriesRequest(), + parent="parent_value", + ) + + +def test_list_repositories_pager(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + repository.Repository(), + repository.Repository(), + ], + next_page_token="abc", + ), + repository.ListRepositoriesResponse( + repositories=[], + next_page_token="def", + ), + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + ], + next_page_token="ghi", + ), + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + repository.Repository(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_repositories(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, repository.Repository) for i in results) + + +def test_list_repositories_pages(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + repository.Repository(), + repository.Repository(), + ], + next_page_token="abc", + ), + repository.ListRepositoriesResponse( + repositories=[], + next_page_token="def", + ), + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + ], + next_page_token="ghi", + ), + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + repository.Repository(), + ], + ), + RuntimeError, + ) + pages = list(client.list_repositories(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_repositories_async_pager(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + repository.Repository(), + repository.Repository(), + ], + next_page_token="abc", + ), + repository.ListRepositoriesResponse( + repositories=[], + next_page_token="def", + ), + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + ], + next_page_token="ghi", + ), + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + repository.Repository(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_repositories( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, repository.Repository) for i in responses) + + +@pytest.mark.asyncio +async def test_list_repositories_async_pages(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_repositories), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + repository.Repository(), + repository.Repository(), + ], + next_page_token="abc", + ), + repository.ListRepositoriesResponse( + repositories=[], + next_page_token="def", + ), + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + ], + next_page_token="ghi", + ), + repository.ListRepositoriesResponse( + repositories=[ + repository.Repository(), + repository.Repository(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in ( + await client.list_repositories(request={}) + ).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + repository.GetRepositoryRequest, + dict, + ], +) +def test_get_repository(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = repository.Repository( + name="name_value", + format_=repository.Repository.Format.DOCKER, + description="description_value", + kms_key_name="kms_key_name_value", + maven_config=repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ), + ) + response = client.get_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == repository.GetRepositoryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repository.Repository) + assert response.name == "name_value" + assert response.format_ == repository.Repository.Format.DOCKER + assert response.description == "description_value" + assert response.kms_key_name == "kms_key_name_value" + + +def test_get_repository_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + client.get_repository() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == repository.GetRepositoryRequest() + + +@pytest.mark.asyncio +async def test_get_repository_async( + transport: str = "grpc_asyncio", request_type=repository.GetRepositoryRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + repository.Repository( + name="name_value", + format_=repository.Repository.Format.DOCKER, + description="description_value", + kms_key_name="kms_key_name_value", + ) + ) + response = await client.get_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == repository.GetRepositoryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, repository.Repository) + assert response.name == "name_value" + assert response.format_ == repository.Repository.Format.DOCKER + assert response.description == "description_value" + assert response.kms_key_name == "kms_key_name_value" + + +@pytest.mark.asyncio +async def test_get_repository_async_from_dict(): + await test_get_repository_async(request_type=dict) + + +def test_get_repository_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = repository.GetRepositoryRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + call.return_value = repository.Repository() + client.get_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_repository_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = repository.GetRepositoryRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + repository.Repository() + ) + await client.get_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_get_repository_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = repository.Repository() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_repository( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_get_repository_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_repository( + repository.GetRepositoryRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_repository_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = repository.Repository() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + repository.Repository() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_repository( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_get_repository_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_repository( + repository.GetRepositoryRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + gda_repository.CreateRepositoryRequest, + dict, + ], +) +def test_create_repository(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + response = client.create_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == gda_repository.CreateRepositoryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_create_repository_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_repository), "__call__" + ) as call: + client.create_repository() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == gda_repository.CreateRepositoryRequest() + + +@pytest.mark.asyncio +async def test_create_repository_async( + transport: str = "grpc_asyncio", request_type=gda_repository.CreateRepositoryRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + response = await client.create_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == gda_repository.CreateRepositoryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_create_repository_async_from_dict(): + await test_create_repository_async(request_type=dict) + + +def test_create_repository_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = gda_repository.CreateRepositoryRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_repository), "__call__" + ) as call: + call.return_value = operations_pb2.Operation(name="operations/op") + client.create_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_repository_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = gda_repository.CreateRepositoryRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_repository), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + await client.create_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +def test_create_repository_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_repository( + parent="parent_value", + repository=gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ), + repository_id="repository_id_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].repository + mock_val = gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ) + assert arg == mock_val + arg = args[0].repository_id + mock_val = "repository_id_value" + assert arg == mock_val + + +def test_create_repository_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_repository( + gda_repository.CreateRepositoryRequest(), + parent="parent_value", + repository=gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ), + repository_id="repository_id_value", + ) + + +@pytest.mark.asyncio +async def test_create_repository_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_repository( + parent="parent_value", + repository=gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ), + repository_id="repository_id_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].repository + mock_val = gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ) + assert arg == mock_val + arg = args[0].repository_id + mock_val = "repository_id_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_create_repository_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_repository( + gda_repository.CreateRepositoryRequest(), + parent="parent_value", + repository=gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ), + repository_id="repository_id_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + gda_repository.UpdateRepositoryRequest, + dict, + ], +) +def test_update_repository(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gda_repository.Repository( + name="name_value", + format_=gda_repository.Repository.Format.DOCKER, + description="description_value", + kms_key_name="kms_key_name_value", + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ), + ) + response = client.update_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == gda_repository.UpdateRepositoryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gda_repository.Repository) + assert response.name == "name_value" + assert response.format_ == gda_repository.Repository.Format.DOCKER + assert response.description == "description_value" + assert response.kms_key_name == "kms_key_name_value" + + +def test_update_repository_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_repository), "__call__" + ) as call: + client.update_repository() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == gda_repository.UpdateRepositoryRequest() + + +@pytest.mark.asyncio +async def test_update_repository_async( + transport: str = "grpc_asyncio", request_type=gda_repository.UpdateRepositoryRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gda_repository.Repository( + name="name_value", + format_=gda_repository.Repository.Format.DOCKER, + description="description_value", + kms_key_name="kms_key_name_value", + ) + ) + response = await client.update_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == gda_repository.UpdateRepositoryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gda_repository.Repository) + assert response.name == "name_value" + assert response.format_ == gda_repository.Repository.Format.DOCKER + assert response.description == "description_value" + assert response.kms_key_name == "kms_key_name_value" + + +@pytest.mark.asyncio +async def test_update_repository_async_from_dict(): + await test_update_repository_async(request_type=dict) + + +def test_update_repository_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = gda_repository.UpdateRepositoryRequest() + + request.repository.name = "repository.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_repository), "__call__" + ) as call: + call.return_value = gda_repository.Repository() + client.update_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "repository.name=repository.name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_update_repository_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = gda_repository.UpdateRepositoryRequest() + + request.repository.name = "repository.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_repository), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gda_repository.Repository() + ) + await client.update_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "repository.name=repository.name/value", + ) in kw["metadata"] + + +def test_update_repository_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gda_repository.Repository() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_repository( + repository=gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].repository + mock_val = gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ) + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +def test_update_repository_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_repository( + gda_repository.UpdateRepositoryRequest(), + repository=gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.asyncio +async def test_update_repository_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gda_repository.Repository() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gda_repository.Repository() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_repository( + repository=gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].repository + mock_val = gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ) + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_update_repository_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_repository( + gda_repository.UpdateRepositoryRequest(), + repository=gda_repository.Repository( + maven_config=gda_repository.Repository.MavenRepositoryConfig( + allow_snapshot_overwrites=True + ) + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.parametrize( + "request_type", + [ + repository.DeleteRepositoryRequest, + dict, + ], +) +def test_delete_repository(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + response = client.delete_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == repository.DeleteRepositoryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_delete_repository_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_repository), "__call__" + ) as call: + client.delete_repository() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == repository.DeleteRepositoryRequest() + + +@pytest.mark.asyncio +async def test_delete_repository_async( + transport: str = "grpc_asyncio", request_type=repository.DeleteRepositoryRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + response = await client.delete_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == repository.DeleteRepositoryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_repository_async_from_dict(): + await test_delete_repository_async(request_type=dict) + + +def test_delete_repository_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = repository.DeleteRepositoryRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_repository), "__call__" + ) as call: + call.return_value = operations_pb2.Operation(name="operations/op") + client.delete_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_repository_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = repository.DeleteRepositoryRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_repository), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + await client.delete_repository(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_delete_repository_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_repository( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_delete_repository_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_repository( + repository.DeleteRepositoryRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_repository_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_repository), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_repository( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_delete_repository_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_repository( + repository.DeleteRepositoryRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + package.ListPackagesRequest, + dict, + ], +) +def test_list_packages(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = package.ListPackagesResponse( + next_page_token="next_page_token_value", + ) + response = client.list_packages(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == package.ListPackagesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPackagesPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_packages_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + client.list_packages() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == package.ListPackagesRequest() + + +@pytest.mark.asyncio +async def test_list_packages_async( + transport: str = "grpc_asyncio", request_type=package.ListPackagesRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + package.ListPackagesResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_packages(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == package.ListPackagesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListPackagesAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_packages_async_from_dict(): + await test_list_packages_async(request_type=dict) + + +def test_list_packages_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = package.ListPackagesRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + call.return_value = package.ListPackagesResponse() + client.list_packages(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_packages_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = package.ListPackagesRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + package.ListPackagesResponse() + ) + await client.list_packages(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +def test_list_packages_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = package.ListPackagesResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_packages( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +def test_list_packages_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_packages( + package.ListPackagesRequest(), + parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_packages_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = package.ListPackagesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + package.ListPackagesResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_packages( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_list_packages_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_packages( + package.ListPackagesRequest(), + parent="parent_value", + ) + + +def test_list_packages_pager(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + package.Package(), + ], + next_page_token="abc", + ), + package.ListPackagesResponse( + packages=[], + next_page_token="def", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + ], + next_page_token="ghi", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_packages(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, package.Package) for i in results) + + +def test_list_packages_pages(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_packages), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + package.Package(), + ], + next_page_token="abc", + ), + package.ListPackagesResponse( + packages=[], + next_page_token="def", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + ], + next_page_token="ghi", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + ], + ), + RuntimeError, + ) + pages = list(client.list_packages(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_packages_async_pager(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_packages), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + package.Package(), + ], + next_page_token="abc", + ), + package.ListPackagesResponse( + packages=[], + next_page_token="def", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + ], + next_page_token="ghi", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_packages( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, package.Package) for i in responses) + + +@pytest.mark.asyncio +async def test_list_packages_async_pages(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_packages), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + package.Package(), + ], + next_page_token="abc", + ), + package.ListPackagesResponse( + packages=[], + next_page_token="def", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + ], + next_page_token="ghi", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in ( + await client.list_packages(request={}) + ).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + package.GetPackageRequest, + dict, + ], +) +def test_get_package(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_package), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = package.Package( + name="name_value", + display_name="display_name_value", + ) + response = client.get_package(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == package.GetPackageRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, package.Package) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + + +def test_get_package_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_package), "__call__") as call: + client.get_package() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == package.GetPackageRequest() + + +@pytest.mark.asyncio +async def test_get_package_async( + transport: str = "grpc_asyncio", request_type=package.GetPackageRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_package), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + package.Package( + name="name_value", + display_name="display_name_value", + ) + ) + response = await client.get_package(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == package.GetPackageRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, package.Package) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + + +@pytest.mark.asyncio +async def test_get_package_async_from_dict(): + await test_get_package_async(request_type=dict) + + +def test_get_package_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = package.GetPackageRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_package), "__call__") as call: + call.return_value = package.Package() + client.get_package(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_package_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = package.GetPackageRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_package), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(package.Package()) + await client.get_package(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_get_package_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_package), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = package.Package() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_package( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_get_package_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_package( + package.GetPackageRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_package_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_package), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = package.Package() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(package.Package()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_package( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_get_package_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_package( + package.GetPackageRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + package.DeletePackageRequest, + dict, + ], +) +def test_delete_package(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_package), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + response = client.delete_package(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == package.DeletePackageRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_delete_package_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_package), "__call__") as call: + client.delete_package() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == package.DeletePackageRequest() + + +@pytest.mark.asyncio +async def test_delete_package_async( + transport: str = "grpc_asyncio", request_type=package.DeletePackageRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_package), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + response = await client.delete_package(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == package.DeletePackageRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_package_async_from_dict(): + await test_delete_package_async(request_type=dict) + + +def test_delete_package_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = package.DeletePackageRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_package), "__call__") as call: + call.return_value = operations_pb2.Operation(name="operations/op") + client.delete_package(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_package_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = package.DeletePackageRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_package), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + await client.delete_package(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_delete_package_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_package), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_package( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_delete_package_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_package( + package.DeletePackageRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_package_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_package), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_package( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_delete_package_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_package( + package.DeletePackageRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest, + dict, + ], +) +def test_list_versions(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = version.ListVersionsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_versions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == version.ListVersionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListVersionsPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_versions_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + client.list_versions() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == version.ListVersionsRequest() + + +@pytest.mark.asyncio +async def test_list_versions_async( + transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + version.ListVersionsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_versions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == version.ListVersionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListVersionsAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_versions_async_from_dict(): + await test_list_versions_async(request_type=dict) + + +def test_list_versions_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = version.ListVersionsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + call.return_value = version.ListVersionsResponse() + client.list_versions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_versions_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = version.ListVersionsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + version.ListVersionsResponse() + ) + await client.list_versions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +def test_list_versions_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = version.ListVersionsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_versions( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +def test_list_versions_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_versions( + version.ListVersionsRequest(), + parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_versions_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = version.ListVersionsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + version.ListVersionsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_versions( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_list_versions_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_versions( + version.ListVersionsRequest(), + parent="parent_value", + ) + + +def test_list_versions_pager(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], + next_page_token="abc", + ), + version.ListVersionsResponse( + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_versions(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, version.Version) for i in results) + + +def test_list_versions_pages(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_versions), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], + next_page_token="abc", + ), + version.ListVersionsResponse( + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], + ), + RuntimeError, + ) + pages = list(client.list_versions(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_versions_async_pager(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_versions), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], + next_page_token="abc", + ), + version.ListVersionsResponse( + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_versions( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, version.Version) for i in responses) + + +@pytest.mark.asyncio +async def test_list_versions_async_pages(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_versions), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], + next_page_token="abc", + ), + version.ListVersionsResponse( + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in ( + await client.list_versions(request={}) + ).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest, + dict, + ], +) +def test_get_version(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_version), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = version.Version( + name="name_value", + description="description_value", + ) + response = client.get_version(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == version.GetVersionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, version.Version) + assert response.name == "name_value" + assert response.description == "description_value" + + +def test_get_version_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_version), "__call__") as call: + client.get_version() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == version.GetVersionRequest() + + +@pytest.mark.asyncio +async def test_get_version_async( + transport: str = "grpc_asyncio", request_type=version.GetVersionRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_version), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + version.Version( + name="name_value", + description="description_value", + ) + ) + response = await client.get_version(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == version.GetVersionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, version.Version) + assert response.name == "name_value" + assert response.description == "description_value" + + +@pytest.mark.asyncio +async def test_get_version_async_from_dict(): + await test_get_version_async(request_type=dict) + + +def test_get_version_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = version.GetVersionRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_version), "__call__") as call: + call.return_value = version.Version() + client.get_version(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_version_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = version.GetVersionRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_version), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(version.Version()) + await client.get_version(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_get_version_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_version), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = version.Version() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_version( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_get_version_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_version( + version.GetVersionRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_version_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_version), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = version.Version() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(version.Version()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_version( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_get_version_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_version( + version.GetVersionRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest, + dict, + ], +) +def test_delete_version(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_version), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + response = client.delete_version(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == version.DeleteVersionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_delete_version_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_version), "__call__") as call: + client.delete_version() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == version.DeleteVersionRequest() + + +@pytest.mark.asyncio +async def test_delete_version_async( + transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_version), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + response = await client.delete_version(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == version.DeleteVersionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +@pytest.mark.asyncio +async def test_delete_version_async_from_dict(): + await test_delete_version_async(request_type=dict) + + +def test_delete_version_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = version.DeleteVersionRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_version), "__call__") as call: + call.return_value = operations_pb2.Operation(name="operations/op") + client.delete_version(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_version_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = version.DeleteVersionRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_version), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + await client.delete_version(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_delete_version_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_version), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_version( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_delete_version_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_version( + version.DeleteVersionRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_version_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_version), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_version( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_delete_version_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_version( + version.DeleteVersionRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + file.ListFilesRequest, + dict, + ], +) +def test_list_files(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = file.ListFilesResponse( + next_page_token="next_page_token_value", + ) + response = client.list_files(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == file.ListFilesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListFilesPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_files_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + client.list_files() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == file.ListFilesRequest() + + +@pytest.mark.asyncio +async def test_list_files_async( + transport: str = "grpc_asyncio", request_type=file.ListFilesRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + file.ListFilesResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_files(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == file.ListFilesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListFilesAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_files_async_from_dict(): + await test_list_files_async(request_type=dict) + + +def test_list_files_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = file.ListFilesRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + call.return_value = file.ListFilesResponse() + client.list_files(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_files_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = file.ListFilesRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + file.ListFilesResponse() + ) + await client.list_files(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +def test_list_files_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = file.ListFilesResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_files( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +def test_list_files_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_files( + file.ListFilesRequest(), + parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_files_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = file.ListFilesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + file.ListFilesResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_files( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_list_files_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_files( + file.ListFilesRequest(), + parent="parent_value", + ) + + +def test_list_files_pager(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + file.File(), + ], + next_page_token="abc", + ), + file.ListFilesResponse( + files=[], + next_page_token="def", + ), + file.ListFilesResponse( + files=[ + file.File(), + ], + next_page_token="ghi", + ), + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_files(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, file.File) for i in results) + + +def test_list_files_pages(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_files), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + file.File(), + ], + next_page_token="abc", + ), + file.ListFilesResponse( + files=[], + next_page_token="def", + ), + file.ListFilesResponse( + files=[ + file.File(), + ], + next_page_token="ghi", + ), + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + ], + ), + RuntimeError, + ) + pages = list(client.list_files(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_files_async_pager(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_files), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + file.File(), + ], + next_page_token="abc", + ), + file.ListFilesResponse( + files=[], + next_page_token="def", + ), + file.ListFilesResponse( + files=[ + file.File(), + ], + next_page_token="ghi", + ), + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_files( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, file.File) for i in responses) + + +@pytest.mark.asyncio +async def test_list_files_async_pages(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_files), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + file.File(), + ], + next_page_token="abc", + ), + file.ListFilesResponse( + files=[], + next_page_token="def", + ), + file.ListFilesResponse( + files=[ + file.File(), + ], + next_page_token="ghi", + ), + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in ( + await client.list_files(request={}) + ).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + file.GetFileRequest, + dict, + ], +) +def test_get_file(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_file), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = file.File( + name="name_value", + size_bytes=1089, + owner="owner_value", + ) + response = client.get_file(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == file.GetFileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, file.File) + assert response.name == "name_value" + assert response.size_bytes == 1089 + assert response.owner == "owner_value" + + +def test_get_file_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_file), "__call__") as call: + client.get_file() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == file.GetFileRequest() + + +@pytest.mark.asyncio +async def test_get_file_async( + transport: str = "grpc_asyncio", request_type=file.GetFileRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_file), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + file.File( + name="name_value", + size_bytes=1089, + owner="owner_value", + ) + ) + response = await client.get_file(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == file.GetFileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, file.File) + assert response.name == "name_value" + assert response.size_bytes == 1089 + assert response.owner == "owner_value" + + +@pytest.mark.asyncio +async def test_get_file_async_from_dict(): + await test_get_file_async(request_type=dict) + + +def test_get_file_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = file.GetFileRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_file), "__call__") as call: + call.return_value = file.File() + client.get_file(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_file_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = file.GetFileRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_file), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(file.File()) + await client.get_file(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_get_file_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_file), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = file.File() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_file( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_get_file_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_file( + file.GetFileRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_file_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_file), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = file.File() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(file.File()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_file( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_get_file_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_file( + file.GetFileRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + tag.ListTagsRequest, + dict, + ], +) +def test_list_tags(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tag.ListTagsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_tags(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == tag.ListTagsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTagsPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_tags_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + client.list_tags() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == tag.ListTagsRequest() + + +@pytest.mark.asyncio +async def test_list_tags_async( + transport: str = "grpc_asyncio", request_type=tag.ListTagsRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + tag.ListTagsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_tags(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == tag.ListTagsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTagsAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_tags_async_from_dict(): + await test_list_tags_async(request_type=dict) + + +def test_list_tags_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tag.ListTagsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + call.return_value = tag.ListTagsResponse() + client.list_tags(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_tags_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tag.ListTagsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + tag.ListTagsResponse() + ) + await client.list_tags(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +def test_list_tags_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tag.ListTagsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_tags( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +def test_list_tags_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_tags( + tag.ListTagsRequest(), + parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_tags_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tag.ListTagsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + tag.ListTagsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_tags( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_list_tags_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_tags( + tag.ListTagsRequest(), + parent="parent_value", + ) + + +def test_list_tags_pager(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + tag.Tag(), + ], + next_page_token="abc", + ), + tag.ListTagsResponse( + tags=[], + next_page_token="def", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + ], + next_page_token="ghi", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_tags(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, tag.Tag) for i in results) + + +def test_list_tags_pages(transport_name: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tags), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + tag.Tag(), + ], + next_page_token="abc", + ), + tag.ListTagsResponse( + tags=[], + next_page_token="def", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + ], + next_page_token="ghi", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + ], + ), + RuntimeError, + ) + pages = list(client.list_tags(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_tags_async_pager(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_tags), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + tag.Tag(), + ], + next_page_token="abc", + ), + tag.ListTagsResponse( + tags=[], + next_page_token="def", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + ], + next_page_token="ghi", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_tags( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, tag.Tag) for i in responses) + + +@pytest.mark.asyncio +async def test_list_tags_async_pages(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_tags), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + tag.Tag(), + ], + next_page_token="abc", ), - repository.ListRepositoriesResponse( - repositories=[repository.Repository(), repository.Repository(),], + tag.ListTagsResponse( + tags=[], + next_page_token="def", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + ], + next_page_token="ghi", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + ], ), RuntimeError, ) - pages = list(client.list_repositories(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + pages = [] + async for page_ in ( + await client.list_tags(request={}) + ).pages: # pragma: no branch + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + tag.GetTagRequest, + dict, + ], +) +def test_get_tag(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tag.Tag( + name="name_value", + version="version_value", + ) + response = client.get_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == tag.GetTagRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, tag.Tag) + assert response.name == "name_value" + assert response.version == "version_value" + + +def test_get_tag_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tag), "__call__") as call: + client.get_tag() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == tag.GetTagRequest() + + +@pytest.mark.asyncio +async def test_get_tag_async( + transport: str = "grpc_asyncio", request_type=tag.GetTagRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + tag.Tag( + name="name_value", + version="version_value", + ) + ) + response = await client.get_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == tag.GetTagRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, tag.Tag) + assert response.name == "name_value" + assert response.version == "version_value" + + +@pytest.mark.asyncio +async def test_get_tag_async_from_dict(): + await test_get_tag_async(request_type=dict) + + +def test_get_tag_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tag.GetTagRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tag), "__call__") as call: + call.return_value = tag.Tag() + client.get_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_tag_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tag.GetTagRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tag), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tag.Tag()) + await client.get_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_get_tag_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tag.Tag() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_tag( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_get_tag_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_tag( + tag.GetTagRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_tag_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tag.Tag() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tag.Tag()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_tag( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_get_tag_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_tag( + tag.GetTagRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + gda_tag.CreateTagRequest, + dict, + ], +) +def test_create_tag(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gda_tag.Tag( + name="name_value", + version="version_value", + ) + response = client.create_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == gda_tag.CreateTagRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gda_tag.Tag) + assert response.name == "name_value" + assert response.version == "version_value" + + +def test_create_tag_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tag), "__call__") as call: + client.create_tag() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == gda_tag.CreateTagRequest() + + +@pytest.mark.asyncio +async def test_create_tag_async( + transport: str = "grpc_asyncio", request_type=gda_tag.CreateTagRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gda_tag.Tag( + name="name_value", + version="version_value", + ) + ) + response = await client.create_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == gda_tag.CreateTagRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gda_tag.Tag) + assert response.name == "name_value" + assert response.version == "version_value" + + +@pytest.mark.asyncio +async def test_create_tag_async_from_dict(): + await test_create_tag_async(request_type=dict) + + +def test_create_tag_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = gda_tag.CreateTagRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tag), "__call__") as call: + call.return_value = gda_tag.Tag() + client.create_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_tag_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = gda_tag.CreateTagRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tag), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gda_tag.Tag()) + await client.create_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] + + +def test_create_tag_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gda_tag.Tag() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_tag( + parent="parent_value", + tag=gda_tag.Tag(name="name_value"), + tag_id="tag_id_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].tag + mock_val = gda_tag.Tag(name="name_value") + assert arg == mock_val + arg = args[0].tag_id + mock_val = "tag_id_value" + assert arg == mock_val + + +def test_create_tag_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_tag( + gda_tag.CreateTagRequest(), + parent="parent_value", + tag=gda_tag.Tag(name="name_value"), + tag_id="tag_id_value", + ) + + +@pytest.mark.asyncio +async def test_create_tag_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gda_tag.Tag() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gda_tag.Tag()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_tag( + parent="parent_value", + tag=gda_tag.Tag(name="name_value"), + tag_id="tag_id_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].tag + mock_val = gda_tag.Tag(name="name_value") + assert arg == mock_val + arg = args[0].tag_id + mock_val = "tag_id_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_create_tag_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_tag( + gda_tag.CreateTagRequest(), + parent="parent_value", + tag=gda_tag.Tag(name="name_value"), + tag_id="tag_id_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + gda_tag.UpdateTagRequest, + dict, + ], +) +def test_update_tag(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gda_tag.Tag( + name="name_value", + version="version_value", + ) + response = client.update_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == gda_tag.UpdateTagRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gda_tag.Tag) + assert response.name == "name_value" + assert response.version == "version_value" + + +def test_update_tag_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tag), "__call__") as call: + client.update_tag() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == gda_tag.UpdateTagRequest() + + +@pytest.mark.asyncio +async def test_update_tag_async( + transport: str = "grpc_asyncio", request_type=gda_tag.UpdateTagRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gda_tag.Tag( + name="name_value", + version="version_value", + ) + ) + response = await client.update_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == gda_tag.UpdateTagRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gda_tag.Tag) + assert response.name == "name_value" + assert response.version == "version_value" + + +@pytest.mark.asyncio +async def test_update_tag_async_from_dict(): + await test_update_tag_async(request_type=dict) + + +def test_update_tag_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = gda_tag.UpdateTagRequest() + + request.tag.name = "tag.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tag), "__call__") as call: + call.return_value = gda_tag.Tag() + client.update_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "tag.name=tag.name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_update_tag_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = gda_tag.UpdateTagRequest() + + request.tag.name = "tag.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tag), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gda_tag.Tag()) + await client.update_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "tag.name=tag.name/value", + ) in kw["metadata"] + + +def test_update_tag_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gda_tag.Tag() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_tag( + tag=gda_tag.Tag(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].tag + mock_val = gda_tag.Tag(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +def test_update_tag_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_tag( + gda_tag.UpdateTagRequest(), + tag=gda_tag.Tag(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.asyncio +async def test_update_tag_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gda_tag.Tag() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gda_tag.Tag()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_tag( + tag=gda_tag.Tag(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].tag + mock_val = gda_tag.Tag(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_update_tag_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_tag( + gda_tag.UpdateTagRequest(), + tag=gda_tag.Tag(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.parametrize( + "request_type", + [ + tag.DeleteTagRequest, + dict, + ], +) +def test_delete_tag(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == tag.DeleteTagRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_tag_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tag), "__call__") as call: + client.delete_tag() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == tag.DeleteTagRequest() + + +@pytest.mark.asyncio +async def test_delete_tag_async( + transport: str = "grpc_asyncio", request_type=tag.DeleteTagRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == tag.DeleteTagRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_delete_tag_async_from_dict(): + await test_delete_tag_async(request_type=dict) + + +def test_delete_tag_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tag.DeleteTagRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tag), "__call__") as call: + call.return_value = None + client.delete_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_tag_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tag.DeleteTagRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tag), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_tag(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_delete_tag_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_tag( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_delete_tag_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_tag( + tag.DeleteTagRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_tag_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tag), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_tag( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_delete_tag_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_tag( + tag.DeleteTagRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) +def test_set_iam_policy(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) + response = client.set_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + assert response.version == 774 + assert response.etag == b"etag_blob" + + +def test_set_iam_policy_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + client.set_iam_policy() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_set_iam_policy_async( + transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) + ) + response = await client.set_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.SetIamPolicyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + assert response.version == 774 + assert response.etag == b"etag_blob" + + +@pytest.mark.asyncio +async def test_set_iam_policy_async_from_dict(): + await test_set_iam_policy_async(request_type=dict) + + +def test_set_iam_policy_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.SetIamPolicyRequest() + + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + call.return_value = policy_pb2.Policy() + client.set_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_set_iam_policy_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.SetIamPolicyRequest() + + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + await client.set_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] + + +def test_set_iam_policy_from_dict_foreign(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + response = client.set_iam_policy( + request={ + "resource": "resource_value", + "policy": policy_pb2.Policy(version=774), + "update_mask": field_mask_pb2.FieldMask(paths=["paths_value"]), + } + ) + call.assert_called() + + +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) +def test_get_iam_policy(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) + response = client.get_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + assert response.version == 774 + assert response.etag == b"etag_blob" + + +def test_get_iam_policy_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + client.get_iam_policy() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + +@pytest.mark.asyncio +async def test_get_iam_policy_async( + transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) + ) + response = await client.get_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.GetIamPolicyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, policy_pb2.Policy) + assert response.version == 774 + assert response.etag == b"etag_blob" + + +@pytest.mark.asyncio +async def test_get_iam_policy_async_from_dict(): + await test_get_iam_policy_async(request_type=dict) + + +def test_get_iam_policy_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.GetIamPolicyRequest() + + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + call.return_value = policy_pb2.Policy() + client.get_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_iam_policy_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.GetIamPolicyRequest() + + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) + await client.get_iam_policy(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] + + +def test_get_iam_policy_from_dict_foreign(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = policy_pb2.Policy() + response = client.get_iam_policy( + request={ + "resource": "resource_value", + "options": options_pb2.GetPolicyOptions(requested_policy_version=2598), + } + ) + call.assert_called() + + +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], +) +def test_test_iam_permissions(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse( + permissions=["permissions_value"], + ) + response = client.test_iam_permissions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) + assert response.permissions == ["permissions_value"] + + +def test_test_iam_permissions_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + client.test_iam_permissions() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + +@pytest.mark.asyncio +async def test_test_iam_permissions_async( + transport: str = "grpc_asyncio", + request_type=iam_policy_pb2.TestIamPermissionsRequest, +): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse( + permissions=["permissions_value"], + ) + ) + response = await client.test_iam_permissions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == iam_policy_pb2.TestIamPermissionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, iam_policy_pb2.TestIamPermissionsResponse) + assert response.permissions == ["permissions_value"] + + +@pytest.mark.asyncio +async def test_test_iam_permissions_async_from_dict(): + await test_test_iam_permissions_async(request_type=dict) + + +def test_test_iam_permissions_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.TestIamPermissionsRequest() + + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + client.test_iam_permissions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_test_iam_permissions_field_headers_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = iam_policy_pb2.TestIamPermissionsRequest() + + request.resource = "resource/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + iam_policy_pb2.TestIamPermissionsResponse() + ) + await client.test_iam_permissions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] + + +def test_test_iam_permissions_from_dict_foreign(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.test_iam_permissions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = iam_policy_pb2.TestIamPermissionsResponse() + response = client.test_iam_permissions( + request={ + "resource": "resource_value", + "permissions": ["permissions_value"], + } + ) + call.assert_called() + + +@pytest.mark.parametrize( + "request_type", + [ + settings.GetProjectSettingsRequest, + dict, + ], +) +def test_get_project_settings(request_type, transport: str = "grpc"): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_project_settings), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = settings.ProjectSettings( + name="name_value", + legacy_redirection_state=settings.ProjectSettings.RedirectionState.REDIRECTION_FROM_GCR_IO_DISABLED, + ) + response = client.get_project_settings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == settings.GetProjectSettingsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, settings.ProjectSettings) + assert response.name == "name_value" + assert ( + response.legacy_redirection_state + == settings.ProjectSettings.RedirectionState.REDIRECTION_FROM_GCR_IO_DISABLED + ) + + +def test_get_project_settings_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_project_settings), "__call__" + ) as call: + client.get_project_settings() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == settings.GetProjectSettingsRequest() @pytest.mark.asyncio -async def test_list_repositories_async_pager(): +async def test_get_project_settings_async( + transport: str = "grpc_asyncio", request_type=settings.GetProjectSettingsRequest +): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_repositories), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.get_project_settings), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - repository.ListRepositoriesResponse( - repositories=[ - repository.Repository(), - repository.Repository(), - repository.Repository(), - ], - next_page_token="abc", - ), - repository.ListRepositoriesResponse( - repositories=[], next_page_token="def", - ), - repository.ListRepositoriesResponse( - repositories=[repository.Repository(),], next_page_token="ghi", - ), - repository.ListRepositoriesResponse( - repositories=[repository.Repository(), repository.Repository(),], - ), - RuntimeError, + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + settings.ProjectSettings( + name="name_value", + legacy_redirection_state=settings.ProjectSettings.RedirectionState.REDIRECTION_FROM_GCR_IO_DISABLED, + ) ) - async_pager = await client.list_repositories(request={},) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: - responses.append(response) + response = await client.get_project_settings(request) - assert len(responses) == 6 - assert all(isinstance(i, repository.Repository) for i in responses) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == settings.GetProjectSettingsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, settings.ProjectSettings) + assert response.name == "name_value" + assert ( + response.legacy_redirection_state + == settings.ProjectSettings.RedirectionState.REDIRECTION_FROM_GCR_IO_DISABLED + ) @pytest.mark.asyncio -async def test_list_repositories_async_pages(): +async def test_get_project_settings_async_from_dict(): + await test_get_project_settings_async(request_type=dict) + + +def test_get_project_settings_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = settings.GetProjectSettingsRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_project_settings), "__call__" + ) as call: + call.return_value = settings.ProjectSettings() + client.get_project_settings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_project_settings_field_headers_async(): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = settings.GetProjectSettingsRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_project_settings), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + settings.ProjectSettings() + ) + await client.get_project_settings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] + + +def test_get_project_settings_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_repositories), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.get_project_settings), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - repository.ListRepositoriesResponse( - repositories=[ - repository.Repository(), - repository.Repository(), - repository.Repository(), - ], - next_page_token="abc", - ), - repository.ListRepositoriesResponse( - repositories=[], next_page_token="def", - ), - repository.ListRepositoriesResponse( - repositories=[repository.Repository(),], next_page_token="ghi", - ), - repository.ListRepositoriesResponse( - repositories=[repository.Repository(), repository.Repository(),], - ), - RuntimeError, + # Designate an appropriate return value for the call. + call.return_value = settings.ProjectSettings() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_project_settings( + name="name_value", ) - pages = [] - async for page_ in (await client.list_repositories(request={})).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val -@pytest.mark.parametrize("request_type", [repository.GetRepositoryRequest, dict,]) -def test_get_repository(request_type, transport: str = "grpc"): +def test_get_project_settings_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_project_settings( + settings.GetProjectSettingsRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_project_settings_flattened_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_project_settings), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = settings.ProjectSettings() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + settings.ProjectSettings() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_project_settings( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_get_project_settings_flattened_error_async(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_project_settings( + settings.GetProjectSettingsRequest(), + name="name_value", + ) + + +@pytest.mark.parametrize( + "request_type", + [ + settings.UpdateProjectSettingsRequest, + dict, + ], +) +def test_update_project_settings(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1414,50 +7761,55 @@ def test_get_repository(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + with mock.patch.object( + type(client.transport.update_project_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = repository.Repository( + call.return_value = settings.ProjectSettings( name="name_value", - format_=repository.Repository.Format.DOCKER, - description="description_value", - kms_key_name="kms_key_name_value", + legacy_redirection_state=settings.ProjectSettings.RedirectionState.REDIRECTION_FROM_GCR_IO_DISABLED, ) - response = client.get_repository(request) + response = client.update_project_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == repository.GetRepositoryRequest() + assert args[0] == settings.UpdateProjectSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, repository.Repository) - assert response.name == "name_value" - assert response.format_ == repository.Repository.Format.DOCKER - assert response.description == "description_value" - assert response.kms_key_name == "kms_key_name_value" + assert isinstance(response, settings.ProjectSettings) + assert response.name == "name_value" + assert ( + response.legacy_redirection_state + == settings.ProjectSettings.RedirectionState.REDIRECTION_FROM_GCR_IO_DISABLED + ) -def test_get_repository_empty_call(): +def test_update_project_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_repository), "__call__") as call: - client.get_repository() + with mock.patch.object( + type(client.transport.update_project_settings), "__call__" + ) as call: + client.update_project_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == repository.GetRepositoryRequest() + assert args[0] == settings.UpdateProjectSettingsRequest() @pytest.mark.asyncio -async def test_get_repository_async( - transport: str = "grpc_asyncio", request_type=repository.GetRepositoryRequest +async def test_update_project_settings_async( + transport: str = "grpc_asyncio", request_type=settings.UpdateProjectSettingsRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1465,49 +7817,54 @@ async def test_get_repository_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + with mock.patch.object( + type(client.transport.update_project_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - repository.Repository( + settings.ProjectSettings( name="name_value", - format_=repository.Repository.Format.DOCKER, - description="description_value", - kms_key_name="kms_key_name_value", + legacy_redirection_state=settings.ProjectSettings.RedirectionState.REDIRECTION_FROM_GCR_IO_DISABLED, ) ) - response = await client.get_repository(request) + response = await client.update_project_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == repository.GetRepositoryRequest() + assert args[0] == settings.UpdateProjectSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, repository.Repository) + assert isinstance(response, settings.ProjectSettings) assert response.name == "name_value" - assert response.format_ == repository.Repository.Format.DOCKER - assert response.description == "description_value" - assert response.kms_key_name == "kms_key_name_value" + assert ( + response.legacy_redirection_state + == settings.ProjectSettings.RedirectionState.REDIRECTION_FROM_GCR_IO_DISABLED + ) @pytest.mark.asyncio -async def test_get_repository_async_from_dict(): - await test_get_repository_async(request_type=dict) +async def test_update_project_settings_async_from_dict(): + await test_update_project_settings_async(request_type=dict) -def test_get_repository_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) +def test_update_project_settings_field_headers(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = repository.GetRepositoryRequest() + request = settings.UpdateProjectSettingsRequest() - request.name = "name/value" + request.project_settings.name = "project_settings.name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_repository), "__call__") as call: - call.return_value = repository.Repository() - client.get_repository(request) + with mock.patch.object( + type(client.transport.update_project_settings), "__call__" + ) as call: + call.return_value = settings.ProjectSettings() + client.update_project_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -1516,27 +7873,32 @@ def test_get_repository_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "project_settings.name=project_settings.name/value", + ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_repository_field_headers_async(): +async def test_update_project_settings_field_headers_async(): client = ArtifactRegistryAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = repository.GetRepositoryRequest() + request = settings.UpdateProjectSettingsRequest() - request.name = "name/value" + request.project_settings.name = "project_settings.name/value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + with mock.patch.object( + type(client.transport.update_project_settings), "__call__" + ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - repository.Repository() + settings.ProjectSettings() ) - await client.get_repository(request) + await client.update_project_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -1545,69 +7907,94 @@ async def test_get_repository_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "project_settings.name=project_settings.name/value", + ) in kw["metadata"] -def test_get_repository_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) +def test_update_project_settings_flattened(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + with mock.patch.object( + type(client.transport.update_project_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = repository.Repository() + call.return_value = settings.ProjectSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_repository(name="name_value",) + client.update_project_settings( + project_settings=settings.ProjectSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].project_settings + mock_val = settings.ProjectSettings(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_get_repository_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) +def test_update_project_settings_flattened_error(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_repository( - repository.GetRepositoryRequest(), name="name_value", + client.update_project_settings( + settings.UpdateProjectSettingsRequest(), + project_settings=settings.ProjectSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_get_repository_flattened_async(): +async def test_update_project_settings_flattened_async(): client = ArtifactRegistryAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_repository), "__call__") as call: + with mock.patch.object( + type(client.transport.update_project_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = repository.Repository() + call.return_value = settings.ProjectSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - repository.Repository() + settings.ProjectSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_repository(name="name_value",) + response = await client.update_project_settings( + project_settings=settings.ProjectSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].project_settings + mock_val = settings.ProjectSettings(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_get_repository_flattened_error_async(): +async def test_update_project_settings_flattened_error_async(): client = ArtifactRegistryAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -1615,8 +8002,10 @@ async def test_get_repository_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_repository( - repository.GetRepositoryRequest(), name="name_value", + await client.update_project_settings( + settings.UpdateProjectSettingsRequest(), + project_settings=settings.ProjectSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -1627,7 +8016,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1647,7 +8037,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ArtifactRegistryClient(client_options=options, transport=transport,) + client = ArtifactRegistryClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1663,7 +8056,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ArtifactRegistryClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1706,10 +8100,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ArtifactRegistryClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ArtifactRegistryGrpcTransport,) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ArtifactRegistryGrpcTransport, + ) def test_artifact_registry_base_transport_error(): @@ -1735,8 +8147,32 @@ def test_artifact_registry_base_transport(): # raise NotImplementedError. methods = ( "list_docker_images", + "get_docker_image", + "import_apt_artifacts", + "import_yum_artifacts", "list_repositories", "get_repository", + "create_repository", + "update_repository", + "delete_repository", + "list_packages", + "get_package", + "delete_package", + "list_versions", + "get_version", + "delete_version", + "list_files", + "get_file", + "list_tags", + "get_tag", + "create_tag", + "update_tag", + "delete_tag", + "set_iam_policy", + "get_iam_policy", + "test_iam_permissions", + "get_project_settings", + "update_project_settings", ) for method in methods: with pytest.raises(NotImplementedError): @@ -1745,6 +8181,19 @@ def test_artifact_registry_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + with pytest.raises(NotImplementedError): + transport.operations_client + + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_artifact_registry_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1756,7 +8205,8 @@ def test_artifact_registry_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ArtifactRegistryTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1901,24 +8351,40 @@ def test_artifact_registry_grpc_transport_client_cert_source_for_mtls(transport_ ) -def test_artifact_registry_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_artifact_registry_host_no_port(transport_name): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="artifactregistry.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "artifactregistry.googleapis.com:443" + assert client.transport._host == ("artifactregistry.googleapis.com:443") -def test_artifact_registry_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_artifact_registry_host_with_port(transport_name): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="artifactregistry.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "artifactregistry.googleapis.com:8000" + assert client.transport._host == ("artifactregistry.googleapis.com:8000") def test_artifact_registry_grpc_transport_channel(): @@ -1926,7 +8392,8 @@ def test_artifact_registry_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ArtifactRegistryGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1938,7 +8405,8 @@ def test_artifact_registry_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ArtifactRegistryGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2045,11 +8513,76 @@ def test_artifact_registry_transport_channel_mtls_with_adc(transport_class): assert transport.grpc_channel == mock_grpc_channel -def test_docker_image_path(): +def test_artifact_registry_grpc_lro_client(): + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_artifact_registry_grpc_lro_async_client(): + client = ArtifactRegistryAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", + ) + transport = client.transport + + # Ensure that we have a api-core operations client. + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_apt_artifact_path(): project = "squid" location = "clam" repository = "whelk" - docker_image = "octopus" + apt_artifact = "octopus" + expected = "projects/{project}/locations/{location}/repositories/{repository}/aptArtifacts/{apt_artifact}".format( + project=project, + location=location, + repository=repository, + apt_artifact=apt_artifact, + ) + actual = ArtifactRegistryClient.apt_artifact_path( + project, location, repository, apt_artifact + ) + assert expected == actual + + +def test_parse_apt_artifact_path(): + expected = { + "project": "oyster", + "location": "nudibranch", + "repository": "cuttlefish", + "apt_artifact": "mussel", + } + path = ArtifactRegistryClient.apt_artifact_path(**expected) + + # Check that the path construction is reversible. + actual = ArtifactRegistryClient.parse_apt_artifact_path(path) + assert expected == actual + + +def test_docker_image_path(): + project = "winkle" + location = "nautilus" + repository = "scallop" + docker_image = "abalone" expected = "projects/{project}/locations/{location}/repositories/{repository}/dockerImages/{docker_image}".format( project=project, location=location, @@ -2064,10 +8597,10 @@ def test_docker_image_path(): def test_parse_docker_image_path(): expected = { - "project": "oyster", - "location": "nudibranch", - "repository": "cuttlefish", - "docker_image": "mussel", + "project": "squid", + "location": "clam", + "repository": "whelk", + "docker_image": "octopus", } path = ArtifactRegistryClient.docker_image_path(**expected) @@ -2076,32 +8609,184 @@ def test_parse_docker_image_path(): assert expected == actual +def test_file_path(): + project = "oyster" + location = "nudibranch" + repository = "cuttlefish" + file = "mussel" + expected = "projects/{project}/locations/{location}/repositories/{repository}/files/{file}".format( + project=project, + location=location, + repository=repository, + file=file, + ) + actual = ArtifactRegistryClient.file_path(project, location, repository, file) + assert expected == actual + + +def test_parse_file_path(): + expected = { + "project": "winkle", + "location": "nautilus", + "repository": "scallop", + "file": "abalone", + } + path = ArtifactRegistryClient.file_path(**expected) + + # Check that the path construction is reversible. + actual = ArtifactRegistryClient.parse_file_path(path) + assert expected == actual + + +def test_project_settings_path(): + project = "squid" + expected = "projects/{project}/projectSettings".format( + project=project, + ) + actual = ArtifactRegistryClient.project_settings_path(project) + assert expected == actual + + +def test_parse_project_settings_path(): + expected = { + "project": "clam", + } + path = ArtifactRegistryClient.project_settings_path(**expected) + + # Check that the path construction is reversible. + actual = ArtifactRegistryClient.parse_project_settings_path(path) + assert expected == actual + + def test_repository_path(): + project = "whelk" + location = "octopus" + repository = "oyster" + expected = ( + "projects/{project}/locations/{location}/repositories/{repository}".format( + project=project, + location=location, + repository=repository, + ) + ) + actual = ArtifactRegistryClient.repository_path(project, location, repository) + assert expected == actual + + +def test_parse_repository_path(): + expected = { + "project": "nudibranch", + "location": "cuttlefish", + "repository": "mussel", + } + path = ArtifactRegistryClient.repository_path(**expected) + + # Check that the path construction is reversible. + actual = ArtifactRegistryClient.parse_repository_path(path) + assert expected == actual + + +def test_tag_path(): project = "winkle" location = "nautilus" repository = "scallop" - expected = "projects/{project}/locations/{location}/repositories/{repository}".format( - project=project, location=location, repository=repository, + package = "abalone" + tag = "squid" + expected = "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/tags/{tag}".format( + project=project, + location=location, + repository=repository, + package=package, + tag=tag, + ) + actual = ArtifactRegistryClient.tag_path( + project, location, repository, package, tag ) - actual = ArtifactRegistryClient.repository_path(project, location, repository) assert expected == actual -def test_parse_repository_path(): +def test_parse_tag_path(): + expected = { + "project": "clam", + "location": "whelk", + "repository": "octopus", + "package": "oyster", + "tag": "nudibranch", + } + path = ArtifactRegistryClient.tag_path(**expected) + + # Check that the path construction is reversible. + actual = ArtifactRegistryClient.parse_tag_path(path) + assert expected == actual + + +def test_version_path(): + project = "cuttlefish" + location = "mussel" + repository = "winkle" + package = "nautilus" + version = "scallop" + expected = "projects/{project}/locations/{location}/repositories/{repository}/packages/{package}/versions/{version}".format( + project=project, + location=location, + repository=repository, + package=package, + version=version, + ) + actual = ArtifactRegistryClient.version_path( + project, location, repository, package, version + ) + assert expected == actual + + +def test_parse_version_path(): expected = { "project": "abalone", "location": "squid", "repository": "clam", + "package": "whelk", + "version": "octopus", } - path = ArtifactRegistryClient.repository_path(**expected) + path = ArtifactRegistryClient.version_path(**expected) # Check that the path construction is reversible. - actual = ArtifactRegistryClient.parse_repository_path(path) + actual = ArtifactRegistryClient.parse_version_path(path) + assert expected == actual + + +def test_yum_artifact_path(): + project = "oyster" + location = "nudibranch" + repository = "cuttlefish" + yum_artifact = "mussel" + expected = "projects/{project}/locations/{location}/repositories/{repository}/yumArtifacts/{yum_artifact}".format( + project=project, + location=location, + repository=repository, + yum_artifact=yum_artifact, + ) + actual = ArtifactRegistryClient.yum_artifact_path( + project, location, repository, yum_artifact + ) + assert expected == actual + + +def test_parse_yum_artifact_path(): + expected = { + "project": "winkle", + "location": "nautilus", + "repository": "scallop", + "yum_artifact": "abalone", + } + path = ArtifactRegistryClient.yum_artifact_path(**expected) + + # Check that the path construction is reversible. + actual = ArtifactRegistryClient.parse_yum_artifact_path(path) assert expected == actual def test_common_billing_account_path(): - billing_account = "whelk" + billing_account = "squid" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -2111,7 +8796,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "octopus", + "billing_account": "clam", } path = ArtifactRegistryClient.common_billing_account_path(**expected) @@ -2121,15 +8806,17 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + folder = "whelk" + expected = "folders/{folder}".format( + folder=folder, + ) actual = ArtifactRegistryClient.common_folder_path(folder) assert expected == actual def test_parse_common_folder_path(): expected = { - "folder": "nudibranch", + "folder": "octopus", } path = ArtifactRegistryClient.common_folder_path(**expected) @@ -2139,15 +8826,17 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + organization = "oyster" + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ArtifactRegistryClient.common_organization_path(organization) assert expected == actual def test_parse_common_organization_path(): expected = { - "organization": "mussel", + "organization": "nudibranch", } path = ArtifactRegistryClient.common_organization_path(**expected) @@ -2157,15 +8846,17 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "winkle" - expected = "projects/{project}".format(project=project,) + project = "cuttlefish" + expected = "projects/{project}".format( + project=project, + ) actual = ArtifactRegistryClient.common_project_path(project) assert expected == actual def test_parse_common_project_path(): expected = { - "project": "nautilus", + "project": "mussel", } path = ArtifactRegistryClient.common_project_path(**expected) @@ -2175,10 +8866,11 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "scallop" - location = "abalone" + project = "winkle" + location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ArtifactRegistryClient.common_location_path(project, location) assert expected == actual @@ -2186,8 +8878,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "squid", - "location": "clam", + "project": "scallop", + "location": "abalone", } path = ArtifactRegistryClient.common_location_path(**expected) @@ -2203,7 +8895,8 @@ def test_client_with_default_client_info(): transports.ArtifactRegistryTransport, "_prep_wrapped_messages" ) as prep: client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2212,7 +8905,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ArtifactRegistryClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2220,7 +8914,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py b/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py index 788af6c..36e3762 100644 --- a/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py +++ b/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py @@ -13,47 +13,24 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os -import mock - -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule - +import os +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -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 +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.artifactregistry_v1beta2.services.artifact_registry import ( - ArtifactRegistryAsyncClient, -) -from google.cloud.artifactregistry_v1beta2.services.artifact_registry import ( - ArtifactRegistryClient, -) -from google.cloud.artifactregistry_v1beta2.services.artifact_registry import pagers -from google.cloud.artifactregistry_v1beta2.services.artifact_registry import transports -from google.cloud.artifactregistry_v1beta2.types import apt_artifact -from google.cloud.artifactregistry_v1beta2.types import file -from google.cloud.artifactregistry_v1beta2.types import package -from google.cloud.artifactregistry_v1beta2.types import repository -from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository -from google.cloud.artifactregistry_v1beta2.types import service -from google.cloud.artifactregistry_v1beta2.types import settings -from google.cloud.artifactregistry_v1beta2.types import tag -from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag -from google.cloud.artifactregistry_v1beta2.types import version -from google.cloud.artifactregistry_v1beta2.types import yum_artifact from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import options_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore @@ -63,7 +40,25 @@ from google.protobuf import struct_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.type import expr_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +import mock +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.artifactregistry_v1beta2.services.artifact_registry import ( + ArtifactRegistryAsyncClient, + ArtifactRegistryClient, + pagers, + transports, +) +from google.cloud.artifactregistry_v1beta2.types import apt_artifact, file, package +from google.cloud.artifactregistry_v1beta2.types import repository as gda_repository +from google.cloud.artifactregistry_v1beta2.types import repository +from google.cloud.artifactregistry_v1beta2.types import service, settings +from google.cloud.artifactregistry_v1beta2.types import tag +from google.cloud.artifactregistry_v1beta2.types import tag as gda_tag +from google.cloud.artifactregistry_v1beta2.types import version, yum_artifact def client_cert_source_callback(): @@ -112,20 +107,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ArtifactRegistryClient, ArtifactRegistryAsyncClient,] + "client_class,transport_name", + [ + (ArtifactRegistryClient, "grpc"), + (ArtifactRegistryAsyncClient, "grpc_asyncio"), + ], ) -def test_artifact_registry_client_from_service_account_info(client_class): +def test_artifact_registry_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "artifactregistry.googleapis.com:443" + assert client.transport._host == ("artifactregistry.googleapis.com:443") @pytest.mark.parametrize( @@ -154,23 +155,33 @@ def test_artifact_registry_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ArtifactRegistryClient, ArtifactRegistryAsyncClient,] + "client_class,transport_name", + [ + (ArtifactRegistryClient, "grpc"), + (ArtifactRegistryAsyncClient, "grpc_asyncio"), + ], ) -def test_artifact_registry_client_from_service_account_file(client_class): +def test_artifact_registry_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "artifactregistry.googleapis.com:443" + assert client.transport._host == ("artifactregistry.googleapis.com:443") def test_artifact_registry_client_get_transport_class(): @@ -528,7 +539,9 @@ def test_artifact_registry_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -672,11 +685,16 @@ def test_artifact_registry_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [apt_artifact.ImportAptArtifactsRequest, dict,] + "request_type", + [ + apt_artifact.ImportAptArtifactsRequest, + dict, + ], ) def test_import_apt_artifacts(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -704,7 +722,8 @@ def test_import_apt_artifacts_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -722,7 +741,8 @@ async def test_import_apt_artifacts_async( transport: str = "grpc_asyncio", request_type=apt_artifact.ImportAptArtifactsRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -754,7 +774,9 @@ async def test_import_apt_artifacts_async_from_dict(): def test_import_apt_artifacts_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -776,7 +798,10 @@ def test_import_apt_artifacts_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -807,15 +832,23 @@ async def test_import_apt_artifacts_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [yum_artifact.ImportYumArtifactsRequest, dict,] + "request_type", + [ + yum_artifact.ImportYumArtifactsRequest, + dict, + ], ) def test_import_yum_artifacts(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -843,7 +876,8 @@ def test_import_yum_artifacts_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -861,7 +895,8 @@ async def test_import_yum_artifacts_async( transport: str = "grpc_asyncio", request_type=yum_artifact.ImportYumArtifactsRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -893,7 +928,9 @@ async def test_import_yum_artifacts_async_from_dict(): def test_import_yum_artifacts_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -915,7 +952,10 @@ def test_import_yum_artifacts_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -946,13 +986,23 @@ async def test_import_yum_artifacts_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [repository.ListRepositoriesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + repository.ListRepositoriesRequest, + dict, + ], +) def test_list_repositories(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -983,7 +1033,8 @@ def test_list_repositories_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1001,7 +1052,8 @@ async def test_list_repositories_async( transport: str = "grpc_asyncio", request_type=repository.ListRepositoriesRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1036,7 +1088,9 @@ async def test_list_repositories_async_from_dict(): def test_list_repositories_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1058,7 +1112,10 @@ def test_list_repositories_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1089,11 +1146,16 @@ async def test_list_repositories_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_repositories_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1103,7 +1165,9 @@ def test_list_repositories_flattened(): call.return_value = repository.ListRepositoriesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_repositories(parent="parent_value",) + client.list_repositories( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1115,13 +1179,16 @@ def test_list_repositories_flattened(): def test_list_repositories_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_repositories( - repository.ListRepositoriesRequest(), parent="parent_value", + repository.ListRepositoriesRequest(), + parent="parent_value", ) @@ -1143,7 +1210,9 @@ async def test_list_repositories_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_repositories(parent="parent_value",) + response = await client.list_repositories( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1164,13 +1233,15 @@ async def test_list_repositories_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_repositories( - repository.ListRepositoriesRequest(), parent="parent_value", + repository.ListRepositoriesRequest(), + parent="parent_value", ) def test_list_repositories_pager(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1188,13 +1259,20 @@ def test_list_repositories_pager(transport_name: str = "grpc"): next_page_token="abc", ), repository.ListRepositoriesResponse( - repositories=[], next_page_token="def", + repositories=[], + next_page_token="def", ), repository.ListRepositoriesResponse( - repositories=[repository.Repository(),], next_page_token="ghi", + repositories=[ + repository.Repository(), + ], + next_page_token="ghi", ), repository.ListRepositoriesResponse( - repositories=[repository.Repository(), repository.Repository(),], + repositories=[ + repository.Repository(), + repository.Repository(), + ], ), RuntimeError, ) @@ -1214,7 +1292,8 @@ def test_list_repositories_pager(transport_name: str = "grpc"): def test_list_repositories_pages(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1232,13 +1311,20 @@ def test_list_repositories_pages(transport_name: str = "grpc"): next_page_token="abc", ), repository.ListRepositoriesResponse( - repositories=[], next_page_token="def", + repositories=[], + next_page_token="def", ), repository.ListRepositoriesResponse( - repositories=[repository.Repository(),], next_page_token="ghi", + repositories=[ + repository.Repository(), + ], + next_page_token="ghi", ), repository.ListRepositoriesResponse( - repositories=[repository.Repository(), repository.Repository(),], + repositories=[ + repository.Repository(), + repository.Repository(), + ], ), RuntimeError, ) @@ -1270,20 +1356,29 @@ async def test_list_repositories_async_pager(): next_page_token="abc", ), repository.ListRepositoriesResponse( - repositories=[], next_page_token="def", + repositories=[], + next_page_token="def", ), repository.ListRepositoriesResponse( - repositories=[repository.Repository(),], next_page_token="ghi", + repositories=[ + repository.Repository(), + ], + next_page_token="ghi", ), repository.ListRepositoriesResponse( - repositories=[repository.Repository(), repository.Repository(),], + repositories=[ + repository.Repository(), + repository.Repository(), + ], ), RuntimeError, ) - async_pager = await client.list_repositories(request={},) + async_pager = await client.list_repositories( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1313,27 +1408,43 @@ async def test_list_repositories_async_pages(): next_page_token="abc", ), repository.ListRepositoriesResponse( - repositories=[], next_page_token="def", + repositories=[], + next_page_token="def", ), repository.ListRepositoriesResponse( - repositories=[repository.Repository(),], next_page_token="ghi", + repositories=[ + repository.Repository(), + ], + next_page_token="ghi", ), repository.ListRepositoriesResponse( - repositories=[repository.Repository(), repository.Repository(),], + repositories=[ + repository.Repository(), + repository.Repository(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_repositories(request={})).pages: + async for page_ in ( + await client.list_repositories(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [repository.GetRepositoryRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + repository.GetRepositoryRequest, + dict, + ], +) def test_get_repository(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1371,7 +1482,8 @@ def test_get_repository_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1387,7 +1499,8 @@ async def test_get_repository_async( transport: str = "grpc_asyncio", request_type=repository.GetRepositoryRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1426,7 +1539,9 @@ async def test_get_repository_async_from_dict(): def test_get_repository_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1446,7 +1561,10 @@ def test_get_repository_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1475,11 +1593,16 @@ async def test_get_repository_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_repository_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_repository), "__call__") as call: @@ -1487,7 +1610,9 @@ def test_get_repository_flattened(): call.return_value = repository.Repository() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_repository(name="name_value",) + client.get_repository( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1499,13 +1624,16 @@ def test_get_repository_flattened(): def test_get_repository_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_repository( - repository.GetRepositoryRequest(), name="name_value", + repository.GetRepositoryRequest(), + name="name_value", ) @@ -1525,7 +1653,9 @@ async def test_get_repository_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_repository(name="name_value",) + response = await client.get_repository( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1546,16 +1676,22 @@ async def test_get_repository_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_repository( - repository.GetRepositoryRequest(), name="name_value", + repository.GetRepositoryRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gda_repository.CreateRepositoryRequest, dict,] + "request_type", + [ + gda_repository.CreateRepositoryRequest, + dict, + ], ) def test_create_repository(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1583,7 +1719,8 @@ def test_create_repository_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1601,7 +1738,8 @@ async def test_create_repository_async( transport: str = "grpc_asyncio", request_type=gda_repository.CreateRepositoryRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1633,7 +1771,9 @@ async def test_create_repository_async_from_dict(): def test_create_repository_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1655,7 +1795,10 @@ def test_create_repository_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1686,11 +1829,16 @@ async def test_create_repository_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_repository_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1730,7 +1878,9 @@ def test_create_repository_flattened(): def test_create_repository_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1816,11 +1966,16 @@ async def test_create_repository_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gda_repository.UpdateRepositoryRequest, dict,] + "request_type", + [ + gda_repository.UpdateRepositoryRequest, + dict, + ], ) def test_update_repository(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1860,7 +2015,8 @@ def test_update_repository_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1878,7 +2034,8 @@ async def test_update_repository_async( transport: str = "grpc_asyncio", request_type=gda_repository.UpdateRepositoryRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1919,7 +2076,9 @@ async def test_update_repository_async_from_dict(): def test_update_repository_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -1941,9 +2100,10 @@ def test_update_repository_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "repository.name=repository.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "repository.name=repository.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1974,13 +2134,16 @@ async def test_update_repository_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "repository.name=repository.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "repository.name=repository.name/value", + ) in kw["metadata"] def test_update_repository_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2016,7 +2179,9 @@ def test_update_repository_flattened(): def test_update_repository_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2095,10 +2260,17 @@ async def test_update_repository_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [repository.DeleteRepositoryRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + repository.DeleteRepositoryRequest, + dict, + ], +) def test_delete_repository(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2126,7 +2298,8 @@ def test_delete_repository_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2144,7 +2317,8 @@ async def test_delete_repository_async( transport: str = "grpc_asyncio", request_type=repository.DeleteRepositoryRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2176,7 +2350,9 @@ async def test_delete_repository_async_from_dict(): def test_delete_repository_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2198,7 +2374,10 @@ def test_delete_repository_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2229,11 +2408,16 @@ async def test_delete_repository_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_repository_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2243,7 +2427,9 @@ def test_delete_repository_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_repository(name="name_value",) + client.delete_repository( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2255,13 +2441,16 @@ def test_delete_repository_flattened(): def test_delete_repository_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_repository( - repository.DeleteRepositoryRequest(), name="name_value", + repository.DeleteRepositoryRequest(), + name="name_value", ) @@ -2283,7 +2472,9 @@ async def test_delete_repository_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_repository(name="name_value",) + response = await client.delete_repository( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2304,14 +2495,22 @@ async def test_delete_repository_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_repository( - repository.DeleteRepositoryRequest(), name="name_value", + repository.DeleteRepositoryRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [package.ListPackagesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + package.ListPackagesRequest, + dict, + ], +) def test_list_packages(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2340,7 +2539,8 @@ def test_list_packages_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2356,7 +2556,8 @@ async def test_list_packages_async( transport: str = "grpc_asyncio", request_type=package.ListPackagesRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2367,7 +2568,9 @@ async def test_list_packages_async( with mock.patch.object(type(client.transport.list_packages), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - package.ListPackagesResponse(next_page_token="next_page_token_value",) + package.ListPackagesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_packages(request) @@ -2387,7 +2590,9 @@ async def test_list_packages_async_from_dict(): def test_list_packages_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2407,7 +2612,10 @@ def test_list_packages_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2436,11 +2644,16 @@ async def test_list_packages_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_packages_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_packages), "__call__") as call: @@ -2448,8 +2661,10 @@ def test_list_packages_flattened(): call.return_value = package.ListPackagesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_packages(parent="parent_value",) - + client.list_packages( + parent="parent_value", + ) + # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 @@ -2460,13 +2675,16 @@ def test_list_packages_flattened(): def test_list_packages_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_packages( - package.ListPackagesRequest(), parent="parent_value", + package.ListPackagesRequest(), + parent="parent_value", ) @@ -2486,7 +2704,9 @@ async def test_list_packages_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_packages(parent="parent_value",) + response = await client.list_packages( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2507,13 +2727,15 @@ async def test_list_packages_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_packages( - package.ListPackagesRequest(), parent="parent_value", + package.ListPackagesRequest(), + parent="parent_value", ) def test_list_packages_pager(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2521,15 +2743,28 @@ def test_list_packages_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( package.ListPackagesResponse( - packages=[package.Package(), package.Package(), package.Package(),], + packages=[ + package.Package(), + package.Package(), + package.Package(), + ], next_page_token="abc", ), - package.ListPackagesResponse(packages=[], next_page_token="def",), package.ListPackagesResponse( - packages=[package.Package(),], next_page_token="ghi", + packages=[], + next_page_token="def", ), package.ListPackagesResponse( - packages=[package.Package(), package.Package(),], + packages=[ + package.Package(), + ], + next_page_token="ghi", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + ], ), RuntimeError, ) @@ -2549,7 +2784,8 @@ def test_list_packages_pager(transport_name: str = "grpc"): def test_list_packages_pages(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2557,15 +2793,28 @@ def test_list_packages_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( package.ListPackagesResponse( - packages=[package.Package(), package.Package(), package.Package(),], + packages=[ + package.Package(), + package.Package(), + package.Package(), + ], next_page_token="abc", ), - package.ListPackagesResponse(packages=[], next_page_token="def",), package.ListPackagesResponse( - packages=[package.Package(),], next_page_token="ghi", + packages=[], + next_page_token="def", ), package.ListPackagesResponse( - packages=[package.Package(), package.Package(),], + packages=[ + package.Package(), + ], + next_page_token="ghi", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + ], ), RuntimeError, ) @@ -2587,22 +2836,37 @@ async def test_list_packages_async_pager(): # Set the response to a series of pages. call.side_effect = ( package.ListPackagesResponse( - packages=[package.Package(), package.Package(), package.Package(),], + packages=[ + package.Package(), + package.Package(), + package.Package(), + ], next_page_token="abc", ), - package.ListPackagesResponse(packages=[], next_page_token="def",), package.ListPackagesResponse( - packages=[package.Package(),], next_page_token="ghi", + packages=[], + next_page_token="def", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + ], + next_page_token="ghi", ), package.ListPackagesResponse( - packages=[package.Package(), package.Package(),], + packages=[ + package.Package(), + package.Package(), + ], ), RuntimeError, ) - async_pager = await client.list_packages(request={},) + async_pager = await client.list_packages( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2622,29 +2886,51 @@ async def test_list_packages_async_pages(): # Set the response to a series of pages. call.side_effect = ( package.ListPackagesResponse( - packages=[package.Package(), package.Package(), package.Package(),], + packages=[ + package.Package(), + package.Package(), + package.Package(), + ], next_page_token="abc", ), - package.ListPackagesResponse(packages=[], next_page_token="def",), package.ListPackagesResponse( - packages=[package.Package(),], next_page_token="ghi", + packages=[], + next_page_token="def", ), package.ListPackagesResponse( - packages=[package.Package(), package.Package(),], + packages=[ + package.Package(), + ], + next_page_token="ghi", + ), + package.ListPackagesResponse( + packages=[ + package.Package(), + package.Package(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_packages(request={})).pages: + async for page_ in ( + await client.list_packages(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [package.GetPackageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + package.GetPackageRequest, + dict, + ], +) def test_get_package(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2655,7 +2941,8 @@ def test_get_package(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.get_package), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = package.Package( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.get_package(request) @@ -2674,7 +2961,8 @@ def test_get_package_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2690,7 +2978,8 @@ async def test_get_package_async( transport: str = "grpc_asyncio", request_type=package.GetPackageRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2701,7 +2990,10 @@ async def test_get_package_async( with mock.patch.object(type(client.transport.get_package), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - package.Package(name="name_value", display_name="display_name_value",) + package.Package( + name="name_value", + display_name="display_name_value", + ) ) response = await client.get_package(request) @@ -2722,7 +3014,9 @@ async def test_get_package_async_from_dict(): def test_get_package_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2742,7 +3036,10 @@ def test_get_package_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2769,11 +3066,16 @@ async def test_get_package_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_package_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_package), "__call__") as call: @@ -2781,7 +3083,9 @@ def test_get_package_flattened(): call.return_value = package.Package() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_package(name="name_value",) + client.get_package( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2793,13 +3097,16 @@ def test_get_package_flattened(): def test_get_package_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_package( - package.GetPackageRequest(), name="name_value", + package.GetPackageRequest(), + name="name_value", ) @@ -2817,7 +3124,9 @@ async def test_get_package_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(package.Package()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_package(name="name_value",) + response = await client.get_package( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2838,14 +3147,22 @@ async def test_get_package_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_package( - package.GetPackageRequest(), name="name_value", + package.GetPackageRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [package.DeletePackageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + package.DeletePackageRequest, + dict, + ], +) def test_delete_package(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2871,7 +3188,8 @@ def test_delete_package_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2887,7 +3205,8 @@ async def test_delete_package_async( transport: str = "grpc_asyncio", request_type=package.DeletePackageRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2917,7 +3236,9 @@ async def test_delete_package_async_from_dict(): def test_delete_package_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -2937,7 +3258,10 @@ def test_delete_package_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2966,11 +3290,16 @@ async def test_delete_package_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_package_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_package), "__call__") as call: @@ -2978,7 +3307,9 @@ def test_delete_package_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_package(name="name_value",) + client.delete_package( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2990,13 +3321,16 @@ def test_delete_package_flattened(): def test_delete_package_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_package( - package.DeletePackageRequest(), name="name_value", + package.DeletePackageRequest(), + name="name_value", ) @@ -3016,7 +3350,9 @@ async def test_delete_package_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_package(name="name_value",) + response = await client.delete_package( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3037,14 +3373,22 @@ async def test_delete_package_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_package( - package.DeletePackageRequest(), name="name_value", + package.DeletePackageRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [version.ListVersionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest, + dict, + ], +) def test_list_versions(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3073,7 +3417,8 @@ def test_list_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3089,7 +3434,8 @@ async def test_list_versions_async( transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3100,7 +3446,9 @@ async def test_list_versions_async( with mock.patch.object(type(client.transport.list_versions), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - version.ListVersionsResponse(next_page_token="next_page_token_value",) + version.ListVersionsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_versions(request) @@ -3120,7 +3468,9 @@ async def test_list_versions_async_from_dict(): def test_list_versions_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -3140,7 +3490,10 @@ def test_list_versions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3169,11 +3522,16 @@ async def test_list_versions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_versions_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -3181,7 +3539,9 @@ def test_list_versions_flattened(): call.return_value = version.ListVersionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_versions(parent="parent_value",) + client.list_versions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3193,13 +3553,16 @@ def test_list_versions_flattened(): def test_list_versions_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_versions( - version.ListVersionsRequest(), parent="parent_value", + version.ListVersionsRequest(), + parent="parent_value", ) @@ -3219,7 +3582,9 @@ async def test_list_versions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_versions(parent="parent_value",) + response = await client.list_versions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3240,13 +3605,15 @@ async def test_list_versions_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_versions( - version.ListVersionsRequest(), parent="parent_value", + version.ListVersionsRequest(), + parent="parent_value", ) def test_list_versions_pager(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3254,15 +3621,28 @@ def test_list_versions_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -3282,7 +3662,8 @@ def test_list_versions_pager(transport_name: str = "grpc"): def test_list_versions_pages(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3290,15 +3671,28 @@ def test_list_versions_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -3320,22 +3714,37 @@ async def test_list_versions_async_pager(): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) - async_pager = await client.list_versions(request={},) + async_pager = await client.list_versions( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -3355,29 +3764,51 @@ async def test_list_versions_async_pages(): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_versions(request={})).pages: + async for page_ in ( + await client.list_versions(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [version.GetVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest, + dict, + ], +) def test_get_version(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3388,7 +3819,8 @@ def test_get_version(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.get_version), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = version.Version( - name="name_value", description="description_value", + name="name_value", + description="description_value", ) response = client.get_version(request) @@ -3407,7 +3839,8 @@ def test_get_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3423,7 +3856,8 @@ async def test_get_version_async( transport: str = "grpc_asyncio", request_type=version.GetVersionRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3434,7 +3868,10 @@ async def test_get_version_async( with mock.patch.object(type(client.transport.get_version), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - version.Version(name="name_value", description="description_value",) + version.Version( + name="name_value", + description="description_value", + ) ) response = await client.get_version(request) @@ -3455,7 +3892,9 @@ async def test_get_version_async_from_dict(): def test_get_version_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -3475,7 +3914,10 @@ def test_get_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3502,11 +3944,16 @@ async def test_get_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_version_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -3514,7 +3961,9 @@ def test_get_version_flattened(): call.return_value = version.Version() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_version(name="name_value",) + client.get_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3526,13 +3975,16 @@ def test_get_version_flattened(): def test_get_version_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_version( - version.GetVersionRequest(), name="name_value", + version.GetVersionRequest(), + name="name_value", ) @@ -3550,7 +4002,9 @@ async def test_get_version_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(version.Version()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_version(name="name_value",) + response = await client.get_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3571,14 +4025,22 @@ async def test_get_version_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_version( - version.GetVersionRequest(), name="name_value", + version.GetVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [version.DeleteVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest, + dict, + ], +) def test_delete_version(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3604,7 +4066,8 @@ def test_delete_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3620,7 +4083,8 @@ async def test_delete_version_async( transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3650,7 +4114,9 @@ async def test_delete_version_async_from_dict(): def test_delete_version_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -3670,7 +4136,10 @@ def test_delete_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3699,11 +4168,16 @@ async def test_delete_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_version_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -3711,7 +4185,9 @@ def test_delete_version_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_version(name="name_value",) + client.delete_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3723,13 +4199,16 @@ def test_delete_version_flattened(): def test_delete_version_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_version( - version.DeleteVersionRequest(), name="name_value", + version.DeleteVersionRequest(), + name="name_value", ) @@ -3749,7 +4228,9 @@ async def test_delete_version_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_version(name="name_value",) + response = await client.delete_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3770,14 +4251,22 @@ async def test_delete_version_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_version( - version.DeleteVersionRequest(), name="name_value", + version.DeleteVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [file.ListFilesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + file.ListFilesRequest, + dict, + ], +) def test_list_files(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3806,7 +4295,8 @@ def test_list_files_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3822,7 +4312,8 @@ async def test_list_files_async( transport: str = "grpc_asyncio", request_type=file.ListFilesRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3833,7 +4324,9 @@ async def test_list_files_async( with mock.patch.object(type(client.transport.list_files), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - file.ListFilesResponse(next_page_token="next_page_token_value",) + file.ListFilesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_files(request) @@ -3853,7 +4346,9 @@ async def test_list_files_async_from_dict(): def test_list_files_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -3873,7 +4368,10 @@ def test_list_files_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3902,11 +4400,16 @@ async def test_list_files_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_files_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_files), "__call__") as call: @@ -3914,7 +4417,9 @@ def test_list_files_flattened(): call.return_value = file.ListFilesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_files(parent="parent_value",) + client.list_files( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3926,13 +4431,16 @@ def test_list_files_flattened(): def test_list_files_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_files( - file.ListFilesRequest(), parent="parent_value", + file.ListFilesRequest(), + parent="parent_value", ) @@ -3952,7 +4460,9 @@ async def test_list_files_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_files(parent="parent_value",) + response = await client.list_files( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3973,13 +4483,15 @@ async def test_list_files_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_files( - file.ListFilesRequest(), parent="parent_value", + file.ListFilesRequest(), + parent="parent_value", ) def test_list_files_pager(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3987,11 +4499,29 @@ def test_list_files_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( file.ListFilesResponse( - files=[file.File(), file.File(), file.File(),], next_page_token="abc", + files=[ + file.File(), + file.File(), + file.File(), + ], + next_page_token="abc", + ), + file.ListFilesResponse( + files=[], + next_page_token="def", + ), + file.ListFilesResponse( + files=[ + file.File(), + ], + next_page_token="ghi", + ), + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + ], ), - file.ListFilesResponse(files=[], next_page_token="def",), - file.ListFilesResponse(files=[file.File(),], next_page_token="ghi",), - file.ListFilesResponse(files=[file.File(), file.File(),],), RuntimeError, ) @@ -4010,7 +4540,8 @@ def test_list_files_pager(transport_name: str = "grpc"): def test_list_files_pages(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4018,11 +4549,29 @@ def test_list_files_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( file.ListFilesResponse( - files=[file.File(), file.File(), file.File(),], next_page_token="abc", + files=[ + file.File(), + file.File(), + file.File(), + ], + next_page_token="abc", + ), + file.ListFilesResponse( + files=[], + next_page_token="def", + ), + file.ListFilesResponse( + files=[ + file.File(), + ], + next_page_token="ghi", + ), + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + ], ), - file.ListFilesResponse(files=[], next_page_token="def",), - file.ListFilesResponse(files=[file.File(),], next_page_token="ghi",), - file.ListFilesResponse(files=[file.File(), file.File(),],), RuntimeError, ) pages = list(client.list_files(request={}).pages) @@ -4043,17 +4592,37 @@ async def test_list_files_async_pager(): # Set the response to a series of pages. call.side_effect = ( file.ListFilesResponse( - files=[file.File(), file.File(), file.File(),], next_page_token="abc", + files=[ + file.File(), + file.File(), + file.File(), + ], + next_page_token="abc", + ), + file.ListFilesResponse( + files=[], + next_page_token="def", + ), + file.ListFilesResponse( + files=[ + file.File(), + ], + next_page_token="ghi", + ), + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + ], ), - file.ListFilesResponse(files=[], next_page_token="def",), - file.ListFilesResponse(files=[file.File(),], next_page_token="ghi",), - file.ListFilesResponse(files=[file.File(), file.File(),],), RuntimeError, ) - async_pager = await client.list_files(request={},) + async_pager = await client.list_files( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -4073,24 +4642,51 @@ async def test_list_files_async_pages(): # Set the response to a series of pages. call.side_effect = ( file.ListFilesResponse( - files=[file.File(), file.File(), file.File(),], next_page_token="abc", + files=[ + file.File(), + file.File(), + file.File(), + ], + next_page_token="abc", + ), + file.ListFilesResponse( + files=[], + next_page_token="def", + ), + file.ListFilesResponse( + files=[ + file.File(), + ], + next_page_token="ghi", + ), + file.ListFilesResponse( + files=[ + file.File(), + file.File(), + ], ), - file.ListFilesResponse(files=[], next_page_token="def",), - file.ListFilesResponse(files=[file.File(),], next_page_token="ghi",), - file.ListFilesResponse(files=[file.File(), file.File(),],), RuntimeError, ) pages = [] - async for page_ in (await client.list_files(request={})).pages: + async for page_ in ( + await client.list_files(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [file.GetFileRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + file.GetFileRequest, + dict, + ], +) def test_get_file(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4101,7 +4697,9 @@ def test_get_file(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.get_file), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = file.File( - name="name_value", size_bytes=1089, owner="owner_value", + name="name_value", + size_bytes=1089, + owner="owner_value", ) response = client.get_file(request) @@ -4121,7 +4719,8 @@ def test_get_file_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4137,7 +4736,8 @@ async def test_get_file_async( transport: str = "grpc_asyncio", request_type=file.GetFileRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4148,7 +4748,11 @@ async def test_get_file_async( with mock.patch.object(type(client.transport.get_file), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - file.File(name="name_value", size_bytes=1089, owner="owner_value",) + file.File( + name="name_value", + size_bytes=1089, + owner="owner_value", + ) ) response = await client.get_file(request) @@ -4170,7 +4774,9 @@ async def test_get_file_async_from_dict(): def test_get_file_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -4190,7 +4796,10 @@ def test_get_file_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4217,11 +4826,16 @@ async def test_get_file_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_file_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_file), "__call__") as call: @@ -4229,7 +4843,9 @@ def test_get_file_flattened(): call.return_value = file.File() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_file(name="name_value",) + client.get_file( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4241,13 +4857,16 @@ def test_get_file_flattened(): def test_get_file_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_file( - file.GetFileRequest(), name="name_value", + file.GetFileRequest(), + name="name_value", ) @@ -4265,7 +4884,9 @@ async def test_get_file_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(file.File()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_file(name="name_value",) + response = await client.get_file( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4286,14 +4907,22 @@ async def test_get_file_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_file( - file.GetFileRequest(), name="name_value", + file.GetFileRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [tag.ListTagsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + tag.ListTagsRequest, + dict, + ], +) def test_list_tags(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4322,7 +4951,8 @@ def test_list_tags_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4338,7 +4968,8 @@ async def test_list_tags_async( transport: str = "grpc_asyncio", request_type=tag.ListTagsRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4349,7 +4980,9 @@ async def test_list_tags_async( with mock.patch.object(type(client.transport.list_tags), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - tag.ListTagsResponse(next_page_token="next_page_token_value",) + tag.ListTagsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_tags(request) @@ -4369,7 +5002,9 @@ async def test_list_tags_async_from_dict(): def test_list_tags_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -4389,7 +5024,10 @@ def test_list_tags_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4418,11 +5056,16 @@ async def test_list_tags_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_list_tags_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_tags), "__call__") as call: @@ -4430,7 +5073,9 @@ def test_list_tags_flattened(): call.return_value = tag.ListTagsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_tags(parent="parent_value",) + client.list_tags( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4442,13 +5087,16 @@ def test_list_tags_flattened(): def test_list_tags_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_tags( - tag.ListTagsRequest(), parent="parent_value", + tag.ListTagsRequest(), + parent="parent_value", ) @@ -4468,7 +5116,9 @@ async def test_list_tags_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_tags(parent="parent_value",) + response = await client.list_tags( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4489,13 +5139,15 @@ async def test_list_tags_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_tags( - tag.ListTagsRequest(), parent="parent_value", + tag.ListTagsRequest(), + parent="parent_value", ) def test_list_tags_pager(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4503,11 +5155,29 @@ def test_list_tags_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( tag.ListTagsResponse( - tags=[tag.Tag(), tag.Tag(), tag.Tag(),], next_page_token="abc", + tags=[ + tag.Tag(), + tag.Tag(), + tag.Tag(), + ], + next_page_token="abc", + ), + tag.ListTagsResponse( + tags=[], + next_page_token="def", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + ], + next_page_token="ghi", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + ], ), - tag.ListTagsResponse(tags=[], next_page_token="def",), - tag.ListTagsResponse(tags=[tag.Tag(),], next_page_token="ghi",), - tag.ListTagsResponse(tags=[tag.Tag(), tag.Tag(),],), RuntimeError, ) @@ -4526,7 +5196,8 @@ def test_list_tags_pager(transport_name: str = "grpc"): def test_list_tags_pages(transport_name: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4534,11 +5205,29 @@ def test_list_tags_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( tag.ListTagsResponse( - tags=[tag.Tag(), tag.Tag(), tag.Tag(),], next_page_token="abc", + tags=[ + tag.Tag(), + tag.Tag(), + tag.Tag(), + ], + next_page_token="abc", + ), + tag.ListTagsResponse( + tags=[], + next_page_token="def", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + ], + next_page_token="ghi", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + ], ), - tag.ListTagsResponse(tags=[], next_page_token="def",), - tag.ListTagsResponse(tags=[tag.Tag(),], next_page_token="ghi",), - tag.ListTagsResponse(tags=[tag.Tag(), tag.Tag(),],), RuntimeError, ) pages = list(client.list_tags(request={}).pages) @@ -4559,17 +5248,37 @@ async def test_list_tags_async_pager(): # Set the response to a series of pages. call.side_effect = ( tag.ListTagsResponse( - tags=[tag.Tag(), tag.Tag(), tag.Tag(),], next_page_token="abc", + tags=[ + tag.Tag(), + tag.Tag(), + tag.Tag(), + ], + next_page_token="abc", + ), + tag.ListTagsResponse( + tags=[], + next_page_token="def", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + ], + next_page_token="ghi", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + ], ), - tag.ListTagsResponse(tags=[], next_page_token="def",), - tag.ListTagsResponse(tags=[tag.Tag(),], next_page_token="ghi",), - tag.ListTagsResponse(tags=[tag.Tag(), tag.Tag(),],), RuntimeError, ) - async_pager = await client.list_tags(request={},) + async_pager = await client.list_tags( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -4589,24 +5298,51 @@ async def test_list_tags_async_pages(): # Set the response to a series of pages. call.side_effect = ( tag.ListTagsResponse( - tags=[tag.Tag(), tag.Tag(), tag.Tag(),], next_page_token="abc", + tags=[ + tag.Tag(), + tag.Tag(), + tag.Tag(), + ], + next_page_token="abc", + ), + tag.ListTagsResponse( + tags=[], + next_page_token="def", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + ], + next_page_token="ghi", + ), + tag.ListTagsResponse( + tags=[ + tag.Tag(), + tag.Tag(), + ], ), - tag.ListTagsResponse(tags=[], next_page_token="def",), - tag.ListTagsResponse(tags=[tag.Tag(),], next_page_token="ghi",), - tag.ListTagsResponse(tags=[tag.Tag(), tag.Tag(),],), RuntimeError, ) pages = [] - async for page_ in (await client.list_tags(request={})).pages: + async for page_ in ( + await client.list_tags(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [tag.GetTagRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + tag.GetTagRequest, + dict, + ], +) def test_get_tag(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4616,7 +5352,10 @@ def test_get_tag(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_tag), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = tag.Tag(name="name_value", version="version_value",) + call.return_value = tag.Tag( + name="name_value", + version="version_value", + ) response = client.get_tag(request) # Establish that the underlying gRPC stub method was called. @@ -4634,7 +5373,8 @@ def test_get_tag_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4650,7 +5390,8 @@ async def test_get_tag_async( transport: str = "grpc_asyncio", request_type=tag.GetTagRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4661,7 +5402,10 @@ async def test_get_tag_async( with mock.patch.object(type(client.transport.get_tag), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - tag.Tag(name="name_value", version="version_value",) + tag.Tag( + name="name_value", + version="version_value", + ) ) response = await client.get_tag(request) @@ -4682,7 +5426,9 @@ async def test_get_tag_async_from_dict(): def test_get_tag_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -4702,7 +5448,10 @@ def test_get_tag_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4729,11 +5478,16 @@ async def test_get_tag_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_tag_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_tag), "__call__") as call: @@ -4741,7 +5495,9 @@ def test_get_tag_flattened(): call.return_value = tag.Tag() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_tag(name="name_value",) + client.get_tag( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4753,13 +5509,16 @@ def test_get_tag_flattened(): def test_get_tag_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_tag( - tag.GetTagRequest(), name="name_value", + tag.GetTagRequest(), + name="name_value", ) @@ -4777,7 +5536,9 @@ async def test_get_tag_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tag.Tag()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_tag(name="name_value",) + response = await client.get_tag( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4798,14 +5559,22 @@ async def test_get_tag_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_tag( - tag.GetTagRequest(), name="name_value", + tag.GetTagRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gda_tag.CreateTagRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gda_tag.CreateTagRequest, + dict, + ], +) def test_create_tag(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4815,7 +5584,10 @@ def test_create_tag(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_tag), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = gda_tag.Tag(name="name_value", version="version_value",) + call.return_value = gda_tag.Tag( + name="name_value", + version="version_value", + ) response = client.create_tag(request) # Establish that the underlying gRPC stub method was called. @@ -4833,7 +5605,8 @@ def test_create_tag_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4849,7 +5622,8 @@ async def test_create_tag_async( transport: str = "grpc_asyncio", request_type=gda_tag.CreateTagRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4860,7 +5634,10 @@ async def test_create_tag_async( with mock.patch.object(type(client.transport.create_tag), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gda_tag.Tag(name="name_value", version="version_value",) + gda_tag.Tag( + name="name_value", + version="version_value", + ) ) response = await client.create_tag(request) @@ -4881,7 +5658,9 @@ async def test_create_tag_async_from_dict(): def test_create_tag_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -4901,7 +5680,10 @@ def test_create_tag_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4928,11 +5710,16 @@ async def test_create_tag_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent/value", + ) in kw["metadata"] def test_create_tag_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_tag), "__call__") as call: @@ -4962,7 +5749,9 @@ def test_create_tag_flattened(): def test_create_tag_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5027,10 +5816,17 @@ async def test_create_tag_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gda_tag.UpdateTagRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gda_tag.UpdateTagRequest, + dict, + ], +) def test_update_tag(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5040,7 +5836,10 @@ def test_update_tag(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_tag), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = gda_tag.Tag(name="name_value", version="version_value",) + call.return_value = gda_tag.Tag( + name="name_value", + version="version_value", + ) response = client.update_tag(request) # Establish that the underlying gRPC stub method was called. @@ -5058,7 +5857,8 @@ def test_update_tag_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5074,7 +5874,8 @@ async def test_update_tag_async( transport: str = "grpc_asyncio", request_type=gda_tag.UpdateTagRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5085,7 +5886,10 @@ async def test_update_tag_async( with mock.patch.object(type(client.transport.update_tag), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gda_tag.Tag(name="name_value", version="version_value",) + gda_tag.Tag( + name="name_value", + version="version_value", + ) ) response = await client.update_tag(request) @@ -5106,7 +5910,9 @@ async def test_update_tag_async_from_dict(): def test_update_tag_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -5126,7 +5932,10 @@ def test_update_tag_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "tag.name=tag.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "tag.name=tag.name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5153,11 +5962,16 @@ async def test_update_tag_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "tag.name=tag.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "tag.name=tag.name/value", + ) in kw["metadata"] def test_update_tag_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_tag), "__call__") as call: @@ -5183,7 +5997,9 @@ def test_update_tag_flattened(): def test_update_tag_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5242,10 +6058,17 @@ async def test_update_tag_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [tag.DeleteTagRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + tag.DeleteTagRequest, + dict, + ], +) def test_delete_tag(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5271,7 +6094,8 @@ def test_delete_tag_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5287,7 +6111,8 @@ async def test_delete_tag_async( transport: str = "grpc_asyncio", request_type=tag.DeleteTagRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5315,7 +6140,9 @@ async def test_delete_tag_async_from_dict(): def test_delete_tag_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -5335,7 +6162,10 @@ def test_delete_tag_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5362,11 +6192,16 @@ async def test_delete_tag_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_delete_tag_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_tag), "__call__") as call: @@ -5374,7 +6209,9 @@ def test_delete_tag_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_tag(name="name_value",) + client.delete_tag( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5386,13 +6223,16 @@ def test_delete_tag_flattened(): def test_delete_tag_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_tag( - tag.DeleteTagRequest(), name="name_value", + tag.DeleteTagRequest(), + name="name_value", ) @@ -5410,7 +6250,9 @@ async def test_delete_tag_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_tag(name="name_value",) + response = await client.delete_tag( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5431,14 +6273,22 @@ async def test_delete_tag_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_tag( - tag.DeleteTagRequest(), name="name_value", + tag.DeleteTagRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.SetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) def test_set_iam_policy(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5448,7 +6298,10 @@ def test_set_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.set_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -5466,7 +6319,8 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5482,7 +6336,8 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5493,7 +6348,10 @@ async def test_set_iam_policy_async( with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.set_iam_policy(request) @@ -5514,7 +6372,9 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -5534,7 +6394,10 @@ def test_set_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5561,11 +6424,16 @@ async def test_set_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_set_iam_policy_from_dict_foreign(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -5574,15 +6442,23 @@ def test_set_iam_policy_from_dict_foreign(): request={ "resource": "resource_value", "policy": policy_pb2.Policy(version=774), + "update_mask": field_mask_pb2.FieldMask(paths=["paths_value"]), } ) call.assert_called() -@pytest.mark.parametrize("request_type", [iam_policy_pb2.GetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) def test_get_iam_policy(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5592,7 +6468,10 @@ def test_get_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.get_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -5610,7 +6489,8 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5626,7 +6506,8 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5637,7 +6518,10 @@ async def test_get_iam_policy_async( with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.get_iam_policy(request) @@ -5658,7 +6542,9 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -5678,7 +6564,10 @@ def test_get_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5705,11 +6594,16 @@ async def test_get_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_get_iam_policy_from_dict_foreign(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -5724,11 +6618,16 @@ def test_get_iam_policy_from_dict_foreign(): @pytest.mark.parametrize( - "request_type", [iam_policy_pb2.TestIamPermissionsRequest, dict,] + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5759,7 +6658,8 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5778,7 +6678,8 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5813,7 +6714,9 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -5835,7 +6738,10 @@ def test_test_iam_permissions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5866,11 +6772,16 @@ async def test_test_iam_permissions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource/value", + ) in kw["metadata"] def test_test_iam_permissions_from_dict_foreign(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.test_iam_permissions), "__call__" @@ -5886,10 +6797,17 @@ def test_test_iam_permissions_from_dict_foreign(): call.assert_called() -@pytest.mark.parametrize("request_type", [settings.GetProjectSettingsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + settings.GetProjectSettingsRequest, + dict, + ], +) def test_get_project_settings(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5925,7 +6843,8 @@ def test_get_project_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5943,7 +6862,8 @@ async def test_get_project_settings_async( transport: str = "grpc_asyncio", request_type=settings.GetProjectSettingsRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5983,7 +6903,9 @@ async def test_get_project_settings_async_from_dict(): def test_get_project_settings_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -6005,7 +6927,10 @@ def test_get_project_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -6036,11 +6961,16 @@ async def test_get_project_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name/value", + ) in kw["metadata"] def test_get_project_settings_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6050,7 +6980,9 @@ def test_get_project_settings_flattened(): call.return_value = settings.ProjectSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_project_settings(name="name_value",) + client.get_project_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6062,13 +6994,16 @@ def test_get_project_settings_flattened(): def test_get_project_settings_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_project_settings( - settings.GetProjectSettingsRequest(), name="name_value", + settings.GetProjectSettingsRequest(), + name="name_value", ) @@ -6090,7 +7025,9 @@ async def test_get_project_settings_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_project_settings(name="name_value",) + response = await client.get_project_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -6111,14 +7048,22 @@ async def test_get_project_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_project_settings( - settings.GetProjectSettingsRequest(), name="name_value", + settings.GetProjectSettingsRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [settings.UpdateProjectSettingsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + settings.UpdateProjectSettingsRequest, + dict, + ], +) def test_update_project_settings(request_type, transport: str = "grpc"): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6154,7 +7099,8 @@ def test_update_project_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -6172,7 +7118,8 @@ async def test_update_project_settings_async( transport: str = "grpc_asyncio", request_type=settings.UpdateProjectSettingsRequest ): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -6212,7 +7159,9 @@ async def test_update_project_settings_async_from_dict(): def test_update_project_settings_field_headers(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. @@ -6275,7 +7224,9 @@ async def test_update_project_settings_field_headers_async(): def test_update_project_settings_flattened(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6303,7 +7254,9 @@ def test_update_project_settings_flattened(): def test_update_project_settings_flattened_error(): - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -6373,7 +7326,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -6393,7 +7347,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ArtifactRegistryClient(client_options=options, transport=transport,) + client = ArtifactRegistryClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -6409,7 +7366,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ArtifactRegistryClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -6452,10 +7410,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ArtifactRegistryClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ArtifactRegistryClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ArtifactRegistryGrpcTransport,) + client = ArtifactRegistryClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ArtifactRegistryGrpcTransport, + ) def test_artifact_registry_base_transport_error(): @@ -6518,6 +7494,14 @@ def test_artifact_registry_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_artifact_registry_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -6529,7 +7513,8 @@ def test_artifact_registry_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ArtifactRegistryTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -6674,24 +7659,40 @@ def test_artifact_registry_grpc_transport_client_cert_source_for_mtls(transport_ ) -def test_artifact_registry_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_artifact_registry_host_no_port(transport_name): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="artifactregistry.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "artifactregistry.googleapis.com:443" + assert client.transport._host == ("artifactregistry.googleapis.com:443") -def test_artifact_registry_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_artifact_registry_host_with_port(transport_name): client = ArtifactRegistryClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="artifactregistry.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "artifactregistry.googleapis.com:8000" + assert client.transport._host == ("artifactregistry.googleapis.com:8000") def test_artifact_registry_grpc_transport_channel(): @@ -6699,7 +7700,8 @@ def test_artifact_registry_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ArtifactRegistryGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6711,7 +7713,8 @@ def test_artifact_registry_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ArtifactRegistryGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6820,12 +7823,16 @@ def test_artifact_registry_transport_channel_mtls_with_adc(transport_class): def test_artifact_registry_grpc_lro_client(): client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6833,12 +7840,16 @@ def test_artifact_registry_grpc_lro_client(): def test_artifact_registry_grpc_lro_async_client(): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6881,7 +7892,10 @@ def test_file_path(): repository = "scallop" file = "abalone" expected = "projects/{project}/locations/{location}/repositories/{repository}/files/{file}".format( - project=project, location=location, repository=repository, file=file, + project=project, + location=location, + repository=repository, + file=file, ) actual = ArtifactRegistryClient.file_path(project, location, repository, file) assert expected == actual @@ -6903,7 +7917,9 @@ def test_parse_file_path(): def test_project_settings_path(): project = "oyster" - expected = "projects/{project}/projectSettings".format(project=project,) + expected = "projects/{project}/projectSettings".format( + project=project, + ) actual = ArtifactRegistryClient.project_settings_path(project) assert expected == actual @@ -6923,8 +7939,12 @@ def test_repository_path(): project = "cuttlefish" location = "mussel" repository = "winkle" - expected = "projects/{project}/locations/{location}/repositories/{repository}".format( - project=project, location=location, repository=repository, + expected = ( + "projects/{project}/locations/{location}/repositories/{repository}".format( + project=project, + location=location, + repository=repository, + ) ) actual = ArtifactRegistryClient.repository_path(project, location, repository) assert expected == actual @@ -7064,7 +8084,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ArtifactRegistryClient.common_folder_path(folder) assert expected == actual @@ -7082,7 +8104,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ArtifactRegistryClient.common_organization_path(organization) assert expected == actual @@ -7100,7 +8124,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ArtifactRegistryClient.common_project_path(project) assert expected == actual @@ -7120,7 +8146,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ArtifactRegistryClient.common_location_path(project, location) assert expected == actual @@ -7145,7 +8172,8 @@ def test_client_with_default_client_info(): transports.ArtifactRegistryTransport, "_prep_wrapped_messages" ) as prep: client = ArtifactRegistryClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7154,7 +8182,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ArtifactRegistryClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -7162,7 +8191,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ArtifactRegistryAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"