Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
fix(datastream): Change a few resource pattern variables from camelCa…
Browse files Browse the repository at this point in the history
…se to snake_case (#20)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 393705818

Source-Link: googleapis/googleapis@9e99074

Source-Link: https://github.com/googleapis/googleapis-gen/commit/1eee1fcf28b8d8557bd8358d00181ebefffc4a7d
  • Loading branch information
gcf-owl-bot[bot] authored Aug 30, 2021
1 parent 4588eab commit 296962a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
24 changes: 12 additions & 12 deletions google/cloud/datastream_v1alpha1/services/datastream/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,57 +161,57 @@ def transport(self) -> DatastreamTransport:

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

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

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

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

@staticmethod
def route_path(
project: str, location: str, privateConnection: str, route: str,
project: str, location: str, private_connection: str, route: str,
) -> str:
"""Returns a fully-qualified route string."""
return "projects/{project}/locations/{location}/privateConnections/{privateConnection}/routes/{route}".format(
return "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}".format(
project=project,
location=location,
privateConnection=privateConnection,
private_connection=private_connection,
route=route,
)

@staticmethod
def parse_route_path(path: str) -> Dict[str, str]:
"""Parses a route path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/privateConnections/(?P<privateConnection>.+?)/routes/(?P<route>.+?)$",
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/privateConnections/(?P<private_connection>.+?)/routes/(?P<route>.+?)$",
path,
)
return m.groupdict() if m else {}
Expand Down
30 changes: 15 additions & 15 deletions tests/unit/gapic/datastream_v1alpha1/test_datastream.py
Original file line number Diff line number Diff line change
Expand Up @@ -6046,12 +6046,12 @@ def test_datastream_grpc_lro_async_client():
def test_connection_profile_path():
project = "squid"
location = "clam"
connectionProfile = "whelk"
expected = "projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}".format(
project=project, location=location, connectionProfile=connectionProfile,
connection_profile = "whelk"
expected = "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}".format(
project=project, location=location, connection_profile=connection_profile,
)
actual = DatastreamClient.connection_profile_path(
project, location, connectionProfile
project, location, connection_profile
)
assert expected == actual

Expand All @@ -6060,7 +6060,7 @@ def test_parse_connection_profile_path():
expected = {
"project": "octopus",
"location": "oyster",
"connectionProfile": "nudibranch",
"connection_profile": "nudibranch",
}
path = DatastreamClient.connection_profile_path(**expected)

Expand All @@ -6072,12 +6072,12 @@ def test_parse_connection_profile_path():
def test_private_connection_path():
project = "cuttlefish"
location = "mussel"
privateConnection = "winkle"
expected = "projects/{project}/locations/{location}/privateConnections/{privateConnection}".format(
project=project, location=location, privateConnection=privateConnection,
private_connection = "winkle"
expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}".format(
project=project, location=location, private_connection=private_connection,
)
actual = DatastreamClient.private_connection_path(
project, location, privateConnection
project, location, private_connection
)
assert expected == actual

Expand All @@ -6086,7 +6086,7 @@ def test_parse_private_connection_path():
expected = {
"project": "nautilus",
"location": "scallop",
"privateConnection": "abalone",
"private_connection": "abalone",
}
path = DatastreamClient.private_connection_path(**expected)

Expand All @@ -6098,23 +6098,23 @@ def test_parse_private_connection_path():
def test_route_path():
project = "squid"
location = "clam"
privateConnection = "whelk"
private_connection = "whelk"
route = "octopus"
expected = "projects/{project}/locations/{location}/privateConnections/{privateConnection}/routes/{route}".format(
expected = "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}".format(
project=project,
location=location,
privateConnection=privateConnection,
private_connection=private_connection,
route=route,
)
actual = DatastreamClient.route_path(project, location, privateConnection, route)
actual = DatastreamClient.route_path(project, location, private_connection, route)
assert expected == actual


def test_parse_route_path():
expected = {
"project": "oyster",
"location": "nudibranch",
"privateConnection": "cuttlefish",
"private_connection": "cuttlefish",
"route": "mussel",
}
path = DatastreamClient.route_path(**expected)
Expand Down

0 comments on commit 296962a

Please sign in to comment.