Aurora
Adminer
Auto Root
WP Admin
cPanel Reset
Anti Backdoor
Root
lib
python3.9
site-packages
oci
cloud_migrations
Upload
New Folder
New File
Name
Size
Permissions
Actions
..
-
-
-
Upload File
Select File
New Folder
Folder Name
New File
File Name
Add WordPress Admin
Database Host
Database Name
Database User
Database Password
Admin Username
Admin Password
cPanel Password Reset
Email Address
Edit: migration_client_composite_operations.py
# coding: utf-8 # Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. # NOTE: This class is auto generated by OracleSDKGenerator. DO NOT EDIT. API Version: 20220919 import oci # noqa: F401 from oci.util import WAIT_RESOURCE_NOT_FOUND # noqa: F401 class MigrationClientCompositeOperations(object): """ This class provides a wrapper around :py:class:`~oci.cloud_migrations.MigrationClient` 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 """ def __init__(self, client, **kwargs): """ Creates a new MigrationClientCompositeOperations object :param MigrationClient client: The service client which will be wrapped by this object """ self.client = client def change_migration_compartment_and_wait_for_state(self, migration_id, change_migration_compartment_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.change_migration_compartment` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_id: (required) Unique migration identifier :param oci.cloud_migrations.models.ChangeMigrationCompartmentDetails change_migration_compartment_details: (required) The information to be updated. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.change_migration_compartment` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.change_migration_compartment(migration_id, change_migration_compartment_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def change_migration_plan_compartment_and_wait_for_state(self, migration_plan_id, change_migration_plan_compartment_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.change_migration_plan_compartment` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_plan_id: (required) Unique migration plan identifier :param oci.cloud_migrations.models.ChangeMigrationPlanCompartmentDetails change_migration_plan_compartment_details: (required) Details for the compartment move. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.change_migration_plan_compartment` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.change_migration_plan_compartment(migration_plan_id, change_migration_plan_compartment_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def change_replication_schedule_compartment_and_wait_for_state(self, replication_schedule_id, change_replication_schedule_compartment_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.change_replication_schedule_compartment` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str replication_schedule_id: (required) Unique replication schedule identifier in path :param oci.cloud_migrations.models.ChangeReplicationScheduleCompartmentDetails change_replication_schedule_compartment_details: (required) Details for the compartment move. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.change_replication_schedule_compartment` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.change_replication_schedule_compartment(replication_schedule_id, change_replication_schedule_compartment_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def create_migration_and_wait_for_state(self, create_migration_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.create_migration` and waits for the :py:class:`~oci.cloud_migrations.models.Migration` acted upon to enter the given state(s). :param oci.cloud_migrations.models.CreateMigrationDetails create_migration_details: (required) Details for the new migration. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.Migration.lifecycle_state` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.create_migration` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.create_migration(create_migration_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] migration_id = operation_result.data.id try: waiter_result = oci.wait_until( self.client, self.client.get_migration(migration_id), # noqa: F821 evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except (NameError, TypeError) as e: if not e.args: e.args = ('',) e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', ) raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def create_migration_asset_and_wait_for_state(self, create_migration_asset_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.create_migration_asset` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param oci.cloud_migrations.models.CreateMigrationAssetDetails create_migration_asset_details: (required) Details for the new migration asset. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.create_migration_asset` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.create_migration_asset(create_migration_asset_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def create_migration_plan_and_wait_for_state(self, create_migration_plan_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.create_migration_plan` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param oci.cloud_migrations.models.CreateMigrationPlanDetails create_migration_plan_details: (required) Details for the new migration plan. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.create_migration_plan` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.create_migration_plan(create_migration_plan_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def create_replication_schedule_and_wait_for_state(self, create_replication_schedule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.create_replication_schedule` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param oci.cloud_migrations.models.CreateReplicationScheduleDetails create_replication_schedule_details: (required) Details for the new replication schedule. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.create_replication_schedule` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.create_replication_schedule(create_replication_schedule_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def create_target_asset_and_wait_for_state(self, create_target_asset_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.create_target_asset` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param oci.cloud_migrations.models.CreateTargetAssetDetails create_target_asset_details: (required) Details for the new target asset. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.create_target_asset` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.create_target_asset(create_target_asset_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def delete_migration_and_wait_for_state(self, migration_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.delete_migration` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_id: (required) Unique migration identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.delete_migration` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = None try: operation_result = self.client.delete_migration(migration_id, **operation_kwargs) except oci.exceptions.ServiceError as e: if e.status == 404: return WAIT_RESOURCE_NOT_FOUND else: raise e if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def delete_migration_asset_and_wait_for_state(self, migration_asset_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.delete_migration_asset` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_asset_id: (required) Unique migration asset identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.delete_migration_asset` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = None try: operation_result = self.client.delete_migration_asset(migration_asset_id, **operation_kwargs) except oci.exceptions.ServiceError as e: if e.status == 404: return WAIT_RESOURCE_NOT_FOUND else: raise e if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def delete_migration_plan_and_wait_for_state(self, migration_plan_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.delete_migration_plan` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_plan_id: (required) Unique migration plan identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.delete_migration_plan` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = None try: operation_result = self.client.delete_migration_plan(migration_plan_id, **operation_kwargs) except oci.exceptions.ServiceError as e: if e.status == 404: return WAIT_RESOURCE_NOT_FOUND else: raise e if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def delete_replication_schedule_and_wait_for_state(self, replication_schedule_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.delete_replication_schedule` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str replication_schedule_id: (required) Unique replication schedule identifier in path :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.delete_replication_schedule` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = None try: operation_result = self.client.delete_replication_schedule(replication_schedule_id, **operation_kwargs) except oci.exceptions.ServiceError as e: if e.status == 404: return WAIT_RESOURCE_NOT_FOUND else: raise e if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def delete_target_asset_and_wait_for_state(self, target_asset_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.delete_target_asset` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str target_asset_id: (required) Unique target asset identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.delete_target_asset` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = None try: operation_result = self.client.delete_target_asset(target_asset_id, **operation_kwargs) except oci.exceptions.ServiceError as e: if e.status == 404: return WAIT_RESOURCE_NOT_FOUND else: raise e if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def execute_migration_plan_and_wait_for_state(self, migration_plan_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.execute_migration_plan` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_plan_id: (required) Unique migration plan identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.execute_migration_plan` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.execute_migration_plan(migration_plan_id, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def import_migration_plan_and_wait_for_state(self, migration_plan_id, import_migration_plan_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.import_migration_plan` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_plan_id: (required) Unique migration plan identifier :param stream import_migration_plan_details: (required) The csv file to be uploaded. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.import_migration_plan` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.import_migration_plan(migration_plan_id, import_migration_plan_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def refresh_migration_and_wait_for_state(self, migration_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.refresh_migration` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_id: (required) Unique migration identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.refresh_migration` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.refresh_migration(migration_id, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def refresh_migration_asset_and_wait_for_state(self, migration_asset_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.refresh_migration_asset` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_asset_id: (required) Unique migration asset identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.refresh_migration_asset` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.refresh_migration_asset(migration_asset_id, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def refresh_migration_plan_and_wait_for_state(self, migration_plan_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.refresh_migration_plan` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_plan_id: (required) Unique migration plan identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.refresh_migration_plan` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.refresh_migration_plan(migration_plan_id, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def start_asset_replication_and_wait_for_state(self, migration_asset_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.start_asset_replication` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_asset_id: (required) Unique migration asset identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.start_asset_replication` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.start_asset_replication(migration_asset_id, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def start_migration_replication_and_wait_for_state(self, migration_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.start_migration_replication` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_id: (required) Unique migration identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.start_migration_replication` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.start_migration_replication(migration_id, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def update_migration_and_wait_for_state(self, migration_id, update_migration_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.update_migration` and waits for the :py:class:`~oci.cloud_migrations.models.Migration` acted upon to enter the given state(s). :param str migration_id: (required) Unique migration identifier :param oci.cloud_migrations.models.UpdateMigrationDetails update_migration_details: (required) The information to be updated. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.Migration.lifecycle_state` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.update_migration` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.update_migration(migration_id, update_migration_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] migration_id = operation_result.data.id try: waiter_result = oci.wait_until( self.client, self.client.get_migration(migration_id), # noqa: F821 evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except (NameError, TypeError) as e: if not e.args: e.args = ('',) e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', ) raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def update_migration_asset_and_wait_for_state(self, migration_asset_id, update_migration_asset_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.update_migration_asset` and waits for the :py:class:`~oci.cloud_migrations.models.MigrationAsset` acted upon to enter the given state(s). :param str migration_asset_id: (required) Unique migration asset identifier :param oci.cloud_migrations.models.UpdateMigrationAssetDetails update_migration_asset_details: (required) The information to be updated. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.MigrationAsset.lifecycle_state` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.update_migration_asset` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.update_migration_asset(migration_asset_id, update_migration_asset_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] migration_asset_id = operation_result.data.id try: waiter_result = oci.wait_until( self.client, self.client.get_migration_asset(migration_asset_id), # noqa: F821 evaluate_response=lambda r: getattr(r.data, 'lifecycle_state') and getattr(r.data, 'lifecycle_state').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except (NameError, TypeError) as e: if not e.args: e.args = ('',) e.args = e.args + ('This composite operation is currently not supported in the SDK. Please use the operation from the service client and use waiters as an alternative. For more information on waiters, visit: "https://docs.oracle.com/en-us/iaas/tools/python/latest/api/waiters.html"', ) raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def update_migration_plan_and_wait_for_state(self, migration_plan_id, update_migration_plan_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.update_migration_plan` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str migration_plan_id: (required) Unique migration plan identifier :param oci.cloud_migrations.models.UpdateMigrationPlanDetails update_migration_plan_details: (required) The information to be updated. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.update_migration_plan` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.update_migration_plan(migration_plan_id, update_migration_plan_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def update_replication_schedule_and_wait_for_state(self, replication_schedule_id, update_replication_schedule_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.update_replication_schedule` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str replication_schedule_id: (required) Unique replication schedule identifier in path :param oci.cloud_migrations.models.UpdateReplicationScheduleDetails update_replication_schedule_details: (required) The information to be updated. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.update_replication_schedule` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.update_replication_schedule(replication_schedule_id, update_replication_schedule_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e) def update_target_asset_and_wait_for_state(self, target_asset_id, update_target_asset_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.cloud_migrations.MigrationClient.update_target_asset` and waits for the :py:class:`~oci.cloud_migrations.models.WorkRequest` to enter the given state(s). :param str target_asset_id: (required) Unique target asset identifier :param oci.cloud_migrations.models.UpdateTargetAssetDetails update_target_asset_details: (required) The information to be updated. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.cloud_migrations.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.cloud_migrations.MigrationClient.update_target_asset` :param dict waiter_kwargs: A dictionary of keyword arguments to pass to the :py:func:`oci.wait_until` function. For example, you could pass ``max_interval_seconds`` or ``max_interval_seconds`` as dictionary keys to modify how long the waiter function will wait between retries and the maximum amount of time it will wait """ operation_result = self.client.update_target_asset(target_asset_id, update_target_asset_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] if 'opc-work-request-id' not in operation_result.headers: return operation_result wait_for_resource_id = operation_result.headers['opc-work-request-id'] try: waiter_result = oci.wait_until( self.client, self.client.get_work_request(wait_for_resource_id), evaluate_response=lambda r: getattr(r.data, 'status') and getattr(r.data, 'status').lower() in lowered_wait_for_states, **waiter_kwargs ) result_to_return = waiter_result return result_to_return except Exception as e: raise oci.exceptions.CompositeOperationError(partial_results=[operation_result], cause=e)