Class: OCI::Core::ComputeClientCompositeOperations

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/core/compute_client_composite_operations.rb

Overview

This class provides a wrapper around ComputeClient and offers convenience methods for operations that would otherwise need to be chained together. For example, instead of performing an action on a resource (e.g. launching an instance, creating a load balancer) and then using a waiter to wait for the resource to enter a given state, you can call a single method in this class to accomplish the same functionality

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_client = OCI::Core::ComputeClient.new) ⇒ ComputeClientCompositeOperations

Initializes a new ComputeClientCompositeOperations

Parameters:



19
20
21
# File 'lib/oci/core/compute_client_composite_operations.rb', line 19

def initialize(service_client = OCI::Core::ComputeClient.new)
  @service_client = service_client
end

Instance Attribute Details

#service_clientOCI::Core::ComputeClient (readonly)

The OCI::Core::ComputeClient used to communicate with the service_client



13
14
15
# File 'lib/oci/core/compute_client_composite_operations.rb', line 13

def service_client
  @service_client
end

Instance Method Details

#attach_boot_volume_and_wait_for_state(attach_boot_volume_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#attach_boot_volume and then waits for the Models::BootVolumeAttachment acted upon to enter the given state(s).

Parameters:

  • attach_boot_volume_details (OCI::Core::Models::AttachBootVolumeDetails)

    Attach boot volume request

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::BootVolumeAttachment#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#attach_boot_volume

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/oci/core/compute_client_composite_operations.rb', line 38

