Method: OCI::KeyManagement::KmsManagementClientCompositeOperations#enable_key_and_wait_for_state
- Defined in:
- lib/oci/key_management/kms_management_client_composite_operations.rb
#enable_key_and_wait_for_state(key_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) ⇒ OCI::Response
Calls OCI::KeyManagement::KmsManagementClient#enable_key and then waits for the Models::Key acted upon to enter the given state(s).
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/oci/key_management/kms_management_client_composite_operations.rb', line 155 def enable_key_and_wait_for_state(key_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.enable_key(key_id, 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_key(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 |