Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 1b85e6c

Browse files
feat: add resource path parse methods (#13)
1 parent 3528a72 commit 1b85e6c

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

google/cloud/gaming_v1/services/game_server_deployments_service/client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,37 +134,37 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
134134
from_service_account_json = from_service_account_file
135135

136136
@staticmethod
137-
def game_server_deployment_rollout_path(
137+
def game_server_deployment_path(
138138
project: str, location: str, deployment: str
139139
) -> str:
140-
"""Return a fully-qualified game_server_deployment_rollout string."""
141-
return "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format(
140+
"""Return a fully-qualified game_server_deployment string."""
141+
return "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format(
142142
project=project, location=location, deployment=deployment
143143
)
144144

145145
@staticmethod
146-
def parse_game_server_deployment_rollout_path(path: str) -> Dict[str, str]:
147-
"""Parse a game_server_deployment_rollout path into its component segments."""
146+
def parse_game_server_deployment_path(path: str) -> Dict[str, str]:
147+
"""Parse a game_server_deployment path into its component segments."""
148148
m = re.match(
149-
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/gameServerDeployments/(?P<deployment>.+?)/rollout$",
149+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/gameServerDeployments/(?P<deployment>.+?)$",
150150
path,
151151
)
152152
return m.groupdict() if m else {}
153153

154154
@staticmethod
155-
def game_server_deployment_path(
155+
def game_server_deployment_rollout_path(
156156
project: str, location: str, deployment: str
157157
) -> str:
158-
"""Return a fully-qualified game_server_deployment string."""
159-
return "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format(
158+
"""Return a fully-qualified game_server_deployment_rollout string."""
159+
return "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format(
160160
project=project, location=location, deployment=deployment
161161
)
162162

163163
@staticmethod
164-
def parse_game_server_deployment_path(path: str) -> Dict[str, str]:
165-
"""Parse a game_server_deployment path into its component segments."""
164+
def parse_game_server_deployment_rollout_path(path: str) -> Dict[str, str]:
165+
"""Parse a game_server_deployment_rollout path into its component segments."""
166166
m = re.match(
167-
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/gameServerDeployments/(?P<deployment>.+?)$",
167+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/gameServerDeployments/(?P<deployment>.+?)/rollout$",
168168
path,
169169
)
170170
return m.groupdict() if m else {}

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def docs(session):
138138
"""Build the docs for this library."""
139139

140140
session.install("-e", ".")
141-
session.install("sphinx<3.0.0", "alabaster", "recommonmark")
141+
session.install("sphinx", "alabaster", "recommonmark")
142142

143143
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
144144
session.run(

synth.metadata

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-game-servers.git",
7-
"sha": "bdadd8e6afa749a776ee9018b5cd64e543c69f53"
7+
"sha": "3528a72c887b51b2dd0484869d028ed8f98c8c79"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "googleapis",
1313
"remote": "https://github.com/googleapis/googleapis.git",
14-
"sha": "551cf1e6e3addcc63740427c4f9b40dedd3dac27",
15-
"internalRef": "302792195"
14+
"sha": "eafa840ceec23b44a5c21670288107c661252711",
15+
"internalRef": "313488995"
1616
}
1717
},
1818
{
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "274dd49554809834287c24b6dd324a85283f1182"
22+
"sha": "71b8a272549c06b5768d00fa48d3ae990e871bec"
2323
}
2424
}
2525
],

tests/unit/gaming_v1/test_game_server_deployments_service.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,51 +1108,51 @@ def test_game_server_deployments_service_grpc_lro_client():
11081108
assert transport.operations_client is transport.operations_client
11091109

11101110

1111-
def test_game_server_deployment_rollout_path():
1111+
def test_game_server_deployment_path():
11121112
project = "squid"
11131113
location = "clam"
11141114
deployment = "whelk"
11151115

1116-
expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format(
1116+
expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format(
11171117
project=project, location=location, deployment=deployment
11181118
)
1119-
actual = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path(
1119+
actual = GameServerDeploymentsServiceClient.game_server_deployment_path(
11201120
project, location, deployment
11211121
)
11221122
assert expected == actual
11231123

11241124

1125-
def test_parse_game_server_deployment_rollout_path():
1125+
def test_parse_game_server_deployment_path():
11261126
expected = {"project": "octopus", "location": "oyster", "deployment": "nudibranch"}
1127-
path = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path(
1128-
**expected
1129-
)
1127+
path = GameServerDeploymentsServiceClient.game_server_deployment_path(**expected)
11301128

11311129
# Check that the path construction is reversible.
1132-
actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_rollout_path(
1133-
path
1134-
)
1130+
actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_path(path)
11351131
assert expected == actual
11361132

11371133

1138-
def test_game_server_deployment_path():
1134+
def test_game_server_deployment_rollout_path():
11391135
project = "squid"
11401136
location = "clam"
11411137
deployment = "whelk"
11421138

1143-
expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format(
1139+
expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format(
11441140
project=project, location=location, deployment=deployment
11451141
)
1146-
actual = GameServerDeploymentsServiceClient.game_server_deployment_path(
1142+
actual = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path(
11471143
project, location, deployment
11481144
)
11491145
assert expected == actual
11501146

11511147

1152-
def test_parse_game_server_deployment_path():
1148+
def test_parse_game_server_deployment_rollout_path():
11531149
expected = {"project": "octopus", "location": "oyster", "deployment": "nudibranch"}
1154-
path = GameServerDeploymentsServiceClient.game_server_deployment_path(**expected)
1150+
path = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path(
1151+
**expected
1152+
)
11551153

11561154
# Check that the path construction is reversible.
1157-
actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_path(path)
1155+
actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_rollout_path(
1156+
path
1157+
)
11581158
assert expected == actual

0 commit comments

Comments
 (0)