Module: OCI::LoadBalancer::Util
- Defined in:
- lib/oci/load_balancer/util.rb
Overview
Load balancer utility methods
Class Method Summary collapse
-
.wait_on_work_request(client, work_request_id, max_interval_seconds: 30, max_wait_seconds: 1200, raise_error_on_failure: true) ⇒ OCI::Response
Wait until the work request succeeds or fails, or max_wait_seconds is reached.
Class Method Details
.wait_on_work_request(client, work_request_id, max_interval_seconds: 30, max_wait_seconds: 1200, raise_error_on_failure: true) ⇒ OCI::Response
Wait until the work request succeeds or fails, or max_wait_seconds is reached. The work request will be polled at an increasing rate, with a maximum of max_interval_seconds between requests.
raised if the work request is in a failed state. Models::WorkRequest
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/oci/load_balancer/util.rb', line 19 def self.wait_on_work_request(client, work_request_id, max_interval_seconds: 30, max_wait_seconds: 1200, raise_error_on_failure: true) OCI::Waiter::WorkRequest.wait_for_state( client, work_request_id, lambda do |work_request| work_request.lifecycle_state == OCI::LoadBalancer::Models::WorkRequest::LIFECYCLE_STATE_SUCCEEDED end, lambda do |work_request| is_failed_state = work_request.lifecycle_state == \ OCI::LoadBalancer::Models::WorkRequest::LIFECYCLE_STATE_FAILED raise OCI::Errors::WorkRequestFailedError.new(work_request, work_request.lifecycle_state) \ if raise_error_on_failure && is_failed_state is_failed_state end, max_interval_seconds: max_interval_seconds, max_wait_seconds: max_wait_seconds ) end |