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(monitoring): un-deprecate resource name helpers, add 2.7 sunset warning; bump copyright year to 2020; use templated noxfile (via synth) #10047

Merged
merged 4 commits into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 monitoring/google/cloud/monitoring_v3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@


from __future__ import absolute_import
import sys
import warnings

from google.cloud.monitoring_v3 import types
from google.cloud.monitoring_v3.gapic import alert_policy_service_client
Expand All @@ -29,6 +31,15 @@
from google.cloud.monitoring_v3.gapic import uptime_check_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 AlertPolicyServiceClient(alert_policy_service_client.AlertPolicyServiceClient):
__doc__ = alert_policy_service_client.AlertPolicyServiceClient.__doc__
enums = enums
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def alert_policy_path(cls, project, alert_policy):
"""DEPRECATED. Return a fully-qualified alert_policy string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified alert_policy string."""
return google.api_core.path_template.expand(
"projects/{project}/alertPolicies/{alert_policy}",
project=project,
Expand All @@ -104,12 +99,7 @@ def alert_policy_path(cls, project, alert_policy):

@classmethod
def alert_policy_condition_path(cls, project, alert_policy, condition):
"""DEPRECATED. Return a fully-qualified alert_policy_condition string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified alert_policy_condition string."""
return google.api_core.path_template.expand(
"projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}",
project=project,
Expand All @@ -119,12 +109,7 @@ def alert_policy_condition_path(cls, project, alert_policy, condition):

@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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,24 +95,14 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

@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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def metric_descriptor_path(cls, project, metric_descriptor):
"""DEPRECATED. Return a fully-qualified metric_descriptor string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified metric_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/metricDescriptors/{metric_descriptor=**}",
project=project,
Expand All @@ -104,12 +99,7 @@ def metric_descriptor_path(cls, project, metric_descriptor):

@classmethod
def monitored_resource_descriptor_path(cls, project, monitored_resource_descriptor):
"""DEPRECATED. Return a fully-qualified monitored_resource_descriptor string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified monitored_resource_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}",
project=project,
Expand All @@ -118,12 +108,7 @@ def monitored_resource_descriptor_path(cls, project, monitored_resource_descript

@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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,7 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def notification_channel_path(cls, project, notification_channel):
"""DEPRECATED. Return a fully-qualified notification_channel string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified notification_channel string."""
return google.api_core.path_template.expand(
"projects/{project}/notificationChannels/{notification_channel}",
project=project,
Expand All @@ -110,12 +105,7 @@ def notification_channel_path(cls, project, notification_channel):

@classmethod
def notification_channel_descriptor_path(cls, project, channel_descriptor):
"""DEPRECATED. Return a fully-qualified notification_channel_descriptor string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified notification_channel_descriptor string."""
return google.api_core.path_template.expand(
"projects/{project}/notificationChannelDescriptors/{channel_descriptor}",
project=project,
Expand All @@ -124,12 +114,7 @@ def notification_channel_descriptor_path(cls, project, channel_descriptor):

@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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,36 +101,21 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@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 service_path(cls, project, service):
"""DEPRECATED. Return a fully-qualified service string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified service string."""
return google.api_core.path_template.expand(
"projects/{project}/services/{service}", project=project, service=service,
)

@classmethod
def service_level_objective_path(cls, project, service, service_level_objective):
"""DEPRECATED. Return a fully-qualified service_level_objective string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified service_level_objective string."""
return google.api_core.path_template.expand(
"projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}",
project=project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,14 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@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 uptime_check_config_path(cls, project, uptime_check_config):
"""DEPRECATED. Return a fully-qualified uptime_check_config string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
"""Return a fully-qualified uptime_check_config string."""
return google.api_core.path_template.expand(
"projects/{project}/uptimeCheckConfigs/{uptime_check_config}",
project=project,
Expand Down
Loading