Skip to content

Commit 1a98305

Browse files
yoshi-automationbusunkim96
authored andcommitted
fix(logging): deprecate resource name helper methods (via synth) (#9837)
1 parent 6a2e9a7 commit 1a98305

File tree

4 files changed

+155
-30
lines changed

4 files changed

+155
-30
lines changed

logging/google/cloud/logging_v2/gapic/config_service_v2_client.py

+72-12
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,24 @@ def from_service_account_file(cls, filename, *args, **kwargs):
7575

7676
@classmethod
7777
def billing_path(cls, billing_account):
78-
"""Return a fully-qualified billing string."""
78+
"""DEPRECATED. Return a fully-qualified billing string."""
79+
warnings.warn(
80+
"Resource name helper functions are deprecated.",
81+
PendingDeprecationWarning,
82+
stacklevel=1,
83+
)
7984
return google.api_core.path_template.expand(
8085
"billingAccounts/{billing_account}", billing_account=billing_account,
8186
)
8287

8388
@classmethod
8489
def billing_exclusion_path(cls, billing_account, exclusion):
85-
"""Return a fully-qualified billing_exclusion string."""
90+
"""DEPRECATED. Return a fully-qualified billing_exclusion string."""
91+
warnings.warn(
92+
"Resource name helper functions are deprecated.",
93+
PendingDeprecationWarning,
94+
stacklevel=1,
95+
)
8696
return google.api_core.path_template.expand(
8797
"billingAccounts/{billing_account}/exclusions/{exclusion}",
8898
billing_account=billing_account,
@@ -91,7 +101,12 @@ def billing_exclusion_path(cls, billing_account, exclusion):
91101

92102
@classmethod
93103
def billing_sink_path(cls, billing_account, sink):
94-
"""Return a fully-qualified billing_sink string."""
104+
"""DEPRECATED. Return a fully-qualified billing_sink string."""
105+
warnings.warn(
106+
"Resource name helper functions are deprecated.",
107+
PendingDeprecationWarning,
108+
stacklevel=1,
109+
)
95110
return google.api_core.path_template.expand(
96111
"billingAccounts/{billing_account}/sinks/{sink}",
97112
billing_account=billing_account,
@@ -100,7 +115,12 @@ def billing_sink_path(cls, billing_account, sink):
100115

101116
@classmethod
102117
def exclusion_path(cls, project, exclusion):
103-
"""Return a fully-qualified exclusion string."""
118+
"""DEPRECATED. Return a fully-qualified exclusion string."""
119+
warnings.warn(
120+
"Resource name helper functions are deprecated.",
121+
PendingDeprecationWarning,
122+
stacklevel=1,
123+
)
104124
return google.api_core.path_template.expand(
105125
"projects/{project}/exclusions/{exclusion}",
106126
project=project,
@@ -109,12 +129,22 @@ def exclusion_path(cls, project, exclusion):
109129

110130
@classmethod
111131
def folder_path(cls, folder):
112-
"""Return a fully-qualified folder string."""
132+
"""DEPRECATED. Return a fully-qualified folder string."""
133+
warnings.warn(
134+
"Resource name helper functions are deprecated.",
135+
PendingDeprecationWarning,
136+
stacklevel=1,
137+
)
113138
return google.api_core.path_template.expand("folders/{folder}", folder=folder,)
114139

115140
@classmethod
116141
def folder_exclusion_path(cls, folder, exclusion):
117-
"""Return a fully-qualified folder_exclusion string."""
142+
"""DEPRECATED. Return a fully-qualified folder_exclusion string."""
143+
warnings.warn(
144+
"Resource name helper functions are deprecated.",
145+
PendingDeprecationWarning,
146+
stacklevel=1,
147+
)
118148
return google.api_core.path_template.expand(
119149
"folders/{folder}/exclusions/{exclusion}",
120150
folder=folder,
@@ -123,21 +153,36 @@ def folder_exclusion_path(cls, folder, exclusion):
123153

124154
@classmethod
125155
def folder_sink_path(cls, folder, sink):
126-
"""Return a fully-qualified folder_sink string."""
156+
"""DEPRECATED. Return a fully-qualified folder_sink string."""
157+
warnings.warn(
158+
"Resource name helper functions are deprecated.",
159+
PendingDeprecationWarning,
160+
stacklevel=1,
161+
)
127162
return google.api_core.path_template.expand(
128163
"folders/{folder}/sinks/{sink}", folder=folder, sink=sink,
129164
)
130165

131166
@classmethod
132167
def organization_path(cls, organization):
133-
"""Return a fully-qualified organization string."""
168+
"""DEPRECATED. Return a fully-qualified organization string."""
169+
warnings.warn(
170+
"Resource name helper functions are deprecated.",
171+
PendingDeprecationWarning,
172+
stacklevel=1,
173+
)
134174
return google.api_core.path_template.expand(
135175
"organizations/{organization}", organization=organization,
136176
)
137177

138178
@classmethod
139179
def organization_exclusion_path(cls, organization, exclusion):
140-
"""Return a fully-qualified organization_exclusion string."""
180+
"""DEPRECATED. Return a fully-qualified organization_exclusion string."""
181+
warnings.warn(
182+
"Resource name helper functions are deprecated.",
183+
PendingDeprecationWarning,
184+
stacklevel=1,
185+
)
141186
return google.api_core.path_template.expand(
142187
"organizations/{organization}/exclusions/{exclusion}",
143188
organization=organization,
@@ -146,7 +191,12 @@ def organization_exclusion_path(cls, organization, exclusion):
146191

147192
@classmethod
148193
def organization_sink_path(cls, organization, sink):
149-
"""Return a fully-qualified organization_sink string."""
194+
"""DEPRECATED. Return a fully-qualified organization_sink string."""
195+
warnings.warn(
196+
"Resource name helper functions are deprecated.",
197+
PendingDeprecationWarning,
198+
stacklevel=1,
199+
)
150200
return google.api_core.path_template.expand(
151201
"organizations/{organization}/sinks/{sink}",
152202
organization=organization,
@@ -155,14 +205,24 @@ def organization_sink_path(cls, organization, sink):
155205

156206
@classmethod
157207
def project_path(cls, project):
158-
"""Return a fully-qualified project string."""
208+
"""DEPRECATED. Return a fully-qualified project string."""
209+
warnings.warn(
210+
"Resource name helper functions are deprecated.",
211+
PendingDeprecationWarning,
212+
stacklevel=1,
213+
)
159214
return google.api_core.path_template.expand(
160215
"projects/{project}", project=project,
161216
)
162217

163218
@classmethod
164219
def sink_path(cls, project, sink):
165-
"""Return a fully-qualified sink string."""
220+
"""DEPRECATED. Return a fully-qualified sink string."""
221+
warnings.warn(
222+
"Resource name helper functions are deprecated.",
223+
PendingDeprecationWarning,
224+
stacklevel=1,
225+
)
166226
return google.api_core.path_template.expand(
167227
"projects/{project}/sinks/{sink}", project=project, sink=sink,
168228
)

logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py

+48-8
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,24 @@ def from_service_account_file(cls, filename, *args, **kwargs):
7979

8080
@classmethod
8181
def billing_path(cls, billing_account):
82-
"""Return a fully-qualified billing string."""
82+
"""DEPRECATED. Return a fully-qualified billing string."""
83+
warnings.warn(
84+
"Resource name helper functions are deprecated.",
85+
PendingDeprecationWarning,
86+
stacklevel=1,
87+
)
8388
return google.api_core.path_template.expand(
8489
"billingAccounts/{billing_account}", billing_account=billing_account,
8590
)
8691

8792
@classmethod
8893
def billing_log_path(cls, billing_account, log):
89-
"""Return a fully-qualified billing_log string."""
94+
"""DEPRECATED. Return a fully-qualified billing_log string."""
95+
warnings.warn(
96+
"Resource name helper functions are deprecated.",
97+
PendingDeprecationWarning,
98+
stacklevel=1,
99+
)
90100
return google.api_core.path_template.expand(
91101
"billingAccounts/{billing_account}/logs/{log}",
92102
billing_account=billing_account,
@@ -95,33 +105,58 @@ def billing_log_path(cls, billing_account, log):
95105

96106
@classmethod
97107
def folder_path(cls, folder):
98-
"""Return a fully-qualified folder string."""
108+
"""DEPRECATED. Return a fully-qualified folder string."""
109+
warnings.warn(
110+
"Resource name helper functions are deprecated.",
111+
PendingDeprecationWarning,
112+
stacklevel=1,
113+
)
99114
return google.api_core.path_template.expand("folders/{folder}", folder=folder,)
100115

101116
@classmethod
102117
def folder_log_path(cls, folder, log):
103-
"""Return a fully-qualified folder_log string."""
118+
"""DEPRECATED. Return a fully-qualified folder_log string."""
119+
warnings.warn(
120+
"Resource name helper functions are deprecated.",
121+
PendingDeprecationWarning,
122+
stacklevel=1,
123+
)
104124
return google.api_core.path_template.expand(
105125
"folders/{folder}/logs/{log}", folder=folder, log=log,
106126
)
107127

108128
@classmethod
109129
def log_path(cls, project, log):
110-
"""Return a fully-qualified log string."""
130+
"""DEPRECATED. Return a fully-qualified log string."""
131+
warnings.warn(
132+
"Resource name helper functions are deprecated.",
133+
PendingDeprecationWarning,
134+
stacklevel=1,
135+
)
111136
return google.api_core.path_template.expand(
112137
"projects/{project}/logs/{log}", project=project, log=log,
113138
)
114139

115140
@classmethod
116141
def organization_path(cls, organization):
117-
"""Return a fully-qualified organization string."""
142+
"""DEPRECATED. Return a fully-qualified organization string."""
143+
warnings.warn(
144+
"Resource name helper functions are deprecated.",
145+
PendingDeprecationWarning,
146+
stacklevel=1,
147+
)
118148
return google.api_core.path_template.expand(
119149
"organizations/{organization}", organization=organization,
120150
)
121151

122152
@classmethod
123153
def organization_log_path(cls, organization, log):
124-
"""Return a fully-qualified organization_log string."""
154+
"""DEPRECATED. Return a fully-qualified organization_log string."""
155+
warnings.warn(
156+
"Resource name helper functions are deprecated.",
157+
PendingDeprecationWarning,
158+
stacklevel=1,
159+
)
125160
return google.api_core.path_template.expand(
126161
"organizations/{organization}/logs/{log}",
127162
organization=organization,
@@ -130,7 +165,12 @@ def organization_log_path(cls, organization, log):
130165

131166
@classmethod
132167
def project_path(cls, project):
133-
"""Return a fully-qualified project string."""
168+
"""DEPRECATED. Return a fully-qualified project string."""
169+
warnings.warn(
170+
"Resource name helper functions are deprecated.",
171+
PendingDeprecationWarning,
172+
stacklevel=1,
173+
)
134174
return google.api_core.path_template.expand(
135175
"projects/{project}", project=project,
136176
)

logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py

+30-5
Original file line numberDiff line numberDiff line change
@@ -81,33 +81,58 @@ def from_service_account_file(cls, filename, *args, **kwargs):
8181

8282
@classmethod
8383
def billing_path(cls, billing_account):
84-
"""Return a fully-qualified billing string."""
84+
"""DEPRECATED. Return a fully-qualified billing string."""
85+
warnings.warn(
86+
"Resource name helper functions are deprecated.",
87+
PendingDeprecationWarning,
88+
stacklevel=1,
89+
)
8590
return google.api_core.path_template.expand(
8691
"billingAccounts/{billing_account}", billing_account=billing_account,
8792
)
8893

8994
@classmethod
9095
def folder_path(cls, folder):
91-
"""Return a fully-qualified folder string."""
96+
"""DEPRECATED. Return a fully-qualified folder string."""
97+
warnings.warn(
98+
"Resource name helper functions are deprecated.",
99+
PendingDeprecationWarning,
100+
stacklevel=1,
101+
)
92102
return google.api_core.path_template.expand("folders/{folder}", folder=folder,)
93103

94104
@classmethod
95105
def metric_path(cls, project, metric):
96-
"""Return a fully-qualified metric string."""
106+
"""DEPRECATED. Return a fully-qualified metric string."""
107+
warnings.warn(
108+
"Resource name helper functions are deprecated.",
109+
PendingDeprecationWarning,
110+
stacklevel=1,
111+
)
97112
return google.api_core.path_template.expand(
98113
"projects/{project}/metrics/{metric}", project=project, metric=metric,
99114
)
100115

101116
@classmethod
102117
def organization_path(cls, organization):
103-
"""Return a fully-qualified organization string."""
118+
"""DEPRECATED. Return a fully-qualified organization string."""
119+
warnings.warn(
120+
"Resource name helper functions are deprecated.",
121+
PendingDeprecationWarning,
122+
stacklevel=1,
123+
)
104124
return google.api_core.path_template.expand(
105125
"organizations/{organization}", organization=organization,
106126
)
107127

108128
@classmethod
109129
def project_path(cls, project):
110-
"""Return a fully-qualified project string."""
130+
"""DEPRECATED. Return a fully-qualified project string."""
131+
warnings.warn(
132+
"Resource name helper functions are deprecated.",
133+
PendingDeprecationWarning,
134+
stacklevel=1,
135+
)
111136
return google.api_core.path_template.expand(
112137
"projects/{project}", project=project,
113138
)

logging/synth.metadata

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-11-12T13:33:01.620730Z",
2+
"updateTime": "2019-11-19T13:27:19.668508Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.41.1",
8-
"dockerImage": "googleapis/artman@sha256:545c758c76c3f779037aa259023ec3d1ef2d57d2c8cd00a222cb187d63ceac5e"
7+
"version": "0.42.1",
8+
"dockerImage": "googleapis/artman@sha256:c773192618c608a7a0415dd95282f841f8e6bcdef7dd760a988c93b77a64bd57"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "f69562be0608904932bdcfbc5ad8b9a22d9dceb8",
16-
"internalRef": "279774957"
15+
"sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a",
16+
"internalRef": "281088257"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)