google-cloud-commerce-consumer-procurement-v1 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +3 -3
  4. data/lib/google/cloud/commerce/consumer/procurement/v1/consumer_procurement_service/client.rb +224 -1
  5. data/lib/google/cloud/commerce/consumer/procurement/v1/consumer_procurement_service/rest/client.rb +210 -1
  6. data/lib/google/cloud/commerce/consumer/procurement/v1/consumer_procurement_service/rest/service_stub.rb +120 -0
  7. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/client.rb +825 -0
  8. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/credentials.rb +51 -0
  9. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/paths.rb +54 -0
  10. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/rest/client.rb +764 -0
  11. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/rest/service_stub.rb +371 -0
  12. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service/rest.rb +56 -0
  13. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service.rb +59 -0
  14. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service_pb.rb +69 -0
  15. data/lib/google/cloud/commerce/consumer/procurement/v1/license_management_service_services_pb.rb +57 -0
  16. data/lib/google/cloud/commerce/consumer/procurement/v1/procurement_service_pb.rb +8 -1
  17. data/lib/google/cloud/commerce/consumer/procurement/v1/procurement_service_services_pb.rb +7 -0
  18. data/lib/google/cloud/commerce/consumer/procurement/v1/rest.rb +2 -1
  19. data/lib/google/cloud/commerce/consumer/procurement/v1/version.rb +1 -1
  20. data/lib/google/cloud/commerce/consumer/procurement/v1.rb +3 -2
  21. data/proto_docs/google/cloud/commerce/consumer/procurement/v1/license_management_service.rb +196 -0
  22. data/proto_docs/google/cloud/commerce/consumer/procurement/v1/order.rb +14 -10
  23. data/proto_docs/google/cloud/commerce/consumer/procurement/v1/procurement_service.rb +115 -1
  24. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  25. metadata +14 -3
