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