Skip to content
Permalink
Browse files
fix: fix resource pattern ID segment name (#107)
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 416140747

Source-Link: googleapis/googleapis@429d35c

Source-Link: googleapis/googleapis-gen@9fea20e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWZlYTIwZWRjNjA0MTMyNDg2NDZjNDljMmU1ZDk4NjYzM2VkYjE5MyJ9
  • Loading branch information
gcf-owl-bot[bot] committed Dec 20, 2021
1 parent bf63600 commit 254dc73dbbc52d41014e0d2db81f3cc6cd864058
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
@@ -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<project>.+?)/locations/(?P<location>.+?)/repositories/(?P<repo>.+?)/files/(?P<file>.+?)$",
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/repositories/(?P<repository>.+?)/files/(?P<file>.+?)$",
path,
)
return m.groupdict() if m else {}
@@ -5913,20 +5913,20 @@ 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


def test_parse_file_path():
expected = {
"project": "oyster",
"location": "nudibranch",
"repo": "cuttlefish",
"repository": "cuttlefish",
"file": "mussel",
}
path = ArtifactRegistryClient.file_path(**expected)

0 comments on commit 254dc73

Please sign in to comment.