Method: OCI::DataLabelingServiceDataplane::DataLabelingClientCompositeOperations#update_annotation_and_wait_for_state
- Defined in:
- lib/oci/data_labeling_service_dataplane/data_labeling_client_composite_operations.rb
#update_annotation_and_wait_for_state(annotation_id, update_annotation_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response
Calls OCI::DataLabelingServiceDataplane::DataLabelingClient#update_annotation and then waits for the Models::Annotation acted upon to enter the given state(s).
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/oci/data_labeling_service_dataplane/data_labeling_client_composite_operations.rb', line 198 def update_annotation_and_wait_for_state(annotation_id, update_annotation_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.update_annotation(annotation_id, update_annotation_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_annotation(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 |