google-cloud-billing-v1 0.9.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +2 -2
- data/lib/google/cloud/billing/v1/cloud_billing/client.rb +37 -31
- data/lib/google/cloud/billing/v1/cloud_billing/credentials.rb +2 -0
- data/lib/google/cloud/billing/v1/cloud_billing/rest/client.rb +1143 -0
- data/lib/google/cloud/billing/v1/cloud_billing/rest/service_stub.rb +639 -0
- data/lib/google/cloud/billing/v1/cloud_billing/rest.rb +53 -0
- data/lib/google/cloud/billing/v1/cloud_billing.rb +9 -2
- data/lib/google/cloud/billing/v1/cloud_billing_services_pb.rb +19 -13
- data/lib/google/cloud/billing/v1/cloud_catalog/client.rb +8 -12
- data/lib/google/cloud/billing/v1/cloud_catalog/credentials.rb +2 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/rest/client.rb +450 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/rest/service_stub.rb +164 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/rest.rb +54 -0
- data/lib/google/cloud/billing/v1/cloud_catalog.rb +7 -1
- data/lib/google/cloud/billing/v1/cloud_catalog_pb.rb +15 -2
- data/lib/google/cloud/billing/v1/cloud_catalog_services_pb.rb +1 -2
- data/lib/google/cloud/billing/v1/rest.rb +38 -0
- data/lib/google/cloud/billing/v1/version.rb +1 -1
- data/lib/google/cloud/billing/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/cloud/billing/v1/cloud_billing.rb +26 -21
- data/proto_docs/google/cloud/billing/v1/cloud_catalog.rb +48 -15
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +19 -8
@@ -0,0 +1,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,19 +25,26 @@ 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
|
31
32
|
module Billing
|
32
33
|
module V1
|
33
34
|
##
|
34
|
-
# Retrieves
|
35
|
+
# Retrieves the Google Cloud Console billing accounts and associates them with
|
36
|
+
# projects.
|
35
37
|
#
|
36
|
-
#
|
38
|
+
# @example Load this service and instantiate a gRPC client
|
37
39
|
#
|
38
40
|
# require "google/cloud/billing/v1/cloud_billing"
|
39
41
|
# client = ::Google::Cloud::Billing::V1::CloudBilling::Client.new
|
40
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
|
+
#
|
41
48
|
module CloudBilling
|
42
49
|
end
|
43
50
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
2
|
# Source: google/cloud/billing/v1/cloud_billing.proto for package 'google.cloud.billing.v1'
|
3
3
|
# Original file comments:
|
4
|
-
# Copyright
|
4
|
+
# Copyright 2022 Google LLC
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
@@ -15,7 +15,6 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
#
|
19
18
|
|
20
19
|
require 'grpc'
|
21
20
|
require 'google/cloud/billing/v1/cloud_billing_pb'
|
@@ -25,7 +24,8 @@ module Google
|
|
25
24
|
module Billing
|
26
25
|
module V1
|
27
26
|
module CloudBilling
|
28
|
-
# Retrieves
|
27
|
+
# Retrieves the Google Cloud Console billing accounts and associates them with
|
28
|
+
# projects.
|
29
29
|
class Service
|
30
30
|
|
31
31
|
include ::GRPC::GenericService
|
@@ -49,15 +49,20 @@ module Google
|
|
49
49
|
# [administrator](https://cloud.google.com/billing/docs/how-to/billing-access)
|
50
50
|
# of the billing account.
|
51
51
|
rpc :UpdateBillingAccount, ::Google::Cloud::Billing::V1::UpdateBillingAccountRequest, ::Google::Cloud::Billing::V1::BillingAccount
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
52
|
+
# This method creates [billing
|
53
|
+
# subaccounts](https://cloud.google.com/billing/docs/concepts#subaccounts).
|
54
|
+
#
|
55
|
+
# Google Cloud resellers should use the
|
56
|
+
# Channel Services APIs,
|
57
|
+
# [accounts.customers.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers/create)
|
58
|
+
# and
|
59
|
+
# [accounts.customers.entitlements.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers.entitlements/create).
|
60
|
+
#
|
56
61
|
# When creating a subaccount, the current authenticated user must have the
|
57
|
-
# `billing.accounts.update` IAM permission on the
|
62
|
+
# `billing.accounts.update` IAM permission on the parent account, which is
|
58
63
|
# typically given to billing account
|
59
64
|
# [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
|
60
|
-
# This method will return an error if the
|
65
|
+
# This method will return an error if the parent account has not been
|
61
66
|
# provisioned as a reseller account.
|
62
67
|
rpc :CreateBillingAccount, ::Google::Cloud::Billing::V1::CreateBillingAccountRequest, ::Google::Cloud::Billing::V1::BillingAccount
|
63
68
|
# Lists the projects associated with a billing account. The current
|
@@ -66,9 +71,10 @@ module Google
|
|
66
71
|
# [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
|
67
72
|
rpc :ListProjectBillingInfo, ::Google::Cloud::Billing::V1::ListProjectBillingInfoRequest, ::Google::Cloud::Billing::V1::ListProjectBillingInfoResponse
|
68
73
|
# Gets the billing information for a project. The current authenticated user
|
69
|
-
# must have
|
70
|
-
#
|
71
|
-
# )
|
74
|
+
# must have the `resourcemanager.projects.get` permission for the project,
|
75
|
+
# which can be granted by assigning the [Project
|
76
|
+
# Viewer](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles)
|
77
|
+
# role.
|
72
78
|
rpc :GetProjectBillingInfo, ::Google::Cloud::Billing::V1::GetProjectBillingInfoRequest, ::Google::Cloud::Billing::V1::ProjectBillingInfo
|
73
79
|
# Sets or updates the billing account associated with a project. You specify
|
74
80
|
# the new billing account by setting the `billing_account_name` in the
|
@@ -79,7 +85,7 @@ module Google
|
|
79
85
|
# usage charges.
|
80
86
|
#
|
81
87
|
# *Note:* Incurred charges that have not yet been reported in the transaction
|
82
|
-
# history of the
|
88
|
+
# history of the Google Cloud Console might be billed to the new billing
|
83
89
|
# account, even if the charge occurred before the new billing account was
|
84
90
|
# assigned to the project.
|
85
91
|
#
|
@@ -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
|
-
# #
|
200
|
-
#
|
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
|
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
|
-
# #
|
309
|
-
#
|
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
|
309
|
+
# p item
|
314
310
|
# end
|
315
311
|
#
|
316
312
|
def list_skus request, options = nil
|
@@ -26,6 +26,8 @@ module Google
|
|
26
26
|
# Credentials for the CloudCatalog API.
|
27
27
|
class Credentials < ::Google::Auth::Credentials
|
28
28
|
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-billing",
|
30
|
+
"https://www.googleapis.com/auth/cloud-billing.readonly",
|
29
31
|
"https://www.googleapis.com/auth/cloud-platform"
|
30
32
|
]
|
31
33
|
self.env_vars = [
|
@@ -0,0 +1,450 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/billing/v1/cloud_catalog_pb"
|
21
|
+
require "google/cloud/billing/v1/cloud_catalog/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Billing
|
26
|
+
module V1
|
27
|
+
module CloudCatalog
|
28
|
+
module Rest
|
29
|
+
##
|
30
|
+
# REST client for the CloudCatalog service.
|
31
|
+
#
|
32
|
+
# A catalog of Google Cloud Platform services and SKUs.
|
33
|
+
# Provides pricing information and metadata on Google Cloud Platform services
|
34
|
+
# and SKUs.
|
35
|
+
#
|
36
|
+
class Client
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :cloud_catalog_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configure the CloudCatalog Client class.
|
44
|
+
#
|
45
|
+
# See {::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client::Configuration}
|
46
|
+
# for a description of the configuration fields.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# # Modify the configuration for all CloudCatalog clients
|
51
|
+
# ::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Cloud", "Billing", "V1"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.rpcs.list_services.timeout = 60.0
|
72
|
+
|
73
|
+
default_config.rpcs.list_skus.timeout = 60.0
|
74
|
+
|
75
|
+
default_config
|
76
|
+
end
|
77
|
+
yield @configure if block_given?
|
78
|
+
@configure
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Configure the CloudCatalog Client instance.
|
83
|
+
#
|
84
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
85
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
86
|
+
# should be made on {Client.configure}.
|
87
|
+
#
|
88
|
+
# See {::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client::Configuration}
|
89
|
+
# for a description of the configuration fields.
|
90
|
+
#
|
91
|
+
# @yield [config] Configure the Client client.
|
92
|
+
# @yieldparam config [Client::Configuration]
|
93
|
+
#
|
94
|
+
# @return [Client::Configuration]
|
95
|
+
#
|
96
|
+
def configure
|
97
|
+
yield @config if block_given?
|
98
|
+
@config
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Create a new CloudCatalog REST client object.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
#
|
106
|
+
# # Create a client using the default configuration
|
107
|
+
# client = ::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client.new
|
108
|
+
#
|
109
|
+
# # Create a client using a custom configuration
|
110
|
+
# client = ::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client.new do |config|
|
111
|
+
# config.timeout = 10.0
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# @yield [config] Configure the CloudCatalog client.
|
115
|
+
# @yieldparam config [Client::Configuration]
|
116
|
+
#
|
117
|
+
def initialize
|
118
|
+
# Create the configuration object
|
119
|
+
@config = Configuration.new Client.configure
|
120
|
+
|
121
|
+
# Yield the configuration if needed
|
122
|
+
yield @config if block_given?
|
123
|
+
|
124
|
+
# Create credentials
|
125
|
+
credentials = @config.credentials
|
126
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
127
|
+
# but only if the default endpoint does not have a region prefix.
|
128
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
129
|
+
!@config.endpoint.split(".").first.include?("-")
|
130
|
+
credentials ||= Credentials.default scope: @config.scope,
|
131
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
132
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
133
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
134
|
+
end
|
135
|
+
|
136
|
+
@quota_project_id = @config.quota_project
|
137
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
138
|
+
|
139
|
+
@cloud_catalog_stub = ::Google::Cloud::Billing::V1::CloudCatalog::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
140
|
+
end
|
141
|
+
|
142
|
+
# Service calls
|
143
|
+
|
144
|
+
##
|
145
|
+
# Lists all public cloud services.
|
146
|
+
#
|
147
|
+
# @overload list_services(request, options = nil)
|
148
|
+
# Pass arguments to `list_services` via a request object, either of type
|
149
|
+
# {::Google::Cloud::Billing::V1::ListServicesRequest} or an equivalent Hash.
|
150
|
+
#
|
151
|
+
# @param request [::Google::Cloud::Billing::V1::ListServicesRequest, ::Hash]
|
152
|
+
# A request object representing the call parameters. Required. To specify no
|
153
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
154
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
155
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
156
|
+
#
|
157
|
+
# @overload list_services(page_size: nil, page_token: nil)
|
158
|
+
# Pass arguments to `list_services` via keyword arguments. Note that at
|
159
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
160
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
161
|
+
#
|
162
|
+
# @param page_size [::Integer]
|
163
|
+
# Requested page size. Defaults to 5000.
|
164
|
+
# @param page_token [::String]
|
165
|
+
# A token identifying a page of results to return. This should be a
|
166
|
+
# `next_page_token` value returned from a previous `ListServices`
|
167
|
+
# call. If unspecified, the first page of results is returned.
|
168
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
169
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::Service>]
|
170
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
171
|
+
#
|
172
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::Service>]
|
173
|
+
#
|
174
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
175
|
+
def list_services request, options = nil
|
176
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
177
|
+
|
178
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::ListServicesRequest
|
179
|
+
|
180
|
+
# Converts hash and nil to an options object
|
181
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
182
|
+
|
183
|
+
# Customize the options with defaults
|
184
|
+
call_metadata = @config.rpcs.list_services.metadata.to_h
|
185
|
+
|
186
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
187
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
188
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
189
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
190
|
+
transports_version_send: [:rest]
|
191
|
+
|
192
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
193
|
+
|
194
|
+
options.apply_defaults timeout: @config.rpcs.list_services.timeout,
|
195
|
+
metadata: call_metadata,
|
196
|
+
retry_policy: @config.rpcs.list_services.retry_policy
|
197
|
+
|
198
|
+
options.apply_defaults timeout: @config.timeout,
|
199
|
+
metadata: @config.metadata,
|
200
|
+
retry_policy: @config.retry_policy
|
201
|
+
|
202
|
+
@cloud_catalog_stub.list_services request, options do |result, operation|
|
203
|
+
result = ::Gapic::Rest::PagedEnumerable.new @cloud_catalog_stub, :list_services, "services", request, result, options
|
204
|
+
yield result, operation if block_given?
|
205
|
+
return result
|
206
|
+
end
|
207
|
+
rescue ::Gapic::Rest::Error => e
|
208
|
+
raise ::Google::Cloud::Error.from_error(e)
|
209
|
+
end
|
210
|
+
|
211
|
+
##
|
212
|
+
# Lists all publicly available SKUs for a given cloud service.
|
213
|
+
#
|
214
|
+
# @overload list_skus(request, options = nil)
|
215
|
+
# Pass arguments to `list_skus` via a request object, either of type
|
216
|
+
# {::Google::Cloud::Billing::V1::ListSkusRequest} or an equivalent Hash.
|
217
|
+
#
|
218
|
+
# @param request [::Google::Cloud::Billing::V1::ListSkusRequest, ::Hash]
|
219
|
+
# A request object representing the call parameters. Required. To specify no
|
220
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
221
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
222
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
223
|
+
#
|
224
|
+
# @overload list_skus(parent: nil, start_time: nil, end_time: nil, currency_code: nil, page_size: nil, page_token: nil)
|
225
|
+
# Pass arguments to `list_skus` via keyword arguments. Note that at
|
226
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
227
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
228
|
+
#
|
229
|
+
# @param parent [::String]
|
230
|
+
# Required. The name of the service.
|
231
|
+
# Example: "services/DA34-426B-A397"
|
232
|
+
# @param start_time [::Google::Protobuf::Timestamp, ::Hash]
|
233
|
+
# Optional inclusive start time of the time range for which the pricing
|
234
|
+
# versions will be returned. Timestamps in the future are not allowed.
|
235
|
+
# The time range has to be within a single calendar month in
|
236
|
+
# America/Los_Angeles timezone. Time range as a whole is optional. If not
|
237
|
+
# specified, the latest pricing will be returned (up to 12 hours old at
|
238
|
+
# most).
|
239
|
+
# @param end_time [::Google::Protobuf::Timestamp, ::Hash]
|
240
|
+
# Optional exclusive end time of the time range for which the pricing
|
241
|
+
# versions will be returned. Timestamps in the future are not allowed.
|
242
|
+
# The time range has to be within a single calendar month in
|
243
|
+
# America/Los_Angeles timezone. Time range as a whole is optional. If not
|
244
|
+
# specified, the latest pricing will be returned (up to 12 hours old at
|
245
|
+
# most).
|
246
|
+
# @param currency_code [::String]
|
247
|
+
# The ISO 4217 currency code for the pricing info in the response proto.
|
248
|
+
# Will use the conversion rate as of start_time.
|
249
|
+
# Optional. If not specified USD will be used.
|
250
|
+
# @param page_size [::Integer]
|
251
|
+
# Requested page size. Defaults to 5000.
|
252
|
+
# @param page_token [::String]
|
253
|
+
# A token identifying a page of results to return. This should be a
|
254
|
+
# `next_page_token` value returned from a previous `ListSkus`
|
255
|
+
# call. If unspecified, the first page of results is returned.
|
256
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
257
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::Sku>]
|
258
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
259
|
+
#
|
260
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Billing::V1::Sku>]
|
261
|
+
#
|
262
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
263
|
+
def list_skus request, options = nil
|
264
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
265
|
+
|
266
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Billing::V1::ListSkusRequest
|
267
|
+
|
268
|
+
# Converts hash and nil to an options object
|
269
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
270
|
+
|
271
|
+
# Customize the options with defaults
|
272
|
+
call_metadata = @config.rpcs.list_skus.metadata.to_h
|
273
|
+
|
274
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
275
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
276
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
277
|
+
gapic_version: ::Google::Cloud::Billing::V1::VERSION,
|
278
|
+
transports_version_send: [:rest]
|
279
|
+
|
280
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
281
|
+
|
282
|
+
options.apply_defaults timeout: @config.rpcs.list_skus.timeout,
|
283
|
+
metadata: call_metadata,
|
284
|
+
retry_policy: @config.rpcs.list_skus.retry_policy
|
285
|
+
|
286
|
+
options.apply_defaults timeout: @config.timeout,
|
287
|
+
metadata: @config.metadata,
|
288
|
+
retry_policy: @config.retry_policy
|
289
|
+
|
290
|
+
@cloud_catalog_stub.list_skus request, options do |result, operation|
|
291
|
+
result = ::Gapic::Rest::PagedEnumerable.new @cloud_catalog_stub, :list_skus, "skus", request, result, options
|
292
|
+
yield result, operation if block_given?
|
293
|
+
return result
|
294
|
+
end
|
295
|
+
rescue ::Gapic::Rest::Error => e
|
296
|
+
raise ::Google::Cloud::Error.from_error(e)
|
297
|
+
end
|
298
|
+
|
299
|
+
##
|
300
|
+
# Configuration class for the CloudCatalog REST API.
|
301
|
+
#
|
302
|
+
# This class represents the configuration for CloudCatalog REST,
|
303
|
+
# providing control over timeouts, retry behavior, logging, transport
|
304
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
305
|
+
# applied individually to specific RPCs. See
|
306
|
+
# {::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client::Configuration::Rpcs}
|
307
|
+
# for a list of RPCs that can be configured independently.
|
308
|
+
#
|
309
|
+
# Configuration can be applied globally to all clients, or to a single client
|
310
|
+
# on construction.
|
311
|
+
#
|
312
|
+
# @example
|
313
|
+
#
|
314
|
+
# # Modify the global config, setting the timeout for
|
315
|
+
# # list_services to 20 seconds,
|
316
|
+
# # and all remaining timeouts to 10 seconds.
|
317
|
+
# ::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client.configure do |config|
|
318
|
+
# config.timeout = 10.0
|
319
|
+
# config.rpcs.list_services.timeout = 20.0
|
320
|
+
# end
|
321
|
+
#
|
322
|
+
# # Apply the above configuration only to a new client.
|
323
|
+
# client = ::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client.new do |config|
|
324
|
+
# config.timeout = 10.0
|
325
|
+
# config.rpcs.list_services.timeout = 20.0
|
326
|
+
# end
|
327
|
+
#
|
328
|
+
# @!attribute [rw] endpoint
|
329
|
+
# The hostname or hostname:port of the service endpoint.
|
330
|
+
# Defaults to `"cloudbilling.googleapis.com"`.
|
331
|
+
# @return [::String]
|
332
|
+
# @!attribute [rw] credentials
|
333
|
+
# Credentials to send with calls. You may provide any of the following types:
|
334
|
+
# * (`String`) The path to a service account key file in JSON format
|
335
|
+
# * (`Hash`) A service account key as a Hash
|
336
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
337
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
338
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
339
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
340
|
+
# * (`nil`) indicating no credentials
|
341
|
+
# @return [::Object]
|
342
|
+
# @!attribute [rw] scope
|
343
|
+
# The OAuth scopes
|
344
|
+
# @return [::Array<::String>]
|
345
|
+
# @!attribute [rw] lib_name
|
346
|
+
# The library name as recorded in instrumentation and logging
|
347
|
+
# @return [::String]
|
348
|
+
# @!attribute [rw] lib_version
|
349
|
+
# The library version as recorded in instrumentation and logging
|
350
|
+
# @return [::String]
|
351
|
+
# @!attribute [rw] timeout
|
352
|
+
# The call timeout in seconds.
|
353
|
+
# @return [::Numeric]
|
354
|
+
# @!attribute [rw] metadata
|
355
|
+
# Additional headers to be sent with the call.
|
356
|
+
# @return [::Hash{::Symbol=>::String}]
|
357
|
+
# @!attribute [rw] retry_policy
|
358
|
+
# The retry policy. The value is a hash with the following keys:
|
359
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
360
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
361
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
362
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
363
|
+
# trigger a retry.
|
364
|
+
# @return [::Hash]
|
365
|
+
# @!attribute [rw] quota_project
|
366
|
+
# A separate project against which to charge quota.
|
367
|
+
# @return [::String]
|
368
|
+
#
|
369
|
+
class Configuration
|
370
|
+
extend ::Gapic::Config
|
371
|
+
|
372
|
+
config_attr :endpoint, "cloudbilling.googleapis.com", ::String
|
373
|
+
config_attr :credentials, nil do |value|
|
374
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
375
|
+
allowed.any? { |klass| klass === value }
|
376
|
+
end
|
377
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
378
|
+
config_attr :lib_name, nil, ::String, nil
|
379
|
+
config_attr :lib_version, nil, ::String, nil
|
380
|
+
config_attr :timeout, nil, ::Numeric, nil
|
381
|
+
config_attr :metadata, nil, ::Hash, nil
|
382
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
383
|
+
config_attr :quota_project, nil, ::String, nil
|
384
|
+
|
385
|
+
# @private
|
386
|
+
def initialize parent_config = nil
|
387
|
+
@parent_config = parent_config unless parent_config.nil?
|
388
|
+
|
389
|
+
yield self if block_given?
|
390
|
+
end
|
391
|
+
|
392
|
+
##
|
393
|
+
# Configurations for individual RPCs
|
394
|
+
# @return [Rpcs]
|
395
|
+
#
|
396
|
+
def rpcs
|
397
|
+
@rpcs ||= begin
|
398
|
+
parent_rpcs = nil
|
399
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
400
|
+
Rpcs.new parent_rpcs
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
##
|
405
|
+
# Configuration RPC class for the CloudCatalog API.
|
406
|
+
#
|
407
|
+
# Includes fields providing the configuration for each RPC in this service.
|
408
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
409
|
+
# the following configuration fields:
|
410
|
+
#
|
411
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
412
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
413
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
414
|
+
# include the following keys:
|
415
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
416
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
417
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
418
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
419
|
+
# trigger a retry.
|
420
|
+
#
|
421
|
+
class Rpcs
|
422
|
+
##
|
423
|
+
# RPC-specific configuration for `list_services`
|
424
|
+
# @return [::Gapic::Config::Method]
|
425
|
+
#
|
426
|
+
attr_reader :list_services
|
427
|
+
##
|
428
|
+
# RPC-specific configuration for `list_skus`
|
429
|
+
# @return [::Gapic::Config::Method]
|
430
|
+
#
|
431
|
+
attr_reader :list_skus
|
432
|
+
|
433
|
+
# @private
|
434
|
+
def initialize parent_rpcs = nil
|
435
|
+
list_services_config = parent_rpcs.list_services if parent_rpcs.respond_to? :list_services
|
436
|
+
@list_services = ::Gapic::Config::Method.new list_services_config
|
437
|
+
list_skus_config = parent_rpcs.list_skus if parent_rpcs.respond_to? :list_skus
|
438
|
+
@list_skus = ::Gapic::Config::Method.new list_skus_config
|
439
|
+
|
440
|
+
yield self if block_given?
|
441
|
+
end
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|