Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 23dca59

Browse files
yoshi-automationbusunkim96
authored andcommitted
feat(kms): undeprecate resource name helper methods, add 2.7 deprecation warning (via synth) (#10045)
1 parent de8b813 commit 23dca59

File tree

3 files changed

+3438
-41
lines changed

3 files changed

+3438
-41
lines changed

google/cloud/kms_v1/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,23 @@
1616

1717

1818
from __future__ import absolute_import
19+
import sys
20+
import warnings
1921

2022
from google.cloud.kms_v1 import types
2123
from google.cloud.kms_v1.gapic import enums
2224
from google.cloud.kms_v1.gapic import key_management_service_client
2325

2426

27+
if sys.version_info[:2] == (2, 7):
28+
message = (
29+
"A future version of this library will drop support for Python 2.7."
30+
"More details about Python 2 support for Google Cloud Client Libraries"
31+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
32+
)
33+
warnings.warn(message, DeprecationWarning)
34+
35+
2536
class KeyManagementServiceClient(
2637
key_management_service_client.KeyManagementServiceClient
2738
):

google/cloud/kms_v1/gapic/key_management_service_client.py

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
9292

9393
@classmethod
9494
def crypto_key_path(cls, project, location, key_ring, crypto_key):
95-
"""DEPRECATED. Return a fully-qualified crypto_key string."""
96-
warnings.warn(
97-
"Resource name helper functions are deprecated.",
98-
PendingDeprecationWarning,
99-
stacklevel=1,
100-
)
95+
"""Return a fully-qualified crypto_key string."""
10196
return google.api_core.path_template.expand(
10297
"projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}",
10398
project=project,
@@ -108,12 +103,7 @@ def crypto_key_path(cls, project, location, key_ring, crypto_key):
108103

109104
@classmethod
110105
def crypto_key_path_path(cls, project, location, key_ring, crypto_key_path):
111-
"""DEPRECATED. Return a fully-qualified crypto_key_path string."""
112-
warnings.warn(
113-
"Resource name helper functions are deprecated.",
114-
PendingDeprecationWarning,
115-
stacklevel=1,
116-
)
106+
"""Return a fully-qualified crypto_key_path string."""
117107
return google.api_core.path_template.expand(
118108
"projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key_path=**}",
119109
project=project,
@@ -126,12 +116,7 @@ def crypto_key_path_path(cls, project, location, key_ring, crypto_key_path):
126116
def crypto_key_version_path(
127117
cls, project, location, key_ring, crypto_key, crypto_key_version
128118
):
129-
"""DEPRECATED. Return a fully-qualified crypto_key_version string."""
130-
warnings.warn(
131-
"Resource name helper functions are deprecated.",
132-
PendingDeprecationWarning,
133-
stacklevel=1,
134-
)
119+
"""Return a fully-qualified crypto_key_version string."""
135120
return google.api_core.path_template.expand(
136121
"projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}",
137122
project=project,
@@ -143,12 +128,7 @@ def crypto_key_version_path(
143128

144129
@classmethod
145130
def import_job_path(cls, project, location, key_ring, import_job):
146-
"""DEPRECATED. Return a fully-qualified import_job string."""
147-
warnings.warn(
148-
"Resource name helper functions are deprecated.",
149-
PendingDeprecationWarning,
150-
stacklevel=1,
151-
)
131+
"""Return a fully-qualified import_job string."""
152132
return google.api_core.path_template.expand(
153133
"projects/{project}/locations/{location}/keyRings/{key_ring}/importJobs/{import_job}",
154134
project=project,
@@ -159,12 +139,7 @@ def import_job_path(cls, project, location, key_ring, import_job):
159139

160140
@classmethod
161141
def key_ring_path(cls, project, location, key_ring):
162-
"""DEPRECATED. Return a fully-qualified key_ring string."""
163-
warnings.warn(
164-
"Resource name helper functions are deprecated.",
165-
PendingDeprecationWarning,
166-
stacklevel=1,
167-
)
142+
"""Return a fully-qualified key_ring string."""
168143
return google.api_core.path_template.expand(
169144
"projects/{project}/locations/{location}/keyRings/{key_ring}",
170145
project=project,
@@ -174,12 +149,7 @@ def key_ring_path(cls, project, location, key_ring):
174149

175150
@classmethod
176151
def location_path(cls, project, location):
177-
"""DEPRECATED. Return a fully-qualified location string."""
178-
warnings.warn(
179-
"Resource name helper functions are deprecated.",
180-
PendingDeprecationWarning,
181-
stacklevel=1,
182-
)
152+
"""Return a fully-qualified location string."""
183153
return google.api_core.path_template.expand(
184154
"projects/{project}/locations/{location}",
185155
project=project,

0 commit comments

Comments
 (0)