google-cloud-billing-v1 0.15.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +72 -101
- data/lib/google/cloud/billing/v1/cloud_billing/client.rb +150 -12
- data/lib/google/cloud/billing/v1/cloud_billing/paths.rb +40 -4
- data/lib/google/cloud/billing/v1/cloud_billing/rest/client.rb +145 -11
- data/lib/google/cloud/billing/v1/cloud_billing/rest/service_stub.rb +112 -2
- data/lib/google/cloud/billing/v1/cloud_billing_pb.rb +2 -1
- data/lib/google/cloud/billing/v1/cloud_billing_services_pb.rb +4 -1
- data/lib/google/cloud/billing/v1/cloud_catalog/client.rb +31 -8
- data/lib/google/cloud/billing/v1/cloud_catalog/rest/client.rb +33 -7
- data/lib/google/cloud/billing/v1/cloud_catalog/rest/service_stub.rb +14 -2
- data/lib/google/cloud/billing/v1/version.rb +1 -1
- data/proto_docs/google/api/client.rb +14 -0
- data/proto_docs/google/cloud/billing/v1/cloud_billing.rb +45 -1
- metadata +5 -5
@@ -33,6 +33,9 @@ module Google
|
|
33
33
|
# projects.
|
34
34
|
#
|
35
35
|
class Client
|
36
|
+
# @private
|
37
|
+
DEFAULT_ENDPOINT_TEMPLATE = "cloudbilling.$UNIVERSE_DOMAIN$"
|
38
|
+
|
36
39
|
include Paths
|
37
40
|
|
38
41
|
# @private
|
@@ -140,6 +143,15 @@ module Google
|
|
140
143
|
@config
|
141
144
|
end
|
142
145
|
|
146
|
+
##
|
147
|
+
# The effective universe domain
|
148
|
+
#
|
149
|
+
# @return [String]
|
150
|
+
#
|
151
|
+
def universe_domain
|
152
|
+
@cloud_billing_stub.universe_domain
|
153
|
+
end
|
154
|
+
|
143
155
|
##
|
144
156
|
# Create a new CloudBilling REST client object.
|
145
157
|
#
|
@@ -167,8 +179,9 @@ module Google
|
|
167
179
|
credentials = @config.credentials
|
168
180
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
169
181
|
# but only if the default endpoint does not have a region prefix.
|
170
|
-
enable_self_signed_jwt = @config.endpoint
|
171
|
-
|
182
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
183
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
184
|
+
!@config.endpoint.split(".").first.include?("-"))
|
172
185
|
credentials ||= Credentials.default scope: @config.scope,
|
173
186
|
enable_self_signed_jwt: enable_self_signed_jwt
|
174
187
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -178,7 +191,12 @@ module Google
|
|
178
191
|
@quota_project_id = @config.quota_project
|
179
192
|
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
180
193
|
|
181
|
-
@cloud_billing_stub = ::Google::Cloud::Billing::V1::CloudBilling::Rest::ServiceStub.new
|
194
|
+
@cloud_billing_stub = ::Google::Cloud::Billing::V1::CloudBilling::Rest::ServiceStub.new(
|
195
|
+
endpoint: @config.endpoint,
|
196
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
197
|
+
universe_domain: @config.universe_domain,
|
198
|
+
credentials: credentials
|
199
|
+
)
|
182
200
|
end
|
183
201
|
|
184
202
|
# Service calls
|
@@ -279,7 +297,7 @@ module Google
|
|
279
297
|
# @param options [::Gapic::CallOptions, ::Hash]
|
280
298
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
281
299
|
#
|
282
|
-
# @overload list_billing_accounts(page_size: nil, page_token: nil, filter: nil)
|
300
|
+
# @overload list_billing_accounts(page_size: nil, page_token: nil, filter: nil, parent: nil)
|
283
301
|
# Pass arguments to `list_billing_accounts` via keyword arguments. Note that at
|
284
302
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
285
303
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -296,8 +314,16 @@ module Google
|
|
296
314
|
# This only supports filtering for
|
297
315
|
# [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
|
298
316
|
# single provided parent billing account.
|
299
|
-
# (
|
317
|
+
# (for example,
|
318
|
+
# `master_billing_account=billingAccounts/012345-678901-ABCDEF`).
|
300
319
|
# Boolean algebra and other fields are not currently supported.
|
320
|
+
# @param parent [::String]
|
321
|
+
# Optional. The parent resource to list billing accounts from.
|
322
|
+
# Format:
|
323
|
+
# - `organizations/{organization_id}`, for example,
|
324
|
+
# `organizations/12345678`
|
325
|
+
# - `billingAccounts/{billing_account_id}`, for example,
|
326
|
+
# `billingAccounts/012345-567890-ABCDEF`
|
301
327
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
302
328
|
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::BillingAccount>]
|
303
329
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -477,7 +503,7 @@ module Google
|
|
477
503
|
# @param options [::Gapic::CallOptions, ::Hash]
|
478
504
|
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
479
505
|
#
|
480
|
-
# @overload create_billing_account(billing_account: nil)
|
506
|
+
# @overload create_billing_account(billing_account: nil, parent: nil)
|
481
507
|
# Pass arguments to `create_billing_account` via keyword arguments. Note that at
|
482
508
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
483
509
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -487,6 +513,13 @@ module Google
|
|
487
513
|
# Currently CreateBillingAccount only supports subaccount creation, so
|
488
514
|
# any created billing accounts must be under a provided parent billing
|
489
515
|
# account.
|
516
|
+
# @param parent [::String]
|
517
|
+
# Optional. The parent to create a billing account from.
|
518
|
+
# Format:
|
519
|
+
# - `organizations/{organization_id}`, for example,
|
520
|
+
# `organizations/12345678`
|
521
|
+
# - `billingAccounts/{billing_account_id}`, for example,
|
522
|
+
# `billingAccounts/012345-567890-ABCDEF`
|
490
523
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
491
524
|
# @yieldparam result [::Google::Cloud::Billing::V1::BillingAccount]
|
492
525
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -737,7 +770,8 @@ module Google
|
|
737
770
|
# account, even if the charge occurred before the new billing account was
|
738
771
|
# assigned to the project.
|
739
772
|
#
|
740
|
-
# The current authenticated user must have ownership privileges for both
|
773
|
+
# The current authenticated user must have ownership privileges for both
|
774
|
+
# the
|
741
775
|
# [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
|
742
776
|
# ) and the [billing
|
743
777
|
# account](https://cloud.google.com/billing/docs/how-to/billing-access).
|
@@ -1102,6 +1136,91 @@ module Google
|
|
1102
1136
|
raise ::Google::Cloud::Error.from_error(e)
|
1103
1137
|
end
|
1104
1138
|
|
1139
|
+
##
|
1140
|
+
# Changes which parent organization a billing account belongs to.
|
1141
|
+
#
|
1142
|
+
# @overload move_billing_account(request, options = nil)
|
1143
|
+
# Pass arguments to `move_billing_account` via a request object, either of type
|
1144
|
+
# {::Google::Cloud::Billing::V1::MoveBillingAccountRequest} or an equivalent Hash.
|
1145
|
+
#
|
1146
|
+
# @param request [::Google::Cloud::Billing::V1::MoveBillingAccountRequest, ::Hash]
|
1147
|
+
# A request object representing the call parameters. Required. To specify no
|
1148
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1149
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1150
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1151
|
+
#
|
1152
|
+
# @overload move_billing_account(name: nil, destination_parent: nil)
|
1153
|
+
# Pass arguments to `move_billing_account` via keyword arguments. Note that at
|
1154
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1155
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1156
|
+
#
|
1157
|
+
# @param name [::String]
|
1158
|
+
# Required. The resource name of the billing account to move.
|
1159
|
+
# Must be of the form `billingAccounts/{billing_account_id}`.
|
1160
|
+
# The specified billing account cannot be a subaccount, since a subaccount
|
1161
|
+
# always belongs to the same organization as its parent account.
|
1162
|
+
# @param destination_parent [::String]
|
1163
|
+
# Required. The resource name of the Organization to reparent
|
1164
|
+
# the billing account under.
|
1165
|
+
# Must be of the form `organizations/{organization_id}`.
|
1166
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1167
|
+
# @yieldparam result [::Google::Cloud::Billing::V1::BillingAccount]
|
1168
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1169
|
+
#
|
1170
|
+
# @return [::Google::Cloud::Billing::V1::BillingAccount]
|
1171
|
+
#
|
1172
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1173
|
+
#
|
1174
|
+
# @example Basic example
|
1175
|
+
# require "google/cloud/billing/v1"
|
1176
|
+
#
|
1177
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1178
|
+
# client = Google::Cloud::Billing::V1::CloudBilling::Rest::Client.new
|
1179
|
+
#
|
1180
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1181
|
+
# request = Google::Cloud::Billing::V1::MoveBillingAccountRequest.new
|
1182
|
+
#
|
1183
|
+
# # Call the move_billing_account method.
|
1184
|
+
# result = client.move_billing_account request
|
1185
|
+
#
|
1186
|
+
# # The returned object is of type Google::Cloud::Billing::V1::BillingAccount.
|
1187
|
+
# p result
|
1188
|
+
#
|
1189
|
+
def move_billing_account request, options = nil
|
1190
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1191
|
+
|
1192
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::MoveBillingAccountRequest
|
1193
|
+
|
1194
|
+
# Converts hash and nil to an options object
|
1195
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1196
|
+
|
1197
|
+
# Customize the options with defaults
|
1198
|
+
call_metadata = @config.rpcs.move_billing_account.metadata.to_h
|
1199
|
+
|
1200
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1201
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1202
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1203
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
1204
|
+
transports_version_send: [:rest]
|
1205
|
+
|
1206
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1207
|
+
|
1208
|
+
options.apply_defaults timeout: @config.rpcs.move_billing_account.timeout,
|
1209
|
+
metadata: call_metadata,
|
1210
|
+
retry_policy: @config.rpcs.move_billing_account.retry_policy
|
1211
|
+
|
1212
|
+
options.apply_defaults timeout: @config.timeout,
|
1213
|
+
metadata: @config.metadata,
|
1214
|
+
retry_policy: @config.retry_policy
|
1215
|
+
|
1216
|
+
@cloud_billing_stub.move_billing_account request, options do |result, operation|
|
1217
|
+
yield result, operation if block_given?
|
1218
|
+
return result
|
1219
|
+
end
|
1220
|
+
rescue ::Gapic::Rest::Error => e
|
1221
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1222
|
+
end
|
1223
|
+
|
1105
1224
|
##
|
1106
1225
|
# Configuration class for the CloudBilling REST API.
|
1107
1226
|
#
|
@@ -1132,9 +1251,9 @@ module Google
|
|
1132
1251
|
# end
|
1133
1252
|
#
|
1134
1253
|
# @!attribute [rw] endpoint
|
1135
|
-
#
|
1136
|
-
#
|
1137
|
-
# @return [::String]
|
1254
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
1255
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
1256
|
+
# @return [::String,nil]
|
1138
1257
|
# @!attribute [rw] credentials
|
1139
1258
|
# Credentials to send with calls. You may provide any of the following types:
|
1140
1259
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -1171,13 +1290,20 @@ module Google
|
|
1171
1290
|
# @!attribute [rw] quota_project
|
1172
1291
|
# A separate project against which to charge quota.
|
1173
1292
|
# @return [::String]
|
1293
|
+
# @!attribute [rw] universe_domain
|
1294
|
+
# The universe domain within which to make requests. This determines the
|
1295
|
+
# default endpoint URL. The default value of nil uses the environment
|
1296
|
+
# universe (usually the default "googleapis.com" universe).
|
1297
|
+
# @return [::String,nil]
|
1174
1298
|
#
|
1175
1299
|
class Configuration
|
1176
1300
|
extend ::Gapic::Config
|
1177
1301
|
|
1302
|
+
# @private
|
1303
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
1178
1304
|
DEFAULT_ENDPOINT = "cloudbilling.googleapis.com"
|
1179
1305
|
|
1180
|
-
config_attr :endpoint,
|
1306
|
+
config_attr :endpoint, nil, ::String, nil
|
1181
1307
|
config_attr :credentials, nil do |value|
|
1182
1308
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1183
1309
|
allowed.any? { |klass| klass === value }
|
@@ -1189,6 +1315,7 @@ module Google
|
|
1189
1315
|
config_attr :metadata, nil, ::Hash, nil
|
1190
1316
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1191
1317
|
config_attr :quota_project, nil, ::String, nil
|
1318
|
+
config_attr :universe_domain, nil, ::String, nil
|
1192
1319
|
|
1193
1320
|
# @private
|
1194
1321
|
def initialize parent_config = nil
|
@@ -1277,6 +1404,11 @@ module Google
|
|
1277
1404
|
# @return [::Gapic::Config::Method]
|
1278
1405
|
#
|
1279
1406
|
attr_reader :test_iam_permissions
|
1407
|
+
##
|
1408
|
+
# RPC-specific configuration for `move_billing_account`
|
1409
|
+
# @return [::Gapic::Config::Method]
|
1410
|
+
#
|
1411
|
+
attr_reader :move_billing_account
|
1280
1412
|
|
1281
1413
|
# @private
|
1282
1414
|
def initialize parent_rpcs = nil
|
@@ -1300,6 +1432,8 @@ module Google
|
|
1300
1432
|
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
1301
1433
|
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
1302
1434
|
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
1435
|
+
move_billing_account_config = parent_rpcs.move_billing_account if parent_rpcs.respond_to? :move_billing_account
|
1436
|
+
@move_billing_account = ::Gapic::Config::Method.new move_billing_account_config
|
1303
1437
|
|
1304
1438
|
yield self if block_given?
|
1305
1439
|
end
|
@@ -30,16 +30,28 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
def initialize endpoint:, credentials:
|
33
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
|
34
34
|
# These require statements are intentionally placed here to initialize
|
35
35
|
# the REST modules only when it's required.
|
36
36
|
require "gapic/rest"
|
37
37
|
|
38
|
-
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
39
|
+
endpoint_template: endpoint_template,
|
40
|
+
universe_domain: universe_domain,
|
41
|
+
credentials: credentials,
|
39
42
|
numeric_enums: true,
|
40
43
|
raise_faraday_errors: false
|
41
44
|
end
|
42
45
|
|
46
|
+
##
|
47
|
+
# The effective universe domain
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
def universe_domain
|
52
|
+
@client_stub.universe_domain
|
53
|
+
end
|
54
|
+
|
43
55
|
##
|
44
56
|
# Baseline implementation for the get_billing_account REST call
|
45
57
|
#
|
@@ -420,6 +432,44 @@ module Google
|
|
420
432
|
result
|
421
433
|
end
|
422
434
|
|
435
|
+
##
|
436
|
+
# Baseline implementation for the move_billing_account REST call
|
437
|
+
#
|
438
|
+
# @param request_pb [::Google::Cloud::Billing::V1::MoveBillingAccountRequest]
|
439
|
+
# A request object representing the call parameters. Required.
|
440
|
+
# @param options [::Gapic::CallOptions]
|
441
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
442
|
+
#
|
443
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
444
|
+
# @yieldparam result [::Google::Cloud::Billing::V1::BillingAccount]
|
445
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
446
|
+
#
|
447
|
+
# @return [::Google::Cloud::Billing::V1::BillingAccount]
|
448
|
+
# A result object deserialized from the server's reply
|
449
|
+
def move_billing_account request_pb, options = nil
|
450
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
451
|
+
|
452
|
+
verb, uri, query_string_params, body = ServiceStub.transcode_move_billing_account_request request_pb
|
453
|
+
query_string_params = if query_string_params.any?
|
454
|
+
query_string_params.to_h { |p| p.split "=", 2 }
|
455
|
+
else
|
456
|
+
{}
|
457
|
+
end
|
458
|
+
|
459
|
+
response = @client_stub.make_http_request(
|
460
|
+
verb,
|
461
|
+
uri: uri,
|
462
|
+
body: body || "",
|
463
|
+
params: query_string_params,
|
464
|
+
options: options
|
465
|
+
)
|
466
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
467
|
+
result = ::Google::Cloud::Billing::V1::BillingAccount.decode_json response.body, ignore_unknown_fields: true
|
468
|
+
|
469
|
+
yield result, operation if block_given?
|
470
|
+
result
|
471
|
+
end
|
472
|
+
|
423
473
|
##
|
424
474
|
# @private
|
425
475
|
#
|
@@ -457,6 +507,20 @@ module Google
|
|
457
507
|
uri_template: "/v1/billingAccounts",
|
458
508
|
matches: []
|
459
509
|
)
|
510
|
+
.with_bindings(
|
511
|
+
uri_method: :get,
|
512
|
+
uri_template: "/v1/{parent}/billingAccounts",
|
513
|
+
matches: [
|
514
|
+
["parent", %r{^organizations/[^/]+/?$}, false]
|
515
|
+
]
|
516
|
+
)
|
517
|
+
.with_bindings(
|
518
|
+
uri_method: :get,
|
519
|
+
uri_template: "/v1/{parent}/subAccounts",
|
520
|
+
matches: [
|
521
|
+
["parent", %r{^billingAccounts/[^/]+/?$}, false]
|
522
|
+
]
|
523
|
+
)
|
460
524
|
transcoder.transcode request_pb
|
461
525
|
end
|
462
526
|
|
@@ -499,6 +563,22 @@ module Google
|
|
499
563
|
body: "billing_account",
|
500
564
|
matches: []
|
501
565
|
)
|
566
|
+
.with_bindings(
|
567
|
+
uri_method: :post,
|
568
|
+
uri_template: "/v1/{parent}/billingAccounts",
|
569
|
+
body: "billing_account",
|
570
|
+
matches: [
|
571
|
+
["parent", %r{^organizations/[^/]+/?$}, false]
|
572
|
+
]
|
573
|
+
)
|
574
|
+
.with_bindings(
|
575
|
+
uri_method: :post,
|
576
|
+
uri_template: "/v1/{parent}/subAccounts",
|
577
|
+
body: "billing_account",
|
578
|
+
matches: [
|
579
|
+
["parent", %r{^billingAccounts/[^/]+/?$}, false]
|
580
|
+
]
|
581
|
+
)
|
502
582
|
transcoder.transcode request_pb
|
503
583
|
end
|
504
584
|
|
@@ -630,6 +710,36 @@ module Google
|
|
630
710
|
)
|
631
711
|
transcoder.transcode request_pb
|
632
712
|
end
|
713
|
+
|
714
|
+
##
|
715
|
+
# @private
|
716
|
+
#
|
717
|
+
# GRPC transcoding helper method for the move_billing_account REST call
|
718
|
+
#
|
719
|
+
# @param request_pb [::Google::Cloud::Billing::V1::MoveBillingAccountRequest]
|
720
|
+
# A request object representing the call parameters. Required.
|
721
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
722
|
+
# Uri, Body, Query string parameters
|
723
|
+
def self.transcode_move_billing_account_request request_pb
|
724
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
725
|
+
.with_bindings(
|
726
|
+
uri_method: :post,
|
727
|
+
uri_template: "/v1/{name}:move",
|
728
|
+
body: "*",
|
729
|
+
matches: [
|
730
|
+
["name", %r{^billingAccounts/[^/]+/?$}, false]
|
731
|
+
]
|
732
|
+
)
|
733
|
+
.with_bindings(
|
734
|
+
uri_method: :get,
|
735
|
+
uri_template: "/v1/{destination_parent}/{name}:move",
|
736
|
+
matches: [
|
737
|
+
["destination_parent", %r{^organizations/[^/]+/?$}, false],
|
738
|
+
["name", %r{^billingAccounts/[^/]+/?$}, false]
|
739
|
+
]
|
740
|
+
)
|
741
|
+
transcoder.transcode request_pb
|
742
|
+
end
|
633
743
|
end
|
634
744
|
end
|
635
745
|
end
|
@@ -13,7 +13,7 @@ require 'google/iam/v1/policy_pb'
|
|
13
13
|
require 'google/protobuf/field_mask_pb'
|
14
14
|
|
15
15
|
|
16
|
-
descriptor_data = "\n+google/cloud/billing/v1/cloud_billing.proto\x12\x17google.cloud.billing.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a google/protobuf/field_mask.proto\"\
|
16
|
+
descriptor_data = "\n+google/cloud/billing/v1/cloud_billing.proto\x12\x17google.cloud.billing.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a google/protobuf/field_mask.proto\"\xe7\x02\n\x0e\x42illingAccount\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x03\xfa\x41,\n*cloudbilling.googleapis.com/BillingAccount\x12\x11\n\x04open\x18\x02 \x01(\x08\x42\x03\xe0\x41\x03\x12\x14\n\x0c\x64isplay_name\x18\x03 \x01(\t\x12\x1e\n\x16master_billing_account\x18\x04 \x01(\t\x12\x13\n\x06parent\x18\x06 \x01(\tB\x03\xe0\x41\x03:\xb4\x01\xea\x41\xb0\x01\n*cloudbilling.googleapis.com/BillingAccount\x12!billingAccounts/{billing_account}\x12>organizations/{organization}/billingAccounts/{billing_account}*\x0f\x62illingAccounts2\x0e\x62illingAccount\"\xd1\x01\n\x12ProjectBillingInfo\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x17\n\nproject_id\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12\x1c\n\x14\x62illing_account_name\x18\x03 \x01(\t\x12\x1c\n\x0f\x62illing_enabled\x18\x04 \x01(\x08\x42\x03\xe0\x41\x03:S\xea\x41P\n.cloudbilling.googleapis.com/ProjectBillingInfo\x12\x1eprojects/{project}/billingInfo\"\\\n\x18GetBillingAccountRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*cloudbilling.googleapis.com/BillingAccount\"h\n\x1aListBillingAccountsRequest\x12\x11\n\tpage_size\x18\x01 \x01(\x05\x12\x12\n\npage_token\x18\x02 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x03 \x01(\t\x12\x13\n\x06parent\x18\x04 \x01(\tB\x03\xe0\x41\x01\"y\n\x1bListBillingAccountsResponse\x12\x41\n\x10\x62illing_accounts\x18\x01 \x03(\x0b\x32\'.google.cloud.billing.v1.BillingAccount\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"y\n\x1b\x43reateBillingAccountRequest\x12\x45\n\x0f\x62illing_account\x18\x01 \x01(\x0b\x32\'.google.cloud.billing.v1.BillingAccountB\x03\xe0\x41\x02\x12\x13\n\x06parent\x18\x02 \x01(\tB\x03\xe0\x41\x01\"\xcf\x01\n\x1bUpdateBillingAccountRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*cloudbilling.googleapis.com/BillingAccount\x12=\n\x07\x61\x63\x63ount\x18\x02 \x01(\x0b\x32\'.google.cloud.billing.v1.BillingAccountB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"\x88\x01\n\x1dListProjectBillingInfoRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*cloudbilling.googleapis.com/BillingAccount\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"\x84\x01\n\x1eListProjectBillingInfoResponse\x12I\n\x14project_billing_info\x18\x01 \x03(\x0b\x32+.google.cloud.billing.v1.ProjectBillingInfo\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"a\n\x1cGetProjectBillingInfoRequest\x12\x41\n\x04name\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\"\x7f\n\x1fUpdateProjectBillingInfoRequest\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12I\n\x14project_billing_info\x18\x02 \x01(\x0b\x32+.google.cloud.billing.v1.ProjectBillingInfo\"\xb3\x01\n\x19MoveBillingAccountRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*cloudbilling.googleapis.com/BillingAccount\x12T\n\x12\x64\x65stination_parent\x18\x02 \x01(\tB8\xe0\x41\x02\xfa\x41\x32\n0cloudresourcemanager.googleapis.com/Organization2\xa1\x13\n\x0c\x43loudBilling\x12\x9c\x01\n\x11GetBillingAccount\x12\x31.google.cloud.billing.v1.GetBillingAccountRequest\x1a\'.google.cloud.billing.v1.BillingAccount\"+\x82\xd3\xe4\x93\x02\x1e\x12\x1c/v1/{name=billingAccounts/*}\xda\x41\x04name\x12\x88\x02\n\x13ListBillingAccounts\x12\x33.google.cloud.billing.v1.ListBillingAccountsRequest\x1a\x34.google.cloud.billing.v1.ListBillingAccountsResponse\"\x85\x01\x82\xd3\xe4\x93\x02s\x12\x13/v1/billingAccountsZ.\x12,/v1/{parent=organizations/*}/billingAccountsZ,\x12*/v1/{parent=billingAccounts/*}/subAccounts\xda\x41\x00\xda\x41\x06parent\x12\xb3\x01\n\x14UpdateBillingAccount\x12\x34.google.cloud.billing.v1.UpdateBillingAccountRequest\x1a\'.google.cloud.billing.v1.BillingAccount\"<\x82\xd3\xe4\x93\x02\'2\x1c/v1/{name=billingAccounts/*}:\x07\x61\x63\x63ount\xda\x41\x0cname,account\x12\xd0\x02\n\x14\x43reateBillingAccount\x12\x34.google.cloud.billing.v1.CreateBillingAccountRequest\x1a\'.google.cloud.billing.v1.BillingAccount\"\xd8\x01\x82\xd3\xe4\x93\x02\xa6\x01\"\x13/v1/billingAccounts:\x0f\x62illing_accountZ?\",/v1/{parent=organizations/*}/billingAccounts:\x0f\x62illing_accountZ=\"*/v1/{parent=billingAccounts/*}/subAccounts:\x0f\x62illing_account\xda\x41\x0f\x62illing_account\xda\x41\x16\x62illing_account,parent\x12\xbf\x01\n\x16ListProjectBillingInfo\x12\x36.google.cloud.billing.v1.ListProjectBillingInfoRequest\x1a\x37.google.cloud.billing.v1.ListProjectBillingInfoResponse\"4\x82\xd3\xe4\x93\x02\'\x12%/v1/{name=billingAccounts/*}/projects\xda\x41\x04name\x12\xad\x01\n\x15GetProjectBillingInfo\x12\x35.google.cloud.billing.v1.GetProjectBillingInfoRequest\x1a+.google.cloud.billing.v1.ProjectBillingInfo\"0\x82\xd3\xe4\x93\x02#\x12!/v1/{name=projects/*}/billingInfo\xda\x41\x04name\x12\xde\x01\n\x18UpdateProjectBillingInfo\x12\x38.google.cloud.billing.v1.UpdateProjectBillingInfoRequest\x1a+.google.cloud.billing.v1.ProjectBillingInfo\"[\x82\xd3\xe4\x93\x02\x39\x1a!/v1/{name=projects/*}/billingInfo:\x14project_billing_info\xda\x41\x19name,project_billing_info\x12\x8b\x01\n\x0cGetIamPolicy\x12\".google.iam.v1.GetIamPolicyRequest\x1a\x15.google.iam.v1.Policy\"@\x82\xd3\xe4\x93\x02/\x12-/v1/{resource=billingAccounts/*}:getIamPolicy\xda\x41\x08resource\x12\x95\x01\n\x0cSetIamPolicy\x12\".google.iam.v1.SetIamPolicyRequest\x1a\x15.google.iam.v1.Policy\"J\x82\xd3\xe4\x93\x02\x32\"-/v1/{resource=billingAccounts/*}:setIamPolicy:\x01*\xda\x41\x0fresource,policy\x12\xc0\x01\n\x12TestIamPermissions\x12(.google.iam.v1.TestIamPermissionsRequest\x1a).google.iam.v1.TestIamPermissionsResponse\"U\x82\xd3\xe4\x93\x02\x38\"3/v1/{resource=billingAccounts/*}:testIamPermissions:\x01*\xda\x41\x14resource,permissions\x12\xe9\x01\n\x12MoveBillingAccount\x12\x32.google.cloud.billing.v1.MoveBillingAccountRequest\x1a\'.google.cloud.billing.v1.BillingAccount\"v\x82\xd3\xe4\x93\x02p\"!/v1/{name=billingAccounts/*}:move:\x01*ZH\x12\x46/v1/{destination_parent=organizations/*}/{name=billingAccounts/*}:move\x1a\xb5\x01\xca\x41\x1b\x63loudbilling.googleapis.com\xd2\x41\x93\x01https://www.googleapis.com/auth/cloud-billing,https://www.googleapis.com/auth/cloud-billing.readonly,https://www.googleapis.com/auth/cloud-platformB\x80\x02\n\x1b\x63om.google.cloud.billing.v1B\x11\x43loudBillingProtoP\x01Z5cloud.google.com/go/billing/apiv1/billingpb;billingpb\xea\x41\x41\n+cloudresourcemanager.googleapis.com/Project\x12\x12projects/{project}\xea\x41P\n0cloudresourcemanager.googleapis.com/Organization\x12\x1corganizations/{organization}b\x06proto3"
|
17
17
|
|
18
18
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
19
19
|
|
@@ -55,6 +55,7 @@ module Google
|
|
55
55
|
ListProjectBillingInfoResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.ListProjectBillingInfoResponse").msgclass
|
56
56
|
GetProjectBillingInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.GetProjectBillingInfoRequest").msgclass
|
57
57
|
UpdateProjectBillingInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.UpdateProjectBillingInfoRequest").msgclass
|
58
|
+
MoveBillingAccountRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.MoveBillingAccountRequest").msgclass
|
58
59
|
end
|
59
60
|
end
|
60
61
|
end
|
@@ -89,7 +89,8 @@ module Google
|
|
89
89
|
# account, even if the charge occurred before the new billing account was
|
90
90
|
# assigned to the project.
|
91
91
|
#
|
92
|
-
# The current authenticated user must have ownership privileges for both
|
92
|
+
# The current authenticated user must have ownership privileges for both
|
93
|
+
# the
|
93
94
|
# [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
|
94
95
|
# ) and the [billing
|
95
96
|
# account](https://cloud.google.com/billing/docs/how-to/billing-access).
|
@@ -123,6 +124,8 @@ module Google
|
|
123
124
|
# the resource and a set of permissions as input and returns the subset of
|
124
125
|
# the input permissions that the caller is allowed for that resource.
|
125
126
|
rpc :TestIamPermissions, ::Google::Iam::V1::TestIamPermissionsRequest, ::Google::Iam::V1::TestIamPermissionsResponse
|
127
|
+
# Changes which parent organization a billing account belongs to.
|
128
|
+
rpc :MoveBillingAccount, ::Google::Cloud::Billing::V1::MoveBillingAccountRequest, ::Google::Cloud::Billing::V1::BillingAccount
|
126
129
|
end
|
127
130
|
|
128
131
|
Stub = Service.rpc_stub_class
|
@@ -32,6 +32,9 @@ module Google
|
|
32
32
|
# and SKUs.
|
33
33
|
#
|
34
34
|
class Client
|
35
|
+
# @private
|
36
|
+
DEFAULT_ENDPOINT_TEMPLATE = "cloudbilling.$UNIVERSE_DOMAIN$"
|
37
|
+
|
35
38
|
include Paths
|
36
39
|
|
37
40
|
# @private
|
@@ -96,6 +99,15 @@ module Google
|
|
96
99
|
@config
|
97
100
|
end
|
98
101
|
|
102
|
+
##
|
103
|
+
# The effective universe domain
|
104
|
+
#
|
105
|
+
# @return [String]
|
106
|
+
#
|
107
|
+
def universe_domain
|
108
|
+
@cloud_catalog_stub.universe_domain
|
109
|
+
end
|
110
|
+
|
99
111
|
##
|
100
112
|
# Create a new CloudCatalog client object.
|
101
113
|
#
|
@@ -129,8 +141,9 @@ module Google
|
|
129
141
|
credentials = @config.credentials
|
130
142
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
131
143
|
# but only if the default endpoint does not have a region prefix.
|
132
|
-
enable_self_signed_jwt = @config.endpoint
|
133
|
-
|
144
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
145
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
146
|
+
!@config.endpoint.split(".").first.include?("-"))
|
134
147
|
credentials ||= Credentials.default scope: @config.scope,
|
135
148
|
enable_self_signed_jwt: enable_self_signed_jwt
|
136
149
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -141,8 +154,10 @@ module Google
|
|
141
154
|
|
142
155
|
@cloud_catalog_stub = ::Gapic::ServiceStub.new(
|
143
156
|
::Google::Cloud::Billing::V1::CloudCatalog::Stub,
|
144
|
-
credentials:
|
145
|
-
endpoint:
|
157
|
+
credentials: credentials,
|
158
|
+
endpoint: @config.endpoint,
|
159
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
160
|
+
universe_domain: @config.universe_domain,
|
146
161
|
channel_args: @config.channel_args,
|
147
162
|
interceptors: @config.interceptors,
|
148
163
|
channel_pool_config: @config.channel_pool
|
@@ -382,9 +397,9 @@ module Google
|
|
382
397
|
# end
|
383
398
|
#
|
384
399
|
# @!attribute [rw] endpoint
|
385
|
-
#
|
386
|
-
#
|
387
|
-
# @return [::String]
|
400
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
401
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
402
|
+
# @return [::String,nil]
|
388
403
|
# @!attribute [rw] credentials
|
389
404
|
# Credentials to send with calls. You may provide any of the following types:
|
390
405
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -430,13 +445,20 @@ module Google
|
|
430
445
|
# @!attribute [rw] quota_project
|
431
446
|
# A separate project against which to charge quota.
|
432
447
|
# @return [::String]
|
448
|
+
# @!attribute [rw] universe_domain
|
449
|
+
# The universe domain within which to make requests. This determines the
|
450
|
+
# default endpoint URL. The default value of nil uses the environment
|
451
|
+
# universe (usually the default "googleapis.com" universe).
|
452
|
+
# @return [::String,nil]
|
433
453
|
#
|
434
454
|
class Configuration
|
435
455
|
extend ::Gapic::Config
|
436
456
|
|
457
|
+
# @private
|
458
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
437
459
|
DEFAULT_ENDPOINT = "cloudbilling.googleapis.com"
|
438
460
|
|
439
|
-
config_attr :endpoint,
|
461
|
+
config_attr :endpoint, nil, ::String, nil
|
440
462
|
config_attr :credentials, nil do |value|
|
441
463
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
442
464
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -451,6 +473,7 @@ module Google
|
|
451
473
|
config_attr :metadata, nil, ::Hash, nil
|
452
474
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
453
475
|
config_attr :quota_project, nil, ::String, nil
|
476
|
+
config_attr :universe_domain, nil, ::String, nil
|
454
477
|
|
455
478
|
# @private
|
456
479
|
def initialize parent_config = nil
|