Skip to content

Commit e04d1db

Browse files
yoshi-automationbusunkim96
authored andcommitted
feat(redis): undeprecate resource name helper methods, add 2.7 deprecation warning (via synth) (#10049)
1 parent d2c32d8 commit e04d1db

File tree

5 files changed

+3477
-29
lines changed

5 files changed

+3477
-29
lines changed

redis/google/cloud/redis_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.redis_v1 import types
2123
from google.cloud.redis_v1.gapic import cloud_redis_client
2224
from google.cloud.redis_v1.gapic import enums
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 CloudRedisClient(cloud_redis_client.CloudRedisClient):
2637
__doc__ = cloud_redis_client.CloudRedisClient.__doc__
2738
enums = enums

redis/google/cloud/redis_v1/gapic/cloud_redis_client.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
100100

101101
@classmethod
102102
def instance_path(cls, project, location, instance):
103-
"""DEPRECATED. Return a fully-qualified instance string."""
104-
warnings.warn(
105-
"Resource name helper functions are deprecated.",
106-
PendingDeprecationWarning,
107-
stacklevel=1,
108-
)
103+
"""Return a fully-qualified instance string."""
109104
return google.api_core.path_template.expand(
110105
"projects/{project}/locations/{location}/instances/{instance}",
111106
project=project,
@@ -115,12 +110,7 @@ def instance_path(cls, project, location, instance):
115110

116111
@classmethod
117112
def location_path(cls, project, location):
118-
"""DEPRECATED. Return a fully-qualified location string."""
119-
warnings.warn(
120-
"Resource name helper functions are deprecated.",
121-
PendingDeprecationWarning,
122-
stacklevel=1,
123-
)
113+
"""Return a fully-qualified location string."""
124114
return google.api_core.path_template.expand(
125115
"projects/{project}/locations/{location}",
126116
project=project,

redis/google/cloud/redis_v1beta1/__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.redis_v1beta1 import types
2123
from google.cloud.redis_v1beta1.gapic import cloud_redis_client
2224
from google.cloud.redis_v1beta1.gapic import enums
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 CloudRedisClient(cloud_redis_client.CloudRedisClient):
2637
__doc__ = cloud_redis_client.CloudRedisClient.__doc__
2738
enums = enums

redis/google/cloud/redis_v1beta1/gapic/cloud_redis_client.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
101101

102102
@classmethod
103103
def instance_path(cls, project, location, instance):
104-
"""DEPRECATED. Return a fully-qualified instance string."""
105-
warnings.warn(
106-
"Resource name helper functions are deprecated.",
107-
PendingDeprecationWarning,
108-
stacklevel=1,
109-
)
104+
"""Return a fully-qualified instance string."""
110105
return google.api_core.path_template.expand(
111106
"projects/{project}/locations/{location}/instances/{instance}",
112107
project=project,
@@ -116,12 +111,7 @@ def instance_path(cls, project, location, instance):
116111

117112
@classmethod
118113
def location_path(cls, project, location):
119-
"""DEPRECATED. Return a fully-qualified location string."""
120-
warnings.warn(
121-
"Resource name helper functions are deprecated.",
122-
PendingDeprecationWarning,
123-
stacklevel=1,
124-
)
114+
"""Return a fully-qualified location string."""
125115
return google.api_core.path_template.expand(
126116
"projects/{project}/locations/{location}",
127117
project=project,

0 commit comments

Comments
 (0)