Skip to content

Commit

Permalink
fix(logging): deprecate resource name helper methods (via synth) (#9837)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and busunkim96 committed Nov 19, 2019
1 parent 6a2e9a7 commit 1a98305
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 30 deletions.
84 changes: 72 additions & 12 deletions logging/google/cloud/logging_v2/gapic/config_service_v2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,24 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

@classmethod
def billing_exclusion_path(cls, billing_account, exclusion):
"""Return a fully-qualified billing_exclusion string."""
"""DEPRECATED. Return a fully-qualified billing_exclusion string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"billingAccounts/{billing_account}/exclusions/{exclusion}",
billing_account=billing_account,
Expand All @@ -91,7 +101,12 @@ def billing_exclusion_path(cls, billing_account, exclusion):

@classmethod
def billing_sink_path(cls, billing_account, sink):
"""Return a fully-qualified billing_sink string."""
"""DEPRECATED. Return a fully-qualified billing_sink string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"billingAccounts/{billing_account}/sinks/{sink}",
billing_account=billing_account,
Expand All @@ -100,7 +115,12 @@ def billing_sink_path(cls, billing_account, sink):

@classmethod
def exclusion_path(cls, project, exclusion):
"""Return a fully-qualified exclusion string."""
"""DEPRECATED. Return a fully-qualified exclusion string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/exclusions/{exclusion}",
project=project,
Expand All @@ -109,12 +129,22 @@ def exclusion_path(cls, project, exclusion):

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

@classmethod
def folder_exclusion_path(cls, folder, exclusion):
"""Return a fully-qualified folder_exclusion string."""
"""DEPRECATED. Return a fully-qualified folder_exclusion string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"folders/{folder}/exclusions/{exclusion}",
folder=folder,
Expand All @@ -123,21 +153,36 @@ def folder_exclusion_path(cls, folder, exclusion):

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

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

@classmethod
def organization_exclusion_path(cls, organization, exclusion):
"""Return a fully-qualified organization_exclusion string."""
"""DEPRECATED. Return a fully-qualified organization_exclusion string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"organizations/{organization}/exclusions/{exclusion}",
organization=organization,
Expand All @@ -146,7 +191,12 @@ def organization_exclusion_path(cls, organization, exclusion):

@classmethod
def organization_sink_path(cls, organization, sink):
"""Return a fully-qualified organization_sink string."""
"""DEPRECATED. Return a fully-qualified organization_sink string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"organizations/{organization}/sinks/{sink}",
organization=organization,
Expand All @@ -155,14 +205,24 @@ def organization_sink_path(cls, organization, sink):

@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 sink_path(cls, project, sink):
"""Return a fully-qualified sink string."""
"""DEPRECATED. Return a fully-qualified sink string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/sinks/{sink}", project=project, sink=sink,
)
Expand Down
56 changes: 48 additions & 8 deletions logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,24 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

@classmethod
def billing_log_path(cls, billing_account, log):
"""Return a fully-qualified billing_log string."""
"""DEPRECATED. Return a fully-qualified billing_log string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"billingAccounts/{billing_account}/logs/{log}",
billing_account=billing_account,
Expand All @@ -95,33 +105,58 @@ def billing_log_path(cls, billing_account, log):

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

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

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

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

@classmethod
def organization_log_path(cls, organization, log):
"""Return a fully-qualified organization_log string."""
"""DEPRECATED. Return a fully-qualified organization_log string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"organizations/{organization}/logs/{log}",
organization=organization,
Expand All @@ -130,7 +165,12 @@ def organization_log_path(cls, organization, log):

@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
35 changes: 30 additions & 5 deletions logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,33 +81,58 @@ def from_service_account_file(cls, filename, *args, **kwargs):

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

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

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

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

@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
10 changes: 5 additions & 5 deletions logging/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-11-12T13:33:01.620730Z",
"updateTime": "2019-11-19T13:27:19.668508Z",
"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": "f69562be0608904932bdcfbc5ad8b9a22d9dceb8",
"internalRef": "279774957"
"sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a",
"internalRef": "281088257"
}
},
{
Expand Down

0 comments on commit 1a98305

Please sign in to comment.