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