class OCI::Ocvp::SddcClientCompositeOperations
This class provides a wrapper around {OCI::Ocvp::SddcClient} 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
The {OCI::Ocvp::SddcClient} used to communicate with the service_client
@return [OCI::Ocvp::SddcClient]
Public Class Methods
Initializes a new SddcClientCompositeOperations
@param [OCI::Ocvp::SddcClient] service_client
The client used to communicate with the service.
Defaults to a new service client created via {OCI::Ocvp::SddcClient#initialize} with no arguments
# File lib/oci/ocvp/sddc_client_composite_operations.rb, line 20 def initialize(service_client = OCI::Ocvp::SddcClient.new) @service_client = service_client end
Public Instance Methods
Calls {OCI::Ocvp::SddcClient#cancel_downgrade_hcx} and then waits for the {OCI::Ocvp::Models::WorkRequest} to enter the given state(s).
@param [String] sddc_id The [OCID](docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the SDDC.
@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Ocvp::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Ocvp::SddcClient#cancel_downgrade_hcx} @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::Ocvp::Models::WorkRequest}
# File lib/oci/ocvp/sddc_client_composite_operations.rb, line 40 def cancel_downgrade_hcx_and_wait_for_state(sddc_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.cancel_downgrade_hcx(sddc_id, base_operation_opts) use_util = OCI::Ocvp::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::Ocvp::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
Calls {OCI::Ocvp::SddcClient#create_sddc} and then waits for the {OCI::Ocvp::Models::WorkRequest} to enter the given state(s).
@param [OCI::Ocvp::Models::CreateSddcDetails] create_sddc_details Details for the SDDC. @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Ocvp::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Ocvp::SddcClient#create_sddc} @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::Ocvp::Models::WorkRequest}
# File lib/oci/ocvp/sddc_client_composite_operations.rb, line 89 def create_sddc_and_wait_for_state(create_sddc_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.create_sddc(create_sddc_details, base_operation_opts) use_util = OCI::Ocvp::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::Ocvp::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
Calls {OCI::Ocvp::SddcClient#delete_sddc} and then waits for the {OCI::Ocvp::Models::WorkRequest} to enter the given state(s).
@param [String] sddc_id The [OCID](docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the SDDC.
@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Ocvp::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Ocvp::SddcClient#delete_sddc} @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::Ocvp::Models::WorkRequest}
# File lib/oci/ocvp/sddc_client_composite_operations.rb, line 139 def delete_sddc_and_wait_for_state(sddc_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.delete_sddc(sddc_id, base_operation_opts) use_util = OCI::Ocvp::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::Ocvp::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
Calls {OCI::Ocvp::SddcClient#downgrade_hcx} and then waits for the {OCI::Ocvp::Models::WorkRequest} to enter the given state(s).
@param [OCI::Ocvp::Models::DowngradeHcxDetails] downgrade_hcx_details The HCX on-premise license keys to be reserved when downgrade from HCX Enterprise to HCX Advanced. @param [String] sddc_id The [OCID](docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the SDDC.
@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Ocvp::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Ocvp::SddcClient#downgrade_hcx} @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::Ocvp::Models::WorkRequest}
# File lib/oci/ocvp/sddc_client_composite_operations.rb, line 190 def downgrade_hcx_and_wait_for_state(downgrade_hcx_details, sddc_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.downgrade_hcx(downgrade_hcx_details, sddc_id, base_operation_opts) use_util = OCI::Ocvp::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::Ocvp::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
Calls {OCI::Ocvp::SddcClient#refresh_hcx_license_status} and then waits for the {OCI::Ocvp::Models::WorkRequest} to enter the given state(s).
@param [String] sddc_id The [OCID](docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the SDDC.
@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Ocvp::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Ocvp::SddcClient#refresh_hcx_license_status} @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::Ocvp::Models::WorkRequest}
# File lib/oci/ocvp/sddc_client_composite_operations.rb, line 240 def refresh_hcx_license_status_and_wait_for_state(sddc_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.refresh_hcx_license_status(sddc_id, base_operation_opts) use_util = OCI::Ocvp::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::Ocvp::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
Calls {OCI::Ocvp::SddcClient#update_sddc} and then waits for the {OCI::Ocvp::Models::Sddc} acted upon to enter the given state(s).
@param [String] sddc_id The [OCID](docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the SDDC.
@param [OCI::Ocvp::Models::UpdateSddcDetails] update_sddc_details The information to be updated. @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Ocvp::Models::Sddc#lifecycle_state} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Ocvp::SddcClient#update_sddc} @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::Ocvp::Models::Sddc}
# File lib/oci/ocvp/sddc_client_composite_operations.rb, line 291 def update_sddc_and_wait_for_state(sddc_id, update_sddc_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.update_sddc(sddc_id, update_sddc_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_sddc(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
Calls {OCI::Ocvp::SddcClient#upgrade_hcx} and then waits for the {OCI::Ocvp::Models::WorkRequest} to enter the given state(s).
@param [String] sddc_id The [OCID](docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the SDDC.
@param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Ocvp::Models::WorkRequest#status} @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Ocvp::SddcClient#upgrade_hcx} @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::Ocvp::Models::WorkRequest}
# File lib/oci/ocvp/sddc_client_composite_operations.rb, line 331 def upgrade_hcx_and_wait_for_state(sddc_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {}) operation_result = @service_client.upgrade_hcx(sddc_id, base_operation_opts) use_util = OCI::Ocvp::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::Ocvp::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