Skip to content

Commit 42a152c

Browse files
yoshi-automationbusunkim96
authored andcommitted
feat(websecurityscanner): undeprecate resource name helpers, add 2.7 sunset warning (via synth) (#10054)
1 parent 838a65b commit 42a152c

File tree

5 files changed

+3619
-53
lines changed

5 files changed

+3619
-53
lines changed

websecurityscanner/google/cloud/websecurityscanner_v1alpha/__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.websecurityscanner_v1alpha import types
2123
from google.cloud.websecurityscanner_v1alpha.gapic import enums
2224
from google.cloud.websecurityscanner_v1alpha.gapic import web_security_scanner_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 WebSecurityScannerClient(web_security_scanner_client.WebSecurityScannerClient):
2637
__doc__ = web_security_scanner_client.WebSecurityScannerClient.__doc__
2738
enums = enums

websecurityscanner/google/cloud/websecurityscanner_v1alpha/gapic/web_security_scanner_client.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
8888

8989
@classmethod
9090
def finding_path(cls, project, scan_config, scan_run, finding):
91-
"""DEPRECATED. Return a fully-qualified finding string."""
92-
warnings.warn(
93-
"Resource name helper functions are deprecated.",
94-
PendingDeprecationWarning,
95-
stacklevel=1,
96-
)
91+
"""Return a fully-qualified finding string."""
9792
return google.api_core.path_template.expand(
9893
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}",
9994
project=project,
@@ -104,24 +99,14 @@ def finding_path(cls, project, scan_config, scan_run, finding):
10499

105100
@classmethod
106101
def project_path(cls, project):
107-
"""DEPRECATED. Return a fully-qualified project string."""
108-
warnings.warn(
109-
"Resource name helper functions are deprecated.",
110-
PendingDeprecationWarning,
111-
stacklevel=1,
112-
)
102+
"""Return a fully-qualified project string."""
113103
return google.api_core.path_template.expand(
114104
"projects/{project}", project=project
115105
)
116106

117107
@classmethod
118108
def scan_config_path(cls, project, scan_config):
119-
"""DEPRECATED. Return a fully-qualified scan_config string."""
120-
warnings.warn(
121-
"Resource name helper functions are deprecated.",
122-
PendingDeprecationWarning,
123-
stacklevel=1,
124-
)
109+
"""Return a fully-qualified scan_config string."""
125110
return google.api_core.path_template.expand(
126111
"projects/{project}/scanConfigs/{scan_config}",
127112
project=project,
@@ -130,12 +115,7 @@ def scan_config_path(cls, project, scan_config):
130115

131116
@classmethod
132117
def scan_run_path(cls, project, scan_config, scan_run):
133-
"""DEPRECATED. Return a fully-qualified scan_run string."""
134-
warnings.warn(
135-
"Resource name helper functions are deprecated.",
136-
PendingDeprecationWarning,
137-
stacklevel=1,
138-
)
118+
"""Return a fully-qualified scan_run string."""
139119
return google.api_core.path_template.expand(
140120
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}",
141121
project=project,

websecurityscanner/google/cloud/websecurityscanner_v1beta/__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.websecurityscanner_v1beta import types
2123
from google.cloud.websecurityscanner_v1beta.gapic import enums
2224
from google.cloud.websecurityscanner_v1beta.gapic import web_security_scanner_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 WebSecurityScannerClient(web_security_scanner_client.WebSecurityScannerClient):
2637
__doc__ = web_security_scanner_client.WebSecurityScannerClient.__doc__
2738
enums = enums

websecurityscanner/google/cloud/websecurityscanner_v1beta/gapic/web_security_scanner_client.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):
8888

8989
@classmethod
9090
def finding_path(cls, project, scan_config, scan_run, finding):
91-
"""DEPRECATED. Return a fully-qualified finding string."""
92-
warnings.warn(
93-
"Resource name helper functions are deprecated.",
94-
PendingDeprecationWarning,
95-
stacklevel=1,
96-
)
91+
"""Return a fully-qualified finding string."""
9792
return google.api_core.path_template.expand(
9893
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}",
9994
project=project,
@@ -104,24 +99,14 @@ def finding_path(cls, project, scan_config, scan_run, finding):
10499

105100
@classmethod
106101
def project_path(cls, project):
107-
"""DEPRECATED. Return a fully-qualified project string."""
108-
warnings.warn(
109-
"Resource name helper functions are deprecated.",
110-
PendingDeprecationWarning,
111-
stacklevel=1,
112-
)
102+
"""Return a fully-qualified project string."""
113103
return google.api_core.path_template.expand(
114104
"projects/{project}", project=project
115105
)
116106

117107
@classmethod
118108
def scan_config_path(cls, project, scan_config):
119-
"""DEPRECATED. Return a fully-qualified scan_config string."""
120-
warnings.warn(
121-
"Resource name helper functions are deprecated.",
122-
PendingDeprecationWarning,
123-
stacklevel=1,
124-
)
109+
"""Return a fully-qualified scan_config string."""
125110
return google.api_core.path_template.expand(
126111
"projects/{project}/scanConfigs/{scan_config}",
127112
project=project,
@@ -130,12 +115,7 @@ def scan_config_path(cls, project, scan_config):
130115

131116
@classmethod
132117
def scan_run_path(cls, project, scan_config, scan_run):
133-
"""DEPRECATED. Return a fully-qualified scan_run string."""
134-
warnings.warn(
135-
"Resource name helper functions are deprecated.",
136-
PendingDeprecationWarning,
137-
stacklevel=1,
138-
)
118+
"""Return a fully-qualified scan_run string."""
139119
return google.api_core.path_template.expand(
140120
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}",
141121
project=project,

0 commit comments

Comments
 (0)