@@ -0,0 +1,825 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/commerce/consumer/procurement/v1/license_management_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Commerce
25
+ module Consumer
26
+ module Procurement
27
+ module V1
28
+ module LicenseManagementService
29
+ ##
30
+ # Client for the LicenseManagementService service.
31
+ #
32
+ # Service for managing licenses.
33
+ #
34
+ class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "cloudcommerceconsumerprocurement.$UNIVERSE_DOMAIN$"
40
+
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :license_management_service_stub
45
+
46
+ ##
47
+ # Configure the LicenseManagementService Client class.
48
+ #
49
+ # See {::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all LicenseManagementService clients
55
+ # ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Cloud", "Commerce", "Consumer", "Procurement", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config
76
+ end
77
+ yield @configure if block_given?
78
+ @configure
79
+ end
80
+
81
+ ##
82
+ # Configure the LicenseManagementService Client instance.
83
+ #
84
+ # The configuration is set to the derived mode, meaning that values can be changed,
85
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
86
+ # should be made on {Client.configure}.
87
+ #
88
+ # See {::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client::Configuration}
89
+ # for a description of the configuration fields.
90
+ #
91
+ # @yield [config] Configure the Client client.
92
+ # @yieldparam config [Client::Configuration]
93
+ #
94
+ # @return [Client::Configuration]
95
+ #
96
+ def configure
97
+ yield @config if block_given?
98
+ @config
99
+ end
100
+
101
+ ##
102
+ # The effective universe domain
103
+ #
104
+ # @return [String]
105
+ #
106
+ def universe_domain
107
+ @license_management_service_stub.universe_domain
108
+ end
109
+
110
+ ##
111
+ # Create a new LicenseManagementService client object.
112
+ #
113
+ # @example
114
+ #
115
+ # # Create a client using the default configuration
116
+ # client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
117
+ #
118
+ # # Create a client using a custom configuration
119
+ # client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new do |config|
120
+ # config.timeout = 10.0
121
+ # end
122
+ #
123
+ # @yield [config] Configure the LicenseManagementService client.
124
+ # @yieldparam config [Client::Configuration]
125
+ #
126
+ def initialize
127
+ # These require statements are intentionally placed here to initialize
128
+ # the gRPC module only when it's required.
129
+ # See https://github.com/googleapis/toolkit/issues/446
130
+ require "gapic/grpc"
131
+ require "google/cloud/commerce/consumer/procurement/v1/license_management_service_services_pb"
132
+
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ # Use self-signed JWT if the endpoint is unchanged from default,
142
+ # but only if the default endpoint does not have a region prefix.
143
+ enable_self_signed_jwt = @config.endpoint.nil? ||
144
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
145
+ !@config.endpoint.split(".").first.include?("-"))
146
+ credentials ||= Credentials.default scope: @config.scope,
147
+ enable_self_signed_jwt: enable_self_signed_jwt
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
149
+ credentials = Credentials.new credentials, scope: @config.scope
150
+ end
151
+ @quota_project_id = @config.quota_project
152
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
153
+
154
+ @license_management_service_stub = ::Gapic::ServiceStub.new(
155
+ ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Stub,
156
+ credentials: credentials,
157
+ endpoint: @config.endpoint,
158
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
+ universe_domain: @config.universe_domain,
160
+ channel_args: @config.channel_args,
161
+ interceptors: @config.interceptors,
162
+ channel_pool_config: @config.channel_pool
163
+ )
164
+ end
165
+
166
+ # Service calls
167
+
168
+ ##
169
+ # Gets the license pool.
170
+ #
171
+ # @overload get_license_pool(request, options = nil)
172
+ # Pass arguments to `get_license_pool` via a request object, either of type
173
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::GetLicensePoolRequest} or an equivalent Hash.
174
+ #
175
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::GetLicensePoolRequest, ::Hash]
176
+ # A request object representing the call parameters. Required. To specify no
177
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
178
+ # @param options [::Gapic::CallOptions, ::Hash]
179
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
180
+ #
181
+ # @overload get_license_pool(name: nil)
182
+ # Pass arguments to `get_license_pool` via keyword arguments. Note that at
183
+ # least one keyword argument is required. To specify no parameters, or to keep all
184
+ # the default parameter values, pass an empty Hash as a request object (see above).
185
+ #
186
+ # @param name [::String]
187
+ # Required. The name of the license pool to get.
188
+ # Format: `billingAccounts/{billing_account}/orders/{order}/licensePool`
189
+ #
190
+ # @yield [response, operation] Access the result along with the RPC operation
191
+ # @yieldparam response [::Google::Cloud::Commerce::Consumer::Procurement::V1::LicensePool]
192
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
193
+ #
194
+ # @return [::Google::Cloud::Commerce::Consumer::Procurement::V1::LicensePool]
195
+ #
196
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
197
+ #
198
+ # @example Basic example
199
+ # require "google/cloud/commerce/consumer/procurement/v1"
200
+ #
201
+ # # Create a client object. The client can be reused for multiple calls.
202
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
203
+ #
204
+ # # Create a request. To set request fields, pass in keyword arguments.
205
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::GetLicensePoolRequest.new
206
+ #
207
+ # # Call the get_license_pool method.
208
+ # result = client.get_license_pool request
209
+ #
210
+ # # The returned object is of type Google::Cloud::Commerce::Consumer::Procurement::V1::LicensePool.
211
+ # p result
212
+ #
213
+ def get_license_pool request, options = nil
214
+ raise ::ArgumentError, "request must be provided" if request.nil?
215
+
216
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::GetLicensePoolRequest
217
+
218
+ # Converts hash and nil to an options object
219
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
220
+
221
+ # Customize the options with defaults
222
+ metadata = @config.rpcs.get_license_pool.metadata.to_h
223
+
224
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
225
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
226
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
227
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION
228
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
229
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
230
+
231
+ header_params = {}
232
+ if request.name
233
+ header_params["name"] = request.name
234
+ end
235
+
236
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
237
+ metadata[:"x-goog-request-params"] ||= request_params_header
238
+
239
+ options.apply_defaults timeout: @config.rpcs.get_license_pool.timeout,
240
+ metadata: metadata,
241
+ retry_policy: @config.rpcs.get_license_pool.retry_policy
242
+
243
+ options.apply_defaults timeout: @config.timeout,
244
+ metadata: @config.metadata,
245
+ retry_policy: @config.retry_policy
246
+
247
+ @license_management_service_stub.call_rpc :get_license_pool, request, options: options do |response, operation|
248
+ yield response, operation if block_given?
249
+ return response
250
+ end
251
+ rescue ::GRPC::BadStatus => e
252
+ raise ::Google::Cloud::Error.from_error(e)
253
+ end
254
+
255
+ ##
256
+ # Updates the license pool if one exists for this Order.
257
+ #
258
+ # @overload update_license_pool(request, options = nil)
259
+ # Pass arguments to `update_license_pool` via a request object, either of type
260
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::UpdateLicensePoolRequest} or an equivalent Hash.
261
+ #
262
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::UpdateLicensePoolRequest, ::Hash]
263
+ # A request object representing the call parameters. Required. To specify no
264
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
265
+ # @param options [::Gapic::CallOptions, ::Hash]
266
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
267
+ #
268
+ # @overload update_license_pool(license_pool: nil, update_mask: nil)
269
+ # Pass arguments to `update_license_pool` via keyword arguments. Note that at
270
+ # least one keyword argument is required. To specify no parameters, or to keep all
271
+ # the default parameter values, pass an empty Hash as a request object (see above).
272
+ #
273
+ # @param license_pool [::Google::Cloud::Commerce::Consumer::Procurement::V1::LicensePool, ::Hash]
274
+ # Required. The license pool to update.
275
+ #
276
+ # The license pool's name field is used to identify the license pool to
277
+ # update. Format:
278
+ # `billingAccounts/{billing_account}/orders/{order}/licensePool`.
279
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
280
+ # Required. The list of fields to update.
281
+ #
282
+ # @yield [response, operation] Access the result along with the RPC operation
283
+ # @yieldparam response [::Google::Cloud::Commerce::Consumer::Procurement::V1::LicensePool]
284
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
285
+ #
286
+ # @return [::Google::Cloud::Commerce::Consumer::Procurement::V1::LicensePool]
287
+ #
288
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
+ #
290
+ # @example Basic example
291
+ # require "google/cloud/commerce/consumer/procurement/v1"
292
+ #
293
+ # # Create a client object. The client can be reused for multiple calls.
294
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
295
+ #
296
+ # # Create a request. To set request fields, pass in keyword arguments.
297
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::UpdateLicensePoolRequest.new
298
+ #
299
+ # # Call the update_license_pool method.
300
+ # result = client.update_license_pool request
301
+ #
302
+ # # The returned object is of type Google::Cloud::Commerce::Consumer::Procurement::V1::LicensePool.
303
+ # p result
304
+ #
305
+ def update_license_pool request, options = nil
306
+ raise ::ArgumentError, "request must be provided" if request.nil?
307
+
308
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::UpdateLicensePoolRequest
309
+
310
+ # Converts hash and nil to an options object
311
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
312
+
313
+ # Customize the options with defaults
314
+ metadata = @config.rpcs.update_license_pool.metadata.to_h
315
+
316
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
317
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
318
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
319
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION
320
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
321
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
322
+
323
+ header_params = {}
324
+ if request.license_pool&.name
325
+ header_params["license_pool.name"] = request.license_pool.name
326
+ end
327
+
328
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
329
+ metadata[:"x-goog-request-params"] ||= request_params_header
330
+
331
+ options.apply_defaults timeout: @config.rpcs.update_license_pool.timeout,
332
+ metadata: metadata,
333
+ retry_policy: @config.rpcs.update_license_pool.retry_policy
334
+
335
+ options.apply_defaults timeout: @config.timeout,
336
+ metadata: @config.metadata,
337
+ retry_policy: @config.retry_policy
338
+
339
+ @license_management_service_stub.call_rpc :update_license_pool, request, options: options do |response, operation|
340
+ yield response, operation if block_given?
341
+ return response
342
+ end
343
+ rescue ::GRPC::BadStatus => e
344
+ raise ::Google::Cloud::Error.from_error(e)
345
+ end
346
+
347
+ ##
348
+ # Assigns a license to a user.
349
+ #
350
+ # @overload assign(request, options = nil)
351
+ # Pass arguments to `assign` via a request object, either of type
352
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::AssignRequest} or an equivalent Hash.
353
+ #
354
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::AssignRequest, ::Hash]
355
+ # A request object representing the call parameters. Required. To specify no
356
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
357
+ # @param options [::Gapic::CallOptions, ::Hash]
358
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
359
+ #
360
+ # @overload assign(parent: nil, usernames: nil)
361
+ # Pass arguments to `assign` via keyword arguments. Note that at
362
+ # least one keyword argument is required. To specify no parameters, or to keep all
363
+ # the default parameter values, pass an empty Hash as a request object (see above).
364
+ #
365
+ # @param parent [::String]
366
+ # Required. License pool name.
367
+ # @param usernames [::Array<::String>]
368
+ # Required. Username.
369
+ # Format: `name@domain.com`.
370
+ #
371
+ # @yield [response, operation] Access the result along with the RPC operation
372
+ # @yieldparam response [::Google::Cloud::Commerce::Consumer::Procurement::V1::AssignResponse]
373
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
374
+ #
375
+ # @return [::Google::Cloud::Commerce::Consumer::Procurement::V1::AssignResponse]
376
+ #
377
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
378
+ #
379
+ # @example Basic example
380
+ # require "google/cloud/commerce/consumer/procurement/v1"
381
+ #
382
+ # # Create a client object. The client can be reused for multiple calls.
383
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
384
+ #
385
+ # # Create a request. To set request fields, pass in keyword arguments.
386
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::AssignRequest.new
387
+ #
388
+ # # Call the assign method.
389
+ # result = client.assign request
390
+ #
391
+ # # The returned object is of type Google::Cloud::Commerce::Consumer::Procurement::V1::AssignResponse.
392
+ # p result
393
+ #
394
+ def assign request, options = nil
395
+ raise ::ArgumentError, "request must be provided" if request.nil?
396
+
397
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::AssignRequest
398
+
399
+ # Converts hash and nil to an options object
400
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
401
+
402
+ # Customize the options with defaults
403
+ metadata = @config.rpcs.assign.metadata.to_h
404
+
405
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
406
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
407
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
408
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION
409
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
410
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
411
+
412
+ header_params = {}
413
+ if request.parent
414
+ header_params["parent"] = request.parent
415
+ end
416
+
417
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
418
+ metadata[:"x-goog-request-params"] ||= request_params_header
419
+
420
+ options.apply_defaults timeout: @config.rpcs.assign.timeout,
421
+ metadata: metadata,
422
+ retry_policy: @config.rpcs.assign.retry_policy
423
+
424
+ options.apply_defaults timeout: @config.timeout,
425
+ metadata: @config.metadata,
426
+ retry_policy: @config.retry_policy
427
+
428
+ @license_management_service_stub.call_rpc :assign, request, options: options do |response, operation|
429
+ yield response, operation if block_given?
430
+ return response
431
+ end
432
+ rescue ::GRPC::BadStatus => e
433
+ raise ::Google::Cloud::Error.from_error(e)
434
+ end
435
+
436
+ ##
437
+ # Unassigns a license from a user.
438
+ #
439
+ # @overload unassign(request, options = nil)
440
+ # Pass arguments to `unassign` via a request object, either of type
441
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::UnassignRequest} or an equivalent Hash.
442
+ #
443
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::UnassignRequest, ::Hash]
444
+ # A request object representing the call parameters. Required. To specify no
445
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
446
+ # @param options [::Gapic::CallOptions, ::Hash]
447
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
448
+ #
449
+ # @overload unassign(parent: nil, usernames: nil)
450
+ # Pass arguments to `unassign` via keyword arguments. Note that at
451
+ # least one keyword argument is required. To specify no parameters, or to keep all
452
+ # the default parameter values, pass an empty Hash as a request object (see above).
453
+ #
454
+ # @param parent [::String]
455
+ # Required. License pool name.
456
+ # @param usernames [::Array<::String>]
457
+ # Required. Username.
458
+ # Format: `name@domain.com`.
459
+ #
460
+ # @yield [response, operation] Access the result along with the RPC operation
461
+ # @yieldparam response [::Google::Cloud::Commerce::Consumer::Procurement::V1::UnassignResponse]
462
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
463
+ #
464
+ # @return [::Google::Cloud::Commerce::Consumer::Procurement::V1::UnassignResponse]
465
+ #
466
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
467
+ #
468
+ # @example Basic example
469
+ # require "google/cloud/commerce/consumer/procurement/v1"
470
+ #
471
+ # # Create a client object. The client can be reused for multiple calls.
472
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
473
+ #
474
+ # # Create a request. To set request fields, pass in keyword arguments.
475
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::UnassignRequest.new
476
+ #
477
+ # # Call the unassign method.
478
+ # result = client.unassign request
479
+ #
480
+ # # The returned object is of type Google::Cloud::Commerce::Consumer::Procurement::V1::UnassignResponse.
481
+ # p result
482
+ #
483
+ def unassign request, options = nil
484
+ raise ::ArgumentError, "request must be provided" if request.nil?
485
+
486
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::UnassignRequest
487
+
488
+ # Converts hash and nil to an options object
489
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
490
+
491
+ # Customize the options with defaults
492
+ metadata = @config.rpcs.unassign.metadata.to_h
493
+
494
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
495
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
496
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
497
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION
498
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
499
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
500
+
501
+ header_params = {}
502
+ if request.parent
503
+ header_params["parent"] = request.parent
504
+ end
505
+
506
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
507
+ metadata[:"x-goog-request-params"] ||= request_params_header
508
+
509
+ options.apply_defaults timeout: @config.rpcs.unassign.timeout,
510
+ metadata: metadata,
511
+ retry_policy: @config.rpcs.unassign.retry_policy
512
+
513
+ options.apply_defaults timeout: @config.timeout,
514
+ metadata: @config.metadata,
515
+ retry_policy: @config.retry_policy
516
+
517
+ @license_management_service_stub.call_rpc :unassign, request, options: options do |response, operation|
518
+ yield response, operation if block_given?
519
+ return response
520
+ end
521
+ rescue ::GRPC::BadStatus => e
522
+ raise ::Google::Cloud::Error.from_error(e)
523
+ end
524
+
525
+ ##
526
+ # Enumerates all users assigned a license.
527
+ #
528
+ # @overload enumerate_licensed_users(request, options = nil)
529
+ # Pass arguments to `enumerate_licensed_users` via a request object, either of type
530
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::EnumerateLicensedUsersRequest} or an equivalent Hash.
531
+ #
532
+ # @param request [::Google::Cloud::Commerce::Consumer::Procurement::V1::EnumerateLicensedUsersRequest, ::Hash]
533
+ # A request object representing the call parameters. Required. To specify no
534
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
535
+ # @param options [::Gapic::CallOptions, ::Hash]
536
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
537
+ #
538
+ # @overload enumerate_licensed_users(parent: nil, page_size: nil, page_token: nil)
539
+ # Pass arguments to `enumerate_licensed_users` via keyword arguments. Note that at
540
+ # least one keyword argument is required. To specify no parameters, or to keep all
541
+ # the default parameter values, pass an empty Hash as a request object (see above).
542
+ #
543
+ # @param parent [::String]
544
+ # Required. License pool name.
545
+ # @param page_size [::Integer]
546
+ # Optional. The maximum number of users to return. The service may return
547
+ # fewer than this value.
548
+ # @param page_token [::String]
549
+ # Optional. A page token, received from a previous `EnumerateLicensedUsers`
550
+ # call. Provide this to retrieve the subsequent page.
551
+ #
552
+ # @yield [response, operation] Access the result along with the RPC operation
553
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Commerce::Consumer::Procurement::V1::LicensedUser>]
554
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
555
+ #
556
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Commerce::Consumer::Procurement::V1::LicensedUser>]
557
+ #
558
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
559
+ #
560
+ # @example Basic example
561
+ # require "google/cloud/commerce/consumer/procurement/v1"
562
+ #
563
+ # # Create a client object. The client can be reused for multiple calls.
564
+ # client = Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new
565
+ #
566
+ # # Create a request. To set request fields, pass in keyword arguments.
567
+ # request = Google::Cloud::Commerce::Consumer::Procurement::V1::EnumerateLicensedUsersRequest.new
568
+ #
569
+ # # Call the enumerate_licensed_users method.
570
+ # result = client.enumerate_licensed_users request
571
+ #
572
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
573
+ # # over elements, and API calls will be issued to fetch pages as needed.
574
+ # result.each do |item|
575
+ # # Each element is of type ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicensedUser.
576
+ # p item
577
+ # end
578
+ #
579
+ def enumerate_licensed_users request, options = nil
580
+ raise ::ArgumentError, "request must be provided" if request.nil?
581
+
582
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Commerce::Consumer::Procurement::V1::EnumerateLicensedUsersRequest
583
+
584
+ # Converts hash and nil to an options object
585
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
586
+
587
+ # Customize the options with defaults
588
+ metadata = @config.rpcs.enumerate_licensed_users.metadata.to_h
589
+
590
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
591
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
592
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
593
+ gapic_version: ::Google::Cloud::Commerce::Consumer::Procurement::V1::VERSION
594
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
595
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
596
+
597
+ header_params = {}
598
+ if request.parent
599
+ header_params["parent"] = request.parent
600
+ end
601
+
602
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
603
+ metadata[:"x-goog-request-params"] ||= request_params_header
604
+
605
+ options.apply_defaults timeout: @config.rpcs.enumerate_licensed_users.timeout,
606
+ metadata: metadata,
607
+ retry_policy: @config.rpcs.enumerate_licensed_users.retry_policy
608
+
609
+ options.apply_defaults timeout: @config.timeout,
610
+ metadata: @config.metadata,
611
+ retry_policy: @config.retry_policy
612
+
613
+ @license_management_service_stub.call_rpc :enumerate_licensed_users, request, options: options do |response, operation|
614
+ response = ::Gapic::PagedEnumerable.new @license_management_service_stub, :enumerate_licensed_users, request, response, operation, options
615
+ yield response, operation if block_given?
616
+ return response
617
+ end
618
+ rescue ::GRPC::BadStatus => e
619
+ raise ::Google::Cloud::Error.from_error(e)
620
+ end
621
+
622
+ ##
623
+ # Configuration class for the LicenseManagementService API.
624
+ #
625
+ # This class represents the configuration for LicenseManagementService,
626
+ # providing control over timeouts, retry behavior, logging, transport
627
+ # parameters, and other low-level controls. Certain parameters can also be
628
+ # applied individually to specific RPCs. See
629
+ # {::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client::Configuration::Rpcs}
630
+ # for a list of RPCs that can be configured independently.
631
+ #
632
+ # Configuration can be applied globally to all clients, or to a single client
633
+ # on construction.
634
+ #
635
+ # @example
636
+ #
637
+ # # Modify the global config, setting the timeout for
638
+ # # get_license_pool to 20 seconds,
639
+ # # and all remaining timeouts to 10 seconds.
640
+ # ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.configure do |config|
641
+ # config.timeout = 10.0
642
+ # config.rpcs.get_license_pool.timeout = 20.0
643
+ # end
644
+ #
645
+ # # Apply the above configuration only to a new client.
646
+ # client = ::Google::Cloud::Commerce::Consumer::Procurement::V1::LicenseManagementService::Client.new do |config|
647
+ # config.timeout = 10.0
648
+ # config.rpcs.get_license_pool.timeout = 20.0
649
+ # end
650
+ #
651
+ # @!attribute [rw] endpoint
652
+ # A custom service endpoint, as a hostname or hostname:port. The default is
653
+ # nil, indicating to use the default endpoint in the current universe domain.
654
+ # @return [::String,nil]
655
+ # @!attribute [rw] credentials
656
+ # Credentials to send with calls. You may provide any of the following types:
657
+ # * (`String`) The path to a service account key file in JSON format
658
+ # * (`Hash`) A service account key as a Hash
659
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
660
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
661
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
662
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
663
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
664
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
665
+ # * (`nil`) indicating no credentials
666
+ # @return [::Object]
667
+ # @!attribute [rw] scope
668
+ # The OAuth scopes
669
+ # @return [::Array<::String>]
670
+ # @!attribute [rw] lib_name
671
+ # The library name as recorded in instrumentation and logging
672
+ # @return [::String]
673
+ # @!attribute [rw] lib_version
674
+ # The library version as recorded in instrumentation and logging
675
+ # @return [::String]
676
+ # @!attribute [rw] channel_args
677
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
678
+ # `GRPC::Core::Channel` object is provided as the credential.
679
+ # @return [::Hash]
680
+ # @!attribute [rw] interceptors
681
+ # An array of interceptors that are run before calls are executed.
682
+ # @return [::Array<::GRPC::ClientInterceptor>]
683
+ # @!attribute [rw] timeout
684
+ # The call timeout in seconds.
685
+ # @return [::Numeric]
686
+ # @!attribute [rw] metadata
687
+ # Additional gRPC headers to be sent with the call.
688
+ # @return [::Hash{::Symbol=>::String}]
689
+ # @!attribute [rw] retry_policy
690
+ # The retry policy. The value is a hash with the following keys:
691
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
692
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
693
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
694
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
695
+ # trigger a retry.
696
+ # @return [::Hash]
697
+ # @!attribute [rw] quota_project
698
+ # A separate project against which to charge quota.
699
+ # @return [::String]
700
+ # @!attribute [rw] universe_domain
701
+ # The universe domain within which to make requests. This determines the
702
+ # default endpoint URL. The default value of nil uses the environment
703
+ # universe (usually the default "googleapis.com" universe).
704
+ # @return [::String,nil]
705
+ #
706
+ class Configuration
707
+ extend ::Gapic::Config
708
+
709
+ # @private
710
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
711
+ DEFAULT_ENDPOINT = "cloudcommerceconsumerprocurement.googleapis.com"
712
+
713
+ config_attr :endpoint, nil, ::String, nil
714
+ config_attr :credentials, nil do |value|
715
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
716
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
717
+ allowed.any? { |klass| klass === value }
718
+ end
719
+ config_attr :scope, nil, ::String, ::Array, nil
720
+ config_attr :lib_name, nil, ::String, nil
721
+ config_attr :lib_version, nil, ::String, nil
722
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
723
+ config_attr :interceptors, nil, ::Array, nil
724
+ config_attr :timeout, nil, ::Numeric, nil
725
+ config_attr :metadata, nil, ::Hash, nil
726
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
727
+ config_attr :quota_project, nil, ::String, nil
728
+ config_attr :universe_domain, nil, ::String, nil
729
+
730
+ # @private
731
+ def initialize parent_config = nil
732
+ @parent_config = parent_config unless parent_config.nil?
733
+
734
+ yield self if block_given?
735
+ end
736
+
737
+ ##
738
+ # Configurations for individual RPCs
739
+ # @return [Rpcs]
740
+ #
741
+ def rpcs
742
+ @rpcs ||= begin
743
+ parent_rpcs = nil
744
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
745
+ Rpcs.new parent_rpcs
746
+ end
747
+ end
748
+
749
+ ##
750
+ # Configuration for the channel pool
751
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
752
+ #
753
+ def channel_pool
754
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
755
+ end
756
+
757
+ ##
758
+ # Configuration RPC class for the LicenseManagementService API.
759
+ #
760
+ # Includes fields providing the configuration for each RPC in this service.
761
+ # Each configuration object is of type `Gapic::Config::Method` and includes
762
+ # the following configuration fields:
763
+ #
764
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
765
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
766
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
767
+ # include the following keys:
768
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
769
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
770
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
771
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
772
+ # trigger a retry.
773
+ #
774
+ class Rpcs
775
+ ##
776
+ # RPC-specific configuration for `get_license_pool`
777
+ # @return [::Gapic::Config::Method]
778
+ #
779
+ attr_reader :get_license_pool
780
+ ##
781
+ # RPC-specific configuration for `update_license_pool`
782
+ # @return [::Gapic::Config::Method]
783
+ #
784
+ attr_reader :update_license_pool
785
+ ##
786
+ # RPC-specific configuration for `assign`
787
+ # @return [::Gapic::Config::Method]
788
+ #
789
+ attr_reader :assign
790
+ ##
791
+ # RPC-specific configuration for `unassign`
792
+ # @return [::Gapic::Config::Method]
793
+ #
794
+ attr_reader :unassign
795
+ ##
796
+ # RPC-specific configuration for `enumerate_licensed_users`
797
+ # @return [::Gapic::Config::Method]
798
+ #
799
+ attr_reader :enumerate_licensed_users
800
+
801
+ # @private
802
+ def initialize parent_rpcs = nil
803
+ get_license_pool_config = parent_rpcs.get_license_pool if parent_rpcs.respond_to? :get_license_pool
804
+ @get_license_pool = ::Gapic::Config::Method.new get_license_pool_config
805
+ update_license_pool_config = parent_rpcs.update_license_pool if parent_rpcs.respond_to? :update_license_pool
806
+ @update_license_pool = ::Gapic::Config::Method.new update_license_pool_config
807
+ assign_config = parent_rpcs.assign if parent_rpcs.respond_to? :assign
808
+ @assign = ::Gapic::Config::Method.new assign_config
809
+ unassign_config = parent_rpcs.unassign if parent_rpcs.respond_to? :unassign
810
+ @unassign = ::Gapic::Config::Method.new unassign_config
811
+ enumerate_licensed_users_config = parent_rpcs.enumerate_licensed_users if parent_rpcs.respond_to? :enumerate_licensed_users
812
+ @enumerate_licensed_users = ::Gapic::Config::Method.new enumerate_licensed_users_config
813
+
814
+ yield self if block_given?
815
+ end
816
+ end
817
+ end
818
+ end
819
+ end
820
+ end
821
+ end
822
+ end
823
+ end
824
+ end
825
+ end