google-cloud-billing-v1 0.9.0 → 0.11.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 +1 -1
- data/README.md +2 -2
- data/lib/google/cloud/billing/v1/cloud_billing/client.rb +37 -31
- data/lib/google/cloud/billing/v1/cloud_billing/credentials.rb +2 -0
- data/lib/google/cloud/billing/v1/cloud_billing/rest/client.rb +1143 -0
- data/lib/google/cloud/billing/v1/cloud_billing/rest/service_stub.rb +639 -0
- data/lib/google/cloud/billing/v1/cloud_billing/rest.rb +53 -0
- data/lib/google/cloud/billing/v1/cloud_billing.rb +9 -2
- data/lib/google/cloud/billing/v1/cloud_billing_services_pb.rb +19 -13
- data/lib/google/cloud/billing/v1/cloud_catalog/client.rb +8 -12
- data/lib/google/cloud/billing/v1/cloud_catalog/credentials.rb +2 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/rest/client.rb +450 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/rest/service_stub.rb +164 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/rest.rb +54 -0
- data/lib/google/cloud/billing/v1/cloud_catalog.rb +7 -1
- data/lib/google/cloud/billing/v1/cloud_catalog_pb.rb +15 -2
- data/lib/google/cloud/billing/v1/cloud_catalog_services_pb.rb +1 -2
- data/lib/google/cloud/billing/v1/rest.rb +38 -0
- data/lib/google/cloud/billing/v1/version.rb +1 -1
- data/lib/google/cloud/billing/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/cloud/billing/v1/cloud_billing.rb +26 -21
- data/proto_docs/google/cloud/billing/v1/cloud_catalog.rb +48 -15
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +19 -8
@@ -0,0 +1,1143 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/billing/v1/cloud_billing_pb"
|
21
|
+
require "google/cloud/billing/v1/cloud_billing/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Billing
|
26
|
+
module V1
|
27
|
+
module CloudBilling
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the CloudBilling service.
|
31
|
+
#
|
32
|
+
# Retrieves the Google Cloud Console billing accounts and associates them with
|
33
|
+
# projects.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :cloud_billing_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the CloudBilling Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::Billing::V1::CloudBilling::Rest::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
#
|
49
|
+
# # Modify the configuration for all CloudBilling clients
|
50
|
+
# ::Google::Cloud::Billing::V1::CloudBilling::Rest::Client.configure do |config|
|
51
|
+
# config.timeout = 10.0
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @yield [config] Configure the Client client.
|
55
|
+
# @yieldparam config [Client::Configuration]
|
56
|
+
#
|
57
|
+
# @return [Client::Configuration]
|
58
|
+
#
|
59
|
+
def self.configure
|
60
|
+
@configure ||= begin
|
61
|
+
namespace = ["Google", "Cloud", "Billing", "V1"]
|
62
|
+
parent_config = while namespace.any?
|
63
|
+
parent_name = namespace.join "::"
|
64
|
+
parent_const = const_get parent_name
|
65
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
|
+
namespace.pop
|
67
|
+
end
|
68
|
+
default_config = Client::Configuration.new parent_config
|
69
|
+
|
70
|
+
default_config.rpcs.get_billing_account.timeout = 60.0
|
71
|
+
default_config.rpcs.get_billing_account.retry_policy = {
|
72
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
73
|
+
}
|
74
|
+
|
75
|
+
default_config.rpcs.list_billing_accounts.timeout = 60.0
|
76
|
+
default_config.rpcs.list_billing_accounts.retry_policy = {
|
77
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
78
|
+
}
|
79
|
+
|
80
|
+
default_config.rpcs.update_billing_account.timeout = 60.0
|
81
|
+
default_config.rpcs.update_billing_account.retry_policy = {
|
82
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
83
|
+
}
|
84
|
+
|
85
|
+
default_config.rpcs.create_billing_account.timeout = 60.0
|
86
|
+
|
87
|
+
default_config.rpcs.list_project_billing_info.timeout = 60.0
|
88
|
+
default_config.rpcs.list_project_billing_info.retry_policy = {
|
89
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
90
|
+
}
|
91
|
+
|
92
|
+
default_config.rpcs.get_project_billing_info.timeout = 60.0
|
93
|
+
default_config.rpcs.get_project_billing_info.retry_policy = {
|
94
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
95
|
+
}
|
96
|
+
|
97
|
+
default_config.rpcs.update_project_billing_info.timeout = 60.0
|
98
|
+
default_config.rpcs.update_project_billing_info.retry_policy = {
|
99
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
100
|
+
}
|
101
|
+
|
102
|
+
default_config.rpcs.get_iam_policy.timeout = 60.0
|
103
|
+
default_config.rpcs.get_iam_policy.retry_policy = {
|
104
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
105
|
+
}
|
106
|
+
|
107
|
+
default_config.rpcs.set_iam_policy.timeout = 60.0
|
108
|
+
default_config.rpcs.set_iam_policy.retry_policy = {
|
109
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
110
|
+
}
|
111
|
+
|
112
|
+
default_config.rpcs.test_iam_permissions.timeout = 60.0
|
113
|
+
default_config.rpcs.test_iam_permissions.retry_policy = {
|
114
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
115
|
+
}
|
116
|
+
|
117
|
+
default_config
|
118
|
+
end
|
119
|
+
yield @configure if block_given?
|
120
|
+
@configure
|
121
|
+
end
|
122
|
+
|
123
|
+
##
|
124
|
+
# Configure the CloudBilling Client instance.
|
125
|
+
#
|
126
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
127
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
128
|
+
# should be made on {Client.configure}.
|
129
|
+
#
|
130
|
+
# See {::Google::Cloud::Billing::V1::CloudBilling::Rest::Client::Configuration}
|
131
|
+
# for a description of the configuration fields.
|
132
|
+
#
|
133
|
+
# @yield [config] Configure the Client client.
|
134
|
+
# @yieldparam config [Client::Configuration]
|
135
|
+
#
|
136
|
+
# @return [Client::Configuration]
|
137
|
+
#
|
138
|
+
def configure
|
139
|
+
yield @config if block_given?
|
140
|
+
@config
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Create a new CloudBilling REST client object.
|
145
|
+
#
|
146
|
+
# @example
|
147
|
+
#
|
148
|
+
# # Create a client using the default configuration
|
149
|
+
# client = ::Google::Cloud::Billing::V1::CloudBilling::Rest::Client.new
|
150
|
+
#
|
151
|
+
# # Create a client using a custom configuration
|
152
|
+
# client = ::Google::Cloud::Billing::V1::CloudBilling::Rest::Client.new do |config|
|
153
|
+
# config.timeout = 10.0
|
154
|
+
# end
|
155
|
+
#
|
156
|
+
# @yield [config] Configure the CloudBilling client.
|
157
|
+
# @yieldparam config [Client::Configuration]
|
158
|
+
#
|
159
|
+
def initialize
|
160
|
+
# Create the configuration object
|
161
|
+
@config = Configuration.new Client.configure
|
162
|
+
|
163
|
+
# Yield the configuration if needed
|
164
|
+
yield @config if block_given?
|
165
|
+
|
166
|
+
# Create credentials
|
167
|
+
credentials = @config.credentials
|
168
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
169
|
+
# but only if the default endpoint does not have a region prefix.
|
170
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
171
|
+
!@config.endpoint.split(".").first.include?("-")
|
172
|
+
credentials ||= Credentials.default scope: @config.scope,
|
173
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
174
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
175
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
176
|
+
end
|
177
|
+
|
178
|
+
@quota_project_id = @config.quota_project
|
179
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
180
|
+
|
181
|
+
@cloud_billing_stub = ::Google::Cloud::Billing::V1::CloudBilling::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
182
|
+
end
|
183
|
+
|
184
|
+
# Service calls
|
185
|
+
|
186
|
+
##
|
187
|
+
# Gets information about a billing account. The current authenticated user
|
188
|
+
# must be a [viewer of the billing
|
189
|
+
# account](https://cloud.google.com/billing/docs/how-to/billing-access).
|
190
|
+
#
|
191
|
+
# @overload get_billing_account(request, options = nil)
|
192
|
+
# Pass arguments to `get_billing_account` via a request object, either of type
|
193
|
+
# {::Google::Cloud::Billing::V1::GetBillingAccountRequest} or an equivalent Hash.
|
194
|
+
#
|
195
|
+
# @param request [::Google::Cloud::Billing::V1::GetBillingAccountRequest, ::Hash]
|
196
|
+
# A request object representing the call parameters. Required. To specify no
|
197
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
198
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
199
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
200
|
+
#
|
201
|
+
# @overload get_billing_account(name: nil)
|
202
|
+
# Pass arguments to `get_billing_account` via keyword arguments. Note that at
|
203
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
204
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
205
|
+
#
|
206
|
+
# @param name [::String]
|
207
|
+
# Required. The resource name of the billing account to retrieve. For
|
208
|
+
# example, `billingAccounts/012345-567890-ABCDEF`.
|
209
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
210
|
+
# @yieldparam result [::Google::Cloud::Billing::V1::BillingAccount]
|
211
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
212
|
+
#
|
213
|
+
# @return [::Google::Cloud::Billing::V1::BillingAccount]
|
214
|
+
#
|
215
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
216
|
+
def get_billing_account request, options = nil
|
217
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
218
|
+
|
219
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::GetBillingAccountRequest
|
220
|
+
|
221
|
+
# Converts hash and nil to an options object
|
222
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
223
|
+
|
224
|
+
# Customize the options with defaults
|
225
|
+
call_metadata = @config.rpcs.get_billing_account.metadata.to_h
|
226
|
+
|
227
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
228
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
229
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
230
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
231
|
+
transports_version_send: [:rest]
|
232
|
+
|
233
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
234
|
+
|
235
|
+
options.apply_defaults timeout: @config.rpcs.get_billing_account.timeout,
|
236
|
+
metadata: call_metadata,
|
237
|
+
retry_policy: @config.rpcs.get_billing_account.retry_policy
|
238
|
+
|
239
|
+
options.apply_defaults timeout: @config.timeout,
|
240
|
+
metadata: @config.metadata,
|
241
|
+
retry_policy: @config.retry_policy
|
242
|
+
|
243
|
+
@cloud_billing_stub.get_billing_account request, options do |result, operation|
|
244
|
+
yield result, operation if block_given?
|
245
|
+
return result
|
246
|
+
end
|
247
|
+
rescue ::Gapic::Rest::Error => e
|
248
|
+
raise ::Google::Cloud::Error.from_error(e)
|
249
|
+
end
|
250
|
+
|
251
|
+
##
|
252
|
+
# Lists the billing accounts that the current authenticated user has
|
253
|
+
# permission to
|
254
|
+
# [view](https://cloud.google.com/billing/docs/how-to/billing-access).
|
255
|
+
#
|
256
|
+
# @overload list_billing_accounts(request, options = nil)
|
257
|
+
# Pass arguments to `list_billing_accounts` via a request object, either of type
|
258
|
+
# {::Google::Cloud::Billing::V1::ListBillingAccountsRequest} or an equivalent Hash.
|
259
|
+
#
|
260
|
+
# @param request [::Google::Cloud::Billing::V1::ListBillingAccountsRequest, ::Hash]
|
261
|
+
# A request object representing the call parameters. Required. To specify no
|
262
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
263
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
264
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
265
|
+
#
|
266
|
+
# @overload list_billing_accounts(page_size: nil, page_token: nil, filter: nil)
|
267
|
+
# Pass arguments to `list_billing_accounts` via keyword arguments. Note that at
|
268
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
269
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
270
|
+
#
|
271
|
+
# @param page_size [::Integer]
|
272
|
+
# Requested page size. The maximum page size is 100; this is also the
|
273
|
+
# default.
|
274
|
+
# @param page_token [::String]
|
275
|
+
# A token identifying a page of results to return. This should be a
|
276
|
+
# `next_page_token` value returned from a previous `ListBillingAccounts`
|
277
|
+
# call. If unspecified, the first page of results is returned.
|
278
|
+
# @param filter [::String]
|
279
|
+
# Options for how to filter the returned billing accounts.
|
280
|
+
# Currently this only supports filtering for
|
281
|
+
# [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
|
282
|
+
# single provided reseller billing account.
|
283
|
+
# (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
|
284
|
+
# Boolean algebra and other fields are not currently supported.
|
285
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
286
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::BillingAccount>]
|
287
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
288
|
+
#
|
289
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::BillingAccount>]
|
290
|
+
#
|
291
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
292
|
+
def list_billing_accounts request, options = nil
|
293
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
294
|
+
|
295
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::ListBillingAccountsRequest
|
296
|
+
|
297
|
+
# Converts hash and nil to an options object
|
298
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
299
|
+
|
300
|
+
# Customize the options with defaults
|
301
|
+
call_metadata = @config.rpcs.list_billing_accounts.metadata.to_h
|
302
|
+
|
303
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
304
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
305
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
306
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
307
|
+
transports_version_send: [:rest]
|
308
|
+
|
309
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
310
|
+
|
311
|
+
options.apply_defaults timeout: @config.rpcs.list_billing_accounts.timeout,
|
312
|
+
metadata: call_metadata,
|
313
|
+
retry_policy: @config.rpcs.list_billing_accounts.retry_policy
|
314
|
+
|
315
|
+
options.apply_defaults timeout: @config.timeout,
|
316
|
+
metadata: @config.metadata,
|
317
|
+
retry_policy: @config.retry_policy
|
318
|
+
|
319
|
+
@cloud_billing_stub.list_billing_accounts request, options do |result, operation|
|
320
|
+
result = ::Gapic::Rest::PagedEnumerable.new @cloud_billing_stub, :list_billing_accounts, "billing_accounts", request, result, options
|
321
|
+
yield result, operation if block_given?
|
322
|
+
return result
|
323
|
+
end
|
324
|
+
rescue ::Gapic::Rest::Error => e
|
325
|
+
raise ::Google::Cloud::Error.from_error(e)
|
326
|
+
end
|
327
|
+
|
328
|
+
##
|
329
|
+
# Updates a billing account's fields.
|
330
|
+
# Currently the only field that can be edited is `display_name`.
|
331
|
+
# The current authenticated user must have the `billing.accounts.update`
|
332
|
+
# IAM permission, which is typically given to the
|
333
|
+
# [administrator](https://cloud.google.com/billing/docs/how-to/billing-access)
|
334
|
+
# of the billing account.
|
335
|
+
#
|
336
|
+
# @overload update_billing_account(request, options = nil)
|
337
|
+
# Pass arguments to `update_billing_account` via a request object, either of type
|
338
|
+
# {::Google::Cloud::Billing::V1::UpdateBillingAccountRequest} or an equivalent Hash.
|
339
|
+
#
|
340
|
+
# @param request [::Google::Cloud::Billing::V1::UpdateBillingAccountRequest, ::Hash]
|
341
|
+
# A request object representing the call parameters. Required. To specify no
|
342
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
343
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
344
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
345
|
+
#
|
346
|
+
# @overload update_billing_account(name: nil, account: nil, update_mask: nil)
|
347
|
+
# Pass arguments to `update_billing_account` via keyword arguments. Note that at
|
348
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
349
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
350
|
+
#
|
351
|
+
# @param name [::String]
|
352
|
+
# Required. The name of the billing account resource to be updated.
|
353
|
+
# @param account [::Google::Cloud::Billing::V1::BillingAccount, ::Hash]
|
354
|
+
# Required. The billing account resource to replace the resource on the
|
355
|
+
# server.
|
356
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
357
|
+
# The update mask applied to the resource.
|
358
|
+
# Only "display_name" is currently supported.
|
359
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
360
|
+
# @yieldparam result [::Google::Cloud::Billing::V1::BillingAccount]
|
361
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
362
|
+
#
|
363
|
+
# @return [::Google::Cloud::Billing::V1::BillingAccount]
|
364
|
+
#
|
365
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
366
|
+
def update_billing_account request, options = nil
|
367
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
368
|
+
|
369
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::UpdateBillingAccountRequest
|
370
|
+
|
371
|
+
# Converts hash and nil to an options object
|
372
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
373
|
+
|
374
|
+
# Customize the options with defaults
|
375
|
+
call_metadata = @config.rpcs.update_billing_account.metadata.to_h
|
376
|
+
|
377
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
378
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
379
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
380
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
381
|
+
transports_version_send: [:rest]
|
382
|
+
|
383
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
384
|
+
|
385
|
+
options.apply_defaults timeout: @config.rpcs.update_billing_account.timeout,
|
386
|
+
metadata: call_metadata,
|
387
|
+
retry_policy: @config.rpcs.update_billing_account.retry_policy
|
388
|
+
|
389
|
+
options.apply_defaults timeout: @config.timeout,
|
390
|
+
metadata: @config.metadata,
|
391
|
+
retry_policy: @config.retry_policy
|
392
|
+
|
393
|
+
@cloud_billing_stub.update_billing_account request, options do |result, operation|
|
394
|
+
yield result, operation if block_given?
|
395
|
+
return result
|
396
|
+
end
|
397
|
+
rescue ::Gapic::Rest::Error => e
|
398
|
+
raise ::Google::Cloud::Error.from_error(e)
|
399
|
+
end
|
400
|
+
|
401
|
+
##
|
402
|
+
# This method creates [billing
|
403
|
+
# subaccounts](https://cloud.google.com/billing/docs/concepts#subaccounts).
|
404
|
+
#
|
405
|
+
# Google Cloud resellers should use the
|
406
|
+
# Channel Services APIs,
|
407
|
+
# [accounts.customers.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers/create)
|
408
|
+
# and
|
409
|
+
# [accounts.customers.entitlements.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers.entitlements/create).
|
410
|
+
#
|
411
|
+
# When creating a subaccount, the current authenticated user must have the
|
412
|
+
# `billing.accounts.update` IAM permission on the parent account, which is
|
413
|
+
# typically given to billing account
|
414
|
+
# [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
|
415
|
+
# This method will return an error if the parent account has not been
|
416
|
+
# provisioned as a reseller account.
|
417
|
+
#
|
418
|
+
# @overload create_billing_account(request, options = nil)
|
419
|
+
# Pass arguments to `create_billing_account` via a request object, either of type
|
420
|
+
# {::Google::Cloud::Billing::V1::CreateBillingAccountRequest} or an equivalent Hash.
|
421
|
+
#
|
422
|
+
# @param request [::Google::Cloud::Billing::V1::CreateBillingAccountRequest, ::Hash]
|
423
|
+
# A request object representing the call parameters. Required. To specify no
|
424
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
425
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
426
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
427
|
+
#
|
428
|
+
# @overload create_billing_account(billing_account: nil)
|
429
|
+
# Pass arguments to `create_billing_account` via keyword arguments. Note that at
|
430
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
431
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
432
|
+
#
|
433
|
+
# @param billing_account [::Google::Cloud::Billing::V1::BillingAccount, ::Hash]
|
434
|
+
# Required. The billing account resource to create.
|
435
|
+
# Currently CreateBillingAccount only supports subaccount creation, so
|
436
|
+
# any created billing accounts must be under a provided parent billing
|
437
|
+
# account.
|
438
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
439
|
+
# @yieldparam result [::Google::Cloud::Billing::V1::BillingAccount]
|
440
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
441
|
+
#
|
442
|
+
# @return [::Google::Cloud::Billing::V1::BillingAccount]
|
443
|
+
#
|
444
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
445
|
+
def create_billing_account request, options = nil
|
446
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
447
|
+
|
448
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::CreateBillingAccountRequest
|
449
|
+
|
450
|
+
# Converts hash and nil to an options object
|
451
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
452
|
+
|
453
|
+
# Customize the options with defaults
|
454
|
+
call_metadata = @config.rpcs.create_billing_account.metadata.to_h
|
455
|
+
|
456
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
457
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
458
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
459
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
460
|
+
transports_version_send: [:rest]
|
461
|
+
|
462
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
463
|
+
|
464
|
+
options.apply_defaults timeout: @config.rpcs.create_billing_account.timeout,
|
465
|
+
metadata: call_metadata,
|
466
|
+
retry_policy: @config.rpcs.create_billing_account.retry_policy
|
467
|
+
|
468
|
+
options.apply_defaults timeout: @config.timeout,
|
469
|
+
metadata: @config.metadata,
|
470
|
+
retry_policy: @config.retry_policy
|
471
|
+
|
472
|
+
@cloud_billing_stub.create_billing_account request, options do |result, operation|
|
473
|
+
yield result, operation if block_given?
|
474
|
+
return result
|
475
|
+
end
|
476
|
+
rescue ::Gapic::Rest::Error => e
|
477
|
+
raise ::Google::Cloud::Error.from_error(e)
|
478
|
+
end
|
479
|
+
|
480
|
+
##
|
481
|
+
# Lists the projects associated with a billing account. The current
|
482
|
+
# authenticated user must have the `billing.resourceAssociations.list` IAM
|
483
|
+
# permission, which is often given to billing account
|
484
|
+
# [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
|
485
|
+
#
|
486
|
+
# @overload list_project_billing_info(request, options = nil)
|
487
|
+
# Pass arguments to `list_project_billing_info` via a request object, either of type
|
488
|
+
# {::Google::Cloud::Billing::V1::ListProjectBillingInfoRequest} or an equivalent Hash.
|
489
|
+
#
|
490
|
+
# @param request [::Google::Cloud::Billing::V1::ListProjectBillingInfoRequest, ::Hash]
|
491
|
+
# A request object representing the call parameters. Required. To specify no
|
492
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
493
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
494
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
495
|
+
#
|
496
|
+
# @overload list_project_billing_info(name: nil, page_size: nil, page_token: nil)
|
497
|
+
# Pass arguments to `list_project_billing_info` via keyword arguments. Note that at
|
498
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
499
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
500
|
+
#
|
501
|
+
# @param name [::String]
|
502
|
+
# Required. The resource name of the billing account associated with the
|
503
|
+
# projects that you want to list. For example,
|
504
|
+
# `billingAccounts/012345-567890-ABCDEF`.
|
505
|
+
# @param page_size [::Integer]
|
506
|
+
# Requested page size. The maximum page size is 100; this is also the
|
507
|
+
# default.
|
508
|
+
# @param page_token [::String]
|
509
|
+
# A token identifying a page of results to be returned. This should be a
|
510
|
+
# `next_page_token` value returned from a previous `ListProjectBillingInfo`
|
511
|
+
# call. If unspecified, the first page of results is returned.
|
512
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
513
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::ProjectBillingInfo>]
|
514
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
515
|
+
#
|
516
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::ProjectBillingInfo>]
|
517
|
+
#
|
518
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
519
|
+
def list_project_billing_info request, options = nil
|
520
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
521
|
+
|
522
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::ListProjectBillingInfoRequest
|
523
|
+
|
524
|
+
# Converts hash and nil to an options object
|
525
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
526
|
+
|
527
|
+
# Customize the options with defaults
|
528
|
+
call_metadata = @config.rpcs.list_project_billing_info.metadata.to_h
|
529
|
+
|
530
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
531
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
532
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
533
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
534
|
+
transports_version_send: [:rest]
|
535
|
+
|
536
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
537
|
+
|
538
|
+
options.apply_defaults timeout: @config.rpcs.list_project_billing_info.timeout,
|
539
|
+
metadata: call_metadata,
|
540
|
+
retry_policy: @config.rpcs.list_project_billing_info.retry_policy
|
541
|
+
|
542
|
+
options.apply_defaults timeout: @config.timeout,
|
543
|
+
metadata: @config.metadata,
|
544
|
+
retry_policy: @config.retry_policy
|
545
|
+
|
546
|
+
@cloud_billing_stub.list_project_billing_info request, options do |result, operation|
|
547
|
+
result = ::Gapic::Rest::PagedEnumerable.new @cloud_billing_stub, :list_project_billing_info, "project_billing_info", request, result, options
|
548
|
+
yield result, operation if block_given?
|
549
|
+
return result
|
550
|
+
end
|
551
|
+
rescue ::Gapic::Rest::Error => e
|
552
|
+
raise ::Google::Cloud::Error.from_error(e)
|
553
|
+
end
|
554
|
+
|
555
|
+
##
|
556
|
+
# Gets the billing information for a project. The current authenticated user
|
557
|
+
# must have the `resourcemanager.projects.get` permission for the project,
|
558
|
+
# which can be granted by assigning the [Project
|
559
|
+
# Viewer](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles)
|
560
|
+
# role.
|
561
|
+
#
|
562
|
+
# @overload get_project_billing_info(request, options = nil)
|
563
|
+
# Pass arguments to `get_project_billing_info` via a request object, either of type
|
564
|
+
# {::Google::Cloud::Billing::V1::GetProjectBillingInfoRequest} or an equivalent Hash.
|
565
|
+
#
|
566
|
+
# @param request [::Google::Cloud::Billing::V1::GetProjectBillingInfoRequest, ::Hash]
|
567
|
+
# A request object representing the call parameters. Required. To specify no
|
568
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
569
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
570
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
571
|
+
#
|
572
|
+
# @overload get_project_billing_info(name: nil)
|
573
|
+
# Pass arguments to `get_project_billing_info` via keyword arguments. Note that at
|
574
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
575
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
576
|
+
#
|
577
|
+
# @param name [::String]
|
578
|
+
# Required. The resource name of the project for which billing information is
|
579
|
+
# retrieved. For example, `projects/tokyo-rain-123`.
|
580
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
581
|
+
# @yieldparam result [::Google::Cloud::Billing::V1::ProjectBillingInfo]
|
582
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
583
|
+
#
|
584
|
+
# @return [::Google::Cloud::Billing::V1::ProjectBillingInfo]
|
585
|
+
#
|
586
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
587
|
+
def get_project_billing_info request, options = nil
|
588
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
589
|
+
|
590
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::GetProjectBillingInfoRequest
|
591
|
+
|
592
|
+
# Converts hash and nil to an options object
|
593
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
594
|
+
|
595
|
+
# Customize the options with defaults
|
596
|
+
call_metadata = @config.rpcs.get_project_billing_info.metadata.to_h
|
597
|
+
|
598
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
599
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
600
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
601
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
602
|
+
transports_version_send: [:rest]
|
603
|
+
|
604
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
605
|
+
|
606
|
+
options.apply_defaults timeout: @config.rpcs.get_project_billing_info.timeout,
|
607
|
+
metadata: call_metadata,
|
608
|
+
retry_policy: @config.rpcs.get_project_billing_info.retry_policy
|
609
|
+
|
610
|
+
options.apply_defaults timeout: @config.timeout,
|
611
|
+
metadata: @config.metadata,
|
612
|
+
retry_policy: @config.retry_policy
|
613
|
+
|
614
|
+
@cloud_billing_stub.get_project_billing_info request, options do |result, operation|
|
615
|
+
yield result, operation if block_given?
|
616
|
+
return result
|
617
|
+
end
|
618
|
+
rescue ::Gapic::Rest::Error => e
|
619
|
+
raise ::Google::Cloud::Error.from_error(e)
|
620
|
+
end
|
621
|
+
|
622
|
+
##
|
623
|
+
# Sets or updates the billing account associated with a project. You specify
|
624
|
+
# the new billing account by setting the `billing_account_name` in the
|
625
|
+
# `ProjectBillingInfo` resource to the resource name of a billing account.
|
626
|
+
# Associating a project with an open billing account enables billing on the
|
627
|
+
# project and allows charges for resource usage. If the project already had a
|
628
|
+
# billing account, this method changes the billing account used for resource
|
629
|
+
# usage charges.
|
630
|
+
#
|
631
|
+
# *Note:* Incurred charges that have not yet been reported in the transaction
|
632
|
+
# history of the Google Cloud Console might be billed to the new billing
|
633
|
+
# account, even if the charge occurred before the new billing account was
|
634
|
+
# assigned to the project.
|
635
|
+
#
|
636
|
+
# The current authenticated user must have ownership privileges for both the
|
637
|
+
# [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
|
638
|
+
# ) and the [billing
|
639
|
+
# account](https://cloud.google.com/billing/docs/how-to/billing-access).
|
640
|
+
#
|
641
|
+
# You can disable billing on the project by setting the
|
642
|
+
# `billing_account_name` field to empty. This action disassociates the
|
643
|
+
# current billing account from the project. Any billable activity of your
|
644
|
+
# in-use services will stop, and your application could stop functioning as
|
645
|
+
# expected. Any unbilled charges to date will be billed to the previously
|
646
|
+
# associated account. The current authenticated user must be either an owner
|
647
|
+
# of the project or an owner of the billing account for the project.
|
648
|
+
#
|
649
|
+
# Note that associating a project with a *closed* billing account will have
|
650
|
+
# much the same effect as disabling billing on the project: any paid
|
651
|
+
# resources used by the project will be shut down. Thus, unless you wish to
|
652
|
+
# disable billing, you should always call this method with the name of an
|
653
|
+
# *open* billing account.
|
654
|
+
#
|
655
|
+
# @overload update_project_billing_info(request, options = nil)
|
656
|
+
# Pass arguments to `update_project_billing_info` via a request object, either of type
|
657
|
+
# {::Google::Cloud::Billing::V1::UpdateProjectBillingInfoRequest} or an equivalent Hash.
|
658
|
+
#
|
659
|
+
# @param request [::Google::Cloud::Billing::V1::UpdateProjectBillingInfoRequest, ::Hash]
|
660
|
+
# A request object representing the call parameters. Required. To specify no
|
661
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
662
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
663
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
664
|
+
#
|
665
|
+
# @overload update_project_billing_info(name: nil, project_billing_info: nil)
|
666
|
+
# Pass arguments to `update_project_billing_info` via keyword arguments. Note that at
|
667
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
668
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
669
|
+
#
|
670
|
+
# @param name [::String]
|
671
|
+
# Required. The resource name of the project associated with the billing
|
672
|
+
# information that you want to update. For example,
|
673
|
+
# `projects/tokyo-rain-123`.
|
674
|
+
# @param project_billing_info [::Google::Cloud::Billing::V1::ProjectBillingInfo, ::Hash]
|
675
|
+
# The new billing information for the project. Read-only fields are ignored;
|
676
|
+
# thus, you can leave empty all fields except `billing_account_name`.
|
677
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
678
|
+
# @yieldparam result [::Google::Cloud::Billing::V1::ProjectBillingInfo]
|
679
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
680
|
+
#
|
681
|
+
# @return [::Google::Cloud::Billing::V1::ProjectBillingInfo]
|
682
|
+
#
|
683
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
684
|
+
def update_project_billing_info request, options = nil
|
685
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
686
|
+
|
687
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::UpdateProjectBillingInfoRequest
|
688
|
+
|
689
|
+
# Converts hash and nil to an options object
|
690
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
691
|
+
|
692
|
+
# Customize the options with defaults
|
693
|
+
call_metadata = @config.rpcs.update_project_billing_info.metadata.to_h
|
694
|
+
|
695
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
696
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
697
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
698
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
699
|
+
transports_version_send: [:rest]
|
700
|
+
|
701
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
702
|
+
|
703
|
+
options.apply_defaults timeout: @config.rpcs.update_project_billing_info.timeout,
|
704
|
+
metadata: call_metadata,
|
705
|
+
retry_policy: @config.rpcs.update_project_billing_info.retry_policy
|
706
|
+
|
707
|
+
options.apply_defaults timeout: @config.timeout,
|
708
|
+
metadata: @config.metadata,
|
709
|
+
retry_policy: @config.retry_policy
|
710
|
+
|
711
|
+
@cloud_billing_stub.update_project_billing_info request, options do |result, operation|
|
712
|
+
yield result, operation if block_given?
|
713
|
+
return result
|
714
|
+
end
|
715
|
+
rescue ::Gapic::Rest::Error => e
|
716
|
+
raise ::Google::Cloud::Error.from_error(e)
|
717
|
+
end
|
718
|
+
|
719
|
+
##
|
720
|
+
# Gets the access control policy for a billing account.
|
721
|
+
# The caller must have the `billing.accounts.getIamPolicy` permission on the
|
722
|
+
# account, which is often given to billing account
|
723
|
+
# [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
|
724
|
+
#
|
725
|
+
# @overload get_iam_policy(request, options = nil)
|
726
|
+
# Pass arguments to `get_iam_policy` via a request object, either of type
|
727
|
+
# {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
|
728
|
+
#
|
729
|
+
# @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
|
730
|
+
# A request object representing the call parameters. Required. To specify no
|
731
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
732
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
733
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
734
|
+
#
|
735
|
+
# @overload get_iam_policy(resource: nil, options: nil)
|
736
|
+
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
737
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
738
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
739
|
+
#
|
740
|
+
# @param resource [::String]
|
741
|
+
# REQUIRED: The resource for which the policy is being requested.
|
742
|
+
# See the operation documentation for the appropriate value for this field.
|
743
|
+
# @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
|
744
|
+
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
745
|
+
# `GetIamPolicy`.
|
746
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
747
|
+
# @yieldparam result [::Google::Iam::V1::Policy]
|
748
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
749
|
+
#
|
750
|
+
# @return [::Google::Iam::V1::Policy]
|
751
|
+
#
|
752
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
753
|
+
def get_iam_policy request, options = nil
|
754
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
755
|
+
|
756
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
|
757
|
+
|
758
|
+
# Converts hash and nil to an options object
|
759
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
760
|
+
|
761
|
+
# Customize the options with defaults
|
762
|
+
call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
763
|
+
|
764
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
765
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
766
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
767
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
768
|
+
transports_version_send: [:rest]
|
769
|
+
|
770
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
771
|
+
|
772
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
773
|
+
metadata: call_metadata,
|
774
|
+
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
775
|
+
|
776
|
+
options.apply_defaults timeout: @config.timeout,
|
777
|
+
metadata: @config.metadata,
|
778
|
+
retry_policy: @config.retry_policy
|
779
|
+
|
780
|
+
@cloud_billing_stub.get_iam_policy request, options do |result, operation|
|
781
|
+
yield result, operation if block_given?
|
782
|
+
return result
|
783
|
+
end
|
784
|
+
rescue ::Gapic::Rest::Error => e
|
785
|
+
raise ::Google::Cloud::Error.from_error(e)
|
786
|
+
end
|
787
|
+
|
788
|
+
##
|
789
|
+
# Sets the access control policy for a billing account. Replaces any existing
|
790
|
+
# policy.
|
791
|
+
# The caller must have the `billing.accounts.setIamPolicy` permission on the
|
792
|
+
# account, which is often given to billing account
|
793
|
+
# [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
|
794
|
+
#
|
795
|
+
# @overload set_iam_policy(request, options = nil)
|
796
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
797
|
+
# {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
798
|
+
#
|
799
|
+
# @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
|
800
|
+
# A request object representing the call parameters. Required. To specify no
|
801
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
802
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
803
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
804
|
+
#
|
805
|
+
# @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
|
806
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
807
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
808
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
809
|
+
#
|
810
|
+
# @param resource [::String]
|
811
|
+
# REQUIRED: The resource for which the policy is being specified.
|
812
|
+
# See the operation documentation for the appropriate value for this field.
|
813
|
+
# @param policy [::Google::Iam::V1::Policy, ::Hash]
|
814
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
815
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
816
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
817
|
+
# might reject them.
|
818
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
819
|
+
# OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
|
820
|
+
# the fields in the mask will be modified. If no mask is provided, the
|
821
|
+
# following default mask is used:
|
822
|
+
#
|
823
|
+
# `paths: "bindings, etag"`
|
824
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
825
|
+
# @yieldparam result [::Google::Iam::V1::Policy]
|
826
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
827
|
+
#
|
828
|
+
# @return [::Google::Iam::V1::Policy]
|
829
|
+
#
|
830
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
831
|
+
def set_iam_policy request, options = nil
|
832
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
833
|
+
|
834
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
|
835
|
+
|
836
|
+
# Converts hash and nil to an options object
|
837
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
838
|
+
|
839
|
+
# Customize the options with defaults
|
840
|
+
call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
841
|
+
|
842
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
843
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
844
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
845
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
846
|
+
transports_version_send: [:rest]
|
847
|
+
|
848
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
849
|
+
|
850
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
851
|
+
metadata: call_metadata,
|
852
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
853
|
+
|
854
|
+
options.apply_defaults timeout: @config.timeout,
|
855
|
+
metadata: @config.metadata,
|
856
|
+
retry_policy: @config.retry_policy
|
857
|
+
|
858
|
+
@cloud_billing_stub.set_iam_policy request, options do |result, operation|
|
859
|
+
yield result, operation if block_given?
|
860
|
+
return result
|
861
|
+
end
|
862
|
+
rescue ::Gapic::Rest::Error => e
|
863
|
+
raise ::Google::Cloud::Error.from_error(e)
|
864
|
+
end
|
865
|
+
|
866
|
+
##
|
867
|
+
# Tests the access control policy for a billing account. This method takes
|
868
|
+
# the resource and a set of permissions as input and returns the subset of
|
869
|
+
# the input permissions that the caller is allowed for that resource.
|
870
|
+
#
|
871
|
+
# @overload test_iam_permissions(request, options = nil)
|
872
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
873
|
+
# {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
874
|
+
#
|
875
|
+
# @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
|
876
|
+
# A request object representing the call parameters. Required. To specify no
|
877
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
878
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
879
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
880
|
+
#
|
881
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
882
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
883
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
884
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
885
|
+
#
|
886
|
+
# @param resource [::String]
|
887
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
888
|
+
# See the operation documentation for the appropriate value for this field.
|
889
|
+
# @param permissions [::Array<::String>]
|
890
|
+
# The set of permissions to check for the `resource`. Permissions with
|
891
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
892
|
+
# information see
|
893
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
894
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
895
|
+
# @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
|
896
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
897
|
+
#
|
898
|
+
# @return [::Google::Iam::V1::TestIamPermissionsResponse]
|
899
|
+
#
|
900
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
901
|
+
def test_iam_permissions request, options = nil
|
902
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
903
|
+
|
904
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
|
905
|
+
|
906
|
+
# Converts hash and nil to an options object
|
907
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
908
|
+
|
909
|
+
# Customize the options with defaults
|
910
|
+
call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
911
|
+
|
912
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
913
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
914
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
915
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
916
|
+
transports_version_send: [:rest]
|
917
|
+
|
918
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
919
|
+
|
920
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
921
|
+
metadata: call_metadata,
|
922
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
923
|
+
|
924
|
+
options.apply_defaults timeout: @config.timeout,
|
925
|
+
metadata: @config.metadata,
|
926
|
+
retry_policy: @config.retry_policy
|
927
|
+
|
928
|
+
@cloud_billing_stub.test_iam_permissions request, options do |result, operation|
|
929
|
+
yield result, operation if block_given?
|
930
|
+
return result
|
931
|
+
end
|
932
|
+
rescue ::Gapic::Rest::Error => e
|
933
|
+
raise ::Google::Cloud::Error.from_error(e)
|
934
|
+
end
|
935
|
+
|
936
|
+
##
|
937
|
+
# Configuration class for the CloudBilling REST API.
|
938
|
+
#
|
939
|
+
# This class represents the configuration for CloudBilling REST,
|
940
|
+
# providing control over timeouts, retry behavior, logging, transport
|
941
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
942
|
+
# applied individually to specific RPCs. See
|
943
|
+
# {::Google::Cloud::Billing::V1::CloudBilling::Rest::Client::Configuration::Rpcs}
|
944
|
+
# for a list of RPCs that can be configured independently.
|
945
|
+
#
|
946
|
+
# Configuration can be applied globally to all clients, or to a single client
|
947
|
+
# on construction.
|
948
|
+
#
|
949
|
+
# @example
|
950
|
+
#
|
951
|
+
# # Modify the global config, setting the timeout for
|
952
|
+
# # get_billing_account to 20 seconds,
|
953
|
+
# # and all remaining timeouts to 10 seconds.
|
954
|
+
# ::Google::Cloud::Billing::V1::CloudBilling::Rest::Client.configure do |config|
|
955
|
+
# config.timeout = 10.0
|
956
|
+
# config.rpcs.get_billing_account.timeout = 20.0
|
957
|
+
# end
|
958
|
+
#
|
959
|
+
# # Apply the above configuration only to a new client.
|
960
|
+
# client = ::Google::Cloud::Billing::V1::CloudBilling::Rest::Client.new do |config|
|
961
|
+
# config.timeout = 10.0
|
962
|
+
# config.rpcs.get_billing_account.timeout = 20.0
|
963
|
+
# end
|
964
|
+
#
|
965
|
+
# @!attribute [rw] endpoint
|
966
|
+
# The hostname or hostname:port of the service endpoint.
|
967
|
+
# Defaults to `"cloudbilling.googleapis.com"`.
|
968
|
+
# @return [::String]
|
969
|
+
# @!attribute [rw] credentials
|
970
|
+
# Credentials to send with calls. You may provide any of the following types:
|
971
|
+
# * (`String`) The path to a service account key file in JSON format
|
972
|
+
# * (`Hash`) A service account key as a Hash
|
973
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
974
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
975
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
976
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
977
|
+
# * (`nil`) indicating no credentials
|
978
|
+
# @return [::Object]
|
979
|
+
# @!attribute [rw] scope
|
980
|
+
# The OAuth scopes
|
981
|
+
# @return [::Array<::String>]
|
982
|
+
# @!attribute [rw] lib_name
|
983
|
+
# The library name as recorded in instrumentation and logging
|
984
|
+
# @return [::String]
|
985
|
+
# @!attribute [rw] lib_version
|
986
|
+
# The library version as recorded in instrumentation and logging
|
987
|
+
# @return [::String]
|
988
|
+
# @!attribute [rw] timeout
|
989
|
+
# The call timeout in seconds.
|
990
|
+
# @return [::Numeric]
|
991
|
+
# @!attribute [rw] metadata
|
992
|
+
# Additional headers to be sent with the call.
|
993
|
+
# @return [::Hash{::Symbol=>::String}]
|
994
|
+
# @!attribute [rw] retry_policy
|
995
|
+
# The retry policy. The value is a hash with the following keys:
|
996
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
997
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
998
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
999
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1000
|
+
# trigger a retry.
|
1001
|
+
# @return [::Hash]
|
1002
|
+
# @!attribute [rw] quota_project
|
1003
|
+
# A separate project against which to charge quota.
|
1004
|
+
# @return [::String]
|
1005
|
+
#
|
1006
|
+
class Configuration
|
1007
|
+
extend ::Gapic::Config
|
1008
|
+
|
1009
|
+
config_attr :endpoint, "cloudbilling.googleapis.com", ::String
|
1010
|
+
config_attr :credentials, nil do |value|
|
1011
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1012
|
+
allowed.any? { |klass| klass === value }
|
1013
|
+
end
|
1014
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1015
|
+
config_attr :lib_name, nil, ::String, nil
|
1016
|
+
config_attr :lib_version, nil, ::String, nil
|
1017
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1018
|
+
config_attr :metadata, nil, ::Hash, nil
|
1019
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1020
|
+
config_attr :quota_project, nil, ::String, nil
|
1021
|
+
|
1022
|
+
# @private
|
1023
|
+
def initialize parent_config = nil
|
1024
|
+
@parent_config = parent_config unless parent_config.nil?
|
1025
|
+
|
1026
|
+
yield self if block_given?
|
1027
|
+
end
|
1028
|
+
|
1029
|
+
##
|
1030
|
+
# Configurations for individual RPCs
|
1031
|
+
# @return [Rpcs]
|
1032
|
+
#
|
1033
|
+
def rpcs
|
1034
|
+
@rpcs ||= begin
|
1035
|
+
parent_rpcs = nil
|
1036
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1037
|
+
Rpcs.new parent_rpcs
|
1038
|
+
end
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
##
|
1042
|
+
# Configuration RPC class for the CloudBilling API.
|
1043
|
+
#
|
1044
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1045
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1046
|
+
# the following configuration fields:
|
1047
|
+
#
|
1048
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1049
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
1050
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1051
|
+
# include the following keys:
|
1052
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1053
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1054
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1055
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1056
|
+
# trigger a retry.
|
1057
|
+
#
|
1058
|
+
class Rpcs
|
1059
|
+
##
|
1060
|
+
# RPC-specific configuration for `get_billing_account`
|
1061
|
+
# @return [::Gapic::Config::Method]
|
1062
|
+
#
|
1063
|
+
attr_reader :get_billing_account
|
1064
|
+
##
|
1065
|
+
# RPC-specific configuration for `list_billing_accounts`
|
1066
|
+
# @return [::Gapic::Config::Method]
|
1067
|
+
#
|
1068
|
+
attr_reader :list_billing_accounts
|
1069
|
+
##
|
1070
|
+
# RPC-specific configuration for `update_billing_account`
|
1071
|
+
# @return [::Gapic::Config::Method]
|
1072
|
+
#
|
1073
|
+
attr_reader :update_billing_account
|
1074
|
+
##
|
1075
|
+
# RPC-specific configuration for `create_billing_account`
|
1076
|
+
# @return [::Gapic::Config::Method]
|
1077
|
+
#
|
1078
|
+
attr_reader :create_billing_account
|
1079
|
+
##
|
1080
|
+
# RPC-specific configuration for `list_project_billing_info`
|
1081
|
+
# @return [::Gapic::Config::Method]
|
1082
|
+
#
|
1083
|
+
attr_reader :list_project_billing_info
|
1084
|
+
##
|
1085
|
+
# RPC-specific configuration for `get_project_billing_info`
|
1086
|
+
# @return [::Gapic::Config::Method]
|
1087
|
+
#
|
1088
|
+
attr_reader :get_project_billing_info
|
1089
|
+
##
|
1090
|
+
# RPC-specific configuration for `update_project_billing_info`
|
1091
|
+
# @return [::Gapic::Config::Method]
|
1092
|
+
#
|
1093
|
+
attr_reader :update_project_billing_info
|
1094
|
+
##
|
1095
|
+
# RPC-specific configuration for `get_iam_policy`
|
1096
|
+
# @return [::Gapic::Config::Method]
|
1097
|
+
#
|
1098
|
+
attr_reader :get_iam_policy
|
1099
|
+
##
|
1100
|
+
# RPC-specific configuration for `set_iam_policy`
|
1101
|
+
# @return [::Gapic::Config::Method]
|
1102
|
+
#
|
1103
|
+
attr_reader :set_iam_policy
|
1104
|
+
##
|
1105
|
+
# RPC-specific configuration for `test_iam_permissions`
|
1106
|
+
# @return [::Gapic::Config::Method]
|
1107
|
+
#
|
1108
|
+
attr_reader :test_iam_permissions
|
1109
|
+
|
1110
|
+
# @private
|
1111
|
+
def initialize parent_rpcs = nil
|
1112
|
+
get_billing_account_config = parent_rpcs.get_billing_account if parent_rpcs.respond_to? :get_billing_account
|
1113
|
+
@get_billing_account = ::Gapic::Config::Method.new get_billing_account_config
|
1114
|
+
list_billing_accounts_config = parent_rpcs.list_billing_accounts if parent_rpcs.respond_to? :list_billing_accounts
|
1115
|
+
@list_billing_accounts = ::Gapic::Config::Method.new list_billing_accounts_config
|
1116
|
+
update_billing_account_config = parent_rpcs.update_billing_account if parent_rpcs.respond_to? :update_billing_account
|
1117
|
+
@update_billing_account = ::Gapic::Config::Method.new update_billing_account_config
|
1118
|
+
create_billing_account_config = parent_rpcs.create_billing_account if parent_rpcs.respond_to? :create_billing_account
|
1119
|
+
@create_billing_account = ::Gapic::Config::Method.new create_billing_account_config
|
1120
|
+
list_project_billing_info_config = parent_rpcs.list_project_billing_info if parent_rpcs.respond_to? :list_project_billing_info
|
1121
|
+
@list_project_billing_info = ::Gapic::Config::Method.new list_project_billing_info_config
|
1122
|
+
get_project_billing_info_config = parent_rpcs.get_project_billing_info if parent_rpcs.respond_to? :get_project_billing_info
|
1123
|
+
@get_project_billing_info = ::Gapic::Config::Method.new get_project_billing_info_config
|
1124
|
+
update_project_billing_info_config = parent_rpcs.update_project_billing_info if parent_rpcs.respond_to? :update_project_billing_info
|
1125
|
+
@update_project_billing_info = ::Gapic::Config::Method.new update_project_billing_info_config
|
1126
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
1127
|
+
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
1128
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
1129
|
+
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
1130
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
1131
|
+
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
1132
|
+
|
1133
|
+
yield self if block_given?
|
1134
|
+
end
|
1135
|
+
end
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
end
|
1139
|
+
end
|
1140
|
+
end
|
1141
|
+
end
|
1142
|
+
end
|
1143
|
+
end
|