Class: OCI::DisasterRecovery::DisasterRecoveryClientCompositeOperations

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb

Overview

This class provides a wrapper around DisasterRecoveryClient 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::DisasterRecovery::DisasterRecoveryClient.new) ⇒ DisasterRecoveryClientCompositeOperations

Initializes a new DisasterRecoveryClientCompositeOperations

Parameters:



22
23
24
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 22

def initialize(service_client = OCI::DisasterRecovery::DisasterRecoveryClient.new)
  @service_client = service_client
end

Instance Attribute Details

#service_clientOCI::DisasterRecovery::DisasterRecoveryClient (readonly)

The OCI::DisasterRecovery::DisasterRecoveryClient used to communicate with the service_client



16
17
18
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 16

def service_client
  @service_client
end

Instance Method Details

#associate_dr_protection_group_and_wait_for_state(associate_dr_protection_group_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Parameters:

  • associate_dr_protection_group_details (OCI::DisasterRecovery::Models::AssociateDrProtectionGroupDetails)

    Details for creating an association between two DR protection groups.

  • dr_protection_group_id (String)

    The OCID of the DR protection group.

    Example: ocid1.drprotectiongroup.oc1..uniqueID

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

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

  • 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:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 45

def associate_dr_protection_group_and_wait_for_state(associate_dr_protection_group_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.associate_dr_protection_group(associate_dr_protection_group_details, dr_protection_group_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#cancel_dr_plan_execution_and_wait_for_state(cancel_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#cancel_dr_plan_execution and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • cancel_dr_plan_execution_details (OCI::DisasterRecovery::Models::CancelDrPlanExecutionDetails)

    Details for canceling the DR plan execution.

  • dr_plan_execution_id (String)

    The OCID of the DR plan execution.

    Example: ocid1.drplanexecution.oc1..uniqueID

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

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

  • 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:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 99

def cancel_dr_plan_execution_and_wait_for_state(cancel_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.cancel_dr_plan_execution(cancel_dr_plan_execution_details, dr_plan_execution_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#change_dr_protection_group_compartment_and_wait_for_state(change_dr_protection_group_compartment_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Parameters:

Returns:



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 153

def change_dr_protection_group_compartment_and_wait_for_state(change_dr_protection_group_compartment_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.change_dr_protection_group_compartment(change_dr_protection_group_compartment_details, dr_protection_group_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

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

Calls OCI::DisasterRecovery::DisasterRecoveryClient#create_dr_plan and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 203

def create_dr_plan_and_wait_for_state(create_dr_plan_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_dr_plan(create_dr_plan_details, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

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

Calls OCI::DisasterRecovery::DisasterRecoveryClient#create_dr_plan_execution and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 253

def create_dr_plan_execution_and_wait_for_state(create_dr_plan_execution_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_dr_plan_execution(create_dr_plan_execution_details, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

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

Calls OCI::DisasterRecovery::DisasterRecoveryClient#create_dr_protection_group and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

Returns:



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 303

def create_dr_protection_group_and_wait_for_state(create_dr_protection_group_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_dr_protection_group(create_dr_protection_group_details, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

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

Calls OCI::DisasterRecovery::DisasterRecoveryClient#delete_dr_plan and then waits for the Models::DrPlan acted upon to enter the given state(s).

Parameters:

  • dr_plan_id (String)

    The OCID of the DR plan.

    Example: ocid1.drplan.oc1..uniqueID

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

    An array of states to wait on. These should be valid values for Models::DrPlan#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:



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 356

def delete_dr_plan_and_wait_for_state(dr_plan_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_dr_plan(dr_plan_id)
  operation_result = @service_client.delete_dr_plan(dr_plan_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_dr_plan_execution_and_wait_for_state(dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#delete_dr_plan_execution and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • dr_plan_execution_id (String)

    The OCID of the DR plan execution.

    Example: ocid1.drplanexecution.oc1..uniqueID

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

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

  • 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:



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 399

def delete_dr_plan_execution_and_wait_for_state(dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.delete_dr_plan_execution(dr_plan_execution_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

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

Calls OCI::DisasterRecovery::DisasterRecoveryClient#delete_dr_protection_group and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • dr_protection_group_id (String)

    The OCID of the DR protection group.

    Example: ocid1.drprotectiongroup.oc1..uniqueID

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

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

  • 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:



452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 452

def delete_dr_protection_group_and_wait_for_state(dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.delete_dr_protection_group(dr_protection_group_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#disassociate_dr_protection_group_and_wait_for_state(disassociate_dr_protection_group_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Parameters:

  • disassociate_dr_protection_group_details (OCI::DisasterRecovery::Models::DisassociateDrProtectionGroupDetails)

    Details for deleting the association between two DR protection groups.

  • dr_protection_group_id (String)

    The OCID of the DR protection group.

    Example: ocid1.drprotectiongroup.oc1..uniqueID

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

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

  • 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:



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 506

def disassociate_dr_protection_group_and_wait_for_state(disassociate_dr_protection_group_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.disassociate_dr_protection_group(disassociate_dr_protection_group_details, dr_protection_group_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#ignore_dr_plan_execution_and_wait_for_state(ignore_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#ignore_dr_plan_execution and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • ignore_dr_plan_execution_details (OCI::DisasterRecovery::Models::IgnoreDrPlanExecutionDetails)

    Details for ignoring the failed group or step and resuming execution.

  • dr_plan_execution_id (String)

    The OCID of the DR plan execution.

    Example: ocid1.drplanexecution.oc1..uniqueID

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

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

  • 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:



560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 560

def ignore_dr_plan_execution_and_wait_for_state(ignore_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.ignore_dr_plan_execution(ignore_dr_plan_execution_details, dr_plan_execution_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#pause_dr_plan_execution_and_wait_for_state(pause_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#pause_dr_plan_execution and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • pause_dr_plan_execution_details (OCI::DisasterRecovery::Models::PauseDrPlanExecutionDetails)

    Details for pausing the DR plan execution.

  • dr_plan_execution_id (String)

    The OCID of the DR plan execution.

    Example: ocid1.drplanexecution.oc1..uniqueID

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

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

  • 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:



614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 614

def pause_dr_plan_execution_and_wait_for_state(pause_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.pause_dr_plan_execution(pause_dr_plan_execution_details, dr_plan_execution_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#resume_dr_plan_execution_and_wait_for_state(resume_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#resume_dr_plan_execution and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • resume_dr_plan_execution_details (OCI::DisasterRecovery::Models::ResumeDrPlanExecutionDetails)

    Details for resuming the DR plan execution.

  • dr_plan_execution_id (String)

    The OCID of the DR plan execution.

    Example: ocid1.drplanexecution.oc1..uniqueID

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

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

  • 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:



668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 668

def resume_dr_plan_execution_and_wait_for_state(resume_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.resume_dr_plan_execution(resume_dr_plan_execution_details, dr_plan_execution_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#retry_dr_plan_execution_and_wait_for_state(retry_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#retry_dr_plan_execution and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • retry_dr_plan_execution_details (OCI::DisasterRecovery::Models::RetryDrPlanExecutionDetails)

    Details for retrying execution of the failed group or step.

  • dr_plan_execution_id (String)

    The OCID of the DR plan execution.

    Example: ocid1.drplanexecution.oc1..uniqueID

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

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

  • 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:



722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 722

def retry_dr_plan_execution_and_wait_for_state(retry_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.retry_dr_plan_execution(retry_dr_plan_execution_details, dr_plan_execution_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#update_dr_plan_and_wait_for_state(update_dr_plan_details, dr_plan_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#update_dr_plan and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • update_dr_plan_details (OCI::DisasterRecovery::Models::UpdateDrPlanDetails)

    Details for updating the DR plan.

  • dr_plan_id (String)

    The OCID of the DR plan.

    Example: ocid1.drplan.oc1..uniqueID

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

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

  • 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:



776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 776

def update_dr_plan_and_wait_for_state(update_dr_plan_details, dr_plan_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_dr_plan(update_dr_plan_details, dr_plan_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#update_dr_plan_execution_and_wait_for_state(update_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#update_dr_plan_execution and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • update_dr_plan_execution_details (OCI::DisasterRecovery::Models::UpdateDrPlanExecutionDetails)

    Details for updating the DR plan execution.

  • dr_plan_execution_id (String)

    The OCID of the DR plan execution.

    Example: ocid1.drplanexecution.oc1..uniqueID

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

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

  • 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:



830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 830

def update_dr_plan_execution_and_wait_for_state(update_dr_plan_execution_details, dr_plan_execution_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_dr_plan_execution(update_dr_plan_execution_details, dr_plan_execution_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#update_dr_protection_group_and_wait_for_state(update_dr_protection_group_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Calls OCI::DisasterRecovery::DisasterRecoveryClient#update_dr_protection_group and then waits for the Models::WorkRequest to enter the given state(s).

Parameters:

  • update_dr_protection_group_details (OCI::DisasterRecovery::Models::UpdateDrProtectionGroupDetails)

    Details for updating the the DR protection group.

  • dr_protection_group_id (String)

    The OCID of the DR protection group.

    Example: ocid1.drprotectiongroup.oc1..uniqueID

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

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

  • 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:



884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 884

def update_dr_protection_group_and_wait_for_state(update_dr_protection_group_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_dr_protection_group(update_dr_protection_group_details, dr_protection_group_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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

#update_dr_protection_group_role_and_wait_for_state(update_dr_protection_group_role_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response

Parameters:

  • update_dr_protection_group_role_details (OCI::DisasterRecovery::Models::UpdateDrProtectionGroupRoleDetails)

    The role details for the DR protection group to be updated.

  • dr_protection_group_id (String)

    The OCID of the DR protection group.

    Example: ocid1.drprotectiongroup.oc1..uniqueID

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

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

  • 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:



938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
# File 'lib/oci/disaster_recovery/disaster_recovery_client_composite_operations.rb', line 938

def update_dr_protection_group_role_and_wait_for_state(update_dr_protection_group_role_details, dr_protection_group_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_dr_protection_group_role(update_dr_protection_group_role_details, dr_protection_group_id, base_operation_opts)
  use_util = OCI::DisasterRecovery::Util.respond_to?(:wait_on_work_request)

  return operation_result if wait_for_states.empty? && !use_util

  lowered_wait_for_states = wait_for_states.map(&:downcase)
  wait_for_resource_id = operation_result.headers['opc-work-request-id']
  return operation_result if wait_for_resource_id.nil? || wait_for_resource_id.empty?

  begin
    if use_util
      waiter_result = OCI::DisasterRecovery::Util.wait_on_work_request(
        @service_client,
        wait_for_resource_id,
        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
      )
    else
      waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
        eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.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
      )
    end
    result_to_return = waiter_result

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