google-apis-cloudbilling_v1 0.1.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.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module CloudbillingV1
18
+ # Version of the google-apis-cloudbilling_v1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20201017"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,391 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module CloudbillingV1
24
+
25
+ class AggregationInfo
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class AuditConfig
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class AuditLogConfig
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class BillingAccount
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class Binding
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class Category
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class Expr
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class GeoTaxonomy
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class ListBillingAccountsResponse
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class ListProjectBillingInfoResponse
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class ListServicesResponse
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class ListSkusResponse
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class Money
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class Policy
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ include Google::Apis::Core::JsonObjectSupport
107
+ end
108
+
109
+ class PricingExpression
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+
112
+ include Google::Apis::Core::JsonObjectSupport
113
+ end
114
+
115
+ class PricingInfo
116
+ class Representation < Google::Apis::Core::JsonRepresentation; end
117
+
118
+ include Google::Apis::Core::JsonObjectSupport
119
+ end
120
+
121
+ class ProjectBillingInfo
122
+ class Representation < Google::Apis::Core::JsonRepresentation; end
123
+
124
+ include Google::Apis::Core::JsonObjectSupport
125
+ end
126
+
127
+ class Service
128
+ class Representation < Google::Apis::Core::JsonRepresentation; end
129
+
130
+ include Google::Apis::Core::JsonObjectSupport
131
+ end
132
+
133
+ class SetIamPolicyRequest
134
+ class Representation < Google::Apis::Core::JsonRepresentation; end
135
+
136
+ include Google::Apis::Core::JsonObjectSupport
137
+ end
138
+
139
+ class Sku
140
+ class Representation < Google::Apis::Core::JsonRepresentation; end
141
+
142
+ include Google::Apis::Core::JsonObjectSupport
143
+ end
144
+
145
+ class TestIamPermissionsRequest
146
+ class Representation < Google::Apis::Core::JsonRepresentation; end
147
+
148
+ include Google::Apis::Core::JsonObjectSupport
149
+ end
150
+
151
+ class TestIamPermissionsResponse
152
+ class Representation < Google::Apis::Core::JsonRepresentation; end
153
+
154
+ include Google::Apis::Core::JsonObjectSupport
155
+ end
156
+
157
+ class TierRate
158
+ class Representation < Google::Apis::Core::JsonRepresentation; end
159
+
160
+ include Google::Apis::Core::JsonObjectSupport
161
+ end
162
+
163
+ class AggregationInfo
164
+ # @private
165
+ class Representation < Google::Apis::Core::JsonRepresentation
166
+ property :aggregation_count, as: 'aggregationCount'
167
+ property :aggregation_interval, as: 'aggregationInterval'
168
+ property :aggregation_level, as: 'aggregationLevel'
169
+ end
170
+ end
171
+
172
+ class AuditConfig
173
+ # @private
174
+ class Representation < Google::Apis::Core::JsonRepresentation
175
+ collection :audit_log_configs, as: 'auditLogConfigs', class: Google::Apis::CloudbillingV1::AuditLogConfig, decorator: Google::Apis::CloudbillingV1::AuditLogConfig::Representation
176
+
177
+ property :service, as: 'service'
178
+ end
179
+ end
180
+
181
+ class AuditLogConfig
182
+ # @private
183
+ class Representation < Google::Apis::Core::JsonRepresentation
184
+ collection :exempted_members, as: 'exemptedMembers'
185
+ property :log_type, as: 'logType'
186
+ end
187
+ end
188
+
189
+ class BillingAccount
190
+ # @private
191
+ class Representation < Google::Apis::Core::JsonRepresentation
192
+ property :display_name, as: 'displayName'
193
+ property :master_billing_account, as: 'masterBillingAccount'
194
+ property :name, as: 'name'
195
+ property :open, as: 'open'
196
+ end
197
+ end
198
+
199
+ class Binding
200
+ # @private
201
+ class Representation < Google::Apis::Core::JsonRepresentation
202
+ property :condition, as: 'condition', class: Google::Apis::CloudbillingV1::Expr, decorator: Google::Apis::CloudbillingV1::Expr::Representation
203
+
204
+ collection :members, as: 'members'
205
+ property :role, as: 'role'
206
+ end
207
+ end
208
+
209
+ class Category
210
+ # @private
211
+ class Representation < Google::Apis::Core::JsonRepresentation
212
+ property :resource_family, as: 'resourceFamily'
213
+ property :resource_group, as: 'resourceGroup'
214
+ property :service_display_name, as: 'serviceDisplayName'
215
+ property :usage_type, as: 'usageType'
216
+ end
217
+ end
218
+
219
+ class Expr
220
+ # @private
221
+ class Representation < Google::Apis::Core::JsonRepresentation
222
+ property :description, as: 'description'
223
+ property :expression, as: 'expression'
224
+ property :location, as: 'location'
225
+ property :title, as: 'title'
226
+ end
227
+ end
228
+
229
+ class GeoTaxonomy
230
+ # @private
231
+ class Representation < Google::Apis::Core::JsonRepresentation
232
+ collection :regions, as: 'regions'
233
+ property :type, as: 'type'
234
+ end
235
+ end
236
+
237
+ class ListBillingAccountsResponse
238
+ # @private
239
+ class Representation < Google::Apis::Core::JsonRepresentation
240
+ collection :billing_accounts, as: 'billingAccounts', class: Google::Apis::CloudbillingV1::BillingAccount, decorator: Google::Apis::CloudbillingV1::BillingAccount::Representation
241
+
242
+ property :next_page_token, as: 'nextPageToken'
243
+ end
244
+ end
245
+
246
+ class ListProjectBillingInfoResponse
247
+ # @private
248
+ class Representation < Google::Apis::Core::JsonRepresentation
249
+ property :next_page_token, as: 'nextPageToken'
250
+ collection :project_billing_info, as: 'projectBillingInfo', class: Google::Apis::CloudbillingV1::ProjectBillingInfo, decorator: Google::Apis::CloudbillingV1::ProjectBillingInfo::Representation
251
+
252
+ end
253
+ end
254
+
255
+ class ListServicesResponse
256
+ # @private
257
+ class Representation < Google::Apis::Core::JsonRepresentation
258
+ property :next_page_token, as: 'nextPageToken'
259
+ collection :services, as: 'services', class: Google::Apis::CloudbillingV1::Service, decorator: Google::Apis::CloudbillingV1::Service::Representation
260
+
261
+ end
262
+ end
263
+
264
+ class ListSkusResponse
265
+ # @private
266
+ class Representation < Google::Apis::Core::JsonRepresentation
267
+ property :next_page_token, as: 'nextPageToken'
268
+ collection :skus, as: 'skus', class: Google::Apis::CloudbillingV1::Sku, decorator: Google::Apis::CloudbillingV1::Sku::Representation
269
+
270
+ end
271
+ end
272
+
273
+ class Money
274
+ # @private
275
+ class Representation < Google::Apis::Core::JsonRepresentation
276
+ property :currency_code, as: 'currencyCode'
277
+ property :nanos, as: 'nanos'
278
+ property :units, :numeric_string => true, as: 'units'
279
+ end
280
+ end
281
+
282
+ class Policy
283
+ # @private
284
+ class Representation < Google::Apis::Core::JsonRepresentation
285
+ collection :audit_configs, as: 'auditConfigs', class: Google::Apis::CloudbillingV1::AuditConfig, decorator: Google::Apis::CloudbillingV1::AuditConfig::Representation
286
+
287
+ collection :bindings, as: 'bindings', class: Google::Apis::CloudbillingV1::Binding, decorator: Google::Apis::CloudbillingV1::Binding::Representation
288
+
289
+ property :etag, :base64 => true, as: 'etag'
290
+ property :version, as: 'version'
291
+ end
292
+ end
293
+
294
+ class PricingExpression
295
+ # @private
296
+ class Representation < Google::Apis::Core::JsonRepresentation
297
+ property :base_unit, as: 'baseUnit'
298
+ property :base_unit_conversion_factor, as: 'baseUnitConversionFactor'
299
+ property :base_unit_description, as: 'baseUnitDescription'
300
+ property :display_quantity, as: 'displayQuantity'
301
+ collection :tiered_rates, as: 'tieredRates', class: Google::Apis::CloudbillingV1::TierRate, decorator: Google::Apis::CloudbillingV1::TierRate::Representation
302
+
303
+ property :usage_unit, as: 'usageUnit'
304
+ property :usage_unit_description, as: 'usageUnitDescription'
305
+ end
306
+ end
307
+
308
+ class PricingInfo
309
+ # @private
310
+ class Representation < Google::Apis::Core::JsonRepresentation
311
+ property :aggregation_info, as: 'aggregationInfo', class: Google::Apis::CloudbillingV1::AggregationInfo, decorator: Google::Apis::CloudbillingV1::AggregationInfo::Representation
312
+
313
+ property :currency_conversion_rate, as: 'currencyConversionRate'
314
+ property :effective_time, as: 'effectiveTime'
315
+ property :pricing_expression, as: 'pricingExpression', class: Google::Apis::CloudbillingV1::PricingExpression, decorator: Google::Apis::CloudbillingV1::PricingExpression::Representation
316
+
317
+ property :summary, as: 'summary'
318
+ end
319
+ end
320
+
321
+ class ProjectBillingInfo
322
+ # @private
323
+ class Representation < Google::Apis::Core::JsonRepresentation
324
+ property :billing_account_name, as: 'billingAccountName'
325
+ property :billing_enabled, as: 'billingEnabled'
326
+ property :name, as: 'name'
327
+ property :project_id, as: 'projectId'
328
+ end
329
+ end
330
+
331
+ class Service
332
+ # @private
333
+ class Representation < Google::Apis::Core::JsonRepresentation
334
+ property :business_entity_name, as: 'businessEntityName'
335
+ property :display_name, as: 'displayName'
336
+ property :name, as: 'name'
337
+ property :service_id, as: 'serviceId'
338
+ end
339
+ end
340
+
341
+ class SetIamPolicyRequest
342
+ # @private
343
+ class Representation < Google::Apis::Core::JsonRepresentation
344
+ property :policy, as: 'policy', class: Google::Apis::CloudbillingV1::Policy, decorator: Google::Apis::CloudbillingV1::Policy::Representation
345
+
346
+ property :update_mask, as: 'updateMask'
347
+ end
348
+ end
349
+
350
+ class Sku
351
+ # @private
352
+ class Representation < Google::Apis::Core::JsonRepresentation
353
+ property :category, as: 'category', class: Google::Apis::CloudbillingV1::Category, decorator: Google::Apis::CloudbillingV1::Category::Representation
354
+
355
+ property :description, as: 'description'
356
+ property :geo_taxonomy, as: 'geoTaxonomy', class: Google::Apis::CloudbillingV1::GeoTaxonomy, decorator: Google::Apis::CloudbillingV1::GeoTaxonomy::Representation
357
+
358
+ property :name, as: 'name'
359
+ collection :pricing_info, as: 'pricingInfo', class: Google::Apis::CloudbillingV1::PricingInfo, decorator: Google::Apis::CloudbillingV1::PricingInfo::Representation
360
+
361
+ property :service_provider_name, as: 'serviceProviderName'
362
+ collection :service_regions, as: 'serviceRegions'
363
+ property :sku_id, as: 'skuId'
364
+ end
365
+ end
366
+
367
+ class TestIamPermissionsRequest
368
+ # @private
369
+ class Representation < Google::Apis::Core::JsonRepresentation
370
+ collection :permissions, as: 'permissions'
371
+ end
372
+ end
373
+
374
+ class TestIamPermissionsResponse
375
+ # @private
376
+ class Representation < Google::Apis::Core::JsonRepresentation
377
+ collection :permissions, as: 'permissions'
378
+ end
379
+ end
380
+
381
+ class TierRate
382
+ # @private
383
+ class Representation < Google::Apis::Core::JsonRepresentation
384
+ property :start_usage_amount, as: 'startUsageAmount'
385
+ property :unit_price, as: 'unitPrice', class: Google::Apis::CloudbillingV1::Money, decorator: Google::Apis::CloudbillingV1::Money::Representation
386
+
387
+ end
388
+ end
389
+ end
390
+ end
391
+ end
@@ -0,0 +1,555 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module CloudbillingV1
23
+ # Cloud Billing API
24
+ #
25
+ # Allows developers to manage billing for their Google Cloud Platform projects
26
+ # programmatically.
27
+ #
28
+ # @example
29
+ # require 'google/apis/cloudbilling_v1'
30
+ #
31
+ # Cloudbilling = Google::Apis::CloudbillingV1 # Alias the module
32
+ # service = Cloudbilling::CloudbillingService.new
33
+ #
34
+ # @see https://cloud.google.com/billing/
35
+ class CloudbillingService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://cloudbilling.googleapis.com/', '',
48
+ client_name: 'google-apis-cloudbilling_v1',
49
+ client_version: Google::Apis::CloudbillingV1::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Creates a billing account. This method can only be used to create [billing
54
+ # subaccounts](https://cloud.google.com/billing/docs/concepts) by Google Cloud
55
+ # resellers. When creating a subaccount, the current authenticated user must
56
+ # have the `billing.accounts.update` IAM permission on the master account, which
57
+ # is typically given to billing account [administrators](https://cloud.google.
58
+ # com/billing/docs/how-to/billing-access). This method will return an error if
59
+ # the master account has not been provisioned as a reseller account.
60
+ # @param [Google::Apis::CloudbillingV1::BillingAccount] billing_account_object
61
+ # @param [String] fields
62
+ # Selector specifying which fields to include in a partial response.
63
+ # @param [String] quota_user
64
+ # Available to use for quota purposes for server-side applications. Can be any
65
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
66
+ # @param [Google::Apis::RequestOptions] options
67
+ # Request-specific options
68
+ #
69
+ # @yield [result, err] Result & error if block supplied
70
+ # @yieldparam result [Google::Apis::CloudbillingV1::BillingAccount] parsed result object
71
+ # @yieldparam err [StandardError] error object if request failed
72
+ #
73
+ # @return [Google::Apis::CloudbillingV1::BillingAccount]
74
+ #
75
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
76
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
77
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
78
+ def create_billing_account(billing_account_object = nil, fields: nil, quota_user: nil, options: nil, &block)
79
+ command = make_simple_command(:post, 'v1/billingAccounts', options)
80
+ command.request_representation = Google::Apis::CloudbillingV1::BillingAccount::Representation
81
+ command.request_object = billing_account_object
82
+ command.response_representation = Google::Apis::CloudbillingV1::BillingAccount::Representation
83
+ command.response_class = Google::Apis::CloudbillingV1::BillingAccount
84
+ command.query['fields'] = fields unless fields.nil?
85
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
86
+ execute_or_queue_command(command, &block)
87
+ end
88
+
89
+ # Gets information about a billing account. The current authenticated user must
90
+ # be a [viewer of the billing account](https://cloud.google.com/billing/docs/how-
91
+ # to/billing-access).
92
+ # @param [String] name
93
+ # Required. The resource name of the billing account to retrieve. For example, `
94
+ # billingAccounts/012345-567890-ABCDEF`.
95
+ # @param [String] fields
96
+ # Selector specifying which fields to include in a partial response.
97
+ # @param [String] quota_user
98
+ # Available to use for quota purposes for server-side applications. Can be any
99
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
100
+ # @param [Google::Apis::RequestOptions] options
101
+ # Request-specific options
102
+ #
103
+ # @yield [result, err] Result & error if block supplied
104
+ # @yieldparam result [Google::Apis::CloudbillingV1::BillingAccount] parsed result object
105
+ # @yieldparam err [StandardError] error object if request failed
106
+ #
107
+ # @return [Google::Apis::CloudbillingV1::BillingAccount]
108
+ #
109
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
110
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
111
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
112
+ def get_billing_account(name, fields: nil, quota_user: nil, options: nil, &block)
113
+ command = make_simple_command(:get, 'v1/{+name}', options)
114
+ command.response_representation = Google::Apis::CloudbillingV1::BillingAccount::Representation
115
+ command.response_class = Google::Apis::CloudbillingV1::BillingAccount
116
+ command.params['name'] = name unless name.nil?
117
+ command.query['fields'] = fields unless fields.nil?
118
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
119
+ execute_or_queue_command(command, &block)
120
+ end
121
+
122
+ # Gets the access control policy for a billing account. The caller must have the
123
+ # `billing.accounts.getIamPolicy` permission on the account, which is often
124
+ # given to billing account [viewers](https://cloud.google.com/billing/docs/how-
125
+ # to/billing-access).
126
+ # @param [String] resource
127
+ # REQUIRED: The resource for which the policy is being requested. See the
128
+ # operation documentation for the appropriate value for this field.
129
+ # @param [Fixnum] options_requested_policy_version
130
+ # Optional. The policy format version to be returned. Valid values are 0, 1, and
131
+ # 3. Requests specifying an invalid value will be rejected. Requests for
132
+ # policies with any conditional bindings must specify version 3. Policies
133
+ # without any conditional bindings may specify any valid value or leave the
134
+ # field unset. To learn which resources support conditions in their IAM policies,
135
+ # see the [IAM documentation](https://cloud.google.com/iam/help/conditions/
136
+ # resource-policies).
137
+ # @param [String] fields
138
+ # Selector specifying which fields to include in a partial response.
139
+ # @param [String] quota_user
140
+ # Available to use for quota purposes for server-side applications. Can be any
141
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
142
+ # @param [Google::Apis::RequestOptions] options
143
+ # Request-specific options
144
+ #
145
+ # @yield [result, err] Result & error if block supplied
146
+ # @yieldparam result [Google::Apis::CloudbillingV1::Policy] parsed result object
147
+ # @yieldparam err [StandardError] error object if request failed
148
+ #
149
+ # @return [Google::Apis::CloudbillingV1::Policy]
150
+ #
151
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
152
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
153
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
154
+ def get_billing_account_iam_policy(resource, options_requested_policy_version: nil, fields: nil, quota_user: nil, options: nil, &block)
155
+ command = make_simple_command(:get, 'v1/{+resource}:getIamPolicy', options)
156
+ command.response_representation = Google::Apis::CloudbillingV1::Policy::Representation
157
+ command.response_class = Google::Apis::CloudbillingV1::Policy
158
+ command.params['resource'] = resource unless resource.nil?
159
+ command.query['options.requestedPolicyVersion'] = options_requested_policy_version unless options_requested_policy_version.nil?
160
+ command.query['fields'] = fields unless fields.nil?
161
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
162
+ execute_or_queue_command(command, &block)
163
+ end
164
+
165
+ # Lists the billing accounts that the current authenticated user has permission
166
+ # to [view](https://cloud.google.com/billing/docs/how-to/billing-access).
167
+ # @param [String] filter
168
+ # Options for how to filter the returned billing accounts. Currently this only
169
+ # supports filtering for [subaccounts](https://cloud.google.com/billing/docs/
170
+ # concepts) under a single provided reseller billing account. (e.g. "
171
+ # master_billing_account=billingAccounts/012345-678901-ABCDEF"). Boolean algebra
172
+ # and other fields are not currently supported.
173
+ # @param [Fixnum] page_size
174
+ # Requested page size. The maximum page size is 100; this is also the default.
175
+ # @param [String] page_token
176
+ # A token identifying a page of results to return. This should be a `
177
+ # next_page_token` value returned from a previous `ListBillingAccounts` call. If
178
+ # unspecified, the first page of results is returned.
179
+ # @param [String] fields
180
+ # Selector specifying which fields to include in a partial response.
181
+ # @param [String] quota_user
182
+ # Available to use for quota purposes for server-side applications. Can be any
183
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
184
+ # @param [Google::Apis::RequestOptions] options
185
+ # Request-specific options
186
+ #
187
+ # @yield [result, err] Result & error if block supplied
188
+ # @yieldparam result [Google::Apis::CloudbillingV1::ListBillingAccountsResponse] parsed result object
189
+ # @yieldparam err [StandardError] error object if request failed
190
+ #
191
+ # @return [Google::Apis::CloudbillingV1::ListBillingAccountsResponse]
192
+ #
193
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
194
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
195
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
196
+ def list_billing_accounts(filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
197
+ command = make_simple_command(:get, 'v1/billingAccounts', options)
198
+ command.response_representation = Google::Apis::CloudbillingV1::ListBillingAccountsResponse::Representation
199
+ command.response_class = Google::Apis::CloudbillingV1::ListBillingAccountsResponse
200
+ command.query['filter'] = filter unless filter.nil?
201
+ command.query['pageSize'] = page_size unless page_size.nil?
202
+ command.query['pageToken'] = page_token unless page_token.nil?
203
+ command.query['fields'] = fields unless fields.nil?
204
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
205
+ execute_or_queue_command(command, &block)
206
+ end
207
+
208
+ # Updates a billing account's fields. Currently the only field that can be
209
+ # edited is `display_name`. The current authenticated user must have the `
210
+ # billing.accounts.update` IAM permission, which is typically given to the [
211
+ # administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of
212
+ # the billing account.
213
+ # @param [String] name
214
+ # Required. The name of the billing account resource to be updated.
215
+ # @param [Google::Apis::CloudbillingV1::BillingAccount] billing_account_object
216
+ # @param [String] update_mask
217
+ # The update mask applied to the resource. Only "display_name" is currently
218
+ # supported.
219
+ # @param [String] fields
220
+ # Selector specifying which fields to include in a partial response.
221
+ # @param [String] quota_user
222
+ # Available to use for quota purposes for server-side applications. Can be any
223
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
224
+ # @param [Google::Apis::RequestOptions] options
225
+ # Request-specific options
226
+ #
227
+ # @yield [result, err] Result & error if block supplied
228
+ # @yieldparam result [Google::Apis::CloudbillingV1::BillingAccount] parsed result object
229
+ # @yieldparam err [StandardError] error object if request failed
230
+ #
231
+ # @return [Google::Apis::CloudbillingV1::BillingAccount]
232
+ #
233
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
234
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
235
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
236
+ def patch_billing_account(name, billing_account_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
237
+ command = make_simple_command(:patch, 'v1/{+name}', options)
238
+ command.request_representation = Google::Apis::CloudbillingV1::BillingAccount::Representation
239
+ command.request_object = billing_account_object
240
+ command.response_representation = Google::Apis::CloudbillingV1::BillingAccount::Representation
241
+ command.response_class = Google::Apis::CloudbillingV1::BillingAccount
242
+ command.params['name'] = name unless name.nil?
243
+ command.query['updateMask'] = update_mask unless update_mask.nil?
244
+ command.query['fields'] = fields unless fields.nil?
245
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
246
+ execute_or_queue_command(command, &block)
247
+ end
248
+
249
+ # Sets the access control policy for a billing account. Replaces any existing
250
+ # policy. The caller must have the `billing.accounts.setIamPolicy` permission on
251
+ # the account, which is often given to billing account [administrators](https://
252
+ # cloud.google.com/billing/docs/how-to/billing-access).
253
+ # @param [String] resource
254
+ # REQUIRED: The resource for which the policy is being specified. See the
255
+ # operation documentation for the appropriate value for this field.
256
+ # @param [Google::Apis::CloudbillingV1::SetIamPolicyRequest] set_iam_policy_request_object
257
+ # @param [String] fields
258
+ # Selector specifying which fields to include in a partial response.
259
+ # @param [String] quota_user
260
+ # Available to use for quota purposes for server-side applications. Can be any
261
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
262
+ # @param [Google::Apis::RequestOptions] options
263
+ # Request-specific options
264
+ #
265
+ # @yield [result, err] Result & error if block supplied
266
+ # @yieldparam result [Google::Apis::CloudbillingV1::Policy] parsed result object
267
+ # @yieldparam err [StandardError] error object if request failed
268
+ #
269
+ # @return [Google::Apis::CloudbillingV1::Policy]
270
+ #
271
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
272
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
273
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
274
+ def set_billing_account_iam_policy(resource, set_iam_policy_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
275
+ command = make_simple_command(:post, 'v1/{+resource}:setIamPolicy', options)
276
+ command.request_representation = Google::Apis::CloudbillingV1::SetIamPolicyRequest::Representation
277
+ command.request_object = set_iam_policy_request_object
278
+ command.response_representation = Google::Apis::CloudbillingV1::Policy::Representation
279
+ command.response_class = Google::Apis::CloudbillingV1::Policy
280
+ command.params['resource'] = resource unless resource.nil?
281
+ command.query['fields'] = fields unless fields.nil?
282
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
283
+ execute_or_queue_command(command, &block)
284
+ end
285
+
286
+ # Tests the access control policy for a billing account. This method takes the
287
+ # resource and a set of permissions as input and returns the subset of the input
288
+ # permissions that the caller is allowed for that resource.
289
+ # @param [String] resource
290
+ # REQUIRED: The resource for which the policy detail is being requested. See the
291
+ # operation documentation for the appropriate value for this field.
292
+ # @param [Google::Apis::CloudbillingV1::TestIamPermissionsRequest] test_iam_permissions_request_object
293
+ # @param [String] fields
294
+ # Selector specifying which fields to include in a partial response.
295
+ # @param [String] quota_user
296
+ # Available to use for quota purposes for server-side applications. Can be any
297
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
298
+ # @param [Google::Apis::RequestOptions] options
299
+ # Request-specific options
300
+ #
301
+ # @yield [result, err] Result & error if block supplied
302
+ # @yieldparam result [Google::Apis::CloudbillingV1::TestIamPermissionsResponse] parsed result object
303
+ # @yieldparam err [StandardError] error object if request failed
304
+ #
305
+ # @return [Google::Apis::CloudbillingV1::TestIamPermissionsResponse]
306
+ #
307
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
308
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
309
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
310
+ def test_billing_account_iam_permissions(resource, test_iam_permissions_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
311
+ command = make_simple_command(:post, 'v1/{+resource}:testIamPermissions', options)
312
+ command.request_representation = Google::Apis::CloudbillingV1::TestIamPermissionsRequest::Representation
313
+ command.request_object = test_iam_permissions_request_object
314
+ command.response_representation = Google::Apis::CloudbillingV1::TestIamPermissionsResponse::Representation
315
+ command.response_class = Google::Apis::CloudbillingV1::TestIamPermissionsResponse
316
+ command.params['resource'] = resource unless resource.nil?
317
+ command.query['fields'] = fields unless fields.nil?
318
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
319
+ execute_or_queue_command(command, &block)
320
+ end
321
+
322
+ # Lists the projects associated with a billing account. The current
323
+ # authenticated user must have the `billing.resourceAssociations.list` IAM
324
+ # permission, which is often given to billing account [viewers](https://cloud.
325
+ # google.com/billing/docs/how-to/billing-access).
326
+ # @param [String] name
327
+ # Required. The resource name of the billing account associated with the
328
+ # projects that you want to list. For example, `billingAccounts/012345-567890-
329
+ # ABCDEF`.
330
+ # @param [Fixnum] page_size
331
+ # Requested page size. The maximum page size is 100; this is also the default.
332
+ # @param [String] page_token
333
+ # A token identifying a page of results to be returned. This should be a `
334
+ # next_page_token` value returned from a previous `ListProjectBillingInfo` call.
335
+ # If unspecified, the first page of results is returned.
336
+ # @param [String] fields
337
+ # Selector specifying which fields to include in a partial response.
338
+ # @param [String] quota_user
339
+ # Available to use for quota purposes for server-side applications. Can be any
340
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
341
+ # @param [Google::Apis::RequestOptions] options
342
+ # Request-specific options
343
+ #
344
+ # @yield [result, err] Result & error if block supplied
345
+ # @yieldparam result [Google::Apis::CloudbillingV1::ListProjectBillingInfoResponse] parsed result object
346
+ # @yieldparam err [StandardError] error object if request failed
347
+ #
348
+ # @return [Google::Apis::CloudbillingV1::ListProjectBillingInfoResponse]
349
+ #
350
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
351
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
352
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
353
+ def list_billing_account_projects(name, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
354
+ command = make_simple_command(:get, 'v1/{+name}/projects', options)
355
+ command.response_representation = Google::Apis::CloudbillingV1::ListProjectBillingInfoResponse::Representation
356
+ command.response_class = Google::Apis::CloudbillingV1::ListProjectBillingInfoResponse
357
+ command.params['name'] = name unless name.nil?
358
+ command.query['pageSize'] = page_size unless page_size.nil?
359
+ command.query['pageToken'] = page_token unless page_token.nil?
360
+ command.query['fields'] = fields unless fields.nil?
361
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
362
+ execute_or_queue_command(command, &block)
363
+ end
364
+
365
+ # Gets the billing information for a project. The current authenticated user
366
+ # must have [permission to view the project](https://cloud.google.com/docs/
367
+ # permissions-overview#h.bgs0oxofvnoo ).
368
+ # @param [String] name
369
+ # Required. The resource name of the project for which billing information is
370
+ # retrieved. For example, `projects/tokyo-rain-123`.
371
+ # @param [String] fields
372
+ # Selector specifying which fields to include in a partial response.
373
+ # @param [String] quota_user
374
+ # Available to use for quota purposes for server-side applications. Can be any
375
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
376
+ # @param [Google::Apis::RequestOptions] options
377
+ # Request-specific options
378
+ #
379
+ # @yield [result, err] Result & error if block supplied
380
+ # @yieldparam result [Google::Apis::CloudbillingV1::ProjectBillingInfo] parsed result object
381
+ # @yieldparam err [StandardError] error object if request failed
382
+ #
383
+ # @return [Google::Apis::CloudbillingV1::ProjectBillingInfo]
384
+ #
385
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
386
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
387
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
388
+ def get_project_billing_info(name, fields: nil, quota_user: nil, options: nil, &block)
389
+ command = make_simple_command(:get, 'v1/{+name}/billingInfo', options)
390
+ command.response_representation = Google::Apis::CloudbillingV1::ProjectBillingInfo::Representation
391
+ command.response_class = Google::Apis::CloudbillingV1::ProjectBillingInfo
392
+ command.params['name'] = name unless name.nil?
393
+ command.query['fields'] = fields unless fields.nil?
394
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
395
+ execute_or_queue_command(command, &block)
396
+ end
397
+
398
+ # Sets or updates the billing account associated with a project. You specify the
399
+ # new billing account by setting the `billing_account_name` in the `
400
+ # ProjectBillingInfo` resource to the resource name of a billing account.
401
+ # Associating a project with an open billing account enables billing on the
402
+ # project and allows charges for resource usage. If the project already had a
403
+ # billing account, this method changes the billing account used for resource
404
+ # usage charges. *Note:* Incurred charges that have not yet been reported in the
405
+ # transaction history of the Google Cloud Console might be billed to the new
406
+ # billing account, even if the charge occurred before the new billing account
407
+ # was assigned to the project. The current authenticated user must have
408
+ # ownership privileges for both the [project](https://cloud.google.com/docs/
409
+ # permissions-overview#h.bgs0oxofvnoo ) and the [billing account](https://cloud.
410
+ # google.com/billing/docs/how-to/billing-access). You can disable billing on the
411
+ # project by setting the `billing_account_name` field to empty. This action
412
+ # disassociates the current billing account from the project. Any billable
413
+ # activity of your in-use services will stop, and your application could stop
414
+ # functioning as expected. Any unbilled charges to date will be billed to the
415
+ # previously associated account. The current authenticated user must be either
416
+ # an owner of the project or an owner of the billing account for the project.
417
+ # Note that associating a project with a *closed* billing account will have much
418
+ # the same effect as disabling billing on the project: any paid resources used
419
+ # by the project will be shut down. Thus, unless you wish to disable billing,
420
+ # you should always call this method with the name of an *open* billing account.
421
+ # @param [String] name
422
+ # Required. The resource name of the project associated with the billing
423
+ # information that you want to update. For example, `projects/tokyo-rain-123`.
424
+ # @param [Google::Apis::CloudbillingV1::ProjectBillingInfo] project_billing_info_object
425
+ # @param [String] fields
426
+ # Selector specifying which fields to include in a partial response.
427
+ # @param [String] quota_user
428
+ # Available to use for quota purposes for server-side applications. Can be any
429
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
430
+ # @param [Google::Apis::RequestOptions] options
431
+ # Request-specific options
432
+ #
433
+ # @yield [result, err] Result & error if block supplied
434
+ # @yieldparam result [Google::Apis::CloudbillingV1::ProjectBillingInfo] parsed result object
435
+ # @yieldparam err [StandardError] error object if request failed
436
+ #
437
+ # @return [Google::Apis::CloudbillingV1::ProjectBillingInfo]
438
+ #
439
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
440
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
441
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
442
+ def update_project_billing_info(name, project_billing_info_object = nil, fields: nil, quota_user: nil, options: nil, &block)
443
+ command = make_simple_command(:put, 'v1/{+name}/billingInfo', options)
444
+ command.request_representation = Google::Apis::CloudbillingV1::ProjectBillingInfo::Representation
445
+ command.request_object = project_billing_info_object
446
+ command.response_representation = Google::Apis::CloudbillingV1::ProjectBillingInfo::Representation
447
+ command.response_class = Google::Apis::CloudbillingV1::ProjectBillingInfo
448
+ command.params['name'] = name unless name.nil?
449
+ command.query['fields'] = fields unless fields.nil?
450
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
451
+ execute_or_queue_command(command, &block)
452
+ end
453
+
454
+ # Lists all public cloud services.
455
+ # @param [Fixnum] page_size
456
+ # Requested page size. Defaults to 5000.
457
+ # @param [String] page_token
458
+ # A token identifying a page of results to return. This should be a `
459
+ # next_page_token` value returned from a previous `ListServices` call. If
460
+ # unspecified, the first page of results is returned.
461
+ # @param [String] fields
462
+ # Selector specifying which fields to include in a partial response.
463
+ # @param [String] quota_user
464
+ # Available to use for quota purposes for server-side applications. Can be any
465
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
466
+ # @param [Google::Apis::RequestOptions] options
467
+ # Request-specific options
468
+ #
469
+ # @yield [result, err] Result & error if block supplied
470
+ # @yieldparam result [Google::Apis::CloudbillingV1::ListServicesResponse] parsed result object
471
+ # @yieldparam err [StandardError] error object if request failed
472
+ #
473
+ # @return [Google::Apis::CloudbillingV1::ListServicesResponse]
474
+ #
475
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
476
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
477
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
478
+ def list_services(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
479
+ command = make_simple_command(:get, 'v1/services', options)
480
+ command.response_representation = Google::Apis::CloudbillingV1::ListServicesResponse::Representation
481
+ command.response_class = Google::Apis::CloudbillingV1::ListServicesResponse
482
+ command.query['pageSize'] = page_size unless page_size.nil?
483
+ command.query['pageToken'] = page_token unless page_token.nil?
484
+ command.query['fields'] = fields unless fields.nil?
485
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
486
+ execute_or_queue_command(command, &block)
487
+ end
488
+
489
+ # Lists all publicly available SKUs for a given cloud service.
490
+ # @param [String] parent
491
+ # Required. The name of the service. Example: "services/DA34-426B-A397"
492
+ # @param [String] currency_code
493
+ # The ISO 4217 currency code for the pricing info in the response proto. Will
494
+ # use the conversion rate as of start_time. Optional. If not specified USD will
495
+ # be used.
496
+ # @param [String] end_time
497
+ # Optional exclusive end time of the time range for which the pricing versions
498
+ # will be returned. Timestamps in the future are not allowed. The time range has
499
+ # to be within a single calendar month in America/Los_Angeles timezone. Time
500
+ # range as a whole is optional. If not specified, the latest pricing will be
501
+ # returned (up to 12 hours old at most).
502
+ # @param [Fixnum] page_size
503
+ # Requested page size. Defaults to 5000.
504
+ # @param [String] page_token
505
+ # A token identifying a page of results to return. This should be a `
506
+ # next_page_token` value returned from a previous `ListSkus` call. If
507
+ # unspecified, the first page of results is returned.
508
+ # @param [String] start_time
509
+ # Optional inclusive start time of the time range for which the pricing versions
510
+ # will be returned. Timestamps in the future are not allowed. The time range has
511
+ # to be within a single calendar month in America/Los_Angeles timezone. Time
512
+ # range as a whole is optional. If not specified, the latest pricing will be
513
+ # returned (up to 12 hours old at most).
514
+ # @param [String] fields
515
+ # Selector specifying which fields to include in a partial response.
516
+ # @param [String] quota_user
517
+ # Available to use for quota purposes for server-side applications. Can be any
518
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
519
+ # @param [Google::Apis::RequestOptions] options
520
+ # Request-specific options
521
+ #
522
+ # @yield [result, err] Result & error if block supplied
523
+ # @yieldparam result [Google::Apis::CloudbillingV1::ListSkusResponse] parsed result object
524
+ # @yieldparam err [StandardError] error object if request failed
525
+ #
526
+ # @return [Google::Apis::CloudbillingV1::ListSkusResponse]
527
+ #
528
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
529
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
530
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
531
+ def list_service_skus(parent, currency_code: nil, end_time: nil, page_size: nil, page_token: nil, start_time: nil, fields: nil, quota_user: nil, options: nil, &block)
532
+ command = make_simple_command(:get, 'v1/{+parent}/skus', options)
533
+ command.response_representation = Google::Apis::CloudbillingV1::ListSkusResponse::Representation
534
+ command.response_class = Google::Apis::CloudbillingV1::ListSkusResponse
535
+ command.params['parent'] = parent unless parent.nil?
536
+ command.query['currencyCode'] = currency_code unless currency_code.nil?
537
+ command.query['endTime'] = end_time unless end_time.nil?
538
+ command.query['pageSize'] = page_size unless page_size.nil?
539
+ command.query['pageToken'] = page_token unless page_token.nil?
540
+ command.query['startTime'] = start_time unless start_time.nil?
541
+ command.query['fields'] = fields unless fields.nil?
542
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
543
+ execute_or_queue_command(command, &block)
544
+ end
545
+
546
+ protected
547
+
548
+ def apply_command_defaults(command)
549
+ command.query['key'] = key unless key.nil?
550
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
551
+ end
552
+ end
553
+ end
554
+ end
555
+ end