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(websecurityscanner): undeprecate resource name helpers, add 2.7 sunset warning (via synth) #10054

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.websecurityscanner_v1alpha import types
from google.cloud.websecurityscanner_v1alpha.gapic import enums
from google.cloud.websecurityscanner_v1alpha.gapic import web_security_scanner_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 WebSecurityScannerClient(web_security_scanner_client.WebSecurityScannerClient):
__doc__ = web_security_scanner_client.WebSecurityScannerClient.__doc__
enums = enums
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def finding_path(cls, project, scan_config, scan_run, finding):
"""DEPRECATED. Return a fully-qualified finding string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified finding string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}",
project=project,
Expand All @@ -104,24 +99,14 @@ def finding_path(cls, project, scan_config, scan_run, finding):

@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 scan_config_path(cls, project, scan_config):
"""DEPRECATED. Return a fully-qualified scan_config string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified scan_config string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}",
project=project,
Expand All @@ -130,12 +115,7 @@ def scan_config_path(cls, project, scan_config):

@classmethod
def scan_run_path(cls, project, scan_config, scan_run):
"""DEPRECATED. Return a fully-qualified scan_run string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified scan_run string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}",
project=project,
Expand Down
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.websecurityscanner_v1beta import types
from google.cloud.websecurityscanner_v1beta.gapic import enums
from google.cloud.websecurityscanner_v1beta.gapic import web_security_scanner_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 WebSecurityScannerClient(web_security_scanner_client.WebSecurityScannerClient):
__doc__ = web_security_scanner_client.WebSecurityScannerClient.__doc__
enums = enums
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def finding_path(cls, project, scan_config, scan_run, finding):
"""DEPRECATED. Return a fully-qualified finding string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified finding string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}",
project=project,
Expand All @@ -104,24 +99,14 @@ def finding_path(cls, project, scan_config, scan_run, finding):

@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 scan_config_path(cls, project, scan_config):
"""DEPRECATED. Return a fully-qualified scan_config string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified scan_config string."""
return google.api_core.path_template.expand(
"projects/{project}/scanConfigs/{scan_config}",
project=project,
Expand All @@ -130,12 +115,7 @@ def scan_config_path(cls, project, scan_config):

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