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,452 @@
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 == Configuration::DEFAULT_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://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
338
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
339
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
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
+ DEFAULT_ENDPOINT = "cloudbilling.googleapis.com"
373
+
374
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
375
+ config_attr :credentials, nil do |value|
376
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
377
+ allowed.any? { |klass| klass === value }
378
+ end
379
+ config_attr :scope, nil, ::String, ::Array, nil
380
+ config_attr :lib_name, nil, ::String, nil
381
+ config_attr :lib_version, nil, ::String, nil
382
+ config_attr :timeout, nil, ::Numeric, nil
383
+ config_attr :metadata, nil, ::Hash, nil
384
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
385
+ config_attr :quota_project, nil, ::String, nil
386
+
387
+ # @private
388
+ def initialize parent_config = nil
389
+ @parent_config = parent_config unless parent_config.nil?
390
+
391
+ yield self if block_given?
392
+ end
393
+
394
+ ##
395
+ # Configurations for individual RPCs
396
+ # @return [Rpcs]
397
+ #
398
+ def rpcs
399
+ @rpcs ||= begin
400
+ parent_rpcs = nil
401
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
402
+ Rpcs.new parent_rpcs
403
+ end
404
+ end
405
+
406
+ ##
407
+ # Configuration RPC class for the CloudCatalog API.
408
+ #
409
+ # Includes fields providing the configuration for each RPC in this service.
410
+ # Each configuration object is of type `Gapic::Config::Method` and includes
411
+ # the following configuration fields:
412
+ #
413
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
414
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
415
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
416
+ # include the following keys:
417
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
418
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
419
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
420
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
421
+ # trigger a retry.
422
+ #
423
+ class Rpcs
424
+ ##
425
+ # RPC-specific configuration for `list_services`
426
+ # @return [::Gapic::Config::Method]
427
+ #
428
+ attr_reader :list_services
429
+ ##
430
+ # RPC-specific configuration for `list_skus`
431
+ # @return [::Gapic::Config::Method]
432
+ #
433
+ attr_reader :list_skus
434
+
435
+ # @private
436
+ def initialize parent_rpcs = nil
437
+ list_services_config = parent_rpcs.list_services if parent_rpcs.respond_to? :list_services
438
+ @list_services = ::Gapic::Config::Method.new list_services_config
439
+ list_skus_config = parent_rpcs.list_skus if parent_rpcs.respond_to? :list_skus
440
+ @list_skus = ::Gapic::Config::Method.new list_skus_config
441
+
442
+ yield self if block_given?
443
+ end
444
+ end
445
+ end
446
+ end
447
+ end
448
+ end
449
+ end
450
+ end
451
+ end
452
+ end
@@ -0,0 +1,164 @@
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/billing/v1/cloud_catalog_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Billing
24
+ module V1
25
+ module CloudCatalog
26
+ module Rest
27
+ ##
28
+ # REST service stub for the CloudCatalog service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ def initialize endpoint:, credentials:
34
+ # These require statements are intentionally placed here to initialize
35
+ # the REST modules only when it's required.
36
+ require "gapic/rest"
37
+
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
39
+ numeric_enums: true,
40
+ raise_faraday_errors: false
41
+ end
42
+
43
+ ##
44
+ # Baseline implementation for the list_services REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Billing::V1::ListServicesRequest]
47
+ # A request object representing the call parameters. Required.
48
+ # @param options [::Gapic::CallOptions]
49
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
50
+ #
51
+ # @yield [result, operation] Access the result along with the TransportOperation object
52
+ # @yieldparam result [::Google::Cloud::Billing::V1::ListServicesResponse]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Billing::V1::ListServicesResponse]
56
+ # A result object deserialized from the server's reply
57
+ def list_services request_pb, options = nil
58
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
59
+
60
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_services_request request_pb
61
+ query_string_params = if query_string_params.any?
62
+ query_string_params.to_h { |p| p.split "=", 2 }
63
+ else
64
+ {}
65
+ end
66
+
67
+ response = @client_stub.make_http_request(
68
+ verb,
69
+ uri: uri,
70
+ body: body || "",
71
+ params: query_string_params,
72
+ options: options
73
+ )
74
+ operation = ::Gapic::Rest::TransportOperation.new response
75
+ result = ::Google::Cloud::Billing::V1::ListServicesResponse.decode_json response.body, ignore_unknown_fields: true
76
+
77
+ yield result, operation if block_given?
78
+ result
79
+ end
80
+
81
+ ##
82
+ # Baseline implementation for the list_skus REST call
83
+ #
84
+ # @param request_pb [::Google::Cloud::Billing::V1::ListSkusRequest]
85
+ # A request object representing the call parameters. Required.
86
+ # @param options [::Gapic::CallOptions]
87
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
88
+ #
89
+ # @yield [result, operation] Access the result along with the TransportOperation object
90
+ # @yieldparam result [::Google::Cloud::Billing::V1::ListSkusResponse]
91
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
92
+ #
93
+ # @return [::Google::Cloud::Billing::V1::ListSkusResponse]
94
+ # A result object deserialized from the server's reply
95
+ def list_skus request_pb, options = nil
96
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
97
+
98
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_skus_request request_pb
99
+ query_string_params = if query_string_params.any?
100
+ query_string_params.to_h { |p| p.split "=", 2 }
101
+ else
102
+ {}
103
+ end
104
+
105
+ response = @client_stub.make_http_request(
106
+ verb,
107
+ uri: uri,
108
+ body: body || "",
109
+ params: query_string_params,
110
+ options: options
111
+ )
112
+ operation = ::Gapic::Rest::TransportOperation.new response
113
+ result = ::Google::Cloud::Billing::V1::ListSkusResponse.decode_json response.body, ignore_unknown_fields: true
114
+
115
+ yield result, operation if block_given?
116
+ result
117
+ end
118
+
119
+ ##
120
+ # @private
121
+ #
122
+ # GRPC transcoding helper method for the list_services REST call
123
+ #
124
+ # @param request_pb [::Google::Cloud::Billing::V1::ListServicesRequest]
125
+ # A request object representing the call parameters. Required.
126
+ # @return [Array(String, [String, nil], Hash{String => String})]
127
+ # Uri, Body, Query string parameters
128
+ def self.transcode_list_services_request request_pb
129
+ transcoder = Gapic::Rest::GrpcTranscoder.new
130
+ .with_bindings(
131
+ uri_method: :get,
132
+ uri_template: "/v1/services",
133
+ matches: []
134
+ )
135
+ transcoder.transcode request_pb
136
+ end
137
+
138
+ ##
139
+ # @private
140
+ #
141
+ # GRPC transcoding helper method for the list_skus REST call
142
+ #
143
+ # @param request_pb [::Google::Cloud::Billing::V1::ListSkusRequest]
144
+ # A request object representing the call parameters. Required.
145
+ # @return [Array(String, [String, nil], Hash{String => String})]
146
+ # Uri, Body, Query string parameters
147
+ def self.transcode_list_skus_request request_pb
148
+ transcoder = Gapic::Rest::GrpcTranscoder.new
149
+ .with_bindings(
150
+ uri_method: :get,
151
+ uri_template: "/v1/{parent}/skus",
152
+ matches: [
153
+ ["parent", %r{^services/[^/]+/?$}, false]
154
+ ]
155
+ )
156
+ transcoder.transcode request_pb
157
+ end
158
+ end
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,54 @@
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_catalog/credentials"
26
+ require "google/cloud/billing/v1/cloud_catalog/paths"
27
+ require "google/cloud/billing/v1/cloud_catalog/rest/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module Billing
32
+ module V1
33
+ ##
34
+ # A catalog of Google Cloud Platform services and SKUs.
35
+ # Provides pricing information and metadata on Google Cloud Platform services
36
+ # and SKUs.
37
+ #
38
+ # To load this service and instantiate a REST client:
39
+ #
40
+ # require "google/cloud/billing/v1/cloud_catalog/rest"
41
+ # client = ::Google::Cloud::Billing::V1::CloudCatalog::Rest::Client.new
42
+ #
43
+ module CloudCatalog
44
+ # Client for the REST transport
45
+ module Rest
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
54
+ require "google/cloud/billing/v1/cloud_catalog/rest/helpers" if ::File.file? helper_path