google-cloud-license_manager-v1 0.a → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/license_manager/v1/bindings_override.rb +75 -0
  6. data/lib/google/cloud/license_manager/v1/license_manager/client.rb +1831 -0
  7. data/lib/google/cloud/license_manager/v1/license_manager/credentials.rb +47 -0
  8. data/lib/google/cloud/license_manager/v1/license_manager/operations.rb +813 -0
  9. data/lib/google/cloud/license_manager/v1/license_manager/paths.rb +107 -0
  10. data/lib/google/cloud/license_manager/v1/license_manager/rest/client.rb +1722 -0
  11. data/lib/google/cloud/license_manager/v1/license_manager/rest/operations.rb +914 -0
  12. data/lib/google/cloud/license_manager/v1/license_manager/rest/service_stub.rb +878 -0
  13. data/lib/google/cloud/license_manager/v1/license_manager/rest.rb +54 -0
  14. data/lib/google/cloud/license_manager/v1/license_manager.rb +56 -0
  15. data/lib/google/cloud/license_manager/v1/rest.rb +38 -0
  16. data/lib/google/cloud/license_manager/v1/version.rb +7 -2
  17. data/lib/google/cloud/license_manager/v1.rb +45 -0
  18. data/lib/google/cloud/licensemanager/v1/api_entities_pb.rb +58 -0
  19. data/lib/google/cloud/licensemanager/v1/licensemanager_pb.rb +74 -0
  20. data/lib/google/cloud/licensemanager/v1/licensemanager_services_pb.rb +69 -0
  21. data/lib/google-cloud-license_manager-v1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/client.rb +473 -0
  24. data/proto_docs/google/api/field_behavior.rb +85 -0
  25. data/proto_docs/google/api/field_info.rb +88 -0
  26. data/proto_docs/google/api/launch_stage.rb +71 -0
  27. data/proto_docs/google/api/resource.rb +227 -0
  28. data/proto_docs/google/cloud/licensemanager/v1/api_entities.rb +297 -0
  29. data/proto_docs/google/cloud/licensemanager/v1/licensemanager.rb +400 -0
  30. data/proto_docs/google/longrunning/operations.rb +173 -0
  31. data/proto_docs/google/protobuf/any.rb +145 -0
  32. data/proto_docs/google/protobuf/duration.rb +98 -0
  33. data/proto_docs/google/protobuf/empty.rb +34 -0
  34. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  35. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  36. data/proto_docs/google/rpc/status.rb +48 -0
  37. metadata +84 -9
