google-cloud-billing-v1 0.10.0 → 0.12.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,53 @@
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 "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/billing/v1/version"
24
+
25
+ require "google/cloud/billing/v1/cloud_billing/credentials"
26
+ require "google/cloud/billing/v1/cloud_billing/paths"
27
+ require "google/cloud/billing/v1/cloud_billing/rest/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Billing
32
+ module V1
33
+ ##
34
+ # Retrieves the Google Cloud Console billing accounts and associates them with
35
+ # projects.
36
+ #
37
+ # To load this service and instantiate a REST client:
38
+ #
39
+ # require "google/cloud/billing/v1/cloud_billing/rest"
40
+ # client = ::Google::Cloud::Billing::V1::CloudBilling::Rest::Client.new
41
+ #
42
+ module CloudBilling
43
+ # Client for the REST transport
44
+ module Rest
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
53
+ require "google/cloud/billing/v1/cloud_billing/rest/helpers" if ::File.file? helper_path
@@ -25,6 +25,7 @@ require "google/cloud/billing/v1/version"
25
25
  require "google/cloud/billing/v1/cloud_billing/credentials"
26
26
  require "google/cloud/billing/v1/cloud_billing/paths"
27
27
  require "google/cloud/billing/v1/cloud_billing/client"
28
+ require "google/cloud/billing/v1/cloud_billing/rest"
28
29
 
29
30
  module Google
30
31
  module Cloud
@@ -34,11 +35,16 @@ module Google
34
35
  # Retrieves the Google Cloud Console billing accounts and associates them with
35
36
  # projects.
36
37
  #
37
- # To load this service and instantiate a client:
38
+ # @example Load this service and instantiate a gRPC client
38
39
  #
39
40
  # require "google/cloud/billing/v1/cloud_billing"
40
41
  # client = ::Google::Cloud::Billing::V1::CloudBilling::Client.new
41
42
  #
43
+ # @example Load this service and instantiate a REST client
44
+ #
45
+ # require "google/cloud/billing/v1/cloud_billing/rest"
46
+ # client = ::Google::Cloud::Billing::V1::CloudBilling::Rest::Client.new
47
+ #
42
48
  module CloudBilling
43
49
  end
44
50
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: google/cloud/billing/v1/cloud_billing.proto
3
4
 
@@ -11,57 +12,32 @@ require 'google/iam/v1/iam_policy_pb'
11
12
  require 'google/iam/v1/policy_pb'
12
13
  require 'google/protobuf/field_mask_pb'
13
14
 
14
- Google::Protobuf::DescriptorPool.generated_pool.build do
15
- add_file("google/cloud/billing/v1/cloud_billing.proto", :syntax => :proto3) do
16
- add_message "google.cloud.billing.v1.BillingAccount" do
17
- optional :name, :string, 1
18
- optional :open, :bool, 2
19
- optional :display_name, :string, 3
20
- optional :master_billing_account, :string, 4
21
- end
22
- add_message "google.cloud.billing.v1.ProjectBillingInfo" do
23
- optional :name, :string, 1
24
- optional :project_id, :string, 2
25
- optional :billing_account_name, :string, 3
26
- optional :billing_enabled, :bool, 4
27
- end
28
- add_message "google.cloud.billing.v1.GetBillingAccountRequest" do
29
- optional :name, :string, 1
30
- end
31
- add_message "google.cloud.billing.v1.ListBillingAccountsRequest" do
32
- optional :page_size, :int32, 1
33
- optional :page_token, :string, 2
34
- optional :filter, :string, 3
35
- end
36
- add_message "google.cloud.billing.v1.ListBillingAccountsResponse" do
37
- repeated :billing_accounts, :message, 1, "google.cloud.billing.v1.BillingAccount"
38
- optional :next_page_token, :string, 2
39
- end
40
- add_message "google.cloud.billing.v1.CreateBillingAccountRequest" do
41
- optional :billing_account, :message, 1, "google.cloud.billing.v1.BillingAccount"
42
- end
43
- add_message "google.cloud.billing.v1.UpdateBillingAccountRequest" do
44
- optional :name, :string, 1
45
- optional :account, :message, 2, "google.cloud.billing.v1.BillingAccount"
46
- optional :update_mask, :message, 3, "google.protobuf.FieldMask"
47
- end
48
- add_message "google.cloud.billing.v1.ListProjectBillingInfoRequest" do
49
- optional :name, :string, 1
50
- optional :page_size, :int32, 2
51
- optional :page_token, :string, 3
52
- end
53
- add_message "google.cloud.billing.v1.ListProjectBillingInfoResponse" do
54
- repeated :project_billing_info, :message, 1, "google.cloud.billing.v1.ProjectBillingInfo"
55
- optional :next_page_token, :string, 2
56
- end
57
- add_message "google.cloud.billing.v1.GetProjectBillingInfoRequest" do
58
- optional :name, :string, 1
59
- end
60
- add_message "google.cloud.billing.v1.UpdateProjectBillingInfoRequest" do
61
- optional :name, :string, 1
62
- optional :project_billing_info, :message, 2, "google.cloud.billing.v1.ProjectBillingInfo"
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\"\x9b\x01\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\"m\n\x12ProjectBillingInfo\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nproject_id\x18\x02 \x01(\t\x12\x1c\n\x14\x62illing_account_name\x18\x03 \x01(\t\x12\x17\n\x0f\x62illing_enabled\x18\x04 \x01(\x08\"\\\n\x18GetBillingAccountRequest\x12@\n\x04name\x18\x01 \x01(\tB2\xe0\x41\x02\xfa\x41,\n*cloudbilling.googleapis.com/BillingAccount\"S\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\"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\"d\n\x1b\x43reateBillingAccountRequest\x12\x45\n\x0f\x62illing_account\x18\x01 \x01(\x0b\x32\'.google.cloud.billing.v1.BillingAccountB\x03\xe0\x41\x02\"\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\"1\n\x1cGetProjectBillingInfoRequest\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\"\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.ProjectBillingInfo2\xb2\x0f\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\xa0\x01\n\x13ListBillingAccounts\x12\x33.google.cloud.billing.v1.ListBillingAccountsRequest\x1a\x34.google.cloud.billing.v1.ListBillingAccountsResponse\"\x1e\x82\xd3\xe4\x93\x02\x15\x12\x13/v1/billingAccounts\xda\x41\x00\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\xb5\x01\n\x14\x43reateBillingAccount\x12\x34.google.cloud.billing.v1.CreateBillingAccountRequest\x1a\'.google.cloud.billing.v1.BillingAccount\">\x82\xd3\xe4\x93\x02&\"\x13/v1/billingAccounts:\x0f\x62illing_account\xda\x41\x0f\x62illing_account\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\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-platformBi\n\x1b\x63om.google.cloud.billing.v1B\x11\x43loudBillingProtoP\x01Z5cloud.google.com/go/billing/apiv1/billingpb;billingpbb\x06proto3"
17
+
18
+ pool = Google::Protobuf::DescriptorPool.generated_pool
19
+
20
+ begin
21
+ pool.add_serialized_file(descriptor_data)
22
+ rescue TypeError => e
23
+ # Compatibility code: will be removed in the next major version.
24
+ require 'google/protobuf/descriptor_pb'
25
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
26
+ parsed.clear_dependency
27
+ serialized = parsed.class.encode(parsed)
28
+ file = pool.add_serialized_file(serialized)
29
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
30
+ imports = [
31
+ ["google.protobuf.FieldMask", "google/protobuf/field_mask.proto"],
32
+ ]
33
+ imports.each do |type_name, expected_filename|
34
+ import_file = pool.lookup(type_name).file_descriptor
35
+ if import_file.name != expected_filename
36
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
63
37
  end
