Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

chore: Fix resource annotations for Cloud Deploy to use common resource name for locations #136

Merged
merged 2 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions 2 google/cloud/deploy_v1/services/cloud_deploy/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class CloudDeployAsyncClient:
)
job_run_path = staticmethod(CloudDeployClient.job_run_path)
parse_job_run_path = staticmethod(CloudDeployClient.parse_job_run_path)
location_path = staticmethod(CloudDeployClient.location_path)
parse_location_path = staticmethod(CloudDeployClient.parse_location_path)
membership_path = staticmethod(CloudDeployClient.membership_path)
parse_membership_path = staticmethod(CloudDeployClient.parse_membership_path)
release_path = staticmethod(CloudDeployClient.release_path)
Expand Down
17 changes: 0 additions & 17 deletions 17 google/cloud/deploy_v1/services/cloud_deploy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,23 +287,6 @@ def parse_job_run_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def location_path(
project: str,
location: str,
) -> str:
"""Returns a fully-qualified location string."""
return "projects/{project}/locations/{location}".format(
project=project,
location=location,
)

@staticmethod
def parse_location_path(path: str) -> Dict[str, str]:
"""Parses a location path into its component segments."""
m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
return m.groupdict() if m else {}

@staticmethod
def membership_path(
project: str,
Expand Down
117 changes: 47 additions & 70 deletions 117 tests/unit/gapic/deploy_v1/test_cloud_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7683,33 +7683,10 @@ def test_parse_job_run_path():
assert expected == actual


def test_location_path():
def test_membership_path():
project = "scallop"
location = "abalone"
expected = "projects/{project}/locations/{location}".format(
project=project,
location=location,
)
actual = CloudDeployClient.location_path(project, location)
assert expected == actual


def test_parse_location_path():
expected = {
"project": "squid",
"location": "clam",
}
path = CloudDeployClient.location_path(**expected)

# Check that the path construction is reversible.
actual = CloudDeployClient.parse_location_path(path)
assert expected == actual


def test_membership_path():
project = "whelk"
location = "octopus"
membership = "oyster"
membership = "squid"
expected = (
"projects/{project}/locations/{location}/memberships/{membership}".format(
project=project,
Expand All @@ -7723,9 +7700,9 @@ def test_membership_path():

def test_parse_membership_path():
expected = {
"project": "nudibranch",
"location": "cuttlefish",
"membership": "mussel",
"project": "clam",
"location": "whelk",
"membership": "octopus",
}
path = CloudDeployClient.membership_path(**expected)

Expand All @@ -7735,10 +7712,10 @@ def test_parse_membership_path():


def test_release_path():
project = "winkle"
location = "nautilus"
delivery_pipeline = "scallop"
release = "abalone"
project = "oyster"
location = "nudibranch"
delivery_pipeline = "cuttlefish"
release = "mussel"
expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}".format(
project=project,
location=location,
Expand All @@ -7753,10 +7730,10 @@ def test_release_path():

def test_parse_release_path():
expected = {
"project": "squid",
"location": "clam",
"delivery_pipeline": "whelk",
"release": "octopus",
"project": "winkle",
"location": "nautilus",
"delivery_pipeline": "scallop",
"release": "abalone",
}
path = CloudDeployClient.release_path(**expected)

Expand All @@ -7766,11 +7743,11 @@ def test_parse_release_path():


def test_rollout_path():
project = "oyster"
location = "nudibranch"
delivery_pipeline = "cuttlefish"
release = "mussel"
rollout = "winkle"
project = "squid"
location = "clam"
delivery_pipeline = "whelk"
release = "octopus"
rollout = "oyster"
expected = "projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}".format(
project=project,
location=location,
Expand All @@ -7786,11 +7763,11 @@ def test_rollout_path():

def test_parse_rollout_path():
expected = {
"project": "nautilus",
"location": "scallop",
"delivery_pipeline": "abalone",
"release": "squid",
"rollout": "clam",
"project": "nudibranch",
"location": "cuttlefish",
"delivery_pipeline": "mussel",
"release": "winkle",
"rollout": "nautilus",
}
path = CloudDeployClient.rollout_path(**expected)

Expand All @@ -7800,9 +7777,9 @@ def test_parse_rollout_path():


def test_target_path():
project = "whelk"
location = "octopus"
target = "oyster"
project = "scallop"
location = "abalone"
target = "squid"
expected = "projects/{project}/locations/{location}/targets/{target}".format(
project=project,
location=location,
Expand All @@ -7814,9 +7791,9 @@ def test_target_path():

def test_parse_target_path():
expected = {
"project": "nudibranch",
"location": "cuttlefish",
"target": "mussel",
"project": "clam",
"location": "whelk",
"target": "octopus",
}
path = CloudDeployClient.target_path(**expected)

Expand All @@ -7826,9 +7803,9 @@ def test_parse_target_path():


def test_worker_pool_path():
project = "winkle"
location = "nautilus"
worker_pool = "scallop"
project = "oyster"
location = "nudibranch"
worker_pool = "cuttlefish"
expected = (
"projects/{project}/locations/{location}/workerPools/{worker_pool}".format(
project=project,
Expand All @@ -7842,9 +7819,9 @@ def test_worker_pool_path():

def test_parse_worker_pool_path():
expected = {
"project": "abalone",
"location": "squid",
"worker_pool": "clam",
"project": "mussel",
"location": "winkle",
"worker_pool": "nautilus",
}
path = CloudDeployClient.worker_pool_path(**expected)

Expand All @@ -7854,7 +7831,7 @@ def test_parse_worker_pool_path():


def test_common_billing_account_path():
billing_account = "whelk"
billing_account = "scallop"
expected = "billingAccounts/{billing_account}".format(
billing_account=billing_account,
)
Expand All @@ -7864,7 +7841,7 @@ def test_common_billing_account_path():

def test_parse_common_billing_account_path():
expected = {
"billing_account": "octopus",
"billing_account": "abalone",
}
path = CloudDeployClient.common_billing_account_path(**expected)

Expand All @@ -7874,7 +7851,7 @@ def test_parse_common_billing_account_path():


def test_common_folder_path():
folder = "oyster"
folder = "squid"
expected = "folders/{folder}".format(
folder=folder,
)
Expand All @@ -7884,7 +7861,7 @@ def test_common_folder_path():

def test_parse_common_folder_path():
expected = {
"folder": "nudibranch",
"folder": "clam",
}
path = CloudDeployClient.common_folder_path(**expected)

Expand All @@ -7894,7 +7871,7 @@ def test_parse_common_folder_path():


def test_common_organization_path():
organization = "cuttlefish"
organization = "whelk"
expected = "organizations/{organization}".format(
organization=organization,
)
Expand All @@ -7904,7 +7881,7 @@ def test_common_organization_path():

def test_parse_common_organization_path():
expected = {
"organization": "mussel",
"organization": "octopus",
}
path = CloudDeployClient.common_organization_path(**expected)

Expand All @@ -7914,7 +7891,7 @@ def test_parse_common_organization_path():


def test_common_project_path():
project = "winkle"
project = "oyster"
expected = "projects/{project}".format(
project=project,
)
Expand All @@ -7924,7 +7901,7 @@ def test_common_project_path():

def test_parse_common_project_path():
expected = {
"project": "nautilus",
"project": "nudibranch",
}
path = CloudDeployClient.common_project_path(**expected)

Expand All @@ -7934,8 +7911,8 @@ def test_parse_common_project_path():


def test_common_location_path():
project = "scallop"
location = "abalone"
project = "cuttlefish"
location = "mussel"
expected = "projects/{project}/locations/{location}".format(
project=project,
location=location,
Expand All @@ -7946,8 +7923,8 @@ def test_common_location_path():

def test_parse_common_location_path():
expected = {
"project": "squid",
"location": "clam",
"project": "winkle",
"location": "nautilus",
}
path = CloudDeployClient.common_location_path(**expected)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.