Skip to content

Commit 44849f6

Browse files
yoshi-automationbusunkim96
authored andcommitted
feat(irm): undeprecate resource name helper methods, add 2.7 deprecation warning (via synth) (#10044)
1 parent feefced commit 44849f6

File tree

3 files changed

+3440
-53
lines changed

3 files changed

+3440
-53
lines changed

irm/google/cloud/irm_v1alpha2/__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.irm_v1alpha2 import types
2123
from google.cloud.irm_v1alpha2.gapic import enums
2224
from google.cloud.irm_v1alpha2.gapic import incident_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 IncidentServiceClient(incident_service_client.IncidentServiceClient):
2637
__doc__ = incident_service_client.IncidentServiceClient.__doc__
2738
enums = enums

irm/google/cloud/irm_v1alpha2/gapic/incident_service_client.py

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
7777

7878
@classmethod
7979
def annotation_path(cls, project, incident, annotation):
80-
"""DEPRECATED. Return a fully-qualified annotation string."""
81-
warnings.warn(
82-
"Resource name helper functions are deprecated.",
83-
PendingDeprecationWarning,
84-
stacklevel=1,
85-
)
80+
"""Return a fully-qualified annotation string."""
8681
return google.api_core.path_template.expand(
8782
"projects/{project}/incidents/{incident}/annotations/{annotation}",
8883
project=project,
@@ -92,12 +87,7 @@ def annotation_path(cls, project, incident, annotation):
9287

9388
@classmethod
9489
def artifact_path(cls, project, incident, artifact):
95-
"""DEPRECATED. Return a fully-qualified artifact string."""
96-
warnings.warn(
97-
"Resource name helper functions are deprecated.",
98-
PendingDeprecationWarning,
99-
stacklevel=1,
100-
)
90+
"""Return a fully-qualified artifact string."""
10191
return google.api_core.path_template.expand(
10292
"projects/{project}/incidents/{incident}/artifacts/{artifact}",
10393
project=project,
@@ -107,12 +97,7 @@ def artifact_path(cls, project, incident, artifact):
10797

10898
@classmethod
10999
def incident_path(cls, project, incident):
110-
"""DEPRECATED. Return a fully-qualified incident string."""
111-
warnings.warn(
112-
"Resource name helper functions are deprecated.",
113-
PendingDeprecationWarning,
114-
stacklevel=1,
115-
)
100+
"""Return a fully-qualified incident string."""
116101
return google.api_core.path_template.expand(
117102
"projects/{project}/incidents/{incident}",
118103
project=project,
@@ -121,24 +106,14 @@ def incident_path(cls, project, incident):
121106

122107
@classmethod
123108
def project_path(cls, project):
124-
"""DEPRECATED. Return a fully-qualified project string."""
125-
warnings.warn(
126-
"Resource name helper functions are deprecated.",
127-
PendingDeprecationWarning,
128-
stacklevel=1,
129-
)
109+
"""Return a fully-qualified project string."""
130110
return google.api_core.path_template.expand(
131111
"projects/{project}", project=project
132112
)
133113

134114
@classmethod
135115
def role_assignment_path(cls, project, incident, role_assignment):
136-
"""DEPRECATED. Return a fully-qualified role_assignment string."""
137-
warnings.warn(
138-
"Resource name helper functions are deprecated.",
139-
PendingDeprecationWarning,
140-
stacklevel=1,
141-
)
116+
"""Return a fully-qualified role_assignment string."""
142117
return google.api_core.path_template.expand(
143118
"projects/{project}/incidents/{incident}/roleAssignments/{role_assignment}",
144119
project=project,
@@ -148,24 +123,14 @@ def role_assignment_path(cls, project, incident, role_assignment):
148123

149124
@classmethod
150125
def signal_path(cls, project, signal):
151-
"""DEPRECATED. Return a fully-qualified signal string."""
152-
warnings.warn(
153-
"Resource name helper functions are deprecated.",
154-
PendingDeprecationWarning,
155-
stacklevel=1,
156-
)
126+
"""Return a fully-qualified signal string."""
157127
return google.api_core.path_template.expand(
158128
"projects/{project}/signals/{signal}", project=project, signal=signal
159129
)
160130

161131
@classmethod
162132
def subscription_path(cls, project, incident, subscription):
163-
"""DEPRECATED. Return a fully-qualified subscription string."""
164-
warnings.warn(
165-
"Resource name helper functions are deprecated.",
166-
PendingDeprecationWarning,
167-
stacklevel=1,
168-
)
133+
"""Return a fully-qualified subscription string."""
169134
return google.api_core.path_template.expand(
170135
"projects/{project}/incidents/{incident}/subscriptions/{subscription}",
171136
project=project,
@@ -175,12 +140,7 @@ def subscription_path(cls, project, incident, subscription):
175140

176141
@classmethod
177142
def tag_path(cls, project, incident, tag):
178-
"""DEPRECATED. Return a fully-qualified tag string."""
179-
warnings.warn(
180-
"Resource name helper functions are deprecated.",
181-
PendingDeprecationWarning,
182-
stacklevel=1,
183-
)
143+
"""Return a fully-qualified tag string."""
184144
return google.api_core.path_template.expand(
185145
"projects/{project}/incidents/{incident}/tags/{tag}",
186146
project=project,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy