Skip to content

Commit

Permalink
feat(asset): undeprecate resource name helper methods, add 2.7 deprec…
Browse files Browse the repository at this point in the history
…ation warning (via synth) (#10036)
  • Loading branch information
yoshi-automation authored and busunkim96 committed Jan 8, 2020
1 parent f9004e4 commit 9df3d9c
Show file tree
Hide file tree
Showing 7 changed files with 3,566 additions and 29 deletions.
11 changes: 11 additions & 0 deletions asset/google/cloud/asset_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,23 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.asset_v1 import types
from google.cloud.asset_v1.gapic import asset_service_client
from google.cloud.asset_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 AssetServiceClient(asset_service_client.AssetServiceClient):
__doc__ = asset_service_client.AssetServiceClient.__doc__
enums = enums
Expand Down
14 changes: 2 additions & 12 deletions asset/google/cloud/asset_v1/gapic/asset_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,14 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

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


from __future__ import absolute_import
import sys
import warnings

from google.cloud.asset_v1beta1 import types
from google.cloud.asset_v1beta1.gapic import asset_service_client
from google.cloud.asset_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 AssetServiceClient(asset_service_client.AssetServiceClient):
__doc__ = asset_service_client.AssetServiceClient.__doc__
enums = enums
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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


from __future__ import absolute_import
import sys
import warnings

from google.cloud.asset_v1p2beta1 import types
from google.cloud.asset_v1p2beta1.gapic import asset_service_client
from google.cloud.asset_v1p2beta1.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 AssetServiceClient(asset_service_client.AssetServiceClient):
__doc__ = asset_service_client.AssetServiceClient.__doc__
enums = enums
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

0 comments on commit 9df3d9c

Please sign in to comment.