Skip to content

Commit

Permalink
chore: publish Access Context Manager API v1 (#247)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 387216202

Source-Link: googleapis/googleapis@0b261de

Source-Link: googleapis/googleapis-gen@368c01e
  • Loading branch information
gcf-owl-bot[bot] authored Jul 28, 2021
1 parent 1fd5c80 commit f5388bc
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@ class AssetServiceAsyncClient:
DEFAULT_ENDPOINT = AssetServiceClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = AssetServiceClient.DEFAULT_MTLS_ENDPOINT

access_level_path = staticmethod(AssetServiceClient.access_level_path)
parse_access_level_path = staticmethod(AssetServiceClient.parse_access_level_path)
access_policy_path = staticmethod(AssetServiceClient.access_policy_path)
parse_access_policy_path = staticmethod(AssetServiceClient.parse_access_policy_path)
asset_path = staticmethod(AssetServiceClient.asset_path)

feed_path = staticmethod(AssetServiceClient.feed_path)
parse_feed_path = staticmethod(AssetServiceClient.parse_feed_path)
service_perimeter_path = staticmethod(AssetServiceClient.service_perimeter_path)
parse_service_perimeter_path = staticmethod(
AssetServiceClient.parse_service_perimeter_path
)
common_billing_account_path = staticmethod(
AssetServiceClient.common_billing_account_path
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,33 @@ def transport(self) -> AssetServiceTransport:
"""
return self._transport

@staticmethod
def access_level_path(access_policy: str, access_level: str,) -> str:
"""Returns a fully-qualified access_level string."""
return "accessPolicies/{access_policy}/accessLevels/{access_level}".format(
access_policy=access_policy, access_level=access_level,
)

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

@staticmethod
def access_policy_path(access_policy: str,) -> str:
"""Returns a fully-qualified access_policy string."""
return "accessPolicies/{access_policy}".format(access_policy=access_policy,)

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

@staticmethod
def asset_path() -> str:
"""Returns a fully-qualified asset string."""
Expand All @@ -173,6 +200,22 @@ def parse_feed_path(path: str) -> Dict[str, str]:
m = re.match(r"^projects/(?P<project>.+?)/feeds/(?P<feed>.+?)$", path)
return m.groupdict() if m else {}

@staticmethod
def service_perimeter_path(access_policy: str, service_perimeter: str,) -> str:
"""Returns a fully-qualified service_perimeter string."""
return "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format(
access_policy=access_policy, service_perimeter=service_perimeter,
)

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

@staticmethod
def common_billing_account_path(billing_account: str,) -> str:
"""Returns a fully-qualified billing_account string."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ class AssetServiceAsyncClient:
DEFAULT_ENDPOINT = AssetServiceClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = AssetServiceClient.DEFAULT_MTLS_ENDPOINT

access_level_path = staticmethod(AssetServiceClient.access_level_path)
parse_access_level_path = staticmethod(AssetServiceClient.parse_access_level_path)
access_policy_path = staticmethod(AssetServiceClient.access_policy_path)
parse_access_policy_path = staticmethod(AssetServiceClient.parse_access_policy_path)
asset_path = staticmethod(AssetServiceClient.asset_path)

service_perimeter_path = staticmethod(AssetServiceClient.service_perimeter_path)
parse_service_perimeter_path = staticmethod(
AssetServiceClient.parse_service_perimeter_path
)
common_billing_account_path = staticmethod(
AssetServiceClient.common_billing_account_path
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,54 @@ def transport(self) -> AssetServiceTransport:
"""
return self._transport

@staticmethod
def access_level_path(access_policy: str, access_level: str,) -> str:
"""Returns a fully-qualified access_level string."""
return "accessPolicies/{access_policy}/accessLevels/{access_level}".format(
access_policy=access_policy, access_level=access_level,
)

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

@staticmethod
def access_policy_path(access_policy: str,) -> str:
"""Returns a fully-qualified access_policy string."""
return "accessPolicies/{access_policy}".format(access_policy=access_policy,)

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

@staticmethod
def asset_path() -> str:
"""Returns a fully-qualified asset string."""
return "*".format()

@staticmethod
def service_perimeter_path(access_policy: str, service_perimeter: str,) -> str:
"""Returns a fully-qualified service_perimeter string."""
return "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format(
access_policy=access_policy, service_perimeter=service_perimeter,
)

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

@staticmethod
def common_billing_account_path(billing_account: str,) -> str:
"""Returns a fully-qualified billing_account string."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3757,24 +3757,64 @@ def test_asset_service_grpc_lro_async_client():
assert transport.operations_client is transport.operations_client


def test_access_level_path():
access_policy = "squid"
access_level = "clam"
expected = "accessPolicies/{access_policy}/accessLevels/{access_level}".format(
access_policy=access_policy, access_level=access_level,
)
actual = AssetServiceClient.access_level_path(access_policy, access_level)
assert expected == actual


def test_parse_access_level_path():
expected = {
"access_policy": "whelk",
"access_level": "octopus",
}
path = AssetServiceClient.access_level_path(**expected)

# Check that the path construction is reversible.
actual = AssetServiceClient.parse_access_level_path(path)
assert expected == actual


def test_access_policy_path():
access_policy = "oyster"
expected = "accessPolicies/{access_policy}".format(access_policy=access_policy,)
actual = AssetServiceClient.access_policy_path(access_policy)
assert expected == actual


def test_parse_access_policy_path():
expected = {
"access_policy": "nudibranch",
}
path = AssetServiceClient.access_policy_path(**expected)

# Check that the path construction is reversible.
actual = AssetServiceClient.parse_access_policy_path(path)
assert expected == actual


def test_asset_path():
expected = "*".format()
actual = AssetServiceClient.asset_path()
assert expected == actual


def test_feed_path():
project = "squid"
feed = "clam"
project = "cuttlefish"
feed = "mussel"
expected = "projects/{project}/feeds/{feed}".format(project=project, feed=feed,)
actual = AssetServiceClient.feed_path(project, feed)
assert expected == actual


def test_parse_feed_path():
expected = {
"project": "whelk",
"feed": "octopus",
"project": "winkle",
"feed": "nautilus",
}
path = AssetServiceClient.feed_path(**expected)

Expand All @@ -3783,8 +3823,30 @@ def test_parse_feed_path():
assert expected == actual


def test_service_perimeter_path():
access_policy = "scallop"
service_perimeter = "abalone"
expected = "accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}".format(
access_policy=access_policy, service_perimeter=service_perimeter,
)
actual = AssetServiceClient.service_perimeter_path(access_policy, service_perimeter)
assert expected == actual


def test_parse_service_perimeter_path():
expected = {
"access_policy": "squid",
"service_perimeter": "clam",
}
path = AssetServiceClient.service_perimeter_path(**expected)

# Check that the path construction is reversible.
actual = AssetServiceClient.parse_service_perimeter_path(path)
assert expected == actual


def test_common_billing_account_path():
billing_account = "oyster"
billing_account = "whelk"
expected = "billingAccounts/{billing_account}".format(
billing_account=billing_account,
)
Expand All @@ -3794,7 +3856,7 @@ def test_common_billing_account_path():

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

Expand All @@ -3804,15 +3866,15 @@ def test_parse_common_billing_account_path():


def test_common_folder_path():
folder = "cuttlefish"
folder = "oyster"
expected = "folders/{folder}".format(folder=folder,)
actual = AssetServiceClient.common_folder_path(folder)
assert expected == actual


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

Expand All @@ -3822,15 +3884,15 @@ def test_parse_common_folder_path():


def test_common_organization_path():
organization = "winkle"
organization = "cuttlefish"
expected = "organizations/{organization}".format(organization=organization,)
actual = AssetServiceClient.common_organization_path(organization)
assert expected == actual


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

Expand All @@ -3840,15 +3902,15 @@ def test_parse_common_organization_path():


def test_common_project_path():
project = "scallop"
project = "winkle"
expected = "projects/{project}".format(project=project,)
actual = AssetServiceClient.common_project_path(project)
assert expected == actual


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

Expand All @@ -3858,8 +3920,8 @@ def test_parse_common_project_path():


def test_common_location_path():
project = "squid"
location = "clam"
project = "scallop"
location = "abalone"
expected = "projects/{project}/locations/{location}".format(
project=project, location=location,
)
Expand All @@ -3869,8 +3931,8 @@ def test_common_location_path():

def test_parse_common_location_path():
expected = {
"project": "whelk",
"location": "octopus",
"project": "squid",
"location": "clam",
}
path = AssetServiceClient.common_location_path(**expected)

Expand Down
Loading

0 comments on commit f5388bc

Please sign in to comment.