class OCI::DatabaseMigration::DatabaseMigrationClientCompositeOperations

This class provides a wrapper around {OCI::DatabaseMigration::DatabaseMigrationClient} 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

Attributes

service_client[R]

The {OCI::DatabaseMigration::DatabaseMigrationClient} used to communicate with the service_client

@return [OCI::DatabaseMigration::DatabaseMigrationClient]

Public Class Methods

new(service_client = OCI::DatabaseMigration::DatabaseMigrationClient.new) click to toggle source

Initializes a new DatabaseMigrationClientCompositeOperations

@param [OCI::DatabaseMigration::DatabaseMigrationClient] service_client The client used to communicate with the service.

Defaults to a new service client created via {OCI::DatabaseMigration::DatabaseMigrationClient#initialize} with no arguments
# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 20
def initialize(service_client = OCI::DatabaseMigration::DatabaseMigrationClient.new)
  @service_client = service_client
end

Public Instance Methods

abort_job_and_wait_for_state(job_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#abort_job} and then waits for the {OCI::DatabaseMigration::Models::Job} acted upon to enter the given state(s).

@param [String] job_id The OCID of the job

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::Job#lifecycle_state} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#abort_job} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object with data of type {OCI::DatabaseMigration::Models::Job}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 40
def abort_job_and_wait_for_state(job_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.abort_job(job_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_job(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
clone_migration_and_wait_for_state(migration_id, clone_migration_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#clone_migration} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [String] migration_id The OCID of the migration

@param [OCI::DatabaseMigration::Models::CloneMigrationDetails] clone_migration_details Clone Migration properties.

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#clone_migration} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 82
def clone_migration_and_wait_for_state(migration_id, clone_migration_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.clone_migration(migration_id, clone_migration_details, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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_connection_and_wait_for_state(create_connection_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#create_connection} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [OCI::DatabaseMigration::Models::CreateConnectionDetails] create_connection_details Database Connection properties.

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#create_connection} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 132
def create_connection_and_wait_for_state(create_connection_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_connection(create_connection_details, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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_migration_and_wait_for_state(create_migration_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#create_migration} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [OCI::DatabaseMigration::Models::CreateMigrationDetails] create_migration_details Migration properties.

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#create_migration} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 182
def create_migration_and_wait_for_state(create_migration_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.create_migration(create_migration_details, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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_agent_and_wait_for_state(agent_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#delete_agent} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [String] agent_id The OCID of the agent

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#delete_agent} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 232
def delete_agent_and_wait_for_state(agent_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.delete_agent(agent_id, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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_connection_and_wait_for_state(connection_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#delete_connection} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [String] connection_id The OCID of the database connection

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#delete_connection} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 282
def delete_connection_and_wait_for_state(connection_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.delete_connection(connection_id, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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_job_and_wait_for_state(job_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#delete_job} and then waits for the {OCI::DatabaseMigration::Models::Job} acted upon to enter the given state(s).

@param [String] job_id The OCID of the job

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::Job#lifecycle_state} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#delete_job} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object with data of type nil

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 332
def delete_job_and_wait_for_state(job_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  initial_get_result = @service_client.get_job(job_id)
  operation_result = @service_client.delete_job(job_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_migration_and_wait_for_state(migration_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#delete_migration} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [String] migration_id The OCID of the migration

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#delete_migration} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 373
def delete_migration_and_wait_for_state(migration_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.delete_migration(migration_id, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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
evaluate_migration_and_wait_for_state(migration_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#evaluate_migration} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [String] migration_id The OCID of the migration

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#evaluate_migration} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 423
def evaluate_migration_and_wait_for_state(migration_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.evaluate_migration(migration_id, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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_job_and_wait_for_state(job_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#resume_job} and then waits for the {OCI::DatabaseMigration::Models::Job} acted upon to enter the given state(s).

@param [String] job_id The OCID of the job

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::Job#lifecycle_state} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#resume_job} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object with data of type {OCI::DatabaseMigration::Models::Job}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 473
def resume_job_and_wait_for_state(job_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.resume_job(job_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_job(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
start_migration_and_wait_for_state(migration_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#start_migration} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [String] migration_id The OCID of the migration

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#start_migration} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 513
def start_migration_and_wait_for_state(migration_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.start_migration(migration_id, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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_agent_and_wait_for_state(agent_id, update_agent_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#update_agent} and then waits for the {OCI::DatabaseMigration::Models::Agent} acted upon to enter the given state(s).

@param [String] agent_id The OCID of the agent

@param [OCI::DatabaseMigration::Models::UpdateAgentDetails] update_agent_details Update ODMS Agent properties.

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::Agent#lifecycle_state} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#update_agent} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object with data of type {OCI::DatabaseMigration::Models::Agent}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 565
def update_agent_and_wait_for_state(agent_id, update_agent_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_agent(agent_id, update_agent_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_agent(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_connection_and_wait_for_state(connection_id, update_connection_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#update_connection} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [String] connection_id The OCID of the database connection

@param [OCI::DatabaseMigration::Models::UpdateConnectionDetails] update_connection_details Database Connection properties.

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#update_connection} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 607
def update_connection_and_wait_for_state(connection_id, update_connection_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_connection(connection_id, update_connection_details, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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_job_and_wait_for_state(job_id, update_job_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#update_job} and then waits for the {OCI::DatabaseMigration::Models::Job} acted upon to enter the given state(s).

@param [String] job_id The OCID of the job

@param [OCI::DatabaseMigration::Models::UpdateJobDetails] update_job_details Migration Job properties.

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::Job#lifecycle_state} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#update_job} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object with data of type {OCI::DatabaseMigration::Models::Job}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 659
def update_job_and_wait_for_state(job_id, update_job_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_job(job_id, update_job_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_job(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_migration_and_wait_for_state(migration_id, update_migration_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) click to toggle source

Calls {OCI::DatabaseMigration::DatabaseMigrationClient#update_migration} and then waits for the {OCI::DatabaseMigration::Models::WorkRequest} to enter the given state(s).

@param [String] migration_id The OCID of the migration

@param [OCI::DatabaseMigration::Models::UpdateMigrationDetails] update_migration_details Migration properties.

@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::DatabaseMigration::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::DatabaseMigration::DatabaseMigrationClient#update_migration} @param [Hash] waiter_opts 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

@return [OCI::Response] A {OCI::Response} object containing the completed {OCI::DatabaseMigration::Models::WorkRequest}

# File lib/oci/database_migration/database_migration_client_composite_operations.rb, line 701
def update_migration_and_wait_for_state(migration_id, update_migration_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
  operation_result = @service_client.update_migration(migration_id, update_migration_details, base_operation_opts)
  use_util = OCI::DatabaseMigration::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']

  begin
    if use_util
      waiter_result = OCI::DatabaseMigration::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