Skip to content

Commit

Permalink
fix(monitoring): deprecate resource name helper methods; update docs …
Browse files Browse the repository at this point in the history
…configuration (via synth) (#9838)
  • Loading branch information
yoshi-automation authored and busunkim96 committed Nov 19, 2019
1 parent d6d974e commit 40340c9
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

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

@classmethod
def project_path(cls, project):
"""Return a fully-qualified project string."""
"""DEPRECATED. Return a fully-qualified project string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
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,14 +95,24 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

@classmethod
def project_path(cls, project):
"""Return a fully-qualified project string."""
"""DEPRECATED. Return a fully-qualified project string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
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,7 +90,12 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

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

@classmethod
def project_path(cls, project):
"""Return a fully-qualified project string."""
"""DEPRECATED. Return a fully-qualified project string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
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,7 +96,12 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

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

@classmethod
def project_path(cls, project):
"""Return a fully-qualified project string."""
"""DEPRECATED. Return a fully-qualified project string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
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,21 +101,36 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

@classmethod
def service_path(cls, project, service):
"""Return a fully-qualified service string."""
"""DEPRECATED. Return a fully-qualified service string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
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):
"""Return a fully-qualified service_level_objective string."""
"""DEPRECATED. Return a fully-qualified service_level_objective string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
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,14 +108,24 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

@classmethod
def uptime_check_config_path(cls, project, uptime_check_config):
"""Return a fully-qualified uptime_check_config string."""
"""DEPRECATED. Return a fully-qualified uptime_check_config string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/uptimeCheckConfigs/{uptime_check_config}",
project=project,
Expand Down
10 changes: 5 additions & 5 deletions monitoring/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-11-14T13:26:57.703896Z",
"updateTime": "2019-11-19T13:28:35.257420Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.41.1",
"dockerImage": "googleapis/artman@sha256:545c758c76c3f779037aa259023ec3d1ef2d57d2c8cd00a222cb187d63ceac5e"
"version": "0.42.1",
"dockerImage": "googleapis/artman@sha256:c773192618c608a7a0415dd95282f841f8e6bcdef7dd760a988c93b77a64bd57"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "4f747bda9b099b4426f495985680d16d0227fa5f",
"internalRef": "280394936"
"sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a",
"internalRef": "281088257"
}
},
{
Expand Down

0 comments on commit 40340c9

Please sign in to comment.