From 1b85e6c6523fc588f235fd9e320238101c63fade Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 28 May 2020 09:45:51 -0700 Subject: [PATCH] feat: add resource path parse methods (#13) --- .../game_server_deployments_service/client.py | 24 +++++++------- noxfile.py | 2 +- synth.metadata | 8 ++--- .../test_game_server_deployments_service.py | 32 +++++++++---------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/google/cloud/gaming_v1/services/game_server_deployments_service/client.py b/google/cloud/gaming_v1/services/game_server_deployments_service/client.py index 3419bb0f..118543d6 100644 --- a/google/cloud/gaming_v1/services/game_server_deployments_service/client.py +++ b/google/cloud/gaming_v1/services/game_server_deployments_service/client.py @@ -134,37 +134,37 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file @staticmethod - def game_server_deployment_rollout_path( + def game_server_deployment_path( project: str, location: str, deployment: str ) -> str: - """Return a fully-qualified game_server_deployment_rollout string.""" - return "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format( + """Return a fully-qualified game_server_deployment string.""" + return "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format( project=project, location=location, deployment=deployment ) @staticmethod - def parse_game_server_deployment_rollout_path(path: str) -> Dict[str, str]: - """Parse a game_server_deployment_rollout path into its component segments.""" + def parse_game_server_deployment_path(path: str) -> Dict[str, str]: + """Parse a game_server_deployment path into its component segments.""" m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/gameServerDeployments/(?P.+?)/rollout$", + r"^projects/(?P.+?)/locations/(?P.+?)/gameServerDeployments/(?P.+?)$", path, ) return m.groupdict() if m else {} @staticmethod - def game_server_deployment_path( + def game_server_deployment_rollout_path( project: str, location: str, deployment: str ) -> str: - """Return a fully-qualified game_server_deployment string.""" - return "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format( + """Return a fully-qualified game_server_deployment_rollout string.""" + return "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format( project=project, location=location, deployment=deployment ) @staticmethod - def parse_game_server_deployment_path(path: str) -> Dict[str, str]: - """Parse a game_server_deployment path into its component segments.""" + def parse_game_server_deployment_rollout_path(path: str) -> Dict[str, str]: + """Parse a game_server_deployment_rollout path into its component segments.""" m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/gameServerDeployments/(?P.+?)$", + r"^projects/(?P.+?)/locations/(?P.+?)/gameServerDeployments/(?P.+?)/rollout$", path, ) return m.groupdict() if m else {} diff --git a/noxfile.py b/noxfile.py index 39c471a3..64d8340e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -138,7 +138,7 @@ def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx<3.0.0", "alabaster", "recommonmark") + session.install("sphinx", "alabaster", "recommonmark") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/synth.metadata b/synth.metadata index 7f1e5c04..6140ed9f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,22 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-game-servers.git", - "sha": "bdadd8e6afa749a776ee9018b5cd64e543c69f53" + "sha": "3528a72c887b51b2dd0484869d028ed8f98c8c79" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "551cf1e6e3addcc63740427c4f9b40dedd3dac27", - "internalRef": "302792195" + "sha": "eafa840ceec23b44a5c21670288107c661252711", + "internalRef": "313488995" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "274dd49554809834287c24b6dd324a85283f1182" + "sha": "71b8a272549c06b5768d00fa48d3ae990e871bec" } } ], diff --git a/tests/unit/gaming_v1/test_game_server_deployments_service.py b/tests/unit/gaming_v1/test_game_server_deployments_service.py index 847eb83f..9b321e3e 100644 --- a/tests/unit/gaming_v1/test_game_server_deployments_service.py +++ b/tests/unit/gaming_v1/test_game_server_deployments_service.py @@ -1108,51 +1108,51 @@ def test_game_server_deployments_service_grpc_lro_client(): assert transport.operations_client is transport.operations_client -def test_game_server_deployment_rollout_path(): +def test_game_server_deployment_path(): project = "squid" location = "clam" deployment = "whelk" - expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format( + expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format( project=project, location=location, deployment=deployment ) - actual = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path( + actual = GameServerDeploymentsServiceClient.game_server_deployment_path( project, location, deployment ) assert expected == actual -def test_parse_game_server_deployment_rollout_path(): +def test_parse_game_server_deployment_path(): expected = {"project": "octopus", "location": "oyster", "deployment": "nudibranch"} - path = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path( - **expected - ) + path = GameServerDeploymentsServiceClient.game_server_deployment_path(**expected) # Check that the path construction is reversible. - actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_rollout_path( - path - ) + actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_path(path) assert expected == actual -def test_game_server_deployment_path(): +def test_game_server_deployment_rollout_path(): project = "squid" location = "clam" deployment = "whelk" - expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}".format( + expected = "projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout".format( project=project, location=location, deployment=deployment ) - actual = GameServerDeploymentsServiceClient.game_server_deployment_path( + actual = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path( project, location, deployment ) assert expected == actual -def test_parse_game_server_deployment_path(): +def test_parse_game_server_deployment_rollout_path(): expected = {"project": "octopus", "location": "oyster", "deployment": "nudibranch"} - path = GameServerDeploymentsServiceClient.game_server_deployment_path(**expected) + path = GameServerDeploymentsServiceClient.game_server_deployment_rollout_path( + **expected + ) # Check that the path construction is reversible. - actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_path(path) + actual = GameServerDeploymentsServiceClient.parse_game_server_deployment_rollout_path( + path + ) assert expected == actual