diff --git a/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py b/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py index eee91499..8f3efeee 100644 --- a/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py +++ b/google/cloud/servicedirectory_v1beta1/services/registration_service/client.py @@ -151,23 +151,17 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file @staticmethod - def endpoint_path( - project: str, location: str, namespace: str, service: str, endpoint: str - ) -> str: - """Return a fully-qualified endpoint string.""" - return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}/endpoints/{endpoint}".format( - project=project, - location=location, - namespace=namespace, - service=service, - endpoint=endpoint, + def service_path(project: str, location: str, namespace: str, service: str) -> str: + """Return a fully-qualified service string.""" + return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( + project=project, location=location, namespace=namespace, service=service ) @staticmethod - def parse_endpoint_path(path: str) -> Dict[str, str]: - """Parse a endpoint path into its component segments.""" + def parse_service_path(path: str) -> Dict[str, str]: + """Parse a service path into its component segments.""" m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/namespaces/(?P.+?)/services/(?P.+?)/endpoints/(?P.+?)$", + r"^projects/(?P.+?)/locations/(?P.+?)/namespaces/(?P.+?)/services/(?P.+?)$", path, ) return m.groupdict() if m else {} @@ -189,17 +183,23 @@ def parse_namespace_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def service_path(project: str, location: str, namespace: str, service: str) -> str: - """Return a fully-qualified service string.""" - return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( - project=project, location=location, namespace=namespace, service=service + def endpoint_path( + project: str, location: str, namespace: str, service: str, endpoint: str + ) -> str: + """Return a fully-qualified endpoint string.""" + return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}/endpoints/{endpoint}".format( + project=project, + location=location, + namespace=namespace, + service=service, + endpoint=endpoint, ) @staticmethod - def parse_service_path(path: str) -> Dict[str, str]: - """Parse a service path into its component segments.""" + def parse_endpoint_path(path: str) -> Dict[str, str]: + """Parse a endpoint path into its component segments.""" m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/namespaces/(?P.+?)/services/(?P.+?)$", + r"^projects/(?P.+?)/locations/(?P.+?)/namespaces/(?P.+?)/services/(?P.+?)/endpoints/(?P.+?)$", path, ) return m.groupdict() if m else {} diff --git a/synth.metadata b/synth.metadata index 1eeba80e..549fea1f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -19,14 +19,14 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "385d537832113984af2d033aaf353f0432256527" + "sha": "cb3c683e958a4b5c016bb3734436fc1cb887eb7b" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "385d537832113984af2d033aaf353f0432256527" + "sha": "cb3c683e958a4b5c016bb3734436fc1cb887eb7b" } } ], diff --git a/tests/unit/servicedirectory_v1beta1/test_registration_service.py b/tests/unit/servicedirectory_v1beta1/test_registration_service.py index ced075fa..ec5786d2 100644 --- a/tests/unit/servicedirectory_v1beta1/test_registration_service.py +++ b/tests/unit/servicedirectory_v1beta1/test_registration_service.py @@ -1728,38 +1728,32 @@ def test_registration_service_grpc_transport_channel_mtls_with_adc( assert transport.grpc_channel == mock_grpc_channel -def test_endpoint_path(): +def test_service_path(): project = "squid" location = "clam" namespace = "whelk" service = "octopus" - endpoint = "oyster" - expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}/endpoints/{endpoint}".format( - project=project, - location=location, - namespace=namespace, - service=service, - endpoint=endpoint, + expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( + project=project, location=location, namespace=namespace, service=service ) - actual = RegistrationServiceClient.endpoint_path( - project, location, namespace, service, endpoint + actual = RegistrationServiceClient.service_path( + project, location, namespace, service ) assert expected == actual -def test_parse_endpoint_path(): +def test_parse_service_path(): expected = { - "project": "nudibranch", - "location": "cuttlefish", - "namespace": "mussel", - "service": "winkle", - "endpoint": "nautilus", + "project": "oyster", + "location": "nudibranch", + "namespace": "cuttlefish", + "service": "mussel", } - path = RegistrationServiceClient.endpoint_path(**expected) + path = RegistrationServiceClient.service_path(**expected) # Check that the path construction is reversible. - actual = RegistrationServiceClient.parse_endpoint_path(path) + actual = RegistrationServiceClient.parse_service_path(path) assert expected == actual @@ -1784,30 +1778,36 @@ def test_parse_namespace_path(): assert expected == actual -def test_service_path(): +def test_endpoint_path(): project = "squid" location = "clam" namespace = "whelk" service = "octopus" + endpoint = "oyster" - expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( - project=project, location=location, namespace=namespace, service=service + expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}/endpoints/{endpoint}".format( + project=project, + location=location, + namespace=namespace, + service=service, + endpoint=endpoint, ) - actual = RegistrationServiceClient.service_path( - project, location, namespace, service + actual = RegistrationServiceClient.endpoint_path( + project, location, namespace, service, endpoint ) assert expected == actual -def test_parse_service_path(): +def test_parse_endpoint_path(): expected = { - "project": "oyster", - "location": "nudibranch", - "namespace": "cuttlefish", - "service": "mussel", + "project": "nudibranch", + "location": "cuttlefish", + "namespace": "mussel", + "service": "winkle", + "endpoint": "nautilus", } - path = RegistrationServiceClient.service_path(**expected) + path = RegistrationServiceClient.endpoint_path(**expected) # Check that the path construction is reversible. - actual = RegistrationServiceClient.parse_service_path(path) + actual = RegistrationServiceClient.parse_endpoint_path(path) assert expected == actual