Skip to content

Commit d113d5b

Browse files
feat: [google-cloud-parametermanager] KMS key resource_definition `cloudkms.googleapis.com/CryptoKey is added (#14020)
BEGIN_COMMIT_OVERRIDE feat: KMS key resource_definition `[cloudkms.googleapis.com/CryptoKey](https://www.google.com/url?sa=D&q=http%3A%2F%2Fcloudkms.googleapis.com%2FCryptoKey) is added END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. PiperOrigin-RevId: 773618515 Source-Link: googleapis/googleapis@09243fd Source-Link: googleapis/googleapis-gen@bb3ec5e Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXBhcmFtZXRlcm1hbmFnZXIvLk93bEJvdC55YW1sIiwiaCI6ImJiM2VjNWVjNGU2OTQxNjNkZDA0NDk0NTNlNmQ1ZWI0NDJmODIzODAifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 8494eab commit d113d5b

File tree

6 files changed

+85
-28
lines changed

6 files changed

+85
-28
lines changed

packages/google-cloud-parametermanager/google/cloud/parametermanager/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.4" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-parametermanager/google/cloud/parametermanager_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.4" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-parametermanager/google/cloud/parametermanager_v1/services/parameter_manager/async_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class ParameterManagerAsyncClient:
7878
_DEFAULT_ENDPOINT_TEMPLATE = ParameterManagerClient._DEFAULT_ENDPOINT_TEMPLATE
7979
_DEFAULT_UNIVERSE = ParameterManagerClient._DEFAULT_UNIVERSE
8080

81+
crypto_key_path = staticmethod(ParameterManagerClient.crypto_key_path)
82+
parse_crypto_key_path = staticmethod(ParameterManagerClient.parse_crypto_key_path)
8183
parameter_path = staticmethod(ParameterManagerClient.parameter_path)
8284
parse_parameter_path = staticmethod(ParameterManagerClient.parse_parameter_path)
8385
parameter_version_path = staticmethod(ParameterManagerClient.parameter_version_path)

packages/google-cloud-parametermanager/google/cloud/parametermanager_v1/services/parameter_manager/client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,30 @@ def transport(self) -> ParameterManagerTransport:
201201
"""
202202
return self._transport
203203

204+
@staticmethod
205+
def crypto_key_path(
206+
project: str,
207+
location: str,
208+
key_ring: str,
209+
crypto_key: str,
210+
) -> str:
211+
"""Returns a fully-qualified crypto_key string."""
212+
return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format(
213+
project=project,
214+
location=location,
215+
key_ring=key_ring,
216+
crypto_key=crypto_key,
217+
)
218+
219+
@staticmethod
220+
def parse_crypto_key_path(path: str) -> Dict[str, str]:
221+
"""Parses a crypto_key path into its component segments."""
222+
m = re.match(
223+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/keyRings/(?P<key_ring>.+?)/cryptoKeys/(?P<crypto_key>.+?)$",
224+
path,
225+
)
226+
return m.groupdict() if m else {}
227+
204228
@staticmethod
205229
def parameter_path(
206230
project: str,

packages/google-cloud-parametermanager/samples/generated_samples/snippet_metadata_google.cloud.parametermanager.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-parametermanager",
11-
"version": "0.1.4"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-parametermanager/tests/unit/gapic/parametermanager_v1/test_parameter_manager.py

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10813,10 +10813,41 @@ def test_parameter_manager_transport_channel_mtls_with_adc(transport_class):
1081310813
assert transport.grpc_channel == mock_grpc_channel
1081410814

1081510815

10816-
def test_parameter_path():
10816+
def test_crypto_key_path():
1081710817
project = "squid"
1081810818
location = "clam"
10819-
parameter = "whelk"
10819+
key_ring = "whelk"
10820+
crypto_key = "octopus"
10821+
expected = "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format(
10822+
project=project,
10823+
location=location,
10824+
key_ring=key_ring,
10825+
crypto_key=crypto_key,
10826+
)
10827+
actual = ParameterManagerClient.crypto_key_path(
10828+
project, location, key_ring, crypto_key
10829+
)
10830+
assert expected == actual
10831+
10832+
10833+
def test_parse_crypto_key_path():
10834+
expected = {
10835+
"project": "oyster",
10836+
"location": "nudibranch",
10837+
"key_ring": "cuttlefish",
10838+
"crypto_key": "mussel",
10839+
}
10840+
path = ParameterManagerClient.crypto_key_path(**expected)
10841+
10842+
# Check that the path construction is reversible.
10843+
actual = ParameterManagerClient.parse_crypto_key_path(path)
10844+
assert expected == actual
10845+
10846+
10847+
def test_parameter_path():
10848+
project = "winkle"
10849+
location = "nautilus"
10850+
parameter = "scallop"
1082010851
expected = "projects/{project}/locations/{location}/parameters/{parameter}".format(
1082110852
project=project,
1082210853
location=location,
@@ -10828,9 +10859,9 @@ def test_parameter_path():
1082810859

1082910860
def test_parse_parameter_path():
1083010861
expected = {
10831-
"project": "octopus",
10832-
"location": "oyster",
10833-
"parameter": "nudibranch",
10862+
"project": "abalone",
10863+
"location": "squid",
10864+
"parameter": "clam",
1083410865
}
1083510866
path = ParameterManagerClient.parameter_path(**expected)
1083610867

@@ -10840,10 +10871,10 @@ def test_parse_parameter_path():
1084010871

1084110872

1084210873
def test_parameter_version_path():
10843-
project = "cuttlefish"
10844-
location = "mussel"
10845-
parameter = "winkle"
10846-
parameter_version = "nautilus"
10874+
project = "whelk"
10875+
location = "octopus"
10876+
parameter = "oyster"
10877+
parameter_version = "nudibranch"
1084710878
expected = "projects/{project}/locations/{location}/parameters/{parameter}/versions/{parameter_version}".format(
1084810879
project=project,
1084910880
location=location,
@@ -10858,10 +10889,10 @@ def test_parameter_version_path():
1085810889

1085910890
def test_parse_parameter_version_path():
1086010891
expected = {
10861-
"project": "scallop",
10862-
"location": "abalone",
10863-
"parameter": "squid",
10864-
"parameter_version": "clam",
10892+
"project": "cuttlefish",
10893+
"location": "mussel",
10894+
"parameter": "winkle",
10895+
"parameter_version": "nautilus",
1086510896
}
1086610897
path = ParameterManagerClient.parameter_version_path(**expected)
1086710898

@@ -10871,7 +10902,7 @@ def test_parse_parameter_version_path():
1087110902

1087210903

1087310904
def test_common_billing_account_path():
10874-
billing_account = "whelk"
10905+
billing_account = "scallop"
1087510906
expected = "billingAccounts/{billing_account}".format(
1087610907
billing_account=billing_account,
1087710908
)
@@ -10881,7 +10912,7 @@ def test_common_billing_account_path():
1088110912

1088210913
def test_parse_common_billing_account_path():
1088310914
expected = {
10884-
"billing_account": "octopus",
10915+
"billing_account": "abalone",
1088510916
}
1088610917
path = ParameterManagerClient.common_billing_account_path(**expected)
1088710918

@@ -10891,7 +10922,7 @@ def test_parse_common_billing_account_path():
1089110922

1089210923

1089310924
def test_common_folder_path():
10894-
folder = "oyster"
10925+
folder = "squid"
1089510926
expected = "folders/{folder}".format(
1089610927
folder=folder,
1089710928
)
@@ -10901,7 +10932,7 @@ def test_common_folder_path():
1090110932

1090210933
def test_parse_common_folder_path():
1090310934
expected = {
10904-
"folder": "nudibranch",
10935+
"folder": "clam",
1090510936
}
1090610937
path = ParameterManagerClient.common_folder_path(**expected)
1090710938

@@ -10911,7 +10942,7 @@ def test_parse_common_folder_path():
1091110942

1091210943

1091310944
def test_common_organization_path():
10914-
organization = "cuttlefish"
10945+
organization = "whelk"
1091510946
expected = "organizations/{organization}".format(
1091610947
organization=organization,
1091710948
)
@@ -10921,7 +10952,7 @@ def test_common_organization_path():
1092110952

1092210953
def test_parse_common_organization_path():
1092310954
expected = {
10924-
"organization": "mussel",
10955+
"organization": "octopus",
1092510956
}
1092610957
path = ParameterManagerClient.common_organization_path(**expected)
1092710958

@@ -10931,7 +10962,7 @@ def test_parse_common_organization_path():
1093110962

1093210963

1093310964
def test_common_project_path():
10934-
project = "winkle"
10965+
project = "oyster"
1093510966
expected = "projects/{project}".format(
1093610967
project=project,
1093710968
)
@@ -10941,7 +10972,7 @@ def test_common_project_path():
1094110972

1094210973
def test_parse_common_project_path():
1094310974
expected = {
10944-
"project": "nautilus",
10975+
"project": "nudibranch",
1094510976
}
1094610977
path = ParameterManagerClient.common_project_path(**expected)
1094710978

@@ -10951,8 +10982,8 @@ def test_parse_common_project_path():
1095110982

1095210983

1095310984
def test_common_location_path():
10954-
project = "scallop"
10955-
location = "abalone"
10985+
project = "cuttlefish"
10986+
location = "mussel"
1095610987
expected = "projects/{project}/locations/{location}".format(
1095710988
project=project,
1095810989
location=location,
@@ -10963,8 +10994,8 @@ def test_common_location_path():
1096310994

1096410995
def test_parse_common_location_path():
1096510996
expected = {
10966-
"project": "squid",
10967-
"location": "clam",
10997+
"project": "winkle",
10998+
"location": "nautilus",
1096810999
}
1096911000
path = ParameterManagerClient.common_location_path(**expected)
1097011001

0 commit comments

Comments
 (0)