@@ -0,0 +1,1722 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/licensemanager/v1/licensemanager_pb"
21
+ require "google/cloud/license_manager/v1/license_manager/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module LicenseManager
27
+ module V1
28
+ module LicenseManager
29
+ module Rest
30
+ ##
31
+ # REST client for the LicenseManager service.
32
+ #
33
+ # Service describing handlers for resources
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "licensemanager.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :license_manager_stub
46
+
47
+ ##
48
+ # Configure the LicenseManager Client class.
49
+ #
50
+ # See {::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all LicenseManager clients
56
+ # ::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "LicenseManager", "V1"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.rpcs.list_configurations.timeout = 60.0
77
+ default_config.rpcs.list_configurations.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.get_configuration.timeout = 60.0
82
+ default_config.rpcs.get_configuration.retry_policy = {
83
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
84
+ }
85
+
86
+ default_config.rpcs.create_configuration.timeout = 60.0
87
+
88
+ default_config.rpcs.update_configuration.timeout = 60.0
89
+
90
+ default_config.rpcs.delete_configuration.timeout = 60.0
91
+
92
+ default_config.rpcs.list_instances.timeout = 60.0
93
+ default_config.rpcs.list_instances.retry_policy = {
94
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
95
+ }
96
+
97
+ default_config.rpcs.get_instance.timeout = 60.0
98
+ default_config.rpcs.get_instance.retry_policy = {
99
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
100
+ }
101
+
102
+ default_config.rpcs.query_configuration_license_usage.timeout = 60.0
103
+ default_config.rpcs.query_configuration_license_usage.retry_policy = {
104
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
105
+ }
106
+
107
+ default_config.rpcs.aggregate_usage.timeout = 60.0
108
+
109
+ default_config.rpcs.list_products.timeout = 60.0
110
+ default_config.rpcs.list_products.retry_policy = {
111
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
112
+ }
113
+
114
+ default_config.rpcs.get_product.timeout = 60.0
115
+ default_config.rpcs.get_product.retry_policy = {
116
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
117
+ }
118
+
119
+ default_config
120
+ end
121
+ yield @configure if block_given?
122
+ @configure
123
+ end
124
+
125
+ ##
126
+ # Configure the LicenseManager Client instance.
127
+ #
128
+ # The configuration is set to the derived mode, meaning that values can be changed,
129
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
130
+ # should be made on {Client.configure}.
131
+ #
132
+ # See {::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client::Configuration}
133
+ # for a description of the configuration fields.
134
+ #
135
+ # @yield [config] Configure the Client client.
136
+ # @yieldparam config [Client::Configuration]
137
+ #
138
+ # @return [Client::Configuration]
139
+ #
140
+ def configure
141
+ yield @config if block_given?
142
+ @config
143
+ end
144
+
145
+ ##
146
+ # The effective universe domain
147
+ #
148
+ # @return [String]
149
+ #
150
+ def universe_domain
151
+ @license_manager_stub.universe_domain
152
+ end
153
+
154
+ ##
155
+ # Create a new LicenseManager REST client object.
156
+ #
157
+ # @example
158
+ #
159
+ # # Create a client using the default configuration
160
+ # client = ::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
161
+ #
162
+ # # Create a client using a custom configuration
163
+ # client = ::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new do |config|
164
+ # config.timeout = 10.0
165
+ # end
166
+ #
167
+ # @yield [config] Configure the LicenseManager client.
168
+ # @yieldparam config [Client::Configuration]
169
+ #
170
+ def initialize
171
+ # Create the configuration object
172
+ @config = Configuration.new Client.configure
173
+
174
+ # Yield the configuration if needed
175
+ yield @config if block_given?
176
+
177
+ # Create credentials
178
+ credentials = @config.credentials
179
+ # Use self-signed JWT if the endpoint is unchanged from default,
180
+ # but only if the default endpoint does not have a region prefix.
181
+ enable_self_signed_jwt = @config.endpoint.nil? ||
182
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
183
+ !@config.endpoint.split(".").first.include?("-"))
184
+ credentials ||= Credentials.default scope: @config.scope,
185
+ enable_self_signed_jwt: enable_self_signed_jwt
186
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
187
+ credentials = Credentials.new credentials, scope: @config.scope
188
+ end
189
+
190
+ @quota_project_id = @config.quota_project
191
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
192
+
193
+ @operations_client = ::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Operations.new do |config|
194
+ config.credentials = credentials
195
+ config.quota_project = @quota_project_id
196
+ config.endpoint = @config.endpoint
197
+ config.universe_domain = @config.universe_domain
198
+ end
199
+
200
+ @license_manager_stub = ::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::ServiceStub.new(
201
+ endpoint: @config.endpoint,
202
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
203
+ universe_domain: @config.universe_domain,
204
+ credentials: credentials,
205
+ logger: @config.logger
206
+ )
207
+
208
+ @license_manager_stub.logger(stub: true)&.info do |entry|
209
+ entry.set_system_name
210
+ entry.set_service
211
+ entry.message = "Created client for #{entry.service}"
212
+ entry.set_credentials_fields credentials
213
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
214
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
215
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
216
+ end
217
+
218
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
219
+ config.credentials = credentials
220
+ config.quota_project = @quota_project_id
221
+ config.endpoint = @license_manager_stub.endpoint
222
+ config.universe_domain = @license_manager_stub.universe_domain
223
+ config.bindings_override = @config.bindings_override
224
+ config.logger = @license_manager_stub.logger if config.respond_to? :logger=
225
+ end
226
+ end
227
+
228
+ ##
229
+ # Get the associated client for long-running operations.
230
+ #
231
+ # @return [::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Operations]
232
+ #
233
+ attr_reader :operations_client
234
+
235
+ ##
236
+ # Get the associated client for mix-in of the Locations.
237
+ #
238
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
239
+ #
240
+ attr_reader :location_client
241
+
242
+ ##
243
+ # The logger used for request/response debug logging.
244
+ #
245
+ # @return [Logger]
246
+ #
247
+ def logger
248
+ @license_manager_stub.logger
249
+ end
250
+
251
+ # Service calls
252
+
253
+ ##
254
+ # Lists Configurations in a given project and location.
255
+ #
256
+ # @overload list_configurations(request, options = nil)
257
+ # Pass arguments to `list_configurations` via a request object, either of type
258
+ # {::Google::Cloud::LicenseManager::V1::ListConfigurationsRequest} or an equivalent Hash.
259
+ #
260
+ # @param request [::Google::Cloud::LicenseManager::V1::ListConfigurationsRequest, ::Hash]
261
+ # A request object representing the call parameters. Required. To specify no
262
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
263
+ # @param options [::Gapic::CallOptions, ::Hash]
264
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
265
+ #
266
+ # @overload list_configurations(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
267
+ # Pass arguments to `list_configurations` via keyword arguments. Note that at
268
+ # least one keyword argument is required. To specify no parameters, or to keep all
269
+ # the default parameter values, pass an empty Hash as a request object (see above).
270
+ #
271
+ # @param parent [::String]
272
+ # Required. Parent value for ListConfigurationsRequest
273
+ # @param page_size [::Integer]
274
+ # Optional. Requested page size. Server may return fewer items than
275
+ # requested. If unspecified, server will pick an appropriate default.
276
+ # @param page_token [::String]
277
+ # Optional. A token identifying a page of results the server should return.
278
+ # @param filter [::String]
279
+ # Optional. Filtering results
280
+ # @param order_by [::String]
281
+ # Optional. Hint for how to order the results
282
+ # @yield [result, operation] Access the result along with the TransportOperation object
283
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::LicenseManager::V1::Configuration>]
284
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
285
+ #
286
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::LicenseManager::V1::Configuration>]
287
+ #
288
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
289
+ #
290
+ # @example Basic example
291
+ # require "google/cloud/license_manager/v1"
292
+ #
293
+ # # Create a client object. The client can be reused for multiple calls.
294
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
295
+ #
296
+ # # Create a request. To set request fields, pass in keyword arguments.
297
+ # request = Google::Cloud::LicenseManager::V1::ListConfigurationsRequest.new
298
+ #
299
+ # # Call the list_configurations method.
300
+ # result = client.list_configurations request
301
+ #
302
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
303
+ # # over elements, and API calls will be issued to fetch pages as needed.
304
+ # result.each do |item|
305
+ # # Each element is of type ::Google::Cloud::LicenseManager::V1::Configuration.
306
+ # p item
307
+ # end
308
+ #
309
+ def list_configurations request, options = nil
310
+ raise ::ArgumentError, "request must be provided" if request.nil?
311
+
312
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::ListConfigurationsRequest
313
+
314
+ # Converts hash and nil to an options object
315
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
316
+
317
+ # Customize the options with defaults
318
+ call_metadata = @config.rpcs.list_configurations.metadata.to_h
319
+
320
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
321
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
322
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
323
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
324
+ transports_version_send: [:rest]
325
+
326
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
327
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
328
+
329
+ options.apply_defaults timeout: @config.rpcs.list_configurations.timeout,
330
+ metadata: call_metadata,
331
+ retry_policy: @config.rpcs.list_configurations.retry_policy
332
+
333
+ options.apply_defaults timeout: @config.timeout,
334
+ metadata: @config.metadata,
335
+ retry_policy: @config.retry_policy
336
+
337
+ @license_manager_stub.list_configurations request, options do |result, operation|
338
+ result = ::Gapic::Rest::PagedEnumerable.new @license_manager_stub, :list_configurations, "configurations", request, result, options
339
+ yield result, operation if block_given?
340
+ throw :response, result
341
+ end
342
+ rescue ::Gapic::Rest::Error => e
343
+ raise ::Google::Cloud::Error.from_error(e)
344
+ end
345
+
346
+ ##
347
+ # Gets details of a single Configuration.
348
+ #
349
+ # @overload get_configuration(request, options = nil)
350
+ # Pass arguments to `get_configuration` via a request object, either of type
351
+ # {::Google::Cloud::LicenseManager::V1::GetConfigurationRequest} or an equivalent Hash.
352
+ #
353
+ # @param request [::Google::Cloud::LicenseManager::V1::GetConfigurationRequest, ::Hash]
354
+ # A request object representing the call parameters. Required. To specify no
355
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
356
+ # @param options [::Gapic::CallOptions, ::Hash]
357
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
358
+ #
359
+ # @overload get_configuration(name: nil)
360
+ # Pass arguments to `get_configuration` via keyword arguments. Note that at
361
+ # least one keyword argument is required. To specify no parameters, or to keep all
362
+ # the default parameter values, pass an empty Hash as a request object (see above).
363
+ #
364
+ # @param name [::String]
365
+ # Required. Name of the resource
366
+ # @yield [result, operation] Access the result along with the TransportOperation object
367
+ # @yieldparam result [::Google::Cloud::LicenseManager::V1::Configuration]
368
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
369
+ #
370
+ # @return [::Google::Cloud::LicenseManager::V1::Configuration]
371
+ #
372
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
373
+ #
374
+ # @example Basic example
375
+ # require "google/cloud/license_manager/v1"
376
+ #
377
+ # # Create a client object. The client can be reused for multiple calls.
378
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
379
+ #
380
+ # # Create a request. To set request fields, pass in keyword arguments.
381
+ # request = Google::Cloud::LicenseManager::V1::GetConfigurationRequest.new
382
+ #
383
+ # # Call the get_configuration method.
384
+ # result = client.get_configuration request
385
+ #
386
+ # # The returned object is of type Google::Cloud::LicenseManager::V1::Configuration.
387
+ # p result
388
+ #
389
+ def get_configuration request, options = nil
390
+ raise ::ArgumentError, "request must be provided" if request.nil?
391
+
392
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::GetConfigurationRequest
393
+
394
+ # Converts hash and nil to an options object
395
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
396
+
397
+ # Customize the options with defaults
398
+ call_metadata = @config.rpcs.get_configuration.metadata.to_h
399
+
400
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
401
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
402
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
403
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
404
+ transports_version_send: [:rest]
405
+
406
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
407
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
408
+
409
+ options.apply_defaults timeout: @config.rpcs.get_configuration.timeout,
410
+ metadata: call_metadata,
411
+ retry_policy: @config.rpcs.get_configuration.retry_policy
412
+
413
+ options.apply_defaults timeout: @config.timeout,
414
+ metadata: @config.metadata,
415
+ retry_policy: @config.retry_policy
416
+
417
+ @license_manager_stub.get_configuration request, options do |result, operation|
418
+ yield result, operation if block_given?
419
+ end
420
+ rescue ::Gapic::Rest::Error => e
421
+ raise ::Google::Cloud::Error.from_error(e)
422
+ end
423
+
424
+ ##
425
+ # Creates a new Configuration in a given project and location.
426
+ #
427
+ # @overload create_configuration(request, options = nil)
428
+ # Pass arguments to `create_configuration` via a request object, either of type
429
+ # {::Google::Cloud::LicenseManager::V1::CreateConfigurationRequest} or an equivalent Hash.
430
+ #
431
+ # @param request [::Google::Cloud::LicenseManager::V1::CreateConfigurationRequest, ::Hash]
432
+ # A request object representing the call parameters. Required. To specify no
433
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
434
+ # @param options [::Gapic::CallOptions, ::Hash]
435
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
436
+ #
437
+ # @overload create_configuration(parent: nil, configuration_id: nil, configuration: nil, request_id: nil)
438
+ # Pass arguments to `create_configuration` via keyword arguments. Note that at
439
+ # least one keyword argument is required. To specify no parameters, or to keep all
440
+ # the default parameter values, pass an empty Hash as a request object (see above).
441
+ #
442
+ # @param parent [::String]
443
+ # Required. Value for parent.
444
+ # @param configuration_id [::String]
445
+ # Required. Id of the requesting object
446
+ # @param configuration [::Google::Cloud::LicenseManager::V1::Configuration, ::Hash]
447
+ # Required. The resource being created
448
+ # @param request_id [::String]
449
+ # Optional. An optional request ID to identify requests. Specify a unique
450
+ # request ID so that if you must retry your request, the server will know to
451
+ # ignore the request if it has already been completed. The server will
452
+ # guarantee that for at least 60 minutes since the first request.
453
+ #
454
+ # For example, consider a situation where you make an initial request and the
455
+ # request times out. If you make the request again with the same request
456
+ # ID, the server can check if original operation with the same request ID
457
+ # was received, and if so, will ignore the second request. This prevents
458
+ # clients from accidentally creating duplicate commitments.
459
+ #
460
+ # The request ID must be a valid UUID with the exception that zero UUID is
461
+ # not supported (00000000-0000-0000-0000-000000000000).
462
+ # @yield [result, operation] Access the result along with the TransportOperation object
463
+ # @yieldparam result [::Gapic::Operation]
464
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
465
+ #
466
+ # @return [::Gapic::Operation]
467
+ #
468
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
469
+ #
470
+ # @example Basic example
471
+ # require "google/cloud/license_manager/v1"
472
+ #
473
+ # # Create a client object. The client can be reused for multiple calls.
474
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
475
+ #
476
+ # # Create a request. To set request fields, pass in keyword arguments.
477
+ # request = Google::Cloud::LicenseManager::V1::CreateConfigurationRequest.new
478
+ #
479
+ # # Call the create_configuration method.
480
+ # result = client.create_configuration request
481
+ #
482
+ # # The returned object is of type Gapic::Operation. You can use it to
483
+ # # check the status of an operation, cancel it, or wait for results.
484
+ # # Here is how to wait for a response.
485
+ # result.wait_until_done! timeout: 60
486
+ # if result.response?
487
+ # p result.response
488
+ # else
489
+ # puts "No response received."
490
+ # end
491
+ #
492
+ def create_configuration request, options = nil
493
+ raise ::ArgumentError, "request must be provided" if request.nil?
494
+
495
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::CreateConfigurationRequest
496
+
497
+ # Converts hash and nil to an options object
498
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
499
+
500
+ # Customize the options with defaults
501
+ call_metadata = @config.rpcs.create_configuration.metadata.to_h
502
+
503
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
504
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
505
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
506
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
507
+ transports_version_send: [:rest]
508
+
509
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
510
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
511
+
512
+ options.apply_defaults timeout: @config.rpcs.create_configuration.timeout,
513
+ metadata: call_metadata,
514
+ retry_policy: @config.rpcs.create_configuration.retry_policy
515
+
516
+ options.apply_defaults timeout: @config.timeout,
517
+ metadata: @config.metadata,
518
+ retry_policy: @config.retry_policy
519
+
520
+ @license_manager_stub.create_configuration request, options do |result, operation|
521
+ result = ::Gapic::Operation.new result, @operations_client, options: options
522
+ yield result, operation if block_given?
523
+ throw :response, result
524
+ end
525
+ rescue ::Gapic::Rest::Error => e
526
+ raise ::Google::Cloud::Error.from_error(e)
527
+ end
528
+
529
+ ##
530
+ # Updates the parameters of a single Configuration.
531
+ #
532
+ # @overload update_configuration(request, options = nil)
533
+ # Pass arguments to `update_configuration` via a request object, either of type
534
+ # {::Google::Cloud::LicenseManager::V1::UpdateConfigurationRequest} or an equivalent Hash.
535
+ #
536
+ # @param request [::Google::Cloud::LicenseManager::V1::UpdateConfigurationRequest, ::Hash]
537
+ # A request object representing the call parameters. Required. To specify no
538
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
539
+ # @param options [::Gapic::CallOptions, ::Hash]
540
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
541
+ #
542
+ # @overload update_configuration(update_mask: nil, configuration: nil, request_id: nil)
543
+ # Pass arguments to `update_configuration` via keyword arguments. Note that at
544
+ # least one keyword argument is required. To specify no parameters, or to keep all
545
+ # the default parameter values, pass an empty Hash as a request object (see above).
546
+ #
547
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
548
+ # Optional. Field mask is used to specify the fields to be overwritten in the
549
+ # Configuration resource by the update.
550
+ # The fields specified in the update_mask are relative to the resource, not
551
+ # the full request. A field will be overwritten if it is in the mask. If the
552
+ # user does not provide a mask then all fields will be overwritten.
553
+ # @param configuration [::Google::Cloud::LicenseManager::V1::Configuration, ::Hash]
554
+ # Required. The resource being updated
555
+ # @param request_id [::String]
556
+ # Optional. An optional request ID to identify requests. Specify a unique
557
+ # request ID so that if you must retry your request, the server will know to
558
+ # ignore the request if it has already been completed. The server will
559
+ # guarantee that for at least 60 minutes since the first request.
560
+ #
561
+ # For example, consider a situation where you make an initial request and the
562
+ # request times out. If you make the request again with the same request
563
+ # ID, the server can check if original operation with the same request ID
564
+ # was received, and if so, will ignore the second request. This prevents
565
+ # clients from accidentally creating duplicate commitments.
566
+ #
567
+ # The request ID must be a valid UUID with the exception that zero UUID is
568
+ # not supported (00000000-0000-0000-0000-000000000000).
569
+ # @yield [result, operation] Access the result along with the TransportOperation object
570
+ # @yieldparam result [::Gapic::Operation]
571
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
572
+ #
573
+ # @return [::Gapic::Operation]
574
+ #
575
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
576
+ #
577
+ # @example Basic example
578
+ # require "google/cloud/license_manager/v1"
579
+ #
580
+ # # Create a client object. The client can be reused for multiple calls.
581
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
582
+ #
583
+ # # Create a request. To set request fields, pass in keyword arguments.
584
+ # request = Google::Cloud::LicenseManager::V1::UpdateConfigurationRequest.new
585
+ #
586
+ # # Call the update_configuration method.
587
+ # result = client.update_configuration request
588
+ #
589
+ # # The returned object is of type Gapic::Operation. You can use it to
590
+ # # check the status of an operation, cancel it, or wait for results.
591
+ # # Here is how to wait for a response.
592
+ # result.wait_until_done! timeout: 60
593
+ # if result.response?
594
+ # p result.response
595
+ # else
596
+ # puts "No response received."
597
+ # end
598
+ #
599
+ def update_configuration request, options = nil
600
+ raise ::ArgumentError, "request must be provided" if request.nil?
601
+
602
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::UpdateConfigurationRequest
603
+
604
+ # Converts hash and nil to an options object
605
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
606
+
607
+ # Customize the options with defaults
608
+ call_metadata = @config.rpcs.update_configuration.metadata.to_h
609
+
610
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
611
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
612
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
613
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
614
+ transports_version_send: [:rest]
615
+
616
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
617
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
618
+
619
+ options.apply_defaults timeout: @config.rpcs.update_configuration.timeout,
620
+ metadata: call_metadata,
621
+ retry_policy: @config.rpcs.update_configuration.retry_policy
622
+
623
+ options.apply_defaults timeout: @config.timeout,
624
+ metadata: @config.metadata,
625
+ retry_policy: @config.retry_policy
626
+
627
+ @license_manager_stub.update_configuration request, options do |result, operation|
628
+ result = ::Gapic::Operation.new result, @operations_client, options: options
629
+ yield result, operation if block_given?
630
+ throw :response, result
631
+ end
632
+ rescue ::Gapic::Rest::Error => e
633
+ raise ::Google::Cloud::Error.from_error(e)
634
+ end
635
+
636
+ ##
637
+ # Deletes a single Configuration.
638
+ #
639
+ # @overload delete_configuration(request, options = nil)
640
+ # Pass arguments to `delete_configuration` via a request object, either of type
641
+ # {::Google::Cloud::LicenseManager::V1::DeleteConfigurationRequest} or an equivalent Hash.
642
+ #
643
+ # @param request [::Google::Cloud::LicenseManager::V1::DeleteConfigurationRequest, ::Hash]
644
+ # A request object representing the call parameters. Required. To specify no
645
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
646
+ # @param options [::Gapic::CallOptions, ::Hash]
647
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
648
+ #
649
+ # @overload delete_configuration(name: nil, request_id: nil)
650
+ # Pass arguments to `delete_configuration` via keyword arguments. Note that at
651
+ # least one keyword argument is required. To specify no parameters, or to keep all
652
+ # the default parameter values, pass an empty Hash as a request object (see above).
653
+ #
654
+ # @param name [::String]
655
+ # Required. Name of the resource
656
+ # @param request_id [::String]
657
+ # Optional. An optional request ID to identify requests. Specify a unique
658
+ # request ID so that if you must retry your request, the server will know to
659
+ # ignore the request if it has already been completed. The server will
660
+ # guarantee that for at least 60 minutes after the first request.
661
+ #
662
+ # For example, consider a situation where you make an initial request and the
663
+ # request times out. If you make the request again with the same request
664
+ # ID, the server can check if original operation with the same request ID
665
+ # was received, and if so, will ignore the second request. This prevents
666
+ # clients from accidentally creating duplicate commitments.
667
+ #
668
+ # The request ID must be a valid UUID with the exception that zero UUID is
669
+ # not supported (00000000-0000-0000-0000-000000000000).
670
+ # @yield [result, operation] Access the result along with the TransportOperation object
671
+ # @yieldparam result [::Gapic::Operation]
672
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
673
+ #
674
+ # @return [::Gapic::Operation]
675
+ #
676
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
677
+ #
678
+ # @example Basic example
679
+ # require "google/cloud/license_manager/v1"
680
+ #
681
+ # # Create a client object. The client can be reused for multiple calls.
682
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
683
+ #
684
+ # # Create a request. To set request fields, pass in keyword arguments.
685
+ # request = Google::Cloud::LicenseManager::V1::DeleteConfigurationRequest.new
686
+ #
687
+ # # Call the delete_configuration method.
688
+ # result = client.delete_configuration request
689
+ #
690
+ # # The returned object is of type Gapic::Operation. You can use it to
691
+ # # check the status of an operation, cancel it, or wait for results.
692
+ # # Here is how to wait for a response.
693
+ # result.wait_until_done! timeout: 60
694
+ # if result.response?
695
+ # p result.response
696
+ # else
697
+ # puts "No response received."
698
+ # end
699
+ #
700
+ def delete_configuration request, options = nil
701
+ raise ::ArgumentError, "request must be provided" if request.nil?
702
+
703
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::DeleteConfigurationRequest
704
+
705
+ # Converts hash and nil to an options object
706
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
707
+
708
+ # Customize the options with defaults
709
+ call_metadata = @config.rpcs.delete_configuration.metadata.to_h
710
+
711
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
712
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
713
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
714
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
715
+ transports_version_send: [:rest]
716
+
717
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
718
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
719
+
720
+ options.apply_defaults timeout: @config.rpcs.delete_configuration.timeout,
721
+ metadata: call_metadata,
722
+ retry_policy: @config.rpcs.delete_configuration.retry_policy
723
+
724
+ options.apply_defaults timeout: @config.timeout,
725
+ metadata: @config.metadata,
726
+ retry_policy: @config.retry_policy
727
+
728
+ @license_manager_stub.delete_configuration request, options do |result, operation|
729
+ result = ::Gapic::Operation.new result, @operations_client, options: options
730
+ yield result, operation if block_given?
731
+ throw :response, result
732
+ end
733
+ rescue ::Gapic::Rest::Error => e
734
+ raise ::Google::Cloud::Error.from_error(e)
735
+ end
736
+
737
+ ##
738
+ # Lists Instances in a given project and location.
739
+ #
740
+ # @overload list_instances(request, options = nil)
741
+ # Pass arguments to `list_instances` via a request object, either of type
742
+ # {::Google::Cloud::LicenseManager::V1::ListInstancesRequest} or an equivalent Hash.
743
+ #
744
+ # @param request [::Google::Cloud::LicenseManager::V1::ListInstancesRequest, ::Hash]
745
+ # A request object representing the call parameters. Required. To specify no
746
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
747
+ # @param options [::Gapic::CallOptions, ::Hash]
748
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
749
+ #
750
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
751
+ # Pass arguments to `list_instances` via keyword arguments. Note that at
752
+ # least one keyword argument is required. To specify no parameters, or to keep all
753
+ # the default parameter values, pass an empty Hash as a request object (see above).
754
+ #
755
+ # @param parent [::String]
756
+ # Required. Parent value for ListInstancesRequest
757
+ # @param page_size [::Integer]
758
+ # Optional. Requested page size. Server may return fewer items than
759
+ # requested. If unspecified, server will pick an appropriate default.
760
+ # @param page_token [::String]
761
+ # Optional. A token identifying a page of results the server should return.
762
+ # @param filter [::String]
763
+ # Optional. Filtering results
764
+ # @param order_by [::String]
765
+ # Optional. Hint for how to order the results
766
+ # @yield [result, operation] Access the result along with the TransportOperation object
767
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::LicenseManager::V1::Instance>]
768
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
769
+ #
770
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::LicenseManager::V1::Instance>]
771
+ #
772
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
773
+ #
774
+ # @example Basic example
775
+ # require "google/cloud/license_manager/v1"
776
+ #
777
+ # # Create a client object. The client can be reused for multiple calls.
778
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
779
+ #
780
+ # # Create a request. To set request fields, pass in keyword arguments.
781
+ # request = Google::Cloud::LicenseManager::V1::ListInstancesRequest.new
782
+ #
783
+ # # Call the list_instances method.
784
+ # result = client.list_instances request
785
+ #
786
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
787
+ # # over elements, and API calls will be issued to fetch pages as needed.
788
+ # result.each do |item|
789
+ # # Each element is of type ::Google::Cloud::LicenseManager::V1::Instance.
790
+ # p item
791
+ # end
792
+ #
793
+ def list_instances request, options = nil
794
+ raise ::ArgumentError, "request must be provided" if request.nil?
795
+
796
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::ListInstancesRequest
797
+
798
+ # Converts hash and nil to an options object
799
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
800
+
801
+ # Customize the options with defaults
802
+ call_metadata = @config.rpcs.list_instances.metadata.to_h
803
+
804
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
805
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
806
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
807
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
808
+ transports_version_send: [:rest]
809
+
810
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
811
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
812
+
813
+ options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
814
+ metadata: call_metadata,
815
+ retry_policy: @config.rpcs.list_instances.retry_policy
816
+
817
+ options.apply_defaults timeout: @config.timeout,
818
+ metadata: @config.metadata,
819
+ retry_policy: @config.retry_policy
820
+
821
+ @license_manager_stub.list_instances request, options do |result, operation|
822
+ result = ::Gapic::Rest::PagedEnumerable.new @license_manager_stub, :list_instances, "instances", request, result, options
823
+ yield result, operation if block_given?
824
+ throw :response, result
825
+ end
826
+ rescue ::Gapic::Rest::Error => e
827
+ raise ::Google::Cloud::Error.from_error(e)
828
+ end
829
+
830
+ ##
831
+ # Gets details of a single Instance.
832
+ #
833
+ # @overload get_instance(request, options = nil)
834
+ # Pass arguments to `get_instance` via a request object, either of type
835
+ # {::Google::Cloud::LicenseManager::V1::GetInstanceRequest} or an equivalent Hash.
836
+ #
837
+ # @param request [::Google::Cloud::LicenseManager::V1::GetInstanceRequest, ::Hash]
838
+ # A request object representing the call parameters. Required. To specify no
839
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
840
+ # @param options [::Gapic::CallOptions, ::Hash]
841
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
842
+ #
843
+ # @overload get_instance(name: nil)
844
+ # Pass arguments to `get_instance` via keyword arguments. Note that at
845
+ # least one keyword argument is required. To specify no parameters, or to keep all
846
+ # the default parameter values, pass an empty Hash as a request object (see above).
847
+ #
848
+ # @param name [::String]
849
+ # Required. Name of the resource
850
+ # @yield [result, operation] Access the result along with the TransportOperation object
851
+ # @yieldparam result [::Google::Cloud::LicenseManager::V1::Instance]
852
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
853
+ #
854
+ # @return [::Google::Cloud::LicenseManager::V1::Instance]
855
+ #
856
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
857
+ #
858
+ # @example Basic example
859
+ # require "google/cloud/license_manager/v1"
860
+ #
861
+ # # Create a client object. The client can be reused for multiple calls.
862
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
863
+ #
864
+ # # Create a request. To set request fields, pass in keyword arguments.
865
+ # request = Google::Cloud::LicenseManager::V1::GetInstanceRequest.new
866
+ #
867
+ # # Call the get_instance method.
868
+ # result = client.get_instance request
869
+ #
870
+ # # The returned object is of type Google::Cloud::LicenseManager::V1::Instance.
871
+ # p result
872
+ #
873
+ def get_instance request, options = nil
874
+ raise ::ArgumentError, "request must be provided" if request.nil?
875
+
876
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::GetInstanceRequest
877
+
878
+ # Converts hash and nil to an options object
879
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
880
+
881
+ # Customize the options with defaults
882
+ call_metadata = @config.rpcs.get_instance.metadata.to_h
883
+
884
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
885
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
886
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
887
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
888
+ transports_version_send: [:rest]
889
+
890
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
891
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
892
+
893
+ options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
894
+ metadata: call_metadata,
895
+ retry_policy: @config.rpcs.get_instance.retry_policy
896
+
897
+ options.apply_defaults timeout: @config.timeout,
898
+ metadata: @config.metadata,
899
+ retry_policy: @config.retry_policy
900
+
901
+ @license_manager_stub.get_instance request, options do |result, operation|
902
+ yield result, operation if block_given?
903
+ end
904
+ rescue ::Gapic::Rest::Error => e
905
+ raise ::Google::Cloud::Error.from_error(e)
906
+ end
907
+
908
+ ##
909
+ # Deactivates the given configuration.
910
+ #
911
+ # @overload deactivate_configuration(request, options = nil)
912
+ # Pass arguments to `deactivate_configuration` via a request object, either of type
913
+ # {::Google::Cloud::LicenseManager::V1::DeactivateConfigurationRequest} or an equivalent Hash.
914
+ #
915
+ # @param request [::Google::Cloud::LicenseManager::V1::DeactivateConfigurationRequest, ::Hash]
916
+ # A request object representing the call parameters. Required. To specify no
917
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
918
+ # @param options [::Gapic::CallOptions, ::Hash]
919
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
920
+ #
921
+ # @overload deactivate_configuration(name: nil, request_id: nil)
922
+ # Pass arguments to `deactivate_configuration` via keyword arguments. Note that at
923
+ # least one keyword argument is required. To specify no parameters, or to keep all
924
+ # the default parameter values, pass an empty Hash as a request object (see above).
925
+ #
926
+ # @param name [::String]
927
+ # Required. Name of the resource.
928
+ # @param request_id [::String]
929
+ # Optional. An optional request ID to identify requests. Specify a unique
930
+ # request ID so that if you must retry your request, the server will know to
931
+ # ignore the request if it has already been completed. The server will
932
+ # guarantee that for at least 60 minutes after the first request.
933
+ #
934
+ # For example, consider a situation where you make an initial request and
935
+ # the request times out. If you make the request again with the same request
936
+ # ID, the server can check if original operation with the same request ID
937
+ # was received, and if so, will ignore the second request. This prevents
938
+ # clients from accidentally creating duplicate commitments.
939
+ #
940
+ # The request ID must be a valid UUID with the exception that zero UUID is
941
+ # not supported (00000000-0000-0000-0000-000000000000).
942
+ # @yield [result, operation] Access the result along with the TransportOperation object
943
+ # @yieldparam result [::Gapic::Operation]
944
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
945
+ #
946
+ # @return [::Gapic::Operation]
947
+ #
948
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
949
+ #
950
+ # @example Basic example
951
+ # require "google/cloud/license_manager/v1"
952
+ #
953
+ # # Create a client object. The client can be reused for multiple calls.
954
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
955
+ #
956
+ # # Create a request. To set request fields, pass in keyword arguments.
957
+ # request = Google::Cloud::LicenseManager::V1::DeactivateConfigurationRequest.new
958
+ #
959
+ # # Call the deactivate_configuration method.
960
+ # result = client.deactivate_configuration request
961
+ #
962
+ # # The returned object is of type Gapic::Operation. You can use it to
963
+ # # check the status of an operation, cancel it, or wait for results.
964
+ # # Here is how to wait for a response.
965
+ # result.wait_until_done! timeout: 60
966
+ # if result.response?
967
+ # p result.response
968
+ # else
969
+ # puts "No response received."
970
+ # end
971
+ #
972
+ def deactivate_configuration request, options = nil
973
+ raise ::ArgumentError, "request must be provided" if request.nil?
974
+
975
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::DeactivateConfigurationRequest
976
+
977
+ # Converts hash and nil to an options object
978
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
979
+
980
+ # Customize the options with defaults
981
+ call_metadata = @config.rpcs.deactivate_configuration.metadata.to_h
982
+
983
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
984
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
985
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
986
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
987
+ transports_version_send: [:rest]
988
+
989
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
990
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
991
+
992
+ options.apply_defaults timeout: @config.rpcs.deactivate_configuration.timeout,
993
+ metadata: call_metadata,
994
+ retry_policy: @config.rpcs.deactivate_configuration.retry_policy
995
+
996
+ options.apply_defaults timeout: @config.timeout,
997
+ metadata: @config.metadata,
998
+ retry_policy: @config.retry_policy
999
+
1000
+ @license_manager_stub.deactivate_configuration request, options do |result, operation|
1001
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1002
+ yield result, operation if block_given?
1003
+ throw :response, result
1004
+ end
1005
+ rescue ::Gapic::Rest::Error => e
1006
+ raise ::Google::Cloud::Error.from_error(e)
1007
+ end
1008
+
1009
+ ##
1010
+ # Reactivates the given configuration.
1011
+ #
1012
+ # @overload reactivate_configuration(request, options = nil)
1013
+ # Pass arguments to `reactivate_configuration` via a request object, either of type
1014
+ # {::Google::Cloud::LicenseManager::V1::ReactivateConfigurationRequest} or an equivalent Hash.
1015
+ #
1016
+ # @param request [::Google::Cloud::LicenseManager::V1::ReactivateConfigurationRequest, ::Hash]
1017
+ # A request object representing the call parameters. Required. To specify no
1018
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1019
+ # @param options [::Gapic::CallOptions, ::Hash]
1020
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1021
+ #
1022
+ # @overload reactivate_configuration(name: nil, request_id: nil)
1023
+ # Pass arguments to `reactivate_configuration` via keyword arguments. Note that at
1024
+ # least one keyword argument is required. To specify no parameters, or to keep all
1025
+ # the default parameter values, pass an empty Hash as a request object (see above).
1026
+ #
1027
+ # @param name [::String]
1028
+ # Required. Name of the resource.
1029
+ # @param request_id [::String]
1030
+ # Optional. An optional request ID to identify requests. Specify a unique
1031
+ # request ID so that if you must retry your request, the server will know to
1032
+ # ignore the request if it has already been completed. The server will
1033
+ # guarantee that for at least 60 minutes after the first request.
1034
+ #
1035
+ # For example, consider a situation where you make an initial request and
1036
+ # the request times out. If you make the request again with the same request
1037
+ # ID, the server can check if original operation with the same request ID
1038
+ # was received, and if so, will ignore the second request. This prevents
1039
+ # clients from accidentally creating duplicate commitments.
1040
+ #
1041
+ # The request ID must be a valid UUID with the exception that zero UUID is
1042
+ # not supported (00000000-0000-0000-0000-000000000000).
1043
+ # @yield [result, operation] Access the result along with the TransportOperation object
1044
+ # @yieldparam result [::Gapic::Operation]
1045
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1046
+ #
1047
+ # @return [::Gapic::Operation]
1048
+ #
1049
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1050
+ #
1051
+ # @example Basic example
1052
+ # require "google/cloud/license_manager/v1"
1053
+ #
1054
+ # # Create a client object. The client can be reused for multiple calls.
1055
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
1056
+ #
1057
+ # # Create a request. To set request fields, pass in keyword arguments.
1058
+ # request = Google::Cloud::LicenseManager::V1::ReactivateConfigurationRequest.new
1059
+ #
1060
+ # # Call the reactivate_configuration method.
1061
+ # result = client.reactivate_configuration request
1062
+ #
1063
+ # # The returned object is of type Gapic::Operation. You can use it to
1064
+ # # check the status of an operation, cancel it, or wait for results.
1065
+ # # Here is how to wait for a response.
1066
+ # result.wait_until_done! timeout: 60
1067
+ # if result.response?
1068
+ # p result.response
1069
+ # else
1070
+ # puts "No response received."
1071
+ # end
1072
+ #
1073
+ def reactivate_configuration request, options = nil
1074
+ raise ::ArgumentError, "request must be provided" if request.nil?
1075
+
1076
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::ReactivateConfigurationRequest
1077
+
1078
+ # Converts hash and nil to an options object
1079
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1080
+
1081
+ # Customize the options with defaults
1082
+ call_metadata = @config.rpcs.reactivate_configuration.metadata.to_h
1083
+
1084
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1085
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1086
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1087
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
1088
+ transports_version_send: [:rest]
1089
+
1090
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1091
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1092
+
1093
+ options.apply_defaults timeout: @config.rpcs.reactivate_configuration.timeout,
1094
+ metadata: call_metadata,
1095
+ retry_policy: @config.rpcs.reactivate_configuration.retry_policy
1096
+
1097
+ options.apply_defaults timeout: @config.timeout,
1098
+ metadata: @config.metadata,
1099
+ retry_policy: @config.retry_policy
1100
+
1101
+ @license_manager_stub.reactivate_configuration request, options do |result, operation|
1102
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1103
+ yield result, operation if block_given?
1104
+ throw :response, result
1105
+ end
1106
+ rescue ::Gapic::Rest::Error => e
1107
+ raise ::Google::Cloud::Error.from_error(e)
1108
+ end
1109
+
1110
+ ##
1111
+ # License Usage information for a Configuration.
1112
+ #
1113
+ # @overload query_configuration_license_usage(request, options = nil)
1114
+ # Pass arguments to `query_configuration_license_usage` via a request object, either of type
1115
+ # {::Google::Cloud::LicenseManager::V1::QueryConfigurationLicenseUsageRequest} or an equivalent Hash.
1116
+ #
1117
+ # @param request [::Google::Cloud::LicenseManager::V1::QueryConfigurationLicenseUsageRequest, ::Hash]
1118
+ # A request object representing the call parameters. Required. To specify no
1119
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1120
+ # @param options [::Gapic::CallOptions, ::Hash]
1121
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1122
+ #
1123
+ # @overload query_configuration_license_usage(name: nil, start_time: nil, end_time: nil)
1124
+ # Pass arguments to `query_configuration_license_usage` via keyword arguments. Note that at
1125
+ # least one keyword argument is required. To specify no parameters, or to keep all
1126
+ # the default parameter values, pass an empty Hash as a request object (see above).
1127
+ #
1128
+ # @param name [::String]
1129
+ # Required. The resource path of the Configuration.
1130
+ # @param start_time [::Google::Protobuf::Timestamp, ::Hash]
1131
+ # Required. The start time for retrieving the usage. If not specified, we
1132
+ # will use the first day of the current billing period.
1133
+ # @param end_time [::Google::Protobuf::Timestamp, ::Hash]
1134
+ # Required. The end time for retrieving the usage. If not specified, we will
1135
+ # use the last day of the current billing period.
1136
+ # @yield [result, operation] Access the result along with the TransportOperation object
1137
+ # @yieldparam result [::Google::Cloud::LicenseManager::V1::QueryConfigurationLicenseUsageResponse]
1138
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1139
+ #
1140
+ # @return [::Google::Cloud::LicenseManager::V1::QueryConfigurationLicenseUsageResponse]
1141
+ #
1142
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1143
+ #
1144
+ # @example Basic example
1145
+ # require "google/cloud/license_manager/v1"
1146
+ #
1147
+ # # Create a client object. The client can be reused for multiple calls.
1148
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
1149
+ #
1150
+ # # Create a request. To set request fields, pass in keyword arguments.
1151
+ # request = Google::Cloud::LicenseManager::V1::QueryConfigurationLicenseUsageRequest.new
1152
+ #
1153
+ # # Call the query_configuration_license_usage method.
1154
+ # result = client.query_configuration_license_usage request
1155
+ #
1156
+ # # The returned object is of type Google::Cloud::LicenseManager::V1::QueryConfigurationLicenseUsageResponse.
1157
+ # p result
1158
+ #
1159
+ def query_configuration_license_usage request, options = nil
1160
+ raise ::ArgumentError, "request must be provided" if request.nil?
1161
+
1162
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::QueryConfigurationLicenseUsageRequest
1163
+
1164
+ # Converts hash and nil to an options object
1165
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1166
+
1167
+ # Customize the options with defaults
1168
+ call_metadata = @config.rpcs.query_configuration_license_usage.metadata.to_h
1169
+
1170
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1171
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1172
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1173
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
1174
+ transports_version_send: [:rest]
1175
+
1176
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1177
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1178
+
1179
+ options.apply_defaults timeout: @config.rpcs.query_configuration_license_usage.timeout,
1180
+ metadata: call_metadata,
1181
+ retry_policy: @config.rpcs.query_configuration_license_usage.retry_policy
1182
+
1183
+ options.apply_defaults timeout: @config.timeout,
1184
+ metadata: @config.metadata,
1185
+ retry_policy: @config.retry_policy
1186
+
1187
+ @license_manager_stub.query_configuration_license_usage request, options do |result, operation|
1188
+ yield result, operation if block_given?
1189
+ end
1190
+ rescue ::Gapic::Rest::Error => e
1191
+ raise ::Google::Cloud::Error.from_error(e)
1192
+ end
1193
+
1194
+ ##
1195
+ # Aggregates Usage per Instance for a Configuration.
1196
+ #
1197
+ # @overload aggregate_usage(request, options = nil)
1198
+ # Pass arguments to `aggregate_usage` via a request object, either of type
1199
+ # {::Google::Cloud::LicenseManager::V1::AggregateUsageRequest} or an equivalent Hash.
1200
+ #
1201
+ # @param request [::Google::Cloud::LicenseManager::V1::AggregateUsageRequest, ::Hash]
1202
+ # A request object representing the call parameters. Required. To specify no
1203
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1204
+ # @param options [::Gapic::CallOptions, ::Hash]
1205
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1206
+ #
1207
+ # @overload aggregate_usage(name: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, start_time: nil, end_time: nil)
1208
+ # Pass arguments to `aggregate_usage` via keyword arguments. Note that at
1209
+ # least one keyword argument is required. To specify no parameters, or to keep all
1210
+ # the default parameter values, pass an empty Hash as a request object (see above).
1211
+ #
1212
+ # @param name [::String]
1213
+ # Required. Parent value for AggregateUsageRequest
1214
+ # @param page_size [::Integer]
1215
+ # Optional. Requested page size. Server may return fewer items than
1216
+ # requested. If unspecified, server will pick an appropriate default.
1217
+ # @param page_token [::String]
1218
+ # Optional. A token identifying a page of results the server should return.
1219
+ # @param filter [::String]
1220
+ # Optional. Filtering results
1221
+ # @param order_by [::String]
1222
+ # Optional. Hint for how to order the results
1223
+ # @param start_time [::Google::Protobuf::Timestamp, ::Hash]
1224
+ # Required. Licenses are purchased per month - so usage track needs start
1225
+ # time of a month.
1226
+ # @param end_time [::Google::Protobuf::Timestamp, ::Hash]
1227
+ # Required. Usage track is always for a month. This parameter is for the end
1228
+ # time of the month.
1229
+ # @yield [result, operation] Access the result along with the TransportOperation object
1230
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::LicenseManager::V1::Usage>]
1231
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1232
+ #
1233
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::LicenseManager::V1::Usage>]
1234
+ #
1235
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1236
+ #
1237
+ # @example Basic example
1238
+ # require "google/cloud/license_manager/v1"
1239
+ #
1240
+ # # Create a client object. The client can be reused for multiple calls.
1241
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
1242
+ #
1243
+ # # Create a request. To set request fields, pass in keyword arguments.
1244
+ # request = Google::Cloud::LicenseManager::V1::AggregateUsageRequest.new
1245
+ #
1246
+ # # Call the aggregate_usage method.
1247
+ # result = client.aggregate_usage request
1248
+ #
1249
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1250
+ # # over elements, and API calls will be issued to fetch pages as needed.
1251
+ # result.each do |item|
1252
+ # # Each element is of type ::Google::Cloud::LicenseManager::V1::Usage.
1253
+ # p item
1254
+ # end
1255
+ #
1256
+ def aggregate_usage request, options = nil
1257
+ raise ::ArgumentError, "request must be provided" if request.nil?
1258
+
1259
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::AggregateUsageRequest
1260
+
1261
+ # Converts hash and nil to an options object
1262
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1263
+
1264
+ # Customize the options with defaults
1265
+ call_metadata = @config.rpcs.aggregate_usage.metadata.to_h
1266
+
1267
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1268
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1269
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1270
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
1271
+ transports_version_send: [:rest]
1272
+
1273
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1274
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1275
+
1276
+ options.apply_defaults timeout: @config.rpcs.aggregate_usage.timeout,
1277
+ metadata: call_metadata,
1278
+ retry_policy: @config.rpcs.aggregate_usage.retry_policy
1279
+
1280
+ options.apply_defaults timeout: @config.timeout,
1281
+ metadata: @config.metadata,
1282
+ retry_policy: @config.retry_policy
1283
+
1284
+ @license_manager_stub.aggregate_usage request, options do |result, operation|
1285
+ result = ::Gapic::Rest::PagedEnumerable.new @license_manager_stub, :aggregate_usage, "usages", request, result, options
1286
+ yield result, operation if block_given?
1287
+ throw :response, result
1288
+ end
1289
+ rescue ::Gapic::Rest::Error => e
1290
+ raise ::Google::Cloud::Error.from_error(e)
1291
+ end
1292
+
1293
+ ##
1294
+ # Lists Products in a given project and location.
1295
+ #
1296
+ # @overload list_products(request, options = nil)
1297
+ # Pass arguments to `list_products` via a request object, either of type
1298
+ # {::Google::Cloud::LicenseManager::V1::ListProductsRequest} or an equivalent Hash.
1299
+ #
1300
+ # @param request [::Google::Cloud::LicenseManager::V1::ListProductsRequest, ::Hash]
1301
+ # A request object representing the call parameters. Required. To specify no
1302
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1303
+ # @param options [::Gapic::CallOptions, ::Hash]
1304
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1305
+ #
1306
+ # @overload list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
1307
+ # Pass arguments to `list_products` via keyword arguments. Note that at
1308
+ # least one keyword argument is required. To specify no parameters, or to keep all
1309
+ # the default parameter values, pass an empty Hash as a request object (see above).
1310
+ #
1311
+ # @param parent [::String]
1312
+ # Required. Parent value for ListProductsRequest
1313
+ # @param page_size [::Integer]
1314
+ # Optional. Requested page size. Server may return fewer items than
1315
+ # requested. If unspecified, server will pick an appropriate default.
1316
+ # @param page_token [::String]
1317
+ # Optional. A token identifying a page of results the server should return.
1318
+ # @param filter [::String]
1319
+ # Optional. Filtering results
1320
+ # @param order_by [::String]
1321
+ # Optional. Hint for how to order the results
1322
+ # @yield [result, operation] Access the result along with the TransportOperation object
1323
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::LicenseManager::V1::Product>]
1324
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1325
+ #
1326
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::LicenseManager::V1::Product>]
1327
+ #
1328
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1329
+ #
1330
+ # @example Basic example
1331
+ # require "google/cloud/license_manager/v1"
1332
+ #
1333
+ # # Create a client object. The client can be reused for multiple calls.
1334
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
1335
+ #
1336
+ # # Create a request. To set request fields, pass in keyword arguments.
1337
+ # request = Google::Cloud::LicenseManager::V1::ListProductsRequest.new
1338
+ #
1339
+ # # Call the list_products method.
1340
+ # result = client.list_products request
1341
+ #
1342
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1343
+ # # over elements, and API calls will be issued to fetch pages as needed.
1344
+ # result.each do |item|
1345
+ # # Each element is of type ::Google::Cloud::LicenseManager::V1::Product.
1346
+ # p item
1347
+ # end
1348
+ #
1349
+ def list_products request, options = nil
1350
+ raise ::ArgumentError, "request must be provided" if request.nil?
1351
+
1352
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::ListProductsRequest
1353
+
1354
+ # Converts hash and nil to an options object
1355
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1356
+
1357
+ # Customize the options with defaults
1358
+ call_metadata = @config.rpcs.list_products.metadata.to_h
1359
+
1360
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1361
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1362
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1363
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
1364
+ transports_version_send: [:rest]
1365
+
1366
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1367
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1368
+
1369
+ options.apply_defaults timeout: @config.rpcs.list_products.timeout,
1370
+ metadata: call_metadata,
1371
+ retry_policy: @config.rpcs.list_products.retry_policy
1372
+
1373
+ options.apply_defaults timeout: @config.timeout,
1374
+ metadata: @config.metadata,
1375
+ retry_policy: @config.retry_policy
1376
+
1377
+ @license_manager_stub.list_products request, options do |result, operation|
1378
+ result = ::Gapic::Rest::PagedEnumerable.new @license_manager_stub, :list_products, "products", request, result, options
1379
+ yield result, operation if block_given?
1380
+ throw :response, result
1381
+ end
1382
+ rescue ::Gapic::Rest::Error => e
1383
+ raise ::Google::Cloud::Error.from_error(e)
1384
+ end
1385
+
1386
+ ##
1387
+ # Gets details of a single Product.
1388
+ #
1389
+ # @overload get_product(request, options = nil)
1390
+ # Pass arguments to `get_product` via a request object, either of type
1391
+ # {::Google::Cloud::LicenseManager::V1::GetProductRequest} or an equivalent Hash.
1392
+ #
1393
+ # @param request [::Google::Cloud::LicenseManager::V1::GetProductRequest, ::Hash]
1394
+ # A request object representing the call parameters. Required. To specify no
1395
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1396
+ # @param options [::Gapic::CallOptions, ::Hash]
1397
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1398
+ #
1399
+ # @overload get_product(name: nil)
1400
+ # Pass arguments to `get_product` via keyword arguments. Note that at
1401
+ # least one keyword argument is required. To specify no parameters, or to keep all
1402
+ # the default parameter values, pass an empty Hash as a request object (see above).
1403
+ #
1404
+ # @param name [::String]
1405
+ # Required. Name of the resource
1406
+ # @yield [result, operation] Access the result along with the TransportOperation object
1407
+ # @yieldparam result [::Google::Cloud::LicenseManager::V1::Product]
1408
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1409
+ #
1410
+ # @return [::Google::Cloud::LicenseManager::V1::Product]
1411
+ #
1412
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1413
+ #
1414
+ # @example Basic example
1415
+ # require "google/cloud/license_manager/v1"
1416
+ #
1417
+ # # Create a client object. The client can be reused for multiple calls.
1418
+ # client = Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new
1419
+ #
1420
+ # # Create a request. To set request fields, pass in keyword arguments.
1421
+ # request = Google::Cloud::LicenseManager::V1::GetProductRequest.new
1422
+ #
1423
+ # # Call the get_product method.
1424
+ # result = client.get_product request
1425
+ #
1426
+ # # The returned object is of type Google::Cloud::LicenseManager::V1::Product.
1427
+ # p result
1428
+ #
1429
+ def get_product request, options = nil
1430
+ raise ::ArgumentError, "request must be provided" if request.nil?
1431
+
1432
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::LicenseManager::V1::GetProductRequest
1433
+
1434
+ # Converts hash and nil to an options object
1435
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1436
+
1437
+ # Customize the options with defaults
1438
+ call_metadata = @config.rpcs.get_product.metadata.to_h
1439
+
1440
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1441
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1442
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1443
+ gapic_version: ::Google::Cloud::LicenseManager::V1::VERSION,
1444
+ transports_version_send: [:rest]
1445
+
1446
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1447
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1448
+
1449
+ options.apply_defaults timeout: @config.rpcs.get_product.timeout,
1450
+ metadata: call_metadata,
1451
+ retry_policy: @config.rpcs.get_product.retry_policy
1452
+
1453
+ options.apply_defaults timeout: @config.timeout,
1454
+ metadata: @config.metadata,
1455
+ retry_policy: @config.retry_policy
1456
+
1457
+ @license_manager_stub.get_product request, options do |result, operation|
1458
+ yield result, operation if block_given?
1459
+ end
1460
+ rescue ::Gapic::Rest::Error => e
1461
+ raise ::Google::Cloud::Error.from_error(e)
1462
+ end
1463
+
1464
+ ##
1465
+ # Configuration class for the LicenseManager REST API.
1466
+ #
1467
+ # This class represents the configuration for LicenseManager REST,
1468
+ # providing control over timeouts, retry behavior, logging, transport
1469
+ # parameters, and other low-level controls. Certain parameters can also be
1470
+ # applied individually to specific RPCs. See
1471
+ # {::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client::Configuration::Rpcs}
1472
+ # for a list of RPCs that can be configured independently.
1473
+ #
1474
+ # Configuration can be applied globally to all clients, or to a single client
1475
+ # on construction.
1476
+ #
1477
+ # @example
1478
+ #
1479
+ # # Modify the global config, setting the timeout for
1480
+ # # list_configurations to 20 seconds,
1481
+ # # and all remaining timeouts to 10 seconds.
1482
+ # ::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.configure do |config|
1483
+ # config.timeout = 10.0
1484
+ # config.rpcs.list_configurations.timeout = 20.0
1485
+ # end
1486
+ #
1487
+ # # Apply the above configuration only to a new client.
1488
+ # client = ::Google::Cloud::LicenseManager::V1::LicenseManager::Rest::Client.new do |config|
1489
+ # config.timeout = 10.0
1490
+ # config.rpcs.list_configurations.timeout = 20.0
1491
+ # end
1492
+ #
1493
+ # @!attribute [rw] endpoint
1494
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1495
+ # nil, indicating to use the default endpoint in the current universe domain.
1496
+ # @return [::String,nil]
1497
+ # @!attribute [rw] credentials
1498
+ # Credentials to send with calls. You may provide any of the following types:
1499
+ # * (`String`) The path to a service account key file in JSON format
1500
+ # * (`Hash`) A service account key as a Hash
1501
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1502
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1503
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1504
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1505
+ # * (`nil`) indicating no credentials
1506
+ #
1507
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1508
+ # external source for authentication to Google Cloud, you must validate it before
1509
+ # providing it to a Google API client library. Providing an unvalidated credential
1510
+ # configuration to Google APIs can compromise the security of your systems and data.
1511
+ # For more information, refer to [Validate credential configurations from external
1512
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1513
+ # @return [::Object]
1514
+ # @!attribute [rw] scope
1515
+ # The OAuth scopes
1516
+ # @return [::Array<::String>]
1517
+ # @!attribute [rw] lib_name
1518
+ # The library name as recorded in instrumentation and logging
1519
+ # @return [::String]
1520
+ # @!attribute [rw] lib_version
1521
+ # The library version as recorded in instrumentation and logging
1522
+ # @return [::String]
1523
+ # @!attribute [rw] timeout
1524
+ # The call timeout in seconds.
1525
+ # @return [::Numeric]
1526
+ # @!attribute [rw] metadata
1527
+ # Additional headers to be sent with the call.
1528
+ # @return [::Hash{::Symbol=>::String}]
1529
+ # @!attribute [rw] retry_policy
1530
+ # The retry policy. The value is a hash with the following keys:
1531
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1532
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1533
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1534
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1535
+ # trigger a retry.
1536
+ # @return [::Hash]
1537
+ # @!attribute [rw] quota_project
1538
+ # A separate project against which to charge quota.
1539
+ # @return [::String]
1540
+ # @!attribute [rw] universe_domain
1541
+ # The universe domain within which to make requests. This determines the
1542
+ # default endpoint URL. The default value of nil uses the environment
1543
+ # universe (usually the default "googleapis.com" universe).
1544
+ # @return [::String,nil]
1545
+ # @!attribute [rw] logger
1546
+ # A custom logger to use for request/response debug logging, or the value
1547
+ # `:default` (the default) to construct a default logger, or `nil` to
1548
+ # explicitly disable logging.
1549
+ # @return [::Logger,:default,nil]
1550
+ #
1551
+ class Configuration
1552
+ extend ::Gapic::Config
1553
+
1554
+ # @private
1555
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1556
+ DEFAULT_ENDPOINT = "licensemanager.googleapis.com"
1557
+
1558
+ config_attr :endpoint, nil, ::String, nil
1559
+ config_attr :credentials, nil do |value|
1560
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1561
+ allowed.any? { |klass| klass === value }
1562
+ end
1563
+ config_attr :scope, nil, ::String, ::Array, nil
1564
+ config_attr :lib_name, nil, ::String, nil
1565
+ config_attr :lib_version, nil, ::String, nil
1566
+ config_attr :timeout, nil, ::Numeric, nil
1567
+ config_attr :metadata, nil, ::Hash, nil
1568
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1569
+ config_attr :quota_project, nil, ::String, nil
1570
+ config_attr :universe_domain, nil, ::String, nil
1571
+
1572
+ # @private
1573
+ # Overrides for http bindings for the RPCs of this service
1574
+ # are only used when this service is used as mixin, and only
1575
+ # by the host service.
1576
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1577
+ config_attr :bindings_override, {}, ::Hash, nil
1578
+ config_attr :logger, :default, ::Logger, nil, :default
1579
+
1580
+ # @private
1581
+ def initialize parent_config = nil
1582
+ @parent_config = parent_config unless parent_config.nil?
1583
+
1584
+ yield self if block_given?
1585
+ end
1586
+
1587
+ ##
1588
+ # Configurations for individual RPCs
1589
+ # @return [Rpcs]
1590
+ #
1591
+ def rpcs
1592
+ @rpcs ||= begin
1593
+ parent_rpcs = nil
1594
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1595
+ Rpcs.new parent_rpcs
1596
+ end
1597
+ end
1598
+
1599
+ ##
1600
+ # Configuration RPC class for the LicenseManager API.
1601
+ #
1602
+ # Includes fields providing the configuration for each RPC in this service.
1603
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1604
+ # the following configuration fields:
1605
+ #
1606
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1607
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1608
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1609
+ # include the following keys:
1610
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1611
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1612
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1613
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1614
+ # trigger a retry.
1615
+ #
1616
+ class Rpcs
1617
+ ##
1618
+ # RPC-specific configuration for `list_configurations`
1619
+ # @return [::Gapic::Config::Method]
1620
+ #
1621
+ attr_reader :list_configurations
1622
+ ##
1623
+ # RPC-specific configuration for `get_configuration`
1624
+ # @return [::Gapic::Config::Method]
1625
+ #
1626
+ attr_reader :get_configuration
1627
+ ##
1628
+ # RPC-specific configuration for `create_configuration`
1629
+ # @return [::Gapic::Config::Method]
1630
+ #
1631
+ attr_reader :create_configuration
1632
+ ##
1633
+ # RPC-specific configuration for `update_configuration`
1634
+ # @return [::Gapic::Config::Method]
1635
+ #
1636
+ attr_reader :update_configuration
1637
+ ##
1638
+ # RPC-specific configuration for `delete_configuration`
1639
+ # @return [::Gapic::Config::Method]
1640
+ #
1641
+ attr_reader :delete_configuration
1642
+ ##
1643
+ # RPC-specific configuration for `list_instances`
1644
+ # @return [::Gapic::Config::Method]
1645
+ #
1646
+ attr_reader :list_instances
1647
+ ##
1648
+ # RPC-specific configuration for `get_instance`
1649
+ # @return [::Gapic::Config::Method]
1650
+ #
1651
+ attr_reader :get_instance
1652
+ ##
1653
+ # RPC-specific configuration for `deactivate_configuration`
1654
+ # @return [::Gapic::Config::Method]
1655
+ #
1656
+ attr_reader :deactivate_configuration
1657
+ ##
1658
+ # RPC-specific configuration for `reactivate_configuration`
1659
+ # @return [::Gapic::Config::Method]
1660
+ #
1661
+ attr_reader :reactivate_configuration
1662
+ ##
1663
+ # RPC-specific configuration for `query_configuration_license_usage`
1664
+ # @return [::Gapic::Config::Method]
1665
+ #
1666
+ attr_reader :query_configuration_license_usage
1667
+ ##
1668
+ # RPC-specific configuration for `aggregate_usage`
1669
+ # @return [::Gapic::Config::Method]
1670
+ #
1671
+ attr_reader :aggregate_usage
1672
+ ##
1673
+ # RPC-specific configuration for `list_products`
1674
+ # @return [::Gapic::Config::Method]
1675
+ #
1676
+ attr_reader :list_products
1677
+ ##
1678
+ # RPC-specific configuration for `get_product`
1679
+ # @return [::Gapic::Config::Method]
1680
+ #
1681
+ attr_reader :get_product
1682
+
1683
+ # @private
1684
+ def initialize parent_rpcs = nil
1685
+ list_configurations_config = parent_rpcs.list_configurations if parent_rpcs.respond_to? :list_configurations
1686
+ @list_configurations = ::Gapic::Config::Method.new list_configurations_config
1687
+ get_configuration_config = parent_rpcs.get_configuration if parent_rpcs.respond_to? :get_configuration
1688
+ @get_configuration = ::Gapic::Config::Method.new get_configuration_config
1689
+ create_configuration_config = parent_rpcs.create_configuration if parent_rpcs.respond_to? :create_configuration
1690
+ @create_configuration = ::Gapic::Config::Method.new create_configuration_config
1691
+ update_configuration_config = parent_rpcs.update_configuration if parent_rpcs.respond_to? :update_configuration
1692
+ @update_configuration = ::Gapic::Config::Method.new update_configuration_config
1693
+ delete_configuration_config = parent_rpcs.delete_configuration if parent_rpcs.respond_to? :delete_configuration
1694
+ @delete_configuration = ::Gapic::Config::Method.new delete_configuration_config
1695
+ list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
1696
+ @list_instances = ::Gapic::Config::Method.new list_instances_config
1697
+ get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
1698
+ @get_instance = ::Gapic::Config::Method.new get_instance_config
1699
+ deactivate_configuration_config = parent_rpcs.deactivate_configuration if parent_rpcs.respond_to? :deactivate_configuration
1700
+ @deactivate_configuration = ::Gapic::Config::Method.new deactivate_configuration_config
1701
+ reactivate_configuration_config = parent_rpcs.reactivate_configuration if parent_rpcs.respond_to? :reactivate_configuration
1702
+ @reactivate_configuration = ::Gapic::Config::Method.new reactivate_configuration_config
1703
+ query_configuration_license_usage_config = parent_rpcs.query_configuration_license_usage if parent_rpcs.respond_to? :query_configuration_license_usage
1704
+ @query_configuration_license_usage = ::Gapic::Config::Method.new query_configuration_license_usage_config
1705
+ aggregate_usage_config = parent_rpcs.aggregate_usage if parent_rpcs.respond_to? :aggregate_usage
1706
+ @aggregate_usage = ::Gapic::Config::Method.new aggregate_usage_config
1707
+ list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
1708
+ @list_products = ::Gapic::Config::Method.new list_products_config
1709
+ get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
1710
+ @get_product = ::Gapic::Config::Method.new get_product_config
1711
+
1712
+ yield self if block_given?
1713
+ end
1714
+ end
1715
+ end
1716
+ end
1717
+ end
1718
+ end
1719
+ end
1720
+ end
1721
+ end
1722
+ end