google-cloud-billing-v1 0.15.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +72 -101
- data/lib/google/cloud/billing/v1/cloud_billing/client.rb +150 -12
- data/lib/google/cloud/billing/v1/cloud_billing/paths.rb +40 -4
- data/lib/google/cloud/billing/v1/cloud_billing/rest/client.rb +145 -11
- data/lib/google/cloud/billing/v1/cloud_billing/rest/service_stub.rb +112 -2
- data/lib/google/cloud/billing/v1/cloud_billing_pb.rb +2 -1
- data/lib/google/cloud/billing/v1/cloud_billing_services_pb.rb +4 -1
- data/lib/google/cloud/billing/v1/cloud_catalog/client.rb +31 -8
- data/lib/google/cloud/billing/v1/cloud_catalog/rest/client.rb +33 -7
- data/lib/google/cloud/billing/v1/cloud_catalog/rest/service_stub.rb +14 -2
- data/lib/google/cloud/billing/v1/version.rb +1 -1
- data/proto_docs/google/api/client.rb +14 -0
- data/proto_docs/google/cloud/billing/v1/cloud_billing.rb +45 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69b9cf0939f5fa48e2e27c276aec0d6b9d550a086411a3e80c166dfc82f25ca2
|
4
|
+
data.tar.gz: a8ace83814440ed6358a7fc695e1d6f5177321af3014622804849691f16c10cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b06643be2bf76cd015b292b1373cb3b1a1984ec5ecc32fe2c36fdeb2321b9501377c32461e72fd891c7f78a137791e6afd3e4392c5d84c70cb771c87c19eace0
|
7
|
+
data.tar.gz: 6ce95a00909b38013b202eca9d15531618e4e80bd536c96c5ddc5a3f7550f010e9f6e75aa77b54743a825d6d087c1df520aadae4ec20cc38af408642a3505309
|
data/AUTHENTICATION.md
CHANGED
@@ -1,151 +1,122 @@
|
|
1
1
|
# Authentication
|
2
2
|
|
3
|
-
|
4
|
-
[
|
5
|
-
|
6
|
-
[Google Cloud Platform environments](#google-cloud-platform-environments) the
|
7
|
-
credentials will be discovered automatically. When running on other
|
8
|
-
environments, the Service Account credentials can be specified by providing the
|
9
|
-
path to the
|
10
|
-
[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys)
|
11
|
-
for the account (or the JSON itself) in
|
12
|
-
[environment variables](#environment-variables). Additionally, Cloud SDK
|
13
|
-
credentials can also be discovered automatically, but this is only recommended
|
14
|
-
during development.
|
3
|
+
The recommended way to authenticate to the google-cloud-billing-v1 library is to use
|
4
|
+
[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials).
|
5
|
+
To review all of your authentication options, see [Credentials lookup](#credential-lookup).
|
15
6
|
|
16
7
|
## Quickstart
|
17
8
|
|
18
|
-
|
19
|
-
|
9
|
+
The following example shows how to set up authentication for a local development
|
10
|
+
environment with your user credentials.
|
20
11
|
|
21
|
-
|
22
|
-
|
23
|
-
```
|
24
|
-
|
25
|
-
3. Initialize the client.
|
12
|
+
**NOTE:** This method is _not_ recommended for running in production. User credentials
|
13
|
+
should be used only during development.
|
26
14
|
|
27
|
-
|
28
|
-
|
15
|
+
1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk).
|
16
|
+
2. Set up a local ADC file with your user credentials:
|
29
17
|
|
30
|
-
|
18
|
+
```sh
|
19
|
+
gcloud auth application-default login
|
31
20
|
```
|
32
21
|
|
33
|
-
|
34
|
-
|
35
|
-
The google-cloud-billing-v1 library aims to make authentication
|
36
|
-
as simple as possible, and provides several mechanisms to configure your system
|
37
|
-
without requiring **Service Account Credentials** directly in code.
|
38
|
-
|
39
|
-
**Credentials** are discovered in the following order:
|
40
|
-
|
41
|
-
1. Specify credentials in method arguments
|
42
|
-
2. Specify credentials in configuration
|
43
|
-
3. Discover credentials path in environment variables
|
44
|
-
4. Discover credentials JSON in environment variables
|
45
|
-
5. Discover credentials file in the Cloud SDK's path
|
46
|
-
6. Discover GCP credentials
|
47
|
-
|
48
|
-
### Google Cloud Platform environments
|
22
|
+
3. Write code as if already authenticated.
|
49
23
|
|
50
|
-
|
51
|
-
|
52
|
-
Functions (GCF) and Cloud Run, **Credentials** are discovered automatically.
|
53
|
-
Code should be written as if already authenticated.
|
24
|
+
For more information about setting up authentication for a local development environment, see
|
25
|
+
[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev).
|
54
26
|
|
55
|
-
|
27
|
+
## Credential Lookup
|
56
28
|
|
57
|
-
The
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
**Credentials JSON** file can be stored in the environment variable, or the
|
62
|
-
**Credentials JSON** itself can be stored for environments such as Docker
|
63
|
-
containers where writing files is difficult or not encouraged.
|
29
|
+
The google-cloud-billing-v1 library provides several mechanisms to configure your system.
|
30
|
+
Generally, using Application Default Credentials to facilitate automatic
|
31
|
+
credentials discovery is the easist method. But if you need to explicitly specify
|
32
|
+
credentials, there are several methods available to you.
|
64
33
|
|
65
|
-
|
66
|
-
checks for credentials are configured on the service Credentials class (such as
|
67
|
-
{::Google::Cloud::Billing::V1::CloudBilling::Credentials}):
|
34
|
+
Credentials are accepted in the following ways, in the following order or precedence:
|
68
35
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
36
|
+
1. Credentials specified in method arguments
|
37
|
+
2. Credentials specified in configuration
|
38
|
+
3. Credentials pointed to or included in environment variables
|
39
|
+
4. Credentials found in local ADC file
|
40
|
+
5. Credentials returned by the metadata server for the attached service account (GCP)
|
74
41
|
|
75
|
-
|
76
|
-
require "google/cloud/billing/v1"
|
77
|
-
|
78
|
-
ENV["BILLING_CREDENTIALS"] = "path/to/keyfile.json"
|
42
|
+
### Configuration
|
79
43
|
|
80
|
-
client
|
81
|
-
|
44
|
+
You can configure a path to a JSON credentials file, either for an individual client object or
|
45
|
+
globally, for all client objects. The JSON file can contain credentials created for
|
46
|
+
[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation),
|
47
|
+
[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a
|
48
|
+
[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key).
|
82
49
|
|
83
|
-
|
50
|
+
Note: Service account keys are a security risk if not managed correctly. You should
|
51
|
+
[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree)
|
52
|
+
whenever possible.
|
84
53
|
|
85
|
-
|
86
|
-
it in an environment variable. Either on an individual client initialization:
|
54
|
+
To configure a credentials file for an individual client initialization:
|
87
55
|
|
88
56
|
```ruby
|
89
57
|
require "google/cloud/billing/v1"
|
90
58
|
|
91
59
|
client = ::Google::Cloud::Billing::V1::CloudBilling::Client.new do |config|
|
92
|
-
config.credentials = "path/to/
|
60
|
+
config.credentials = "path/to/credentialfile.json"
|
93
61
|
end
|
94
62
|
```
|
95
63
|
|
96
|
-
|
64
|
+
To configure a credentials file globally for all clients:
|
97
65
|
|
98
66
|
```ruby
|
99
67
|
require "google/cloud/billing/v1"
|
100
68
|
|
101
69
|
::Google::Cloud::Billing::V1::CloudBilling::Client.configure do |config|
|
102
|
-
config.credentials = "path/to/
|
70
|
+
config.credentials = "path/to/credentialfile.json"
|
103
71
|
end
|
104
72
|
|
105
73
|
client = ::Google::Cloud::Billing::V1::CloudBilling::Client.new
|
106
74
|
```
|
107
75
|
|
108
|
-
###
|
76
|
+
### Environment Variables
|
109
77
|
|
110
|
-
|
111
|
-
|
112
|
-
|
78
|
+
You can also use an environment variable to provide a JSON credentials file.
|
79
|
+
The environment variable can contain a path to the credentials file or, for
|
80
|
+
environments such as Docker containers where writing files is not encouraged,
|
81
|
+
you can include the credentials file itself.
|
113
82
|
|
114
|
-
|
83
|
+
The JSON file can contain credentials created for
|
84
|
+
[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation),
|
85
|
+
[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a
|
86
|
+
[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key).
|
115
87
|
|
116
|
-
|
117
|
-
|
118
|
-
|
88
|
+
Note: Service account keys are a security risk if not managed correctly. You should
|
89
|
+
[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree)
|
90
|
+
whenever possible.
|
91
|
+
|
92
|
+
The environment variables that google-cloud-billing-v1
|
93
|
+
checks for credentials are:
|
119
94
|
|
120
|
-
|
121
|
-
*
|
95
|
+
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
96
|
+
* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
|
122
97
|
|
123
|
-
|
98
|
+
```ruby
|
99
|
+
require "google/cloud/billing/v1"
|
124
100
|
|
125
|
-
|
126
|
-
connect to the APIs. You will use the **JSON key file** to
|
127
|
-
connect to most services with google-cloud-billing-v1.
|
101
|
+
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
|
128
102
|
|
129
|
-
|
130
|
-
|
131
|
-
need a Google Developers service account.
|
103
|
+
client = ::Google::Cloud::Billing::V1::CloudBilling::Client.new
|
104
|
+
```
|
132
105
|
|
133
|
-
|
134
|
-
2. Create a new project or click on an existing project.
|
135
|
-
3. Activate the menu in the upper left and select **APIs & Services**. From
|
136
|
-
here, you will enable the APIs that your application requires.
|
106
|
+
### Local ADC file
|
137
107
|
|
138
|
-
|
108
|
+
You can set up a local ADC file with your user credentials for authentication during
|
109
|
+
development. If credentials are not provided in code or in environment variables,
|
110
|
+
then the local ADC credentials are discovered.
|
139
111
|
|
140
|
-
|
112
|
+
Follow the steps in [Quickstart](#quickstart) to set up a local ADC file.
|
141
113
|
|
142
|
-
|
143
|
-
"Service account" to be guided through downloading a new JSON key file.
|
114
|
+
### Google Cloud Platform environments
|
144
115
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
116
|
+
When running on Google Cloud Platform (GCP), including Google Compute Engine
|
117
|
+
(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud
|
118
|
+
Functions (GCF) and Cloud Run, credentials are retrieved from the attached
|
119
|
+
service account automatically. Code should be written as if already authenticated.
|
149
120
|
|
150
|
-
|
151
|
-
|
121
|
+
For more information, see
|
122
|
+
[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa).
|
@@ -31,6 +31,9 @@ module Google
|
|
31
31
|
# projects.
|
32
32
|
#
|
33
33
|
class Client
|
34
|
+
# @private
|
35
|
+
DEFAULT_ENDPOINT_TEMPLATE = "cloudbilling.$UNIVERSE_DOMAIN$"
|
36
|
+
|
34
37
|
include Paths
|
35
38
|
|
36
39
|
# @private
|
@@ -138,6 +141,15 @@ module Google
|
|
138
141
|
@config
|
139
142
|
end
|
140
143
|
|
144
|
+
##
|
145
|
+
# The effective universe domain
|
146
|
+
#
|
147
|
+
# @return [String]
|
148
|
+
#
|
149
|
+
def universe_domain
|
150
|
+
@cloud_billing_stub.universe_domain
|
151
|
+
end
|
152
|
+
|
141
153
|
##
|
142
154
|
# Create a new CloudBilling client object.
|
143
155
|
#
|
@@ -171,8 +183,9 @@ module Google
|
|
171
183
|
credentials = @config.credentials
|
172
184
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
173
185
|
# but only if the default endpoint does not have a region prefix.
|
174
|
-
enable_self_signed_jwt = @config.endpoint
|
175
|
-
|
186
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
187
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
188
|
+
!@config.endpoint.split(".").first.include?("-"))
|
176
189
|
credentials ||= Credentials.default scope: @config.scope,
|
177
190
|
enable_self_signed_jwt: enable_self_signed_jwt
|
178
191
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -183,8 +196,10 @@ module Google
|
|
183
196
|
|
184
197
|
@cloud_billing_stub = ::Gapic::ServiceStub.new(
|
185
198
|
::Google::Cloud::Billing::V1::CloudBilling::Stub,
|
186
|
-
credentials:
|
187
|
-
endpoint:
|
199
|
+
credentials: credentials,
|
200
|
+
endpoint: @config.endpoint,
|
201
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
202
|
+
universe_domain: @config.universe_domain,
|
188
203
|
channel_args: @config.channel_args,
|
189
204
|
interceptors: @config.interceptors,
|
190
205
|
channel_pool_config: @config.channel_pool
|
@@ -296,7 +311,7 @@ module Google
|
|
296
311
|
# @param options [::Gapic::CallOptions, ::Hash]
|
297
312
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
298
313
|
#
|
299
|
-
# @overload list_billing_accounts(page_size: nil, page_token: nil, filter: nil)
|
314
|
+
# @overload list_billing_accounts(page_size: nil, page_token: nil, filter: nil, parent: nil)
|
300
315
|
# Pass arguments to `list_billing_accounts` via keyword arguments. Note that at
|
301
316
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
302
317
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -313,8 +328,16 @@ module Google
|
|
313
328
|
# This only supports filtering for
|
314
329
|
# [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
|
315
330
|
# single provided parent billing account.
|
316
|
-
# (
|
331
|
+
# (for example,
|
332
|
+
# `master_billing_account=billingAccounts/012345-678901-ABCDEF`).
|
317
333
|
# Boolean algebra and other fields are not currently supported.
|
334
|
+
# @param parent [::String]
|
335
|
+
# Optional. The parent resource to list billing accounts from.
|
336
|
+
# Format:
|
337
|
+
# - `organizations/{organization_id}`, for example,
|
338
|
+
# `organizations/12345678`
|
339
|
+
# - `billingAccounts/{billing_account_id}`, for example,
|
340
|
+
# `billingAccounts/012345-567890-ABCDEF`
|
318
341
|
#
|
319
342
|
# @yield [response, operation] Access the result along with the RPC operation
|
320
343
|
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Billing::V1::BillingAccount>]
|
@@ -500,7 +523,7 @@ module Google
|
|
500
523
|
# @param options [::Gapic::CallOptions, ::Hash]
|
501
524
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
502
525
|
#
|
503
|
-
# @overload create_billing_account(billing_account: nil)
|
526
|
+
# @overload create_billing_account(billing_account: nil, parent: nil)
|
504
527
|
# Pass arguments to `create_billing_account` via keyword arguments. Note that at
|
505
528
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
506
529
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -510,6 +533,13 @@ module Google
|
|
510
533
|
# Currently CreateBillingAccount only supports subaccount creation, so
|
511
534
|
# any created billing accounts must be under a provided parent billing
|
512
535
|
# account.
|
536
|
+
# @param parent [::String]
|
537
|
+
# Optional. The parent to create a billing account from.
|
538
|
+
# Format:
|
539
|
+
# - `organizations/{organization_id}`, for example,
|
540
|
+
# `organizations/12345678`
|
541
|
+
# - `billingAccounts/{billing_account_id}`, for example,
|
542
|
+
# `billingAccounts/012345-567890-ABCDEF`
|
513
543
|
#
|
514
544
|
# @yield [response, operation] Access the result along with the RPC operation
|
515
545
|
# @yieldparam response [::Google::Cloud::Billing::V1::BillingAccount]
|
@@ -773,7 +803,8 @@ module Google
|
|
773
803
|
# account, even if the charge occurred before the new billing account was
|
774
804
|
# assigned to the project.
|
775
805
|
#
|
776
|
-
# The current authenticated user must have ownership privileges for both
|
806
|
+
# The current authenticated user must have ownership privileges for both
|
807
|
+
# the
|
777
808
|
# [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
|
778
809
|
# ) and the [billing
|
779
810
|
# account](https://cloud.google.com/billing/docs/how-to/billing-access).
|
@@ -1166,6 +1197,98 @@ module Google
|
|
1166
1197
|
raise ::Google::Cloud::Error.from_error(e)
|
1167
1198
|
end
|
1168
1199
|
|
1200
|
+
##
|
1201
|
+
# Changes which parent organization a billing account belongs to.
|
1202
|
+
#
|
1203
|
+
# @overload move_billing_account(request, options = nil)
|
1204
|
+
# Pass arguments to `move_billing_account` via a request object, either of type
|
1205
|
+
# {::Google::Cloud::Billing::V1::MoveBillingAccountRequest} or an equivalent Hash.
|
1206
|
+
#
|
1207
|
+
# @param request [::Google::Cloud::Billing::V1::MoveBillingAccountRequest, ::Hash]
|
1208
|
+
# A request object representing the call parameters. Required. To specify no
|
1209
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1210
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1211
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1212
|
+
#
|
1213
|
+
# @overload move_billing_account(name: nil, destination_parent: nil)
|
1214
|
+
# Pass arguments to `move_billing_account` via keyword arguments. Note that at
|
1215
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1216
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1217
|
+
#
|
1218
|
+
# @param name [::String]
|
1219
|
+
# Required. The resource name of the billing account to move.
|
1220
|
+
# Must be of the form `billingAccounts/{billing_account_id}`.
|
1221
|
+
# The specified billing account cannot be a subaccount, since a subaccount
|
1222
|
+
# always belongs to the same organization as its parent account.
|
1223
|
+
# @param destination_parent [::String]
|
1224
|
+
# Required. The resource name of the Organization to reparent
|
1225
|
+
# the billing account under.
|
1226
|
+
# Must be of the form `organizations/{organization_id}`.
|
1227
|
+
#
|
1228
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1229
|
+
# @yieldparam response [::Google::Cloud::Billing::V1::BillingAccount]
|
1230
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1231
|
+
#
|
1232
|
+
# @return [::Google::Cloud::Billing::V1::BillingAccount]
|
1233
|
+
#
|
1234
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1235
|
+
#
|
1236
|
+
# @example Basic example
|
1237
|
+
# require "google/cloud/billing/v1"
|
1238
|
+
#
|
1239
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1240
|
+
# client = Google::Cloud::Billing::V1::CloudBilling::Client.new
|
1241
|
+
#
|
1242
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1243
|
+
# request = Google::Cloud::Billing::V1::MoveBillingAccountRequest.new
|
1244
|
+
#
|
1245
|
+
# # Call the move_billing_account method.
|
1246
|
+
# result = client.move_billing_account request
|
1247
|
+
#
|
1248
|
+
# # The returned object is of type Google::Cloud::Billing::V1::BillingAccount.
|
1249
|
+
# p result
|
1250
|
+
#
|
1251
|
+
def move_billing_account request, options = nil
|
1252
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1253
|
+
|
1254
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::MoveBillingAccountRequest
|
1255
|
+
|
1256
|
+
# Converts hash and nil to an options object
|
1257
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1258
|
+
|
1259
|
+
# Customize the options with defaults
|
1260
|
+
metadata = @config.rpcs.move_billing_account.metadata.to_h
|
1261
|
+
|
1262
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1263
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1264
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1265
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
1266
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1267
|
+
|
1268
|
+
header_params = {}
|
1269
|
+
if request.name
|
1270
|
+
header_params["name"] = request.name
|
1271
|
+
end
|
1272
|
+
|
1273
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1274
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1275
|
+
|
1276
|
+
options.apply_defaults timeout: @config.rpcs.move_billing_account.timeout,
|
1277
|
+
metadata: metadata,
|
1278
|
+
retry_policy: @config.rpcs.move_billing_account.retry_policy
|
1279
|
+
|
1280
|
+
options.apply_defaults timeout: @config.timeout,
|
1281
|
+
metadata: @config.metadata,
|
1282
|
+
retry_policy: @config.retry_policy
|
1283
|
+
|
1284
|
+
@cloud_billing_stub.call_rpc :move_billing_account, request, options: options do |response, operation|
|
1285
|
+
yield response, operation if block_given?
|
1286
|
+
return response
|
1287
|
+
end
|
1288
|
+
rescue ::GRPC::BadStatus => e
|
1289
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1290
|
+
end
|
1291
|
+
|
1169
1292
|
##
|
1170
1293
|
# Configuration class for the CloudBilling API.
|
1171
1294
|
#
|
@@ -1196,9 +1319,9 @@ module Google
|
|
1196
1319
|
# end
|
1197
1320
|
#
|
1198
1321
|
# @!attribute [rw] endpoint
|
1199
|
-
#
|
1200
|
-
#
|
1201
|
-
# @return [::String]
|
1322
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
1323
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
1324
|
+
# @return [::String,nil]
|
1202
1325
|
# @!attribute [rw] credentials
|
1203
1326
|
# Credentials to send with calls. You may provide any of the following types:
|
1204
1327
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -1244,13 +1367,20 @@ module Google
|
|
1244
1367
|
# @!attribute [rw] quota_project
|
1245
1368
|
# A separate project against which to charge quota.
|
1246
1369
|
# @return [::String]
|
1370
|
+
# @!attribute [rw] universe_domain
|
1371
|
+
# The universe domain within which to make requests. This determines the
|
1372
|
+
# default endpoint URL. The default value of nil uses the environment
|
1373
|
+
# universe (usually the default "googleapis.com" universe).
|
1374
|
+
# @return [::String,nil]
|
1247
1375
|
#
|
1248
1376
|
class Configuration
|
1249
1377
|
extend ::Gapic::Config
|
1250
1378
|
|
1379
|
+
# @private
|
1380
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
1251
1381
|
DEFAULT_ENDPOINT = "cloudbilling.googleapis.com"
|
1252
1382
|
|
1253
|
-
config_attr :endpoint,
|
1383
|
+
config_attr :endpoint, nil, ::String, nil
|
1254
1384
|
config_attr :credentials, nil do |value|
|
1255
1385
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1256
1386
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -1265,6 +1395,7 @@ module Google
|
|
1265
1395
|
config_attr :metadata, nil, ::Hash, nil
|
1266
1396
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1267
1397
|
config_attr :quota_project, nil, ::String, nil
|
1398
|
+
config_attr :universe_domain, nil, ::String, nil
|
1268
1399
|
|
1269
1400
|
# @private
|
1270
1401
|
def initialize parent_config = nil
|
@@ -1361,6 +1492,11 @@ module Google
|
|
1361
1492
|
# @return [::Gapic::Config::Method]
|
1362
1493
|
#
|
1363
1494
|
attr_reader :test_iam_permissions
|
1495
|
+
##
|
1496
|
+
# RPC-specific configuration for `move_billing_account`
|
1497
|
+
# @return [::Gapic::Config::Method]
|
1498
|
+
#
|
1499
|
+
attr_reader :move_billing_account
|
1364
1500
|
|
1365
1501
|
# @private
|
1366
1502
|
def initialize parent_rpcs = nil
|
@@ -1384,6 +1520,8 @@ module Google
|
|
1384
1520
|
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
1385
1521
|
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
1386
1522
|
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
1523
|
+
move_billing_account_config = parent_rpcs.move_billing_account if parent_rpcs.respond_to? :move_billing_account
|
1524
|
+
@move_billing_account = ::Gapic::Config::Method.new move_billing_account_config
|
1387
1525
|
|
1388
1526
|
yield self if block_given?
|
1389
1527
|
end
|
@@ -27,15 +27,51 @@ module Google
|
|
27
27
|
##
|
28
28
|
# Create a fully-qualified BillingAccount resource string.
|
29
29
|
#
|
30
|
+
# @overload billing_account_path(billing_account:)
|
31
|
+
# The resource will be in the following format:
|
32
|
+
#
|
33
|
+
# `billingAccounts/{billing_account}`
|
34
|
+
#
|
35
|
+
# @param billing_account [String]
|
36
|
+
#
|
37
|
+
# @overload billing_account_path(organization:, billing_account:)
|
38
|
+
# The resource will be in the following format:
|
39
|
+
#
|
40
|
+
# `organizations/{organization}/billingAccounts/{billing_account}`
|
41
|
+
#
|
42
|
+
# @param organization [String]
|
43
|
+
# @param billing_account [String]
|
44
|
+
#
|
45
|
+
# @return [::String]
|
46
|
+
def billing_account_path **args
|
47
|
+
resources = {
|
48
|
+
"billing_account" => (proc do |billing_account:|
|
49
|
+
"billingAccounts/#{billing_account}"
|
50
|
+
end),
|
51
|
+
"billing_account:organization" => (proc do |organization:, billing_account:|
|
52
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
53
|
+
|
54
|
+
"organizations/#{organization}/billingAccounts/#{billing_account}"
|
55
|
+
end)
|
56
|
+
}
|
57
|
+
|
58
|
+
resource = resources[args.keys.sort.join(":")]
|
59
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
60
|
+
resource.call(**args)
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Create a fully-qualified Organization resource string.
|
65
|
+
#
|
30
66
|
# The resource will be in the following format:
|
31
67
|
#
|
32
|
-
# `
|
68
|
+
# `organizations/{organization}`
|
33
69
|
#
|
34
|
-
# @param
|
70
|
+
# @param organization [String]
|
35
71
|
#
|
36
72
|
# @return [::String]
|
37
|
-
def
|
38
|
-
"
|
73
|
+
def organization_path organization:
|
74
|
+
"organizations/#{organization}"
|
39
75
|
end
|
40
76
|
|
41
77
|
##
|