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

Commit

Permalink
feat(redis): undeprecate resource name helper methods, add 2.7 deprec…
Browse files Browse the repository at this point in the history
…ation warning (via synth) (#10049)
  • Loading branch information
yoshi-automation authored and busunkim96 committed Jan 8, 2020
1 parent 964bc5b commit b8a8c24
Show file tree
Hide file tree
Showing 5 changed files with 3,477 additions and 29 deletions.
11 changes: 11 additions & 0 deletions google/cloud/redis_v1/__init__.py
Expand Up @@ -16,12 +16,23 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.redis_v1 import types
from google.cloud.redis_v1.gapic import cloud_redis_client
from google.cloud.redis_v1.gapic import enums


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


class CloudRedisClient(cloud_redis_client.CloudRedisClient):
__doc__ = cloud_redis_client.CloudRedisClient.__doc__
enums = enums
Expand Down
14 changes: 2 additions & 12 deletions google/cloud/redis_v1/gapic/cloud_redis_client.py
Expand Up @@ -100,12 +100,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def instance_path(cls, project, location, instance):
"""DEPRECATED. Return a fully-qualified instance string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified instance string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/instances/{instance}",
project=project,
Expand All @@ -115,12 +110,7 @@ def instance_path(cls, project, location, instance):

@classmethod
def location_path(cls, project, location):
"""DEPRECATED. Return a fully-qualified location string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified location string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
Expand Down
11 changes: 11 additions & 0 deletions google/cloud/redis_v1beta1/__init__.py
Expand Up @@ -16,12 +16,23 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.redis_v1beta1 import types
from google.cloud.redis_v1beta1.gapic import cloud_redis_client
from google.cloud.redis_v1beta1.gapic import enums


if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)


class CloudRedisClient(cloud_redis_client.CloudRedisClient):
__doc__ = cloud_redis_client.CloudRedisClient.__doc__
enums = enums
Expand Down
14 changes: 2 additions & 12 deletions google/cloud/redis_v1beta1/gapic/cloud_redis_client.py
Expand Up @@ -101,12 +101,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def instance_path(cls, project, location, instance):
"""DEPRECATED. Return a fully-qualified instance string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified instance string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/instances/{instance}",
project=project,
Expand All @@ -116,12 +111,7 @@ def instance_path(cls, project, location, instance):

@classmethod
def location_path(cls, project, location):
"""DEPRECATED. Return a fully-qualified location string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified location string."""
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
Expand Down

0 comments on commit b8a8c24

Please sign in to comment.