From 254dc73dbbc52d41014e0d2db81f3cc6cd864058 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:40:29 +0000 Subject: [PATCH] fix: fix resource pattern ID segment name (#107) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 416140747 Source-Link: https://github.com/googleapis/googleapis/commit/429d35c835fd8509302ca0e8031eab35a99e767e Source-Link: https://github.com/googleapis/googleapis-gen/commit/9fea20edc60413248646c49c2e5d986633edb193 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWZlYTIwZWRjNjA0MTMyNDg2NDZjNDljMmU1ZDk4NjYzM2VkYjE5MyJ9 --- .../services/artifact_registry/client.py | 8 ++++---- .../artifactregistry_v1beta2/test_artifact_registry.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py index 609ef70..dec72cd 100644 --- a/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py +++ b/google/cloud/artifactregistry_v1beta2/services/artifact_registry/client.py @@ -187,17 +187,17 @@ def transport(self) -> ArtifactRegistryTransport: return self._transport @staticmethod - def file_path(project: str, location: str, repo: 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/{repo}/files/{file}".format( - project=project, location=location, repo=repo, file=file, + 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.+?)$", + r"^projects/(?P.+?)/locations/(?P.+?)/repositories/(?P.+?)/files/(?P.+?)$", path, ) return m.groupdict() if m else {} diff --git a/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py b/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py index 65be90d..6bdf00f 100644 --- a/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py +++ b/tests/unit/gapic/artifactregistry_v1beta2/test_artifact_registry.py @@ -5913,12 +5913,12 @@ def test_artifact_registry_grpc_lro_async_client(): def test_file_path(): project = "squid" location = "clam" - repo = "whelk" + repository = "whelk" file = "octopus" - expected = "projects/{project}/locations/{location}/repositories/{repo}/files/{file}".format( - project=project, location=location, repo=repo, file=file, + expected = "projects/{project}/locations/{location}/repositories/{repository}/files/{file}".format( + project=project, location=location, repository=repository, file=file, ) - actual = ArtifactRegistryClient.file_path(project, location, repo, file) + actual = ArtifactRegistryClient.file_path(project, location, repository, file) assert expected == actual @@ -5926,7 +5926,7 @@ def test_parse_file_path(): expected = { "project": "oyster", "location": "nudibranch", - "repo": "cuttlefish", + "repository": "cuttlefish", "file": "mussel", } path = ArtifactRegistryClient.file_path(**expected)