google-cloud-billing-v1 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +30 -27
- data/lib/google/cloud/billing/v1/cloud_billing/client.rb +278 -28
- data/lib/google/cloud/billing/v1/cloud_catalog/client.rb +149 -9
- data/lib/google/cloud/billing/v1/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +73 -73
- data/proto_docs/google/cloud/billing/v1/cloud_billing.rb +2 -2
- data/proto_docs/google/cloud/billing/v1/cloud_catalog.rb +2 -2
- data/proto_docs/google/iam/v1/iam_policy.rb +3 -3
- data/proto_docs/google/iam/v1/policy.rb +11 -11
- data/proto_docs/google/protobuf/field_mask.rb +40 -40
- data/proto_docs/google/protobuf/timestamp.rb +3 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64ea9c6e82a4e3d064b01f2ec0c5167e2fdd1a2868f7378c0700c65d1412e301
|
4
|
+
data.tar.gz: 0af4a3fae8749e2ae94959cf544aa78b58a92a1060e719c812aa0e71b9581dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 015443ecb2bbffd0f50f7f8401b61f48d5681b7530e8be7359a419d009c7ab9764d72c5e6e1f0e09a8a34a1df7b741bfe26c26df670a722187122d9abf8eb300
|
7
|
+
data.tar.gz: 8341592d563602a3baaf135eb5ddfb9a665b90a047ac6f69d2ed63a9d1a15ad615807ed9810b9863cd696769b780c32d4043f478b30e73d1752d169ccc23187a
|
data/AUTHENTICATION.md
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
# Authentication
|
2
2
|
|
3
|
-
In general, the google-cloud-billing-v1 library uses
|
4
|
-
Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
|
5
|
-
credentials to connect to Google Cloud services. When running within
|
6
|
-
Cloud Platform environments](#google-cloud-platform-environments)
|
7
|
-
|
3
|
+
In general, the google-cloud-billing-v1 library uses
|
4
|
+
[Service Account](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
|
5
|
+
credentials to connect to Google Cloud services. When running within
|
6
|
+
[Google Cloud Platform environments](#google-cloud-platform-environments) the
|
7
|
+
credentials will be discovered automatically. When running on other
|
8
8
|
environments, the Service Account credentials can be specified by providing the
|
9
|
-
path to the
|
10
|
-
keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys)
|
11
|
-
the account (or the JSON itself) in
|
12
|
-
variables](#environment-variables). Additionally, Cloud SDK
|
13
|
-
be discovered automatically, but this is only recommended
|
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.
|
14
15
|
|
15
16
|
## Quickstart
|
16
17
|
|
@@ -46,23 +47,24 @@ without **Service Account Credentials** directly in code.
|
|
46
47
|
|
47
48
|
### Google Cloud Platform environments
|
48
49
|
|
49
|
-
When running on Google Cloud Platform (GCP), including Google Compute Engine
|
50
|
-
Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud
|
51
|
-
(GCF) and Cloud Run, **Credentials**
|
52
|
-
|
50
|
+
When running on Google Cloud Platform (GCP), including Google Compute Engine
|
51
|
+
(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud
|
52
|
+
Functions (GCF) and Cloud Run, **Credentials** are discovered automatically.
|
53
|
+
Code should be written as if already authenticated.
|
53
54
|
|
54
55
|
### Environment Variables
|
55
56
|
|
56
|
-
The **Credentials JSON** can be placed in environment
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
encouraged.
|
57
|
+
The **Credentials JSON** can be placed in environment variables instead of
|
58
|
+
declaring them directly in code. Each service has its own environment variable,
|
59
|
+
allowing for different service accounts to be used for different services. (See
|
60
|
+
the READMEs for the individual service gems for details.) The path to the
|
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.
|
64
64
|
|
65
|
-
The environment variables that google-cloud-billing-v1
|
65
|
+
The environment variables that google-cloud-billing-v1
|
66
|
+
checks for credentials are configured on the service Credentials class (such as
|
67
|
+
{Google::Cloud::Billing::V1::CloudBilling::Credentials}):
|
66
68
|
|
67
69
|
1. `BILLING_CREDENTIALS` - Path to JSON file, or JSON contents
|
68
70
|
2. `BILLING_KEYFILE` - Path to JSON file, or JSON contents
|
@@ -80,7 +82,8 @@ client = Google::Cloud::Billing::V1::CloudBilling::Client.new
|
|
80
82
|
|
81
83
|
### Configuration
|
82
84
|
|
83
|
-
The **Credentials JSON** can be configured instead of placing them in
|
85
|
+
The **Credentials JSON** can be configured instead of placing them in
|
86
|
+
environment variables. Either on an individual client initialization:
|
84
87
|
|
85
88
|
```ruby
|
86
89
|
require "google/cloud/billing/v1"
|
@@ -137,15 +140,15 @@ environments](#google-cloud-platform-environments), you need a Google
|
|
137
140
|
Developers service account.
|
138
141
|
|
139
142
|
1. Visit the [Google Developers Console][dev-console].
|
140
|
-
|
141
|
-
|
143
|
+
2. Create a new project or click on an existing project.
|
144
|
+
3. Activate the slide-out navigation tray and select **API Manager**. From
|
142
145
|
here, you will enable the APIs that your application requires.
|
143
146
|
|
144
147
|
![Enable the APIs that your application requires][enable-apis]
|
145
148
|
|
146
149
|
*Note: You may need to enable billing in order to use these services.*
|
147
150
|
|
148
|
-
|
151
|
+
4. Select **Credentials** from the side navigation.
|
149
152
|
|
150
153
|
You should see a screen like one of the following.
|
151
154
|
|
@@ -40,7 +40,18 @@ module Google
|
|
40
40
|
attr_reader :cloud_billing_stub
|
41
41
|
|
42
42
|
##
|
43
|
-
#
|
43
|
+
# Configure the CloudBilling Client class.
|
44
|
+
#
|
45
|
+
# See {Google::Cloud::Billing::V1::CloudBilling::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# ## Example
|
49
|
+
#
|
50
|
+
# To modify the configuration for all CloudBilling clients:
|
51
|
+
#
|
52
|
+
# Google::Cloud::Billing::V1::CloudBilling::Client.configure do |config|
|
53
|
+
# config.timeout = 10_000
|
54
|
+
# end
|
44
55
|
#
|
45
56
|
# @yield [config] Configure the Client client.
|
46
57
|
# @yieldparam config [Client::Configuration]
|
@@ -56,7 +67,83 @@ module Google
|
|
56
67
|
break parent_const.configure if parent_const&.respond_to? :configure
|
57
68
|
namespace.pop
|
58
69
|
end
|
59
|
-
Client::Configuration.new parent_config
|
70
|
+
default_config = Client::Configuration.new parent_config
|
71
|
+
|
72
|
+
default_config.rpcs.get_billing_account.timeout = 60.0
|
73
|
+
default_config.rpcs.get_billing_account.retry_policy = {
|
74
|
+
initial_delay: 0.1,
|
75
|
+
max_delay: 60.0,
|
76
|
+
multiplier: 1.3,
|
77
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
78
|
+
}
|
79
|
+
|
80
|
+
default_config.rpcs.list_billing_accounts.timeout = 60.0
|
81
|
+
default_config.rpcs.list_billing_accounts.retry_policy = {
|
82
|
+
initial_delay: 0.1,
|
83
|
+
max_delay: 60.0,
|
84
|
+
multiplier: 1.3,
|
85
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
86
|
+
}
|
87
|
+
|
88
|
+
default_config.rpcs.update_billing_account.timeout = 60.0
|
89
|
+
default_config.rpcs.update_billing_account.retry_policy = {
|
90
|
+
initial_delay: 0.1,
|
91
|
+
max_delay: 60.0,
|
92
|
+
multiplier: 1.3,
|
93
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
94
|
+
}
|
95
|
+
|
96
|
+
default_config.rpcs.create_billing_account.timeout = 60.0
|
97
|
+
|
98
|
+
default_config.rpcs.list_project_billing_info.timeout = 60.0
|
99
|
+
default_config.rpcs.list_project_billing_info.retry_policy = {
|
100
|
+
initial_delay: 0.1,
|
101
|
+
max_delay: 60.0,
|
102
|
+
multiplier: 1.3,
|
103
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
104
|
+
}
|
105
|
+
|
106
|
+
default_config.rpcs.get_project_billing_info.timeout = 60.0
|
107
|
+
default_config.rpcs.get_project_billing_info.retry_policy = {
|
108
|
+
initial_delay: 0.1,
|
109
|
+
max_delay: 60.0,
|
110
|
+
multiplier: 1.3,
|
111
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
112
|
+
}
|
113
|
+
|
114
|
+
default_config.rpcs.update_project_billing_info.timeout = 60.0
|
115
|
+
default_config.rpcs.update_project_billing_info.retry_policy = {
|
116
|
+
initial_delay: 0.1,
|
117
|
+
max_delay: 60.0,
|
118
|
+
multiplier: 1.3,
|
119
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
120
|
+
}
|
121
|
+
|
122
|
+
default_config.rpcs.get_iam_policy.timeout = 60.0
|
123
|
+
default_config.rpcs.get_iam_policy.retry_policy = {
|
124
|
+
initial_delay: 0.1,
|
125
|
+
max_delay: 60.0,
|
126
|
+
multiplier: 1.3,
|
127
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
128
|
+
}
|
129
|
+
|
130
|
+
default_config.rpcs.set_iam_policy.timeout = 60.0
|
131
|
+
default_config.rpcs.set_iam_policy.retry_policy = {
|
132
|
+
initial_delay: 0.1,
|
133
|
+
max_delay: 60.0,
|
134
|
+
multiplier: 1.3,
|
135
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
136
|
+
}
|
137
|
+
|
138
|
+
default_config.rpcs.test_iam_permissions.timeout = 60.0
|
139
|
+
default_config.rpcs.test_iam_permissions.retry_policy = {
|
140
|
+
initial_delay: 0.1,
|
141
|
+
max_delay: 60.0,
|
142
|
+
multiplier: 1.3,
|
143
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
144
|
+
}
|
145
|
+
|
146
|
+
default_config
|
60
147
|
end
|
61
148
|
yield @configure if block_given?
|
62
149
|
@configure
|
@@ -69,6 +156,9 @@ module Google
|
|
69
156
|
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
70
157
|
# should be made on {Client.configure}.
|
71
158
|
#
|
159
|
+
# See {Google::Cloud::Billing::V1::CloudBilling::Client::Configuration}
|
160
|
+
# for a description of the configuration fields.
|
161
|
+
#
|
72
162
|
# @yield [config] Configure the Client client.
|
73
163
|
# @yieldparam config [Client::Configuration]
|
74
164
|
#
|
@@ -80,9 +170,23 @@ module Google
|
|
80
170
|
end
|
81
171
|
|
82
172
|
##
|
83
|
-
# Create a new
|
173
|
+
# Create a new CloudBilling client object.
|
84
174
|
#
|
85
|
-
#
|
175
|
+
# ## Examples
|
176
|
+
#
|
177
|
+
# To create a new CloudBilling client with the default
|
178
|
+
# configuration:
|
179
|
+
#
|
180
|
+
# client = Google::Cloud::Billing::V1::CloudBilling::Client.new
|
181
|
+
#
|
182
|
+
# To create a new CloudBilling client with a custom
|
183
|
+
# configuration:
|
184
|
+
#
|
185
|
+
# client = Google::Cloud::Billing::V1::CloudBilling::Client.new do |config|
|
186
|
+
# config.timeout = 10_000
|
187
|
+
# end
|
188
|
+
#
|
189
|
+
# @yield [config] Configure the CloudBilling client.
|
86
190
|
# @yieldparam config [Client::Configuration]
|
87
191
|
#
|
88
192
|
def initialize
|
@@ -104,7 +208,7 @@ module Google
|
|
104
208
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
105
209
|
credentials = Credentials.new credentials, scope: @config.scope
|
106
210
|
end
|
107
|
-
|
211
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
108
212
|
|
109
213
|
@cloud_billing_stub = Gapic::ServiceStub.new(
|
110
214
|
Google::Cloud::Billing::V1::CloudBilling::Stub,
|
@@ -150,15 +254,16 @@ module Google
|
|
150
254
|
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::GetBillingAccountRequest
|
151
255
|
|
152
256
|
# Converts hash and nil to an options object
|
153
|
-
options = Gapic::CallOptions.new
|
257
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
154
258
|
|
155
259
|
# Customize the options with defaults
|
156
260
|
metadata = @config.rpcs.get_billing_account.metadata.to_h
|
157
261
|
|
158
|
-
# Set x-goog-api-client
|
262
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
159
263
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
160
264
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
161
265
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
266
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
162
267
|
|
163
268
|
header_params = {
|
164
269
|
"name" => request.name
|
@@ -224,15 +329,16 @@ module Google
|
|
224
329
|
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::ListBillingAccountsRequest
|
225
330
|
|
226
331
|
# Converts hash and nil to an options object
|
227
|
-
options = Gapic::CallOptions.new
|
332
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
228
333
|
|
229
334
|
# Customize the options with defaults
|
230
335
|
metadata = @config.rpcs.list_billing_accounts.metadata.to_h
|
231
336
|
|
232
|
-
# Set x-goog-api-client
|
337
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
233
338
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
234
339
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
235
340
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
341
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
236
342
|
|
237
343
|
options.apply_defaults timeout: @config.rpcs.list_billing_accounts.timeout,
|
238
344
|
metadata: metadata,
|
@@ -292,15 +398,16 @@ module Google
|
|
292
398
|
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::UpdateBillingAccountRequest
|
293
399
|
|
294
400
|
# Converts hash and nil to an options object
|
295
|
-
options = Gapic::CallOptions.new
|
401
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
296
402
|
|
297
403
|
# Customize the options with defaults
|
298
404
|
metadata = @config.rpcs.update_billing_account.metadata.to_h
|
299
405
|
|
300
|
-
# Set x-goog-api-client
|
406
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
301
407
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
302
408
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
303
409
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
410
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
304
411
|
|
305
412
|
header_params = {
|
306
413
|
"name" => request.name
|
@@ -371,15 +478,16 @@ module Google
|
|
371
478
|
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::CreateBillingAccountRequest
|
372
479
|
|
373
480
|
# Converts hash and nil to an options object
|
374
|
-
options = Gapic::CallOptions.new
|
481
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
375
482
|
|
376
483
|
# Customize the options with defaults
|
377
484
|
metadata = @config.rpcs.create_billing_account.metadata.to_h
|
378
485
|
|
379
|
-
# Set x-goog-api-client
|
486
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
380
487
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
381
488
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
382
489
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
490
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
383
491
|
|
384
492
|
options.apply_defaults timeout: @config.rpcs.create_billing_account.timeout,
|
385
493
|
metadata: metadata,
|
@@ -437,15 +545,16 @@ module Google
|
|
437
545
|
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::ListProjectBillingInfoRequest
|
438
546
|
|
439
547
|
# Converts hash and nil to an options object
|
440
|
-
options = Gapic::CallOptions.new
|
548
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
441
549
|
|
442
550
|
# Customize the options with defaults
|
443
551
|
metadata = @config.rpcs.list_project_billing_info.metadata.to_h
|
444
552
|
|
445
|
-
# Set x-goog-api-client
|
553
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
446
554
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
447
555
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
448
556
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
557
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
449
558
|
|
450
559
|
header_params = {
|
451
560
|
"name" => request.name
|
@@ -503,15 +612,16 @@ module Google
|
|
503
612
|
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::GetProjectBillingInfoRequest
|
504
613
|
|
505
614
|
# Converts hash and nil to an options object
|
506
|
-
options = Gapic::CallOptions.new
|
615
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
507
616
|
|
508
617
|
# Customize the options with defaults
|
509
618
|
metadata = @config.rpcs.get_project_billing_info.metadata.to_h
|
510
619
|
|
511
|
-
# Set x-goog-api-client
|
620
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
512
621
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
513
622
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
514
623
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
624
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
515
625
|
|
516
626
|
header_params = {
|
517
627
|
"name" => request.name
|
@@ -625,15 +735,16 @@ module Google
|
|
625
735
|
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::UpdateProjectBillingInfoRequest
|
626
736
|
|
627
737
|
# Converts hash and nil to an options object
|
628
|
-
options = Gapic::CallOptions.new
|
738
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
629
739
|
|
630
740
|
# Customize the options with defaults
|
631
741
|
metadata = @config.rpcs.update_project_billing_info.metadata.to_h
|
632
742
|
|
633
|
-
# Set x-goog-api-client
|
743
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
634
744
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
635
745
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
636
746
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
747
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
637
748
|
|
638
749
|
header_params = {
|
639
750
|
"name" => request.name
|
@@ -674,7 +785,7 @@ module Google
|
|
674
785
|
# @param resource [String]
|
675
786
|
# REQUIRED: The resource for which the policy is being requested.
|
676
787
|
# `resource` is usually specified as a path. For example, a Project
|
677
|
-
# resource is specified as `projects
|
788
|
+
# resource is specified as `projects/{project}`.
|
678
789
|
#
|
679
790
|
#
|
680
791
|
# @yield [response, operation] Access the result along with the RPC operation
|
@@ -691,15 +802,16 @@ module Google
|
|
691
802
|
request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::GetIamPolicyRequest
|
692
803
|
|
693
804
|
# Converts hash and nil to an options object
|
694
|
-
options = Gapic::CallOptions.new
|
805
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
695
806
|
|
696
807
|
# Customize the options with defaults
|
697
808
|
metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
698
809
|
|
699
|
-
# Set x-goog-api-client
|
810
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
700
811
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
701
812
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
702
813
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
814
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
703
815
|
|
704
816
|
header_params = {
|
705
817
|
"resource" => request.resource
|
@@ -742,7 +854,7 @@ module Google
|
|
742
854
|
# @param resource [String]
|
743
855
|
# REQUIRED: The resource for which the policy is being specified.
|
744
856
|
# `resource` is usually specified as a path. For example, a Project
|
745
|
-
# resource is specified as `projects
|
857
|
+
# resource is specified as `projects/{project}`.
|
746
858
|
# @param policy [Google::Iam::V1::Policy | Hash]
|
747
859
|
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
748
860
|
# the policy is limited to a few 10s of KB. An empty policy is a
|
@@ -764,15 +876,16 @@ module Google
|
|
764
876
|
request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::SetIamPolicyRequest
|
765
877
|
|
766
878
|
# Converts hash and nil to an options object
|
767
|
-
options = Gapic::CallOptions.new
|
879
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
768
880
|
|
769
881
|
# Customize the options with defaults
|
770
882
|
metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
771
883
|
|
772
|
-
# Set x-goog-api-client
|
884
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
773
885
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
774
886
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
775
887
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
888
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
776
889
|
|
777
890
|
header_params = {
|
778
891
|
"resource" => request.resource
|
@@ -811,7 +924,7 @@ module Google
|
|
811
924
|
# @param resource [String]
|
812
925
|
# REQUIRED: The resource for which the policy detail is being requested.
|
813
926
|
# `resource` is usually specified as a path. For example, a Project
|
814
|
-
# resource is specified as `projects
|
927
|
+
# resource is specified as `projects/{project}`.
|
815
928
|
# @param permissions [Array<String>]
|
816
929
|
# The set of permissions to check for the `resource`. Permissions with
|
817
930
|
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
@@ -833,15 +946,16 @@ module Google
|
|
833
946
|
request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::TestIamPermissionsRequest
|
834
947
|
|
835
948
|
# Converts hash and nil to an options object
|
836
|
-
options = Gapic::CallOptions.new
|
949
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
837
950
|
|
838
951
|
# Customize the options with defaults
|
839
952
|
metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
840
953
|
|
841
|
-
# Set x-goog-api-client
|
954
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
842
955
|
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
843
956
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
844
957
|
gapic_version: ::Google::Cloud::Billing::V1::VERSION
|
958
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
845
959
|
|
846
960
|
header_params = {
|
847
961
|
"resource" => request.resource
|
@@ -865,6 +979,81 @@ module Google
|
|
865
979
|
|
866
980
|
##
|
867
981
|
# Configuration class for the CloudBilling API.
|
982
|
+
#
|
983
|
+
# This class represents the configuration for CloudBilling,
|
984
|
+
# providing control over timeouts, retry behavior, logging, transport
|
985
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
986
|
+
# applied individually to specific RPCs. See
|
987
|
+
# {Google::Cloud::Billing::V1::CloudBilling::Client::Configuration::Rpcs}
|
988
|
+
# for a list of RPCs that can be configured independently.
|
989
|
+
#
|
990
|
+
# Configuration can be applied globally to all clients, or to a single client
|
991
|
+
# on construction.
|
992
|
+
#
|
993
|
+
# # Examples
|
994
|
+
#
|
995
|
+
# To modify the global config, setting the timeout for get_billing_account
|
996
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
997
|
+
#
|
998
|
+
# Google::Cloud::Billing::V1::CloudBilling::Client.configure do |config|
|
999
|
+
# config.timeout = 10_000
|
1000
|
+
# config.rpcs.get_billing_account.timeout = 20_000
|
1001
|
+
# end
|
1002
|
+
#
|
1003
|
+
# To apply the above configuration only to a new client:
|
1004
|
+
#
|
1005
|
+
# client = Google::Cloud::Billing::V1::CloudBilling::Client.new do |config|
|
1006
|
+
# config.timeout = 10_000
|
1007
|
+
# config.rpcs.get_billing_account.timeout = 20_000
|
1008
|
+
# end
|
1009
|
+
#
|
1010
|
+
# @!attribute [rw] endpoint
|
1011
|
+
# The hostname or hostname:port of the service endpoint.
|
1012
|
+
# Defaults to `"cloudbilling.googleapis.com"`.
|
1013
|
+
# @return [String]
|
1014
|
+
# @!attribute [rw] credentials
|
1015
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1016
|
+
# * (`String`) The path to a service account key file in JSON format
|
1017
|
+
# * (`Hash`) A service account key as a Hash
|
1018
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1019
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
1020
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1021
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
1022
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
1023
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
1024
|
+
# * (`nil`) indicating no credentials
|
1025
|
+
# @return [Object]
|
1026
|
+
# @!attribute [rw] scope
|
1027
|
+
# The OAuth scopes
|
1028
|
+
# @return [Array<String>]
|
1029
|
+
# @!attribute [rw] lib_name
|
1030
|
+
# The library name as recorded in instrumentation and logging
|
1031
|
+
# @return [String]
|
1032
|
+
# @!attribute [rw] lib_version
|
1033
|
+
# The library version as recorded in instrumentation and logging
|
1034
|
+
# @return [String]
|
1035
|
+
# @!attribute [rw] channel_args
|
1036
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
1037
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
1038
|
+
# @return [Hash]
|
1039
|
+
# @!attribute [rw] interceptors
|
1040
|
+
# An array of interceptors that are run before calls are executed.
|
1041
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
1042
|
+
# @!attribute [rw] timeout
|
1043
|
+
# The call timeout in milliseconds.
|
1044
|
+
# @return [Numeric]
|
1045
|
+
# @!attribute [rw] metadata
|
1046
|
+
# Additional gRPC headers to be sent with the call.
|
1047
|
+
# @return [Hash{Symbol=>String}]
|
1048
|
+
# @!attribute [rw] retry_policy
|
1049
|
+
# The retry policy. The value is a hash with the following keys:
|
1050
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1051
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1052
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1053
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1054
|
+
# trigger a retry.
|
1055
|
+
# @return [Hash]
|
1056
|
+
#
|
868
1057
|
class Configuration
|
869
1058
|
extend Gapic::Config
|
870
1059
|
|
@@ -883,12 +1072,17 @@ module Google
|
|
883
1072
|
config_attr :metadata, nil, Hash, nil
|
884
1073
|
config_attr :retry_policy, nil, Hash, Proc, nil
|
885
1074
|
|
1075
|
+
# @private
|
886
1076
|
def initialize parent_config = nil
|
887
1077
|
@parent_config = parent_config unless parent_config.nil?
|
888
1078
|
|
889
1079
|
yield self if block_given?
|
890
1080
|
end
|
891
1081
|
|
1082
|
+
##
|
1083
|
+
# Configurations for individual RPCs
|
1084
|
+
# @return [Rpcs]
|
1085
|
+
#
|
892
1086
|
def rpcs
|
893
1087
|
@rpcs ||= begin
|
894
1088
|
parent_rpcs = nil
|
@@ -899,18 +1093,74 @@ module Google
|
|
899
1093
|
|
900
1094
|
##
|
901
1095
|
# Configuration RPC class for the CloudBilling API.
|
1096
|
+
#
|
1097
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1098
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1099
|
+
# the following configuration fields:
|
1100
|
+
#
|
1101
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
1102
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1103
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1104
|
+
# include the following keys:
|
1105
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1106
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1107
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1108
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1109
|
+
# trigger a retry.
|
1110
|
+
#
|
902
1111
|
class Rpcs
|
1112
|
+
##
|
1113
|
+
# RPC-specific configuration for `get_billing_account`
|
1114
|
+
# @return [Gapic::Config::Method]
|
1115
|
+
#
|
903
1116
|
attr_reader :get_billing_account
|
1117
|
+
##
|
1118
|
+
# RPC-specific configuration for `list_billing_accounts`
|
1119
|
+
# @return [Gapic::Config::Method]
|
1120
|
+
#
|
904
1121
|
attr_reader :list_billing_accounts
|
1122
|
+
##
|
1123
|
+
# RPC-specific configuration for `update_billing_account`
|
1124
|
+
# @return [Gapic::Config::Method]
|
1125
|
+
#
|
905
1126
|
attr_reader :update_billing_account
|
1127
|
+
##
|
1128
|
+
# RPC-specific configuration for `create_billing_account`
|
1129
|
+
# @return [Gapic::Config::Method]
|
1130
|
+
#
|
906
1131
|
attr_reader :create_billing_account
|
1132
|
+
##
|
1133
|
+
# RPC-specific configuration for `list_project_billing_info`
|
1134
|
+
# @return [Gapic::Config::Method]
|
1135
|
+
#
|
907
1136
|
attr_reader :list_project_billing_info
|
1137
|
+
##
|
1138
|
+
# RPC-specific configuration for `get_project_billing_info`
|
1139
|
+
# @return [Gapic::Config::Method]
|
1140
|
+
#
|
908
1141
|
attr_reader :get_project_billing_info
|
1142
|
+
##
|
1143
|
+
# RPC-specific configuration for `update_project_billing_info`
|
1144
|
+
# @return [Gapic::Config::Method]
|
1145
|
+
#
|
909
1146
|
attr_reader :update_project_billing_info
|
1147
|
+
##
|
1148
|
+
# RPC-specific configuration for `get_iam_policy`
|
1149
|
+
# @return [Gapic::Config::Method]
|
1150
|
+
#
|
910
1151
|
attr_reader :get_iam_policy
|
1152
|
+
##
|
1153
|
+
# RPC-specific configuration for `set_iam_policy`
|
1154
|
+
# @return [Gapic::Config::Method]
|
1155
|
+
#
|
911
1156
|
attr_reader :set_iam_policy
|
1157
|
+
##
|
1158
|
+
# RPC-specific configuration for `test_iam_permissions`
|
1159
|
+
# @return [Gapic::Config::Method]
|
1160
|
+
#
|
912
1161
|
attr_reader :test_iam_permissions
|
913
1162
|
|
1163
|
+
# @private
|
914
1164
|
def initialize parent_rpcs = nil
|
915
1165
|
get_billing_account_config = parent_rpcs&.get_billing_account if parent_rpcs&.respond_to? :get_billing_account
|
916
1166
|
@get_billing_account = Gapic::Config::Method.new get_billing_account_config
|