def attach_boot_volume_and_wait_for_state(attach_boot_volume_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.attach_boot_volume(attach_boot_volume_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_boot_volume_attachment(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#attach_vnic_and_wait_for_state(attach_vnic_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#attach_vnic and then waits for the Models::VnicAttachment acted upon to enter the given state(s).

Parameters:

  • attach_vnic_details (OCI::Core::Models::AttachVnicDetails)

    Attach VNIC details.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::VnicAttachment#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#attach_vnic

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/oci/core/compute_client_composite_operations.rb', line 77

def attach_vnic_and_wait_for_state(attach_vnic_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.attach_vnic(attach_vnic_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_vnic_attachment(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#attach_volume_and_wait_for_state(attach_volume_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#attach_volume and then waits for the Models::VolumeAttachment acted upon to enter the given state(s).

Parameters:

  • attach_volume_details (OCI::Core::Models::AttachVolumeDetails)

    Attach volume request

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::VolumeAttachment#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#attach_volume

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/oci/core/compute_client_composite_operations.rb', line 116

def attach_volume_and_wait_for_state(attach_volume_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.attach_volume(attach_volume_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_volume_attachment(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#capture_console_history_and_wait_for_state(capture_console_history_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#capture_console_history and then waits for the Models::ConsoleHistory acted upon to enter the given state(s).

Parameters:

  • capture_console_history_details (OCI::Core::Models::CaptureConsoleHistoryDetails)

    Console history details

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::ConsoleHistory#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#capture_console_history

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/oci/core/compute_client_composite_operations.rb', line 155

def capture_console_history_and_wait_for_state(capture_console_history_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.capture_console_history(capture_console_history_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_console_history(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#create_image_and_wait_for_state(create_image_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#create_image and then waits for the Models::Image acted upon to enter the given state(s).

Parameters:

  • create_image_details (OCI::Core::Models::CreateImageDetails)

    Image creation details

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Image#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#create_image

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/oci/core/compute_client_composite_operations.rb', line 194

def create_image_and_wait_for_state(create_image_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_image(create_image_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_image(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#create_instance_console_connection_and_wait_for_state(create_instance_console_connection_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#create_instance_console_connection and then waits for the Models::InstanceConsoleConnection acted upon to enter the given state(s).

Parameters:

Returns:



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/oci/core/compute_client_composite_operations.rb', line 233

def create_instance_console_connection_and_wait_for_state(create_instance_console_connection_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_instance_console_connection(create_instance_console_connection_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_instance_console_connection(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#delete_console_history_and_wait_for_state(instance_console_history_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#delete_console_history and then waits for the Models::ConsoleHistory acted upon to enter the given state(s).

Parameters:

  • instance_console_history_id (String)

    The OCID of the console history.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::ConsoleHistory#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#delete_console_history

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/oci/core/compute_client_composite_operations.rb', line 272

def delete_console_history_and_wait_for_state(instance_console_history_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_console_history(instance_console_history_id)
  operation_result = @service_client.delete_console_history(instance_console_history_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)

  begin
    waiter_result = initial_get_result.wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
      succeed_on_not_found: true
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#delete_image_and_wait_for_state(image_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#delete_image and then waits for the Models::Image acted upon to enter the given state(s).

Parameters:

  • image_id (String)

    The OCID of the image.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Image#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#delete_image

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/oci/core/compute_client_composite_operations.rb', line 312

def delete_image_and_wait_for_state(image_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_image(image_id)
  operation_result = @service_client.delete_image(image_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)

  begin
    waiter_result = initial_get_result.wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
      succeed_on_not_found: true
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#delete_instance_console_connection_and_wait_for_state(instance_console_connection_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#delete_instance_console_connection and then waits for the Models::InstanceConsoleConnection acted upon to enter the given state(s).

Parameters:

  • instance_console_connection_id (String)

    The OCID of the intance console connection

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::InstanceConsoleConnection#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})
  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/oci/core/compute_client_composite_operations.rb', line 352

def delete_instance_console_connection_and_wait_for_state(instance_console_connection_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_instance_console_connection(instance_console_connection_id)
  operation_result = @service_client.delete_instance_console_connection(instance_console_connection_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)

  begin
    waiter_result = initial_get_result.wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
      succeed_on_not_found: true
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#detach_boot_volume_and_wait_for_state(boot_volume_attachment_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#detach_boot_volume and then waits for the Models::BootVolumeAttachment acted upon to enter the given state(s).

Parameters:

  • boot_volume_attachment_id (String)

    The OCID of the boot volume attachment.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::BootVolumeAttachment#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#detach_boot_volume

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/oci/core/compute_client_composite_operations.rb', line 392

def detach_boot_volume_and_wait_for_state(boot_volume_attachment_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_boot_volume_attachment(boot_volume_attachment_id)
  operation_result = @service_client.detach_boot_volume(boot_volume_attachment_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)

  begin
    waiter_result = initial_get_result.wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
      succeed_on_not_found: true
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#detach_vnic_and_wait_for_state(vnic_attachment_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#detach_vnic and then waits for the Models::VnicAttachment acted upon to enter the given state(s).

Parameters:

  • vnic_attachment_id (String)

    The OCID of the VNIC attachment.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::VnicAttachment#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#detach_vnic

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/oci/core/compute_client_composite_operations.rb', line 432

def detach_vnic_and_wait_for_state(vnic_attachment_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_vnic_attachment(vnic_attachment_id)
  operation_result = @service_client.detach_vnic(vnic_attachment_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)

  begin
    waiter_result = initial_get_result.wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
      succeed_on_not_found: true
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#detach_volume_and_wait_for_state(volume_attachment_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#detach_volume and then waits for the Models::VolumeAttachment acted upon to enter the given state(s).

Parameters:

  • volume_attachment_id (String)

    The OCID of the volume attachment.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::VolumeAttachment#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#detach_volume

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/oci/core/compute_client_composite_operations.rb', line 472

def detach_volume_and_wait_for_state(volume_attachment_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_volume_attachment(volume_attachment_id)
  operation_result = @service_client.detach_volume(volume_attachment_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)

  begin
    waiter_result = initial_get_result.wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
      succeed_on_not_found: true
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#instance_action_and_wait_for_state(instance_id, action, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#instance_action and then waits for the Models::Instance acted upon to enter the given state(s).

Parameters:

  • instance_id (String)

    The OCID of the instance.

  • action (String)

    The action to perform on the instance. Allowed values are: STOP, START, SOFTRESET, RESET, SOFTSTOP

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Instance#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#instance_action

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'lib/oci/core/compute_client_composite_operations.rb', line 514

def instance_action_and_wait_for_state(instance_id, action, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.instance_action(instance_id, action, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_instance(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#launch_instance_and_wait_for_state(launch_instance_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#launch_instance and then waits for the Models::Instance acted upon to enter the given state(s).

Parameters:

  • launch_instance_details (OCI::Core::Models::LaunchInstanceDetails)

    Instance details

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Instance#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#launch_instance

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
# File 'lib/oci/core/compute_client_composite_operations.rb', line 553

def launch_instance_and_wait_for_state(launch_instance_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.launch_instance(launch_instance_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_instance(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#terminate_instance_and_wait_for_state(instance_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#terminate_instance and then waits for the Models::Instance acted upon to enter the given state(s).

Parameters:

  • instance_id (String)

    The OCID of the instance.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Instance#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#terminate_instance

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/oci/core/compute_client_composite_operations.rb', line 592

def terminate_instance_and_wait_for_state(instance_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_instance(instance_id)
  operation_result = @service_client.terminate_instance(instance_id, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)

  begin
    waiter_result = initial_get_result.wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
      succeed_on_not_found: true
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_console_history_and_wait_for_state(instance_console_history_id, update_console_history_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#update_console_history and then waits for the Models::ConsoleHistory acted upon to enter the given state(s).

Parameters:

  • instance_console_history_id (String)

    The OCID of the console history.

  • update_console_history_details (OCI::Core::Models::UpdateConsoleHistoryDetails)

    Update instance fields

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::ConsoleHistory#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#update_console_history

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
# File 'lib/oci/core/compute_client_composite_operations.rb', line 633

def update_console_history_and_wait_for_state(instance_console_history_id, update_console_history_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_console_history(instance_console_history_id, update_console_history_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_console_history(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_image_and_wait_for_state(image_id, update_image_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#update_image and then waits for the Models::Image acted upon to enter the given state(s).

Parameters:

  • image_id (String)

    The OCID of the image.

  • update_image_details (OCI::Core::Models::UpdateImageDetails)

    Updates the image display name field. Avoid entering confidential information.

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Image#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#update_image

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/oci/core/compute_client_composite_operations.rb', line 673

def update_image_and_wait_for_state(image_id, update_image_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_image(image_id, update_image_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_image(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end

#update_instance_and_wait_for_state(instance_id, update_instance_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::Core::ComputeClient#update_instance and then waits for the Models::Instance acted upon to enter the given state(s).

Parameters:

  • instance_id (String)

    The OCID of the instance.

  • update_instance_details (OCI::Core::Models::UpdateInstanceDetails)

    Update instance fields

  • wait_for_states (Array<String>) (defaults to: [])

    An array of states to wait on. These should be valid values for Models::Instance#lifecycle_state

  • base_operation_opts (Hash) (defaults to: {})

    Any optional arguments accepted by OCI::Core::ComputeClient#update_instance

  • waiter_opts (Hash) (defaults to: {})

    Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:

    • max_interval_seconds: The maximum interval between queries, in seconds.

    • max_wait_seconds The maximum time to wait, in seconds

Returns:



713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
# File 'lib/oci/core/compute_client_composite_operations.rb', line 713

def update_instance_and_wait_for_state(instance_id, update_instance_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_instance(instance_id, update_instance_details, base_operation_opts)

  return operation_result if wait_for_states.empty?

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.data.id

  begin
    waiter_result = @service_client.get_instance(wait_for_resource_id).wait_until(
      eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
      max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
      max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
    )
    result_to_return = waiter_result

    return result_to_return
  rescue StandardError
    raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
  end
end