64
38
  end
39
+ warn "Each proto file must use a consistent fully-qualified name."
40
+ warn "This will become an error in the next major version."
65
41
  end
66
42
 
67
43
  module Google
@@ -129,7 +129,7 @@ module Google
129
129
  credentials = @config.credentials
130
130
  # Use self-signed JWT if the endpoint is unchanged from default,
131
131
  # but only if the default endpoint does not have a region prefix.
132
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
132
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
133
133
  !@config.endpoint.split(".").first.include?("-")
134
134
  credentials ||= Credentials.default scope: @config.scope,
135
135
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -195,13 +195,11 @@ module Google
195
195
  # # Call the list_services method.
196
196
  # result = client.list_services request
197
197
  #
198
- # # The returned object is of type Gapic::PagedEnumerable. You can
199
- # # iterate over all elements by calling #each, and the enumerable
200
- # # will lazily make API calls to fetch subsequent pages. Other
201
- # # methods are also available for managing paging directly.
202
- # result.each do |response|
198
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
199
+ # # over elements, and API calls will be issued to fetch pages as needed.
200
+ # result.each do |item|
203
201
  # # Each element is of type ::Google::Cloud::Billing::V1::Service.
204
- # p response
202
+ # p item
205
203
  # end
206
204
  #
207
205
  def list_services request, options = nil
@@ -304,13 +302,11 @@ module Google
304
302
  # # Call the list_skus method.
305
303
  # result = client.list_skus request
306
304
  #
307
- # # The returned object is of type Gapic::PagedEnumerable. You can
308
- # # iterate over all elements by calling #each, and the enumerable
309
- # # will lazily make API calls to fetch subsequent pages. Other
310
- # # methods are also available for managing paging directly.
311
- # result.each do |response|
305
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
306
+ # # over elements, and API calls will be issued to fetch pages as needed.
307
+ # result.each do |item|
312
308
  # # Each element is of type ::Google::Cloud::Billing::V1::Sku.
313
- # p response
309
+ # p item
314
310
  # end
315
311
  #
316
312
  def list_skus request, options = nil
@@ -393,9 +389,9 @@ module Google
393
389
  # * (`String`) The path to a service account key file in JSON format
394
390
  # * (`Hash`) A service account key as a Hash
395
391
  # * (`Google::Auth::Credentials`) A googleauth credentials object
396
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
392
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
397
393
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
398
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
394
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
399
395
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
400
396
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
401
397
  # * (`nil`) indicating no credentials
@@ -437,7 +433,9 @@ module Google
437
433
  class Configuration
438
434
  extend ::Gapic::Config
439
435
 
440
- config_attr :endpoint, "cloudbilling.googleapis.com", ::String
436
+ DEFAULT_ENDPOINT = "cloudbilling.googleapis.com"
437
+
438
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
441
439
  config_attr :credentials, nil do |value|
442
440
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
443
441
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC