Skip to content

Commit 954192b

Browse files
yoshi-automationtseaver
authored andcommitted
Add path-construction helpers to GAPIC clients (via synth). (#8631)
1 parent 539dc8f commit 954192b

File tree

4 files changed

+139
-5
lines changed

4 files changed

+139
-5
lines changed

google/cloud/logging_v2/gapic/config_service_v2_client.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,31 @@ def from_service_account_file(cls, filename, *args, **kwargs):
8080

8181
from_service_account_json = from_service_account_file
8282

83+
@classmethod
84+
def billing_path(cls, billing_account):
85+
"""Return a fully-qualified billing string."""
86+
return google.api_core.path_template.expand(
87+
"billingAccounts/{billing_account}", billing_account=billing_account
88+
)
89+
90+
@classmethod
91+
def billing_exclusion_path(cls, billing_account, exclusion):
92+
"""Return a fully-qualified billing_exclusion string."""
93+
return google.api_core.path_template.expand(
94+
"billingAccounts/{billing_account}/exclusions/{exclusion}",
95+
billing_account=billing_account,
96+
exclusion=exclusion,
97+
)
98+
99+
@classmethod
100+
def billing_sink_path(cls, billing_account, sink):
101+
"""Return a fully-qualified billing_sink string."""
102+
return google.api_core.path_template.expand(
103+
"billingAccounts/{billing_account}/sinks/{sink}",
104+
billing_account=billing_account,
105+
sink=sink,
106+
)
107+
83108
@classmethod
84109
def exclusion_path(cls, project, exclusion):
85110
"""Return a fully-qualified exclusion string."""
@@ -89,6 +114,52 @@ def exclusion_path(cls, project, exclusion):
89114
exclusion=exclusion,
90115
)
91116

117+
@classmethod
118+
def folder_path(cls, folder):
119+
"""Return a fully-qualified folder string."""
120+
return google.api_core.path_template.expand("folders/{folder}", folder=folder)
121+
122+
@classmethod
123+
def folder_exclusion_path(cls, folder, exclusion):
124+
"""Return a fully-qualified folder_exclusion string."""
125+
return google.api_core.path_template.expand(
126+
"folders/{folder}/exclusions/{exclusion}",
127+
folder=folder,
128+
exclusion=exclusion,
129+
)
130+
131+
@classmethod
132+
def folder_sink_path(cls, folder, sink):
133+
"""Return a fully-qualified folder_sink string."""
134+
return google.api_core.path_template.expand(
135+
"folders/{folder}/sinks/{sink}", folder=folder, sink=sink
136+
)
137+
138+
@classmethod
139+
def organization_path(cls, organization):
140+
"""Return a fully-qualified organization string."""
141+
return google.api_core.path_template.expand(
142+
"organizations/{organization}", organization=organization
143+
)
144+
145+
@classmethod
146+
def organization_exclusion_path(cls, organization, exclusion):
147+
"""Return a fully-qualified organization_exclusion string."""
148+
return google.api_core.path_template.expand(
149+
"organizations/{organization}/exclusions/{exclusion}",
150+
organization=organization,
151+
exclusion=exclusion,
152+
)
153+
154+
@classmethod
155+
def organization_sink_path(cls, organization, sink):
156+
"""Return a fully-qualified organization_sink string."""
157+
return google.api_core.path_template.expand(
158+
"organizations/{organization}/sinks/{sink}",
159+
organization=organization,
160+
sink=sink,
161+
)
162+
92163
@classmethod
93164
def project_path(cls, project):
94165
"""Return a fully-qualified project string."""

google/cloud/logging_v2/gapic/logging_service_v2_client.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,57 @@ def from_service_account_file(cls, filename, *args, **kwargs):
7474

7575
from_service_account_json = from_service_account_file
7676

77+
@classmethod
78+
def billing_path(cls, billing_account):
79+
"""Return a fully-qualified billing string."""
80+
return google.api_core.path_template.expand(
81+
"billingAccounts/{billing_account}", billing_account=billing_account
82+
)
83+
84+
@classmethod
85+
def billing_log_path(cls, billing_account, log):
86+
"""Return a fully-qualified billing_log string."""
87+
return google.api_core.path_template.expand(
88+
"billingAccounts/{billing_account}/logs/{log}",
89+
billing_account=billing_account,
90+
log=log,
91+
)
92+
93+
@classmethod
94+
def folder_path(cls, folder):
95+
"""Return a fully-qualified folder string."""
96+
return google.api_core.path_template.expand("folders/{folder}", folder=folder)
97+
98+
@classmethod
99+
def folder_log_path(cls, folder, log):
100+
"""Return a fully-qualified folder_log string."""
101+
return google.api_core.path_template.expand(
102+
"folders/{folder}/logs/{log}", folder=folder, log=log
103+
)
104+
77105
@classmethod
78106
def log_path(cls, project, log):
79107
"""Return a fully-qualified log string."""
80108
return google.api_core.path_template.expand(
81109
"projects/{project}/logs/{log}", project=project, log=log
82110
)
83111

112+
@classmethod
113+
def organization_path(cls, organization):
114+
"""Return a fully-qualified organization string."""
115+
return google.api_core.path_template.expand(
116+
"organizations/{organization}", organization=organization
117+
)
118+
119+
@classmethod
120+
def organization_log_path(cls, organization, log):
121+
"""Return a fully-qualified organization_log string."""
122+
return google.api_core.path_template.expand(
123+
"organizations/{organization}/logs/{log}",
124+
organization=organization,
125+
log=log,
126+
)
127+
84128
@classmethod
85129
def project_path(cls, project):
86130
"""Return a fully-qualified project string."""

google/cloud/logging_v2/gapic/metrics_service_v2_client.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,32 @@ def from_service_account_file(cls, filename, *args, **kwargs):
7979

8080
from_service_account_json = from_service_account_file
8181

82+
@classmethod
83+
def billing_path(cls, billing_account):
84+
"""Return a fully-qualified billing string."""
85+
return google.api_core.path_template.expand(
86+
"billingAccounts/{billing_account}", billing_account=billing_account
87+
)
88+
89+
@classmethod
90+
def folder_path(cls, folder):
91+
"""Return a fully-qualified folder string."""
92+
return google.api_core.path_template.expand("folders/{folder}", folder=folder)
93+
8294
@classmethod
8395
def metric_path(cls, project, metric):
8496
"""Return a fully-qualified metric string."""
8597
return google.api_core.path_template.expand(
8698
"projects/{project}/metrics/{metric}", project=project, metric=metric
8799
)
88100

101+
@classmethod
102+
def organization_path(cls, organization):
103+
"""Return a fully-qualified organization string."""
104+
return google.api_core.path_template.expand(
105+
"organizations/{organization}", organization=organization
106+
)
107+
89108
@classmethod
90109
def project_path(cls, project):
91110
"""Return a fully-qualified project string."""

synth.metadata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-06-29T12:26:54.494632Z",
2+
"updateTime": "2019-07-10T12:23:32.614992Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.29.2",
8-
"dockerImage": "googleapis/artman@sha256:45263333b058a4b3c26a8b7680a2710f43eae3d250f791a6cb66423991dcb2df"
7+
"version": "0.29.4",
8+
"dockerImage": "googleapis/artman@sha256:63f21e83cb92680b7001dc381069e962c9e6dee314fd8365ac554c07c89221fb"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "84c8ad4e52f8eec8f08a60636cfa597b86969b5c",
16-
"internalRef": "255474859"
15+
"sha": "16c0ea3cde17a897ba04b7b94d9bf4dd57e3227e",
16+
"internalRef": "257239177"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)