/
lib
/
python3.9
/
site-packages
/
oci
/
globally_distributed_database
/
Upload File
HOME
# 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: 20230301 import oci # noqa: F401 from oci.util import WAIT_RESOURCE_NOT_FOUND # noqa: F401 class ShardedDatabaseServiceClientCompositeOperations(object): """ This class provides a wrapper around :py:class:`~oci.globally_distributed_database.ShardedDatabaseServiceClient` 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 ShardedDatabaseServiceClientCompositeOperations object :param ShardedDatabaseServiceClient client: The service client which will be wrapped by this object """ self.client = client def change_private_endpoint_compartment_and_wait_for_state(self, change_private_endpoint_compartment_details, private_endpoint_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.change_private_endpoint_compartment` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param oci.globally_distributed_database.models.ChangePrivateEndpointCompartmentDetails change_private_endpoint_compartment_details: (required) Request to move the private endpoint to a different compartment. :param str private_endpoint_id: (required) Oracle Sharded Database PrivateEndpoint identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.change_private_endpoint_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_private_endpoint_compartment(change_private_endpoint_compartment_details, private_endpoint_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 change_sharded_database_compartment_and_wait_for_state(self, change_sharded_database_compartment_details, sharded_database_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.change_sharded_database_compartment` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param oci.globally_distributed_database.models.ChangeShardedDatabaseCompartmentDetails change_sharded_database_compartment_details: (required) Request to move the sharded database to a different compartment. :param str sharded_database_id: (required) Sharded Database identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.change_sharded_database_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_sharded_database_compartment(change_sharded_database_compartment_details, sharded_database_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 configure_sharded_database_gsms_and_wait_for_state(self, configure_sharded_database_gsms_details, sharded_database_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.configure_sharded_database_gsms` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param oci.globally_distributed_database.models.ConfigureShardedDatabaseGsmsDetails configure_sharded_database_gsms_details: (required) Details to configure the new GSM instances for the sharded database. :param str sharded_database_id: (required) Sharded Database identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.configure_sharded_database_gsms` :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.configure_sharded_database_gsms(configure_sharded_database_gsms_details, sharded_database_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 configure_sharding_and_wait_for_state(self, sharded_database_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.configure_sharding` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.configure_sharding` :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.configure_sharding(sharded_database_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 create_private_endpoint_and_wait_for_state(self, create_private_endpoint_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.create_private_endpoint` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param oci.globally_distributed_database.models.CreatePrivateEndpointDetails create_private_endpoint_details: (required) Details of PrivateEndpoint to be created. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.create_private_endpoint` :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_private_endpoint(create_private_endpoint_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_sharded_database_and_wait_for_state(self, create_sharded_database_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.create_sharded_database` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param oci.globally_distributed_database.models.CreateShardedDatabaseDetails create_sharded_database_details: (required) Details of Sharded database to be created. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.create_sharded_database` :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_sharded_database(create_sharded_database_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_private_endpoint_and_wait_for_state(self, private_endpoint_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.delete_private_endpoint` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str private_endpoint_id: (required) Oracle Sharded Database PrivateEndpoint identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.delete_private_endpoint` :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_private_endpoint(private_endpoint_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_sharded_database_and_wait_for_state(self, sharded_database_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.delete_sharded_database` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.delete_sharded_database` :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_sharded_database(sharded_database_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 generate_gsm_certificate_signing_request_and_wait_for_state(self, sharded_database_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.generate_gsm_certificate_signing_request` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.generate_gsm_certificate_signing_request` :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.generate_gsm_certificate_signing_request(sharded_database_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 patch_sharded_database_and_wait_for_state(self, sharded_database_id, patch_sharded_database_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.patch_sharded_database` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param oci.globally_distributed_database.models.PatchShardedDatabaseDetails patch_sharded_database_details: (required) The payload containing instructions to patch the sharded database. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.patch_sharded_database` :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.patch_sharded_database(sharded_database_id, patch_sharded_database_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 reinstate_proxy_instance_and_wait_for_state(self, private_endpoint_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.reinstate_proxy_instance` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str private_endpoint_id: (required) Oracle Sharded Database PrivateEndpoint identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.reinstate_proxy_instance` :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.reinstate_proxy_instance(private_endpoint_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_sharded_database_and_wait_for_state(self, sharded_database_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.start_sharded_database` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.start_sharded_database` :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_sharded_database(sharded_database_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 stop_sharded_database_and_wait_for_state(self, sharded_database_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.stop_sharded_database` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.stop_sharded_database` :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.stop_sharded_database(sharded_database_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_private_endpoint_and_wait_for_state(self, private_endpoint_id, update_private_endpoint_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.update_private_endpoint` and waits for the :py:class:`~oci.globally_distributed_database.models.PrivateEndpoint` acted upon to enter the given state(s). :param str private_endpoint_id: (required) Oracle Sharded Database PrivateEndpoint identifier :param oci.globally_distributed_database.models.UpdatePrivateEndpointDetails update_private_endpoint_details: (required) The configuration of private endpoint 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.globally_distributed_database.models.PrivateEndpoint.lifecycle_state` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.update_private_endpoint` :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_private_endpoint(private_endpoint_id, update_private_endpoint_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] private_endpoint_id = operation_result.data.id try: waiter_result = oci.wait_until( self.client, self.client.get_private_endpoint(private_endpoint_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_sharded_database_and_wait_for_state(self, sharded_database_id, update_sharded_database_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.update_sharded_database` and waits for the :py:class:`~oci.globally_distributed_database.models.ShardedDatabase` acted upon to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param oci.globally_distributed_database.models.UpdateShardedDatabaseDetails update_sharded_database_details: (required) The configuration of Sharded database 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.globally_distributed_database.models.ShardedDatabase.lifecycle_state` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.update_sharded_database` :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_sharded_database(sharded_database_id, update_sharded_database_details, **operation_kwargs) if not wait_for_states: return operation_result lowered_wait_for_states = [w.lower() for w in wait_for_states] sharded_database_id = operation_result.data.id try: waiter_result = oci.wait_until( self.client, self.client.get_sharded_database(sharded_database_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 upload_signed_certificate_and_generate_wallet_and_wait_for_state(self, sharded_database_id, upload_signed_certificate_and_generate_wallet_details, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.upload_signed_certificate_and_generate_wallet` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param oci.globally_distributed_database.models.UploadSignedCertificateAndGenerateWalletDetails upload_signed_certificate_and_generate_wallet_details: (required) Details required to upload the CA signed certificates to GSM instances of sharded database and generate the wallets. :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.upload_signed_certificate_and_generate_wallet` :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.upload_signed_certificate_and_generate_wallet(sharded_database_id, upload_signed_certificate_and_generate_wallet_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 validate_network_and_wait_for_state(self, sharded_database_id, wait_for_states=[], operation_kwargs={}, waiter_kwargs={}): """ Calls :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.validate_network` and waits for the :py:class:`~oci.globally_distributed_database.models.WorkRequest` to enter the given state(s). :param str sharded_database_id: (required) Sharded Database identifier :param list[str] wait_for_states: An array of states to wait on. These should be valid values for :py:attr:`~oci.globally_distributed_database.models.WorkRequest.status` :param dict operation_kwargs: A dictionary of keyword arguments to pass to :py:func:`~oci.globally_distributed_database.ShardedDatabaseServiceClient.validate_network` :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.validate_network(sharded_database_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)