google-cloud-rapid_migration_assessment-v1 0.a → 0.2.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/rapid_migration_assessment/v1/bindings_override.rb +102 -0
  6. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment/client.rb +1439 -0
  7. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment/credentials.rb +47 -0
  8. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment/operations.rb +779 -0
  9. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment/paths.rb +88 -0
  10. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment/rest/client.rb +1347 -0
  11. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment/rest/operations.rb +870 -0
  12. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment/rest/service_stub.rb +644 -0
  13. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment/rest.rb +54 -0
  14. data/lib/google/cloud/rapid_migration_assessment/v1/rapid_migration_assessment.rb +56 -0
  15. data/lib/google/cloud/rapid_migration_assessment/v1/rest.rb +38 -0
  16. data/lib/google/cloud/rapid_migration_assessment/v1/version.rb +7 -2
  17. data/lib/google/cloud/rapid_migration_assessment/v1.rb +45 -0
  18. data/lib/google/cloud/rapidmigrationassessment/v1/api_entities_pb.rb +52 -0
  19. data/lib/google/cloud/rapidmigrationassessment/v1/rapidmigrationassessment_pb.rb +65 -0
  20. data/lib/google/cloud/rapidmigrationassessment/v1/rapidmigrationassessment_services_pb.rb +64 -0
  21. data/lib/google-cloud-rapid_migration_assessment-v1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/client.rb +381 -0
  24. data/proto_docs/google/api/field_behavior.rb +85 -0
  25. data/proto_docs/google/api/launch_stage.rb +71 -0
  26. data/proto_docs/google/api/resource.rb +222 -0
  27. data/proto_docs/google/cloud/rapidmigrationassessment/v1/api_entities.rb +184 -0
  28. data/proto_docs/google/cloud/rapidmigrationassessment/v1/rapidmigrationassessment.rb +272 -0
  29. data/proto_docs/google/longrunning/operations.rb +164 -0
  30. data/proto_docs/google/protobuf/any.rb +144 -0
  31. data/proto_docs/google/protobuf/duration.rb +98 -0
  32. data/proto_docs/google/protobuf/empty.rb +34 -0
  33. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  34. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  35. data/proto_docs/google/rpc/status.rb +48 -0
  36. metadata +211 -13
@@ -0,0 +1,1439 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/rapidmigrationassessment/v1/rapidmigrationassessment_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module RapidMigrationAssessment
26
+ module V1
27
+ module RapidMigrationAssessment
28
+ ##
29
+ # Client for the RapidMigrationAssessment service.
30
+ #
31
+ # Rapid Migration Assessment service
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :rapid_migration_assessment_stub
38
+
39
+ ##
40
+ # Configure the RapidMigrationAssessment Client class.
41
+ #
42
+ # See {::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all RapidMigrationAssessment clients
48
+ # ::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "RapidMigrationAssessment", "V1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.create_collector.timeout = 60.0
69
+
70
+ default_config.rpcs.create_annotation.timeout = 60.0
71
+
72
+ default_config.rpcs.get_annotation.timeout = 60.0
73
+ default_config.rpcs.get_annotation.retry_policy = {
74
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
75
+ }
76
+
77
+ default_config.rpcs.list_collectors.timeout = 60.0
78
+ default_config.rpcs.list_collectors.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
80
+ }
81
+
82
+ default_config.rpcs.get_collector.timeout = 60.0
83
+ default_config.rpcs.get_collector.retry_policy = {
84
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
85
+ }
86
+
87
+ default_config.rpcs.update_collector.timeout = 60.0
88
+
89
+ default_config.rpcs.delete_collector.timeout = 60.0
90
+
91
+ default_config.rpcs.resume_collector.timeout = 60.0
92
+
93
+ default_config.rpcs.register_collector.timeout = 60.0
94
+
95
+ default_config.rpcs.pause_collector.timeout = 60.0
96
+
97
+ default_config
98
+ end
99
+ yield @configure if block_given?
100
+ @configure
101
+ end
102
+
103
+ ##
104
+ # Configure the RapidMigrationAssessment Client instance.
105
+ #
106
+ # The configuration is set to the derived mode, meaning that values can be changed,
107
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
108
+ # should be made on {Client.configure}.
109
+ #
110
+ # See {::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client::Configuration}
111
+ # for a description of the configuration fields.
112
+ #
113
+ # @yield [config] Configure the Client client.
114
+ # @yieldparam config [Client::Configuration]
115
+ #
116
+ # @return [Client::Configuration]
117
+ #
118
+ def configure
119
+ yield @config if block_given?
120
+ @config
121
+ end
122
+
123
+ ##
124
+ # Create a new RapidMigrationAssessment client object.
125
+ #
126
+ # @example
127
+ #
128
+ # # Create a client using the default configuration
129
+ # client = ::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
130
+ #
131
+ # # Create a client using a custom configuration
132
+ # client = ::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new do |config|
133
+ # config.timeout = 10.0
134
+ # end
135
+ #
136
+ # @yield [config] Configure the RapidMigrationAssessment client.
137
+ # @yieldparam config [Client::Configuration]
138
+ #
139
+ def initialize
140
+ # These require statements are intentionally placed here to initialize
141
+ # the gRPC module only when it's required.
142
+ # See https://github.com/googleapis/toolkit/issues/446
143
+ require "gapic/grpc"
144
+ require "google/cloud/rapidmigrationassessment/v1/rapidmigrationassessment_services_pb"
145
+
146
+ # Create the configuration object
147
+ @config = Configuration.new Client.configure
148
+
149
+ # Yield the configuration if needed
150
+ yield @config if block_given?
151
+
152
+ # Create credentials
153
+ credentials = @config.credentials
154
+ # Use self-signed JWT if the endpoint is unchanged from default,
155
+ # but only if the default endpoint does not have a region prefix.
156
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
157
+ !@config.endpoint.split(".").first.include?("-")
158
+ credentials ||= Credentials.default scope: @config.scope,
159
+ enable_self_signed_jwt: enable_self_signed_jwt
160
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
161
+ credentials = Credentials.new credentials, scope: @config.scope
162
+ end
163
+ @quota_project_id = @config.quota_project
164
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
165
+
166
+ @operations_client = Operations.new do |config|
167
+ config.credentials = credentials
168
+ config.quota_project = @quota_project_id
169
+ config.endpoint = @config.endpoint
170
+ end
171
+
172
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
173
+ config.credentials = credentials
174
+ config.quota_project = @quota_project_id
175
+ config.endpoint = @config.endpoint
176
+ end
177
+
178
+ @rapid_migration_assessment_stub = ::Gapic::ServiceStub.new(
179
+ ::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Stub,
180
+ credentials: credentials,
181
+ endpoint: @config.endpoint,
182
+ channel_args: @config.channel_args,
183
+ interceptors: @config.interceptors,
184
+ channel_pool_config: @config.channel_pool
185
+ )
186
+ end
187
+
188
+ ##
189
+ # Get the associated client for long-running operations.
190
+ #
191
+ # @return [::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Operations]
192
+ #
193
+ attr_reader :operations_client
194
+
195
+ ##
196
+ # Get the associated client for mix-in of the Locations.
197
+ #
198
+ # @return [Google::Cloud::Location::Locations::Client]
199
+ #
200
+ attr_reader :location_client
201
+
202
+ # Service calls
203
+
204
+ ##
205
+ # Create a Collector to manage the on-prem appliance which collects
206
+ # information about Customer assets.
207
+ #
208
+ # @overload create_collector(request, options = nil)
209
+ # Pass arguments to `create_collector` via a request object, either of type
210
+ # {::Google::Cloud::RapidMigrationAssessment::V1::CreateCollectorRequest} or an equivalent Hash.
211
+ #
212
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::CreateCollectorRequest, ::Hash]
213
+ # A request object representing the call parameters. Required. To specify no
214
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
215
+ # @param options [::Gapic::CallOptions, ::Hash]
216
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
217
+ #
218
+ # @overload create_collector(parent: nil, collector_id: nil, collector: nil, request_id: nil)
219
+ # Pass arguments to `create_collector` via keyword arguments. Note that at
220
+ # least one keyword argument is required. To specify no parameters, or to keep all
221
+ # the default parameter values, pass an empty Hash as a request object (see above).
222
+ #
223
+ # @param parent [::String]
224
+ # Required. Name of the parent (project+location).
225
+ # @param collector_id [::String]
226
+ # Required. Id of the requesting object.
227
+ # @param collector [::Google::Cloud::RapidMigrationAssessment::V1::Collector, ::Hash]
228
+ # Required. The resource being created.
229
+ # @param request_id [::String]
230
+ # Optional. An optional request ID to identify requests.
231
+ #
232
+ # @yield [response, operation] Access the result along with the RPC operation
233
+ # @yieldparam response [::Gapic::Operation]
234
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
235
+ #
236
+ # @return [::Gapic::Operation]
237
+ #
238
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
239
+ #
240
+ # @example Basic example
241
+ # require "google/cloud/rapid_migration_assessment/v1"
242
+ #
243
+ # # Create a client object. The client can be reused for multiple calls.
244
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
245
+ #
246
+ # # Create a request. To set request fields, pass in keyword arguments.
247
+ # request = Google::Cloud::RapidMigrationAssessment::V1::CreateCollectorRequest.new
248
+ #
249
+ # # Call the create_collector method.
250
+ # result = client.create_collector request
251
+ #
252
+ # # The returned object is of type Gapic::Operation. You can use it to
253
+ # # check the status of an operation, cancel it, or wait for results.
254
+ # # Here is how to wait for a response.
255
+ # result.wait_until_done! timeout: 60
256
+ # if result.response?
257
+ # p result.response
258
+ # else
259
+ # puts "No response received."
260
+ # end
261
+ #
262
+ def create_collector request, options = nil
263
+ raise ::ArgumentError, "request must be provided" if request.nil?
264
+
265
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::CreateCollectorRequest
266
+
267
+ # Converts hash and nil to an options object
268
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
269
+
270
+ # Customize the options with defaults
271
+ metadata = @config.rpcs.create_collector.metadata.to_h
272
+
273
+ # Set x-goog-api-client and x-goog-user-project headers
274
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
275
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
276
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
277
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
278
+
279
+ header_params = {}
280
+ if request.parent
281
+ header_params["parent"] = request.parent
282
+ end
283
+
284
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
285
+ metadata[:"x-goog-request-params"] ||= request_params_header
286
+
287
+ options.apply_defaults timeout: @config.rpcs.create_collector.timeout,
288
+ metadata: metadata,
289
+ retry_policy: @config.rpcs.create_collector.retry_policy
290
+
291
+ options.apply_defaults timeout: @config.timeout,
292
+ metadata: @config.metadata,
293
+ retry_policy: @config.retry_policy
294
+
295
+ @rapid_migration_assessment_stub.call_rpc :create_collector, request, options: options do |response, operation|
296
+ response = ::Gapic::Operation.new response, @operations_client, options: options
297
+ yield response, operation if block_given?
298
+ return response
299
+ end
300
+ rescue ::GRPC::BadStatus => e
301
+ raise ::Google::Cloud::Error.from_error(e)
302
+ end
303
+
304
+ ##
305
+ # Creates an Annotation
306
+ #
307
+ # @overload create_annotation(request, options = nil)
308
+ # Pass arguments to `create_annotation` via a request object, either of type
309
+ # {::Google::Cloud::RapidMigrationAssessment::V1::CreateAnnotationRequest} or an equivalent Hash.
310
+ #
311
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::CreateAnnotationRequest, ::Hash]
312
+ # A request object representing the call parameters. Required. To specify no
313
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
314
+ # @param options [::Gapic::CallOptions, ::Hash]
315
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
316
+ #
317
+ # @overload create_annotation(parent: nil, annotation: nil, request_id: nil)
318
+ # Pass arguments to `create_annotation` via keyword arguments. Note that at
319
+ # least one keyword argument is required. To specify no parameters, or to keep all
320
+ # the default parameter values, pass an empty Hash as a request object (see above).
321
+ #
322
+ # @param parent [::String]
323
+ # Required. Name of the parent (project+location).
324
+ # @param annotation [::Google::Cloud::RapidMigrationAssessment::V1::Annotation, ::Hash]
325
+ # Required. The resource being created.
326
+ # @param request_id [::String]
327
+ # Optional. An optional request ID to identify requests.
328
+ #
329
+ # @yield [response, operation] Access the result along with the RPC operation
330
+ # @yieldparam response [::Gapic::Operation]
331
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
332
+ #
333
+ # @return [::Gapic::Operation]
334
+ #
335
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
336
+ #
337
+ # @example Basic example
338
+ # require "google/cloud/rapid_migration_assessment/v1"
339
+ #
340
+ # # Create a client object. The client can be reused for multiple calls.
341
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
342
+ #
343
+ # # Create a request. To set request fields, pass in keyword arguments.
344
+ # request = Google::Cloud::RapidMigrationAssessment::V1::CreateAnnotationRequest.new
345
+ #
346
+ # # Call the create_annotation method.
347
+ # result = client.create_annotation request
348
+ #
349
+ # # The returned object is of type Gapic::Operation. You can use it to
350
+ # # check the status of an operation, cancel it, or wait for results.
351
+ # # Here is how to wait for a response.
352
+ # result.wait_until_done! timeout: 60
353
+ # if result.response?
354
+ # p result.response
355
+ # else
356
+ # puts "No response received."
357
+ # end
358
+ #
359
+ def create_annotation request, options = nil
360
+ raise ::ArgumentError, "request must be provided" if request.nil?
361
+
362
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::CreateAnnotationRequest
363
+
364
+ # Converts hash and nil to an options object
365
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
366
+
367
+ # Customize the options with defaults
368
+ metadata = @config.rpcs.create_annotation.metadata.to_h
369
+
370
+ # Set x-goog-api-client and x-goog-user-project headers
371
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
372
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
373
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
374
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
375
+
376
+ header_params = {}
377
+ if request.parent
378
+ header_params["parent"] = request.parent
379
+ end
380
+
381
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
382
+ metadata[:"x-goog-request-params"] ||= request_params_header
383
+
384
+ options.apply_defaults timeout: @config.rpcs.create_annotation.timeout,
385
+ metadata: metadata,
386
+ retry_policy: @config.rpcs.create_annotation.retry_policy
387
+
388
+ options.apply_defaults timeout: @config.timeout,
389
+ metadata: @config.metadata,
390
+ retry_policy: @config.retry_policy
391
+
392
+ @rapid_migration_assessment_stub.call_rpc :create_annotation, request, options: options do |response, operation|
393
+ response = ::Gapic::Operation.new response, @operations_client, options: options
394
+ yield response, operation if block_given?
395
+ return response
396
+ end
397
+ rescue ::GRPC::BadStatus => e
398
+ raise ::Google::Cloud::Error.from_error(e)
399
+ end
400
+
401
+ ##
402
+ # Gets details of a single Annotation.
403
+ #
404
+ # @overload get_annotation(request, options = nil)
405
+ # Pass arguments to `get_annotation` via a request object, either of type
406
+ # {::Google::Cloud::RapidMigrationAssessment::V1::GetAnnotationRequest} or an equivalent Hash.
407
+ #
408
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::GetAnnotationRequest, ::Hash]
409
+ # A request object representing the call parameters. Required. To specify no
410
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
411
+ # @param options [::Gapic::CallOptions, ::Hash]
412
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
413
+ #
414
+ # @overload get_annotation(name: nil)
415
+ # Pass arguments to `get_annotation` via keyword arguments. Note that at
416
+ # least one keyword argument is required. To specify no parameters, or to keep all
417
+ # the default parameter values, pass an empty Hash as a request object (see above).
418
+ #
419
+ # @param name [::String]
420
+ # Required. Name of the resource.
421
+ #
422
+ # @yield [response, operation] Access the result along with the RPC operation
423
+ # @yieldparam response [::Google::Cloud::RapidMigrationAssessment::V1::Annotation]
424
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
425
+ #
426
+ # @return [::Google::Cloud::RapidMigrationAssessment::V1::Annotation]
427
+ #
428
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
429
+ #
430
+ # @example Basic example
431
+ # require "google/cloud/rapid_migration_assessment/v1"
432
+ #
433
+ # # Create a client object. The client can be reused for multiple calls.
434
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
435
+ #
436
+ # # Create a request. To set request fields, pass in keyword arguments.
437
+ # request = Google::Cloud::RapidMigrationAssessment::V1::GetAnnotationRequest.new
438
+ #
439
+ # # Call the get_annotation method.
440
+ # result = client.get_annotation request
441
+ #
442
+ # # The returned object is of type Google::Cloud::RapidMigrationAssessment::V1::Annotation.
443
+ # p result
444
+ #
445
+ def get_annotation request, options = nil
446
+ raise ::ArgumentError, "request must be provided" if request.nil?
447
+
448
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::GetAnnotationRequest
449
+
450
+ # Converts hash and nil to an options object
451
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
452
+
453
+ # Customize the options with defaults
454
+ metadata = @config.rpcs.get_annotation.metadata.to_h
455
+
456
+ # Set x-goog-api-client and x-goog-user-project headers
457
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
458
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
459
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
460
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
461
+
462
+ header_params = {}
463
+ if request.name
464
+ header_params["name"] = request.name
465
+ end
466
+
467
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
468
+ metadata[:"x-goog-request-params"] ||= request_params_header
469
+
470
+ options.apply_defaults timeout: @config.rpcs.get_annotation.timeout,
471
+ metadata: metadata,
472
+ retry_policy: @config.rpcs.get_annotation.retry_policy
473
+
474
+ options.apply_defaults timeout: @config.timeout,
475
+ metadata: @config.metadata,
476
+ retry_policy: @config.retry_policy
477
+
478
+ @rapid_migration_assessment_stub.call_rpc :get_annotation, request, options: options do |response, operation|
479
+ yield response, operation if block_given?
480
+ return response
481
+ end
482
+ rescue ::GRPC::BadStatus => e
483
+ raise ::Google::Cloud::Error.from_error(e)
484
+ end
485
+
486
+ ##
487
+ # Lists Collectors in a given project and location.
488
+ #
489
+ # @overload list_collectors(request, options = nil)
490
+ # Pass arguments to `list_collectors` via a request object, either of type
491
+ # {::Google::Cloud::RapidMigrationAssessment::V1::ListCollectorsRequest} or an equivalent Hash.
492
+ #
493
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::ListCollectorsRequest, ::Hash]
494
+ # A request object representing the call parameters. Required. To specify no
495
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
496
+ # @param options [::Gapic::CallOptions, ::Hash]
497
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
498
+ #
499
+ # @overload list_collectors(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
500
+ # Pass arguments to `list_collectors` via keyword arguments. Note that at
501
+ # least one keyword argument is required. To specify no parameters, or to keep all
502
+ # the default parameter values, pass an empty Hash as a request object (see above).
503
+ #
504
+ # @param parent [::String]
505
+ # Required. Parent value for ListCollectorsRequest.
506
+ # @param page_size [::Integer]
507
+ # Requested page size. Server may return fewer items than requested.
508
+ # If unspecified, server will pick an appropriate default.
509
+ # @param page_token [::String]
510
+ # A token identifying a page of results the server should return.
511
+ # @param filter [::String]
512
+ # Filtering results.
513
+ # @param order_by [::String]
514
+ # Hint for how to order the results.
515
+ #
516
+ # @yield [response, operation] Access the result along with the RPC operation
517
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::RapidMigrationAssessment::V1::Collector>]
518
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
519
+ #
520
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::RapidMigrationAssessment::V1::Collector>]
521
+ #
522
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
523
+ #
524
+ # @example Basic example
525
+ # require "google/cloud/rapid_migration_assessment/v1"
526
+ #
527
+ # # Create a client object. The client can be reused for multiple calls.
528
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
529
+ #
530
+ # # Create a request. To set request fields, pass in keyword arguments.
531
+ # request = Google::Cloud::RapidMigrationAssessment::V1::ListCollectorsRequest.new
532
+ #
533
+ # # Call the list_collectors method.
534
+ # result = client.list_collectors 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::RapidMigrationAssessment::V1::Collector.
540
+ # p item
541
+ # end
542
+ #
543
+ def list_collectors request, options = nil
544
+ raise ::ArgumentError, "request must be provided" if request.nil?
545
+
546
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::ListCollectorsRequest
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
+ metadata = @config.rpcs.list_collectors.metadata.to_h
553
+
554
+ # Set x-goog-api-client and x-goog-user-project headers
555
+ 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::RapidMigrationAssessment::V1::VERSION
558
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
559
+
560
+ header_params = {}
561
+ if request.parent
562
+ header_params["parent"] = request.parent
563
+ end
564
+
565
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
566
+ metadata[:"x-goog-request-params"] ||= request_params_header
567
+
568
+ options.apply_defaults timeout: @config.rpcs.list_collectors.timeout,
569
+ metadata: metadata,
570
+ retry_policy: @config.rpcs.list_collectors.retry_policy
571
+
572
+ options.apply_defaults timeout: @config.timeout,
573
+ metadata: @config.metadata,
574
+ retry_policy: @config.retry_policy
575
+
576
+ @rapid_migration_assessment_stub.call_rpc :list_collectors, request, options: options do |response, operation|
577
+ response = ::Gapic::PagedEnumerable.new @rapid_migration_assessment_stub, :list_collectors, request, response, operation, options
578
+ yield response, operation if block_given?
579
+ return response
580
+ end
581
+ rescue ::GRPC::BadStatus => e
582
+ raise ::Google::Cloud::Error.from_error(e)
583
+ end
584
+
585
+ ##
586
+ # Gets details of a single Collector.
587
+ #
588
+ # @overload get_collector(request, options = nil)
589
+ # Pass arguments to `get_collector` via a request object, either of type
590
+ # {::Google::Cloud::RapidMigrationAssessment::V1::GetCollectorRequest} or an equivalent Hash.
591
+ #
592
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::GetCollectorRequest, ::Hash]
593
+ # A request object representing the call parameters. Required. To specify no
594
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
595
+ # @param options [::Gapic::CallOptions, ::Hash]
596
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
597
+ #
598
+ # @overload get_collector(name: nil)
599
+ # Pass arguments to `get_collector` via keyword arguments. Note that at
600
+ # least one keyword argument is required. To specify no parameters, or to keep all
601
+ # the default parameter values, pass an empty Hash as a request object (see above).
602
+ #
603
+ # @param name [::String]
604
+ # Required. Name of the resource.
605
+ #
606
+ # @yield [response, operation] Access the result along with the RPC operation
607
+ # @yieldparam response [::Google::Cloud::RapidMigrationAssessment::V1::Collector]
608
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
609
+ #
610
+ # @return [::Google::Cloud::RapidMigrationAssessment::V1::Collector]
611
+ #
612
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
613
+ #
614
+ # @example Basic example
615
+ # require "google/cloud/rapid_migration_assessment/v1"
616
+ #
617
+ # # Create a client object. The client can be reused for multiple calls.
618
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
619
+ #
620
+ # # Create a request. To set request fields, pass in keyword arguments.
621
+ # request = Google::Cloud::RapidMigrationAssessment::V1::GetCollectorRequest.new
622
+ #
623
+ # # Call the get_collector method.
624
+ # result = client.get_collector request
625
+ #
626
+ # # The returned object is of type Google::Cloud::RapidMigrationAssessment::V1::Collector.
627
+ # p result
628
+ #
629
+ def get_collector request, options = nil
630
+ raise ::ArgumentError, "request must be provided" if request.nil?
631
+
632
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::GetCollectorRequest
633
+
634
+ # Converts hash and nil to an options object
635
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
636
+
637
+ # Customize the options with defaults
638
+ metadata = @config.rpcs.get_collector.metadata.to_h
639
+
640
+ # Set x-goog-api-client and x-goog-user-project headers
641
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
642
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
643
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
644
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
645
+
646
+ header_params = {}
647
+ if request.name
648
+ header_params["name"] = request.name
649
+ end
650
+
651
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
652
+ metadata[:"x-goog-request-params"] ||= request_params_header
653
+
654
+ options.apply_defaults timeout: @config.rpcs.get_collector.timeout,
655
+ metadata: metadata,
656
+ retry_policy: @config.rpcs.get_collector.retry_policy
657
+
658
+ options.apply_defaults timeout: @config.timeout,
659
+ metadata: @config.metadata,
660
+ retry_policy: @config.retry_policy
661
+
662
+ @rapid_migration_assessment_stub.call_rpc :get_collector, request, options: options do |response, operation|
663
+ yield response, operation if block_given?
664
+ return response
665
+ end
666
+ rescue ::GRPC::BadStatus => e
667
+ raise ::Google::Cloud::Error.from_error(e)
668
+ end
669
+
670
+ ##
671
+ # Updates the parameters of a single Collector.
672
+ #
673
+ # @overload update_collector(request, options = nil)
674
+ # Pass arguments to `update_collector` via a request object, either of type
675
+ # {::Google::Cloud::RapidMigrationAssessment::V1::UpdateCollectorRequest} or an equivalent Hash.
676
+ #
677
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::UpdateCollectorRequest, ::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 update_collector(update_mask: nil, collector: nil, request_id: nil)
684
+ # Pass arguments to `update_collector` 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 update_mask [::Google::Protobuf::FieldMask, ::Hash]
689
+ # Required. Field mask is used to specify the fields to be overwritten in the
690
+ # Collector resource by the update.
691
+ # The fields specified in the update_mask are relative to the resource, not
692
+ # the full request. A field will be overwritten if it is in the mask. If the
693
+ # user does not provide a mask then all fields will be overwritten.
694
+ # @param collector [::Google::Cloud::RapidMigrationAssessment::V1::Collector, ::Hash]
695
+ # Required. The resource being updated.
696
+ # @param request_id [::String]
697
+ # Optional. An optional request ID to identify requests. Specify a unique
698
+ # request ID so that if you must retry your request, the server will know to
699
+ # ignore the request if it has already been completed. The server will
700
+ # guarantee that for at least 60 minutes since the first request.
701
+ #
702
+ # For example, consider a situation where you make an initial request and
703
+ # the request times out. If you make the request again with the same request
704
+ # ID, the server can check if original operation with the same request ID
705
+ # was received, and if so, will ignore the second request. This prevents
706
+ # clients from accidentally creating duplicate commitments.
707
+ #
708
+ # The request ID must be a valid UUID with the exception that zero UUID is
709
+ # not supported (00000000-0000-0000-0000-000000000000).
710
+ #
711
+ # @yield [response, operation] Access the result along with the RPC operation
712
+ # @yieldparam response [::Gapic::Operation]
713
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
714
+ #
715
+ # @return [::Gapic::Operation]
716
+ #
717
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
718
+ #
719
+ # @example Basic example
720
+ # require "google/cloud/rapid_migration_assessment/v1"
721
+ #
722
+ # # Create a client object. The client can be reused for multiple calls.
723
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
724
+ #
725
+ # # Create a request. To set request fields, pass in keyword arguments.
726
+ # request = Google::Cloud::RapidMigrationAssessment::V1::UpdateCollectorRequest.new
727
+ #
728
+ # # Call the update_collector method.
729
+ # result = client.update_collector request
730
+ #
731
+ # # The returned object is of type Gapic::Operation. You can use it to
732
+ # # check the status of an operation, cancel it, or wait for results.
733
+ # # Here is how to wait for a response.
734
+ # result.wait_until_done! timeout: 60
735
+ # if result.response?
736
+ # p result.response
737
+ # else
738
+ # puts "No response received."
739
+ # end
740
+ #
741
+ def update_collector request, options = nil
742
+ raise ::ArgumentError, "request must be provided" if request.nil?
743
+
744
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::UpdateCollectorRequest
745
+
746
+ # Converts hash and nil to an options object
747
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
748
+
749
+ # Customize the options with defaults
750
+ metadata = @config.rpcs.update_collector.metadata.to_h
751
+
752
+ # Set x-goog-api-client and x-goog-user-project headers
753
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
754
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
755
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
756
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
757
+
758
+ header_params = {}
759
+ if request.collector&.name
760
+ header_params["collector.name"] = request.collector.name
761
+ end
762
+
763
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
764
+ metadata[:"x-goog-request-params"] ||= request_params_header
765
+
766
+ options.apply_defaults timeout: @config.rpcs.update_collector.timeout,
767
+ metadata: metadata,
768
+ retry_policy: @config.rpcs.update_collector.retry_policy
769
+
770
+ options.apply_defaults timeout: @config.timeout,
771
+ metadata: @config.metadata,
772
+ retry_policy: @config.retry_policy
773
+
774
+ @rapid_migration_assessment_stub.call_rpc :update_collector, request, options: options do |response, operation|
775
+ response = ::Gapic::Operation.new response, @operations_client, options: options
776
+ yield response, operation if block_given?
777
+ return response
778
+ end
779
+ rescue ::GRPC::BadStatus => e
780
+ raise ::Google::Cloud::Error.from_error(e)
781
+ end
782
+
783
+ ##
784
+ # Deletes a single Collector - changes state of collector to "Deleting".
785
+ #
786
+ # @overload delete_collector(request, options = nil)
787
+ # Pass arguments to `delete_collector` via a request object, either of type
788
+ # {::Google::Cloud::RapidMigrationAssessment::V1::DeleteCollectorRequest} or an equivalent Hash.
789
+ #
790
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::DeleteCollectorRequest, ::Hash]
791
+ # A request object representing the call parameters. Required. To specify no
792
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
793
+ # @param options [::Gapic::CallOptions, ::Hash]
794
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
795
+ #
796
+ # @overload delete_collector(name: nil, request_id: nil)
797
+ # Pass arguments to `delete_collector` via keyword arguments. Note that at
798
+ # least one keyword argument is required. To specify no parameters, or to keep all
799
+ # the default parameter values, pass an empty Hash as a request object (see above).
800
+ #
801
+ # @param name [::String]
802
+ # Required. Name of the resource.
803
+ # @param request_id [::String]
804
+ # Optional. An optional request ID to identify requests. Specify a unique
805
+ # request ID so that if you must retry your request, the server will know to
806
+ # ignore the request if it has already been completed. The server will
807
+ # guarantee that for at least 60 minutes after the first request.
808
+ #
809
+ # For example, consider a situation where you make an initial request and
810
+ # the request times out. If you make the request again with the same request
811
+ # ID, the server can check if original operation with the same request ID
812
+ # was received, and if so, will ignore the second request. This prevents
813
+ # clients from accidentally creating duplicate commitments.
814
+ #
815
+ # The request ID must be a valid UUID with the exception that zero UUID is
816
+ # not supported (00000000-0000-0000-0000-000000000000).
817
+ #
818
+ # @yield [response, operation] Access the result along with the RPC operation
819
+ # @yieldparam response [::Gapic::Operation]
820
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
821
+ #
822
+ # @return [::Gapic::Operation]
823
+ #
824
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
825
+ #
826
+ # @example Basic example
827
+ # require "google/cloud/rapid_migration_assessment/v1"
828
+ #
829
+ # # Create a client object. The client can be reused for multiple calls.
830
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
831
+ #
832
+ # # Create a request. To set request fields, pass in keyword arguments.
833
+ # request = Google::Cloud::RapidMigrationAssessment::V1::DeleteCollectorRequest.new
834
+ #
835
+ # # Call the delete_collector method.
836
+ # result = client.delete_collector request
837
+ #
838
+ # # The returned object is of type Gapic::Operation. You can use it to
839
+ # # check the status of an operation, cancel it, or wait for results.
840
+ # # Here is how to wait for a response.
841
+ # result.wait_until_done! timeout: 60
842
+ # if result.response?
843
+ # p result.response
844
+ # else
845
+ # puts "No response received."
846
+ # end
847
+ #
848
+ def delete_collector request, options = nil
849
+ raise ::ArgumentError, "request must be provided" if request.nil?
850
+
851
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::DeleteCollectorRequest
852
+
853
+ # Converts hash and nil to an options object
854
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
855
+
856
+ # Customize the options with defaults
857
+ metadata = @config.rpcs.delete_collector.metadata.to_h
858
+
859
+ # Set x-goog-api-client and x-goog-user-project headers
860
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
861
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
862
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
863
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
864
+
865
+ header_params = {}
866
+ if request.name
867
+ header_params["name"] = request.name
868
+ end
869
+
870
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
871
+ metadata[:"x-goog-request-params"] ||= request_params_header
872
+
873
+ options.apply_defaults timeout: @config.rpcs.delete_collector.timeout,
874
+ metadata: metadata,
875
+ retry_policy: @config.rpcs.delete_collector.retry_policy
876
+
877
+ options.apply_defaults timeout: @config.timeout,
878
+ metadata: @config.metadata,
879
+ retry_policy: @config.retry_policy
880
+
881
+ @rapid_migration_assessment_stub.call_rpc :delete_collector, request, options: options do |response, operation|
882
+ response = ::Gapic::Operation.new response, @operations_client, options: options
883
+ yield response, operation if block_given?
884
+ return response
885
+ end
886
+ rescue ::GRPC::BadStatus => e
887
+ raise ::Google::Cloud::Error.from_error(e)
888
+ end
889
+
890
+ ##
891
+ # Resumes the given collector.
892
+ #
893
+ # @overload resume_collector(request, options = nil)
894
+ # Pass arguments to `resume_collector` via a request object, either of type
895
+ # {::Google::Cloud::RapidMigrationAssessment::V1::ResumeCollectorRequest} or an equivalent Hash.
896
+ #
897
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::ResumeCollectorRequest, ::Hash]
898
+ # A request object representing the call parameters. Required. To specify no
899
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
900
+ # @param options [::Gapic::CallOptions, ::Hash]
901
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
902
+ #
903
+ # @overload resume_collector(name: nil, request_id: nil)
904
+ # Pass arguments to `resume_collector` via keyword arguments. Note that at
905
+ # least one keyword argument is required. To specify no parameters, or to keep all
906
+ # the default parameter values, pass an empty Hash as a request object (see above).
907
+ #
908
+ # @param name [::String]
909
+ # Required. Name of the resource.
910
+ # @param request_id [::String]
911
+ # Optional. An optional request ID to identify requests. Specify a unique
912
+ # request ID so that if you must retry your request, the server will know to
913
+ # ignore the request if it has already been completed. The server will
914
+ # guarantee that for at least 60 minutes after the first request.
915
+ #
916
+ # For example, consider a situation where you make an initial request and
917
+ # the request times out. If you make the request again with the same request
918
+ # ID, the server can check if original operation with the same request ID
919
+ # was received, and if so, will ignore the second request. This prevents
920
+ # clients from accidentally creating duplicate commitments.
921
+ #
922
+ # The request ID must be a valid UUID with the exception that zero UUID is
923
+ # not supported (00000000-0000-0000-0000-000000000000).
924
+ #
925
+ # @yield [response, operation] Access the result along with the RPC operation
926
+ # @yieldparam response [::Gapic::Operation]
927
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
928
+ #
929
+ # @return [::Gapic::Operation]
930
+ #
931
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
932
+ #
933
+ # @example Basic example
934
+ # require "google/cloud/rapid_migration_assessment/v1"
935
+ #
936
+ # # Create a client object. The client can be reused for multiple calls.
937
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
938
+ #
939
+ # # Create a request. To set request fields, pass in keyword arguments.
940
+ # request = Google::Cloud::RapidMigrationAssessment::V1::ResumeCollectorRequest.new
941
+ #
942
+ # # Call the resume_collector method.
943
+ # result = client.resume_collector request
944
+ #
945
+ # # The returned object is of type Gapic::Operation. You can use it to
946
+ # # check the status of an operation, cancel it, or wait for results.
947
+ # # Here is how to wait for a response.
948
+ # result.wait_until_done! timeout: 60
949
+ # if result.response?
950
+ # p result.response
951
+ # else
952
+ # puts "No response received."
953
+ # end
954
+ #
955
+ def resume_collector request, options = nil
956
+ raise ::ArgumentError, "request must be provided" if request.nil?
957
+
958
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::ResumeCollectorRequest
959
+
960
+ # Converts hash and nil to an options object
961
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
962
+
963
+ # Customize the options with defaults
964
+ metadata = @config.rpcs.resume_collector.metadata.to_h
965
+
966
+ # Set x-goog-api-client and x-goog-user-project headers
967
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
968
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
969
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
970
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
971
+
972
+ header_params = {}
973
+ if request.name
974
+ header_params["name"] = request.name
975
+ end
976
+
977
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
978
+ metadata[:"x-goog-request-params"] ||= request_params_header
979
+
980
+ options.apply_defaults timeout: @config.rpcs.resume_collector.timeout,
981
+ metadata: metadata,
982
+ retry_policy: @config.rpcs.resume_collector.retry_policy
983
+
984
+ options.apply_defaults timeout: @config.timeout,
985
+ metadata: @config.metadata,
986
+ retry_policy: @config.retry_policy
987
+
988
+ @rapid_migration_assessment_stub.call_rpc :resume_collector, request, options: options do |response, operation|
989
+ response = ::Gapic::Operation.new response, @operations_client, options: options
990
+ yield response, operation if block_given?
991
+ return response
992
+ end
993
+ rescue ::GRPC::BadStatus => e
994
+ raise ::Google::Cloud::Error.from_error(e)
995
+ end
996
+
997
+ ##
998
+ # Registers the given collector.
999
+ #
1000
+ # @overload register_collector(request, options = nil)
1001
+ # Pass arguments to `register_collector` via a request object, either of type
1002
+ # {::Google::Cloud::RapidMigrationAssessment::V1::RegisterCollectorRequest} or an equivalent Hash.
1003
+ #
1004
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::RegisterCollectorRequest, ::Hash]
1005
+ # A request object representing the call parameters. Required. To specify no
1006
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1007
+ # @param options [::Gapic::CallOptions, ::Hash]
1008
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1009
+ #
1010
+ # @overload register_collector(name: nil, request_id: nil)
1011
+ # Pass arguments to `register_collector` via keyword arguments. Note that at
1012
+ # least one keyword argument is required. To specify no parameters, or to keep all
1013
+ # the default parameter values, pass an empty Hash as a request object (see above).
1014
+ #
1015
+ # @param name [::String]
1016
+ # Required. Name of the resource.
1017
+ # @param request_id [::String]
1018
+ # Optional. An optional request ID to identify requests. Specify a unique
1019
+ # request ID so that if you must retry your request, the server will know to
1020
+ # ignore the request if it has already been completed. The server will
1021
+ # guarantee that for at least 60 minutes after the first request.
1022
+ #
1023
+ # For example, consider a situation where you make an initial request and
1024
+ # the request times out. If you make the request again with the same request
1025
+ # ID, the server can check if original operation with the same request ID
1026
+ # was received, and if so, will ignore the second request. This prevents
1027
+ # clients from accidentally creating duplicate commitments.
1028
+ #
1029
+ # The request ID must be a valid UUID with the exception that zero UUID is
1030
+ # not supported (00000000-0000-0000-0000-000000000000).
1031
+ #
1032
+ # @yield [response, operation] Access the result along with the RPC operation
1033
+ # @yieldparam response [::Gapic::Operation]
1034
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1035
+ #
1036
+ # @return [::Gapic::Operation]
1037
+ #
1038
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1039
+ #
1040
+ # @example Basic example
1041
+ # require "google/cloud/rapid_migration_assessment/v1"
1042
+ #
1043
+ # # Create a client object. The client can be reused for multiple calls.
1044
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
1045
+ #
1046
+ # # Create a request. To set request fields, pass in keyword arguments.
1047
+ # request = Google::Cloud::RapidMigrationAssessment::V1::RegisterCollectorRequest.new
1048
+ #
1049
+ # # Call the register_collector method.
1050
+ # result = client.register_collector request
1051
+ #
1052
+ # # The returned object is of type Gapic::Operation. You can use it to
1053
+ # # check the status of an operation, cancel it, or wait for results.
1054
+ # # Here is how to wait for a response.
1055
+ # result.wait_until_done! timeout: 60
1056
+ # if result.response?
1057
+ # p result.response
1058
+ # else
1059
+ # puts "No response received."
1060
+ # end
1061
+ #
1062
+ def register_collector request, options = nil
1063
+ raise ::ArgumentError, "request must be provided" if request.nil?
1064
+
1065
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::RegisterCollectorRequest
1066
+
1067
+ # Converts hash and nil to an options object
1068
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1069
+
1070
+ # Customize the options with defaults
1071
+ metadata = @config.rpcs.register_collector.metadata.to_h
1072
+
1073
+ # Set x-goog-api-client and x-goog-user-project headers
1074
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1075
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1076
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
1077
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1078
+
1079
+ header_params = {}
1080
+ if request.name
1081
+ header_params["name"] = request.name
1082
+ end
1083
+
1084
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1085
+ metadata[:"x-goog-request-params"] ||= request_params_header
1086
+
1087
+ options.apply_defaults timeout: @config.rpcs.register_collector.timeout,
1088
+ metadata: metadata,
1089
+ retry_policy: @config.rpcs.register_collector.retry_policy
1090
+
1091
+ options.apply_defaults timeout: @config.timeout,
1092
+ metadata: @config.metadata,
1093
+ retry_policy: @config.retry_policy
1094
+
1095
+ @rapid_migration_assessment_stub.call_rpc :register_collector, request, options: options do |response, operation|
1096
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1097
+ yield response, operation if block_given?
1098
+ return response
1099
+ end
1100
+ rescue ::GRPC::BadStatus => e
1101
+ raise ::Google::Cloud::Error.from_error(e)
1102
+ end
1103
+
1104
+ ##
1105
+ # Pauses the given collector.
1106
+ #
1107
+ # @overload pause_collector(request, options = nil)
1108
+ # Pass arguments to `pause_collector` via a request object, either of type
1109
+ # {::Google::Cloud::RapidMigrationAssessment::V1::PauseCollectorRequest} or an equivalent Hash.
1110
+ #
1111
+ # @param request [::Google::Cloud::RapidMigrationAssessment::V1::PauseCollectorRequest, ::Hash]
1112
+ # A request object representing the call parameters. Required. To specify no
1113
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1114
+ # @param options [::Gapic::CallOptions, ::Hash]
1115
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1116
+ #
1117
+ # @overload pause_collector(name: nil, request_id: nil)
1118
+ # Pass arguments to `pause_collector` via keyword arguments. Note that at
1119
+ # least one keyword argument is required. To specify no parameters, or to keep all
1120
+ # the default parameter values, pass an empty Hash as a request object (see above).
1121
+ #
1122
+ # @param name [::String]
1123
+ # Required. Name of the resource.
1124
+ # @param request_id [::String]
1125
+ # Optional. An optional request ID to identify requests. Specify a unique
1126
+ # request ID so that if you must retry your request, the server will know to
1127
+ # ignore the request if it has already been completed. The server will
1128
+ # guarantee that for at least 60 minutes after the first request.
1129
+ #
1130
+ # For example, consider a situation where you make an initial request and
1131
+ # the request times out. If you make the request again with the same request
1132
+ # ID, the server can check if original operation with the same request ID
1133
+ # was received, and if so, will ignore the second request. This prevents
1134
+ # clients from accidentally creating duplicate commitments.
1135
+ #
1136
+ # The request ID must be a valid UUID with the exception that zero UUID is
1137
+ # not supported (00000000-0000-0000-0000-000000000000).
1138
+ #
1139
+ # @yield [response, operation] Access the result along with the RPC operation
1140
+ # @yieldparam response [::Gapic::Operation]
1141
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1142
+ #
1143
+ # @return [::Gapic::Operation]
1144
+ #
1145
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1146
+ #
1147
+ # @example Basic example
1148
+ # require "google/cloud/rapid_migration_assessment/v1"
1149
+ #
1150
+ # # Create a client object. The client can be reused for multiple calls.
1151
+ # client = Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new
1152
+ #
1153
+ # # Create a request. To set request fields, pass in keyword arguments.
1154
+ # request = Google::Cloud::RapidMigrationAssessment::V1::PauseCollectorRequest.new
1155
+ #
1156
+ # # Call the pause_collector method.
1157
+ # result = client.pause_collector request
1158
+ #
1159
+ # # The returned object is of type Gapic::Operation. You can use it to
1160
+ # # check the status of an operation, cancel it, or wait for results.
1161
+ # # Here is how to wait for a response.
1162
+ # result.wait_until_done! timeout: 60
1163
+ # if result.response?
1164
+ # p result.response
1165
+ # else
1166
+ # puts "No response received."
1167
+ # end
1168
+ #
1169
+ def pause_collector request, options = nil
1170
+ raise ::ArgumentError, "request must be provided" if request.nil?
1171
+
1172
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RapidMigrationAssessment::V1::PauseCollectorRequest
1173
+
1174
+ # Converts hash and nil to an options object
1175
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1176
+
1177
+ # Customize the options with defaults
1178
+ metadata = @config.rpcs.pause_collector.metadata.to_h
1179
+
1180
+ # Set x-goog-api-client and x-goog-user-project headers
1181
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1182
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1183
+ gapic_version: ::Google::Cloud::RapidMigrationAssessment::V1::VERSION
1184
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1185
+
1186
+ header_params = {}
1187
+ if request.name
1188
+ header_params["name"] = request.name
1189
+ end
1190
+
1191
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1192
+ metadata[:"x-goog-request-params"] ||= request_params_header
1193
+
1194
+ options.apply_defaults timeout: @config.rpcs.pause_collector.timeout,
1195
+ metadata: metadata,
1196
+ retry_policy: @config.rpcs.pause_collector.retry_policy
1197
+
1198
+ options.apply_defaults timeout: @config.timeout,
1199
+ metadata: @config.metadata,
1200
+ retry_policy: @config.retry_policy
1201
+
1202
+ @rapid_migration_assessment_stub.call_rpc :pause_collector, request, options: options do |response, operation|
1203
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1204
+ yield response, operation if block_given?
1205
+ return response
1206
+ end
1207
+ rescue ::GRPC::BadStatus => e
1208
+ raise ::Google::Cloud::Error.from_error(e)
1209
+ end
1210
+
1211
+ ##
1212
+ # Configuration class for the RapidMigrationAssessment API.
1213
+ #
1214
+ # This class represents the configuration for RapidMigrationAssessment,
1215
+ # providing control over timeouts, retry behavior, logging, transport
1216
+ # parameters, and other low-level controls. Certain parameters can also be
1217
+ # applied individually to specific RPCs. See
1218
+ # {::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client::Configuration::Rpcs}
1219
+ # for a list of RPCs that can be configured independently.
1220
+ #
1221
+ # Configuration can be applied globally to all clients, or to a single client
1222
+ # on construction.
1223
+ #
1224
+ # @example
1225
+ #
1226
+ # # Modify the global config, setting the timeout for
1227
+ # # create_collector to 20 seconds,
1228
+ # # and all remaining timeouts to 10 seconds.
1229
+ # ::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.configure do |config|
1230
+ # config.timeout = 10.0
1231
+ # config.rpcs.create_collector.timeout = 20.0
1232
+ # end
1233
+ #
1234
+ # # Apply the above configuration only to a new client.
1235
+ # client = ::Google::Cloud::RapidMigrationAssessment::V1::RapidMigrationAssessment::Client.new do |config|
1236
+ # config.timeout = 10.0
1237
+ # config.rpcs.create_collector.timeout = 20.0
1238
+ # end
1239
+ #
1240
+ # @!attribute [rw] endpoint
1241
+ # The hostname or hostname:port of the service endpoint.
1242
+ # Defaults to `"rapidmigrationassessment.googleapis.com"`.
1243
+ # @return [::String]
1244
+ # @!attribute [rw] credentials
1245
+ # Credentials to send with calls. You may provide any of the following types:
1246
+ # * (`String`) The path to a service account key file in JSON format
1247
+ # * (`Hash`) A service account key as a Hash
1248
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1249
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1250
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1251
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1252
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1253
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1254
+ # * (`nil`) indicating no credentials
1255
+ # @return [::Object]
1256
+ # @!attribute [rw] scope
1257
+ # The OAuth scopes
1258
+ # @return [::Array<::String>]
1259
+ # @!attribute [rw] lib_name
1260
+ # The library name as recorded in instrumentation and logging
1261
+ # @return [::String]
1262
+ # @!attribute [rw] lib_version
1263
+ # The library version as recorded in instrumentation and logging
1264
+ # @return [::String]
1265
+ # @!attribute [rw] channel_args
1266
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1267
+ # `GRPC::Core::Channel` object is provided as the credential.
1268
+ # @return [::Hash]
1269
+ # @!attribute [rw] interceptors
1270
+ # An array of interceptors that are run before calls are executed.
1271
+ # @return [::Array<::GRPC::ClientInterceptor>]
1272
+ # @!attribute [rw] timeout
1273
+ # The call timeout in seconds.
1274
+ # @return [::Numeric]
1275
+ # @!attribute [rw] metadata
1276
+ # Additional gRPC headers to be sent with the call.
1277
+ # @return [::Hash{::Symbol=>::String}]
1278
+ # @!attribute [rw] retry_policy
1279
+ # The retry policy. The value is a hash with the following keys:
1280
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1281
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1282
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1283
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1284
+ # trigger a retry.
1285
+ # @return [::Hash]
1286
+ # @!attribute [rw] quota_project
1287
+ # A separate project against which to charge quota.
1288
+ # @return [::String]
1289
+ #
1290
+ class Configuration
1291
+ extend ::Gapic::Config
1292
+
1293
+ DEFAULT_ENDPOINT = "rapidmigrationassessment.googleapis.com"
1294
+
1295
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1296
+ config_attr :credentials, nil do |value|
1297
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1298
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1299
+ allowed.any? { |klass| klass === value }
1300
+ end
1301
+ config_attr :scope, nil, ::String, ::Array, nil
1302
+ config_attr :lib_name, nil, ::String, nil
1303
+ config_attr :lib_version, nil, ::String, nil
1304
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1305
+ config_attr :interceptors, nil, ::Array, nil
1306
+ config_attr :timeout, nil, ::Numeric, nil
1307
+ config_attr :metadata, nil, ::Hash, nil
1308
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1309
+ config_attr :quota_project, nil, ::String, nil
1310
+
1311
+ # @private
1312
+ def initialize parent_config = nil
1313
+ @parent_config = parent_config unless parent_config.nil?
1314
+
1315
+ yield self if block_given?
1316
+ end
1317
+
1318
+ ##
1319
+ # Configurations for individual RPCs
1320
+ # @return [Rpcs]
1321
+ #
1322
+ def rpcs
1323
+ @rpcs ||= begin
1324
+ parent_rpcs = nil
1325
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1326
+ Rpcs.new parent_rpcs
1327
+ end
1328
+ end
1329
+
1330
+ ##
1331
+ # Configuration for the channel pool
1332
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1333
+ #
1334
+ def channel_pool
1335
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1336
+ end
1337
+
1338
+ ##
1339
+ # Configuration RPC class for the RapidMigrationAssessment API.
1340
+ #
1341
+ # Includes fields providing the configuration for each RPC in this service.
1342
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1343
+ # the following configuration fields:
1344
+ #
1345
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1346
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1347
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1348
+ # include the following keys:
1349
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1350
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1351
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1352
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1353
+ # trigger a retry.
1354
+ #
1355
+ class Rpcs
1356
+ ##
1357
+ # RPC-specific configuration for `create_collector`
1358
+ # @return [::Gapic::Config::Method]
1359
+ #
1360
+ attr_reader :create_collector
1361
+ ##
1362
+ # RPC-specific configuration for `create_annotation`
1363
+ # @return [::Gapic::Config::Method]
1364
+ #
1365
+ attr_reader :create_annotation
1366
+ ##
1367
+ # RPC-specific configuration for `get_annotation`
1368
+ # @return [::Gapic::Config::Method]
1369
+ #
1370
+ attr_reader :get_annotation
1371
+ ##
1372
+ # RPC-specific configuration for `list_collectors`
1373
+ # @return [::Gapic::Config::Method]
1374
+ #
1375
+ attr_reader :list_collectors
1376
+ ##
1377
+ # RPC-specific configuration for `get_collector`
1378
+ # @return [::Gapic::Config::Method]
1379
+ #
1380
+ attr_reader :get_collector
1381
+ ##
1382
+ # RPC-specific configuration for `update_collector`
1383
+ # @return [::Gapic::Config::Method]
1384
+ #
1385
+ attr_reader :update_collector
1386
+ ##
1387
+ # RPC-specific configuration for `delete_collector`
1388
+ # @return [::Gapic::Config::Method]
1389
+ #
1390
+ attr_reader :delete_collector
1391
+ ##
1392
+ # RPC-specific configuration for `resume_collector`
1393
+ # @return [::Gapic::Config::Method]
1394
+ #
1395
+ attr_reader :resume_collector
1396
+ ##
1397
+ # RPC-specific configuration for `register_collector`
1398
+ # @return [::Gapic::Config::Method]
1399
+ #
1400
+ attr_reader :register_collector
1401
+ ##
1402
+ # RPC-specific configuration for `pause_collector`
1403
+ # @return [::Gapic::Config::Method]
1404
+ #
1405
+ attr_reader :pause_collector
1406
+
1407
+ # @private
1408
+ def initialize parent_rpcs = nil
1409
+ create_collector_config = parent_rpcs.create_collector if parent_rpcs.respond_to? :create_collector
1410
+ @create_collector = ::Gapic::Config::Method.new create_collector_config
1411
+ create_annotation_config = parent_rpcs.create_annotation if parent_rpcs.respond_to? :create_annotation
1412
+ @create_annotation = ::Gapic::Config::Method.new create_annotation_config
1413
+ get_annotation_config = parent_rpcs.get_annotation if parent_rpcs.respond_to? :get_annotation
1414
+ @get_annotation = ::Gapic::Config::Method.new get_annotation_config
1415
+ list_collectors_config = parent_rpcs.list_collectors if parent_rpcs.respond_to? :list_collectors
1416
+ @list_collectors = ::Gapic::Config::Method.new list_collectors_config
1417
+ get_collector_config = parent_rpcs.get_collector if parent_rpcs.respond_to? :get_collector
1418
+ @get_collector = ::Gapic::Config::Method.new get_collector_config
1419
+ update_collector_config = parent_rpcs.update_collector if parent_rpcs.respond_to? :update_collector
1420
+ @update_collector = ::Gapic::Config::Method.new update_collector_config
1421
+ delete_collector_config = parent_rpcs.delete_collector if parent_rpcs.respond_to? :delete_collector
1422
+ @delete_collector = ::Gapic::Config::Method.new delete_collector_config
1423
+ resume_collector_config = parent_rpcs.resume_collector if parent_rpcs.respond_to? :resume_collector
1424
+ @resume_collector = ::Gapic::Config::Method.new resume_collector_config
1425
+ register_collector_config = parent_rpcs.register_collector if parent_rpcs.respond_to? :register_collector
1426
+ @register_collector = ::Gapic::Config::Method.new register_collector_config
1427
+ pause_collector_config = parent_rpcs.pause_collector if parent_rpcs.respond_to? :pause_collector
1428
+ @pause_collector = ::Gapic::Config::Method.new pause_collector_config
1429
+
1430
+ yield self if block_given?
1431
+ end
1432
+ end
1433
+ end
1434
+ end
1435
+ end
1436
+ end
1437
+ end
1438
+ end
1439
+ end