Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(irm): undeprecate resource name helper methods, add 2.7 deprecation warning (via synth) #10044

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions irm/google/cloud/irm_v1alpha2/__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.irm_v1alpha2 import types
from google.cloud.irm_v1alpha2.gapic import enums
from google.cloud.irm_v1alpha2.gapic import incident_service_client


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 IncidentServiceClient(incident_service_client.IncidentServiceClient):
__doc__ = incident_service_client.IncidentServiceClient.__doc__
enums = enums
Expand Down
56 changes: 8 additions & 48 deletions irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def annotation_path(cls, project, incident, annotation):
"""DEPRECATED. Return a fully-qualified annotation string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified annotation string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/annotations/{annotation}",
project=project,
Expand All @@ -92,12 +87,7 @@ def annotation_path(cls, project, incident, annotation):

@classmethod
def artifact_path(cls, project, incident, artifact):
"""DEPRECATED. Return a fully-qualified artifact string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified artifact string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/artifacts/{artifact}",
project=project,
Expand All @@ -107,12 +97,7 @@ def artifact_path(cls, project, incident, artifact):

@classmethod
def incident_path(cls, project, incident):
"""DEPRECATED. Return a fully-qualified incident string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified incident string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}",
project=project,
Expand All @@ -121,24 +106,14 @@ def incident_path(cls, project, incident):

@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
)

@classmethod
def role_assignment_path(cls, project, incident, role_assignment):
"""DEPRECATED. Return a fully-qualified role_assignment string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified role_assignment string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/roleAssignments/{role_assignment}",
project=project,
Expand All @@ -148,24 +123,14 @@ def role_assignment_path(cls, project, incident, role_assignment):

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

@classmethod
def subscription_path(cls, project, incident, subscription):
"""DEPRECATED. Return a fully-qualified subscription string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified subscription string."""
return google.api_core.path_template.expand(
"projects/{project}/incidents/{incident}/subscriptions/{subscription}",
project=project,
Expand All @@ -175,12 +140,7 @@ def subscription_path(cls, project, incident, subscription):

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