o
    ɶd%                     @   sf  d dl Z d dlZddlmZ d dlmZ d dlmZ	 d
eZe   Zd
eeZG dd	 d	eZG d
d deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG d d! d!eZG d"d# d#eZG d$d% d%eZG d&d' d'e	ZG d(d) d)eZdS )*    N   )__version__)RequestException)ConnectTimeoutzOracle-PythonSDK/{}zClient Version: {}, OS Version: {}, See https://docs.oracle.com/iaas/Content/API/Concepts/sdk_troubleshooting.htm for common issues and steps to resolve them. If you need to contact support, or file a GitHub issue, please include this full error message.c                       s(   e Zd ZdZ fddZdd Z  ZS )ServiceErrorz'The service returned an error response.c                    s^  || _ || _|| _|| _|d| _|  | _|d| _|d| _	|d| _
|d| _|d| _|d| _dt| j t| j t| j }d	| j
}|sZd
| j  }| j
||| j|| j| j| j| jdd
}| j	r{d|| j	||d< nd|||d< t|dtrtj|d}	|	 D ]\}
}|
|vr|||
< qtt| | d S )Noriginal_requestoperation_nameapi_reference_linktarget_servicerequest_endpointclient_version	timestampzSee https://docs.oracle.com/iaas/Content/API/References/apierrors.htm#apierrors_{}__{}_{} for more information about resolving this error.zsIf you are unable to resolve this {} issue, please contact Oracle support and provide them this full error message.z"The service returned error code %szTo get more info on the failing request, refer to https://docs.oracle.com/en-us/iaas/tools/python/latest/logging.html for ways to log the request/response details.)
r
   statuscodeopc-request-idmessager   r   r   r   Zlogging_tipsz?{} Also see {} for details on this operation's requirements. {}Ztroubleshooting_tipsz{} {}deserialized_data)r   r   headersr   getr   _get_opc_request_idZ
request_idr   r	   r
   r   r   r   formatstrlower
isinstancedictociutilZcamel_to_snake_keysitemssuperr   __init__)selfr   r   r   r   kwargsZapi_errors_infoZcontact_infoZerror_detailsr   keyvalue	__class__ 2usr/lib/python3.10/site-packages/oci/exceptions.pyr      sJ   
$
zServiceError.__init__c                 C   s8   | j dr| j dS | jr| jjr| jjdS d S )Nr   )r   r   r   Zheader_paramsr    r&   r&   r'   r   B   s
   z ServiceError._get_opc_request_id)__name__
__module____qualname____doc__r   r   __classcell__r&   r&   r$   r'   r      s    0r   c                   @      e Zd ZdZdS )TransientServiceErrorz"A transient service error occurredNr)   r*   r+   r,   r&   r&   r&   r'   r/   K       r/   c                   @   r.   )ClientErrorzA client-side error occurred..Nr0   r&   r&   r&   r'   r2   O   r1   r2   c                   @   r.   )ConfigFileNotFoundzConfig file not be found.Nr0   r&   r&   r&   r'   r3   S   r1   r3   c                   @   s    e Zd ZdZdd Zdd ZdS )InvalidConfigzThe config object is missing required keys or contains malformed values.

    For example:

    .. code-block:: python

        raise InvalidConfig({
            "region": "missing",
            "key_id": "malformed'
        })
    c                 C   s
   || _ dS )z':param errors: {config key: error code}N)errors)r    r5   r&   r&   r'   r   c   s   
zInvalidConfig.__init__c                 C   s
   t | jS N)r   r5   r(   r&   r&   r'   __str__g   s   
zInvalidConfig.__str__N)r)   r*   r+   r,   r   r7   r&   r&   r&   r'   r4   W   s    r4   c                   @   r.   )!InvalidResourcePrincipalArgumentszThe ResourceId is missing.Nr0   r&   r&   r&   r'   r8   k   r1   r8   c                   @   r.   )InvalidPrivateKeyzOThe provided key is not a private key, or the provided passphrase is incorrect.Nr0   r&   r&   r&   r'   r9   o   r1   r9   c                   @   r.   )MissingPrivateKeyPassphrasez'The provided key requires a passphrase.Nr0   r&   r&   r&   r'   r:   s   r1   r:   c                   @   r.   )InvalidKeyFilePathzKThe value is expected to be a file name but it's not a valid key_file path.Nr0   r&   r&   r&   r'   r;   w   r1   r;   c                   @   r.   )ProfileNotFoundz7The specified profile was not found in the config file.Nr0   r&   r&   r&   r'   r<   {   r1   r<   c                   @   r.   )WaitUntilNotSupportedz-wait_until is not supported by this response.Nr0   r&   r&   r&   r'   r=      r1   r=   c                   @   r.   )MaximumWaitTimeExceededz$Maximum wait time has been exceeded.Nr0   r&   r&   r&   r'   r>      r1   r>   c                       s    e Zd ZdZ fddZ  ZS )MultipartUploadErrorz
    Exception thrown when an error with a multipart upload occurs. As multipart uploads can be
    parallelised, this error contains a collection of errors which caused individual part uploads
    to fail
    c                    sZ   g | _ d|v r|d  s| j |d   |d  rdt | _tt| | j dS )z
        :param queue error_causes_queue:
            A queue containing errors which occured during the multipart upload
        Zerror_causes_queuez,MultipartUploadError exception has occured. N)	Zerror_causesemptyappendr   $UPLOAD_MANAGER_DEBUG_INFORMATION_LOGr   r   	Exceptionr   )r    r!   r$   r&   r'   r      s   
zMultipartUploadError.__init__)r)   r*   r+   r,   r   r-   r&   r&   r$   r'   r?      s    r?   c                   @   s   e Zd ZdZg dfddZdS )CompositeOperationErrora-  
    An exception occurred during a composite operation (e.g. launching an instance and waiting for state)
    but part of the composite operation succeeded. This exception has the following attributes:

    :var list partial_results: Any partial results which are available (e.g. if the :py:meth:`~oci.core.ComputeClient.launch_instance` succeeded and the waiting for state failed then this will contain the :py:meth:`~oci.core.ComputeClient.launch_instance` result)
    :var Exception cause: The exception which caused the composite operation to fail
    Nc                 C   s   || _ || _d S r6   )partial_resultscause)r    rE   rF   r&   r&   r'   r      s   
z CompositeOperationError.__init__)r)   r*   r+   r,   r   r&   r&   r&   r'   rD      s    rD   c                   @   r.   )r   z-An exception occurred when making the requestNr0   r&   r&   r&   r'   r      r1   r   c                   @   r.   )r   zThe request timed out while trying to connect to the remote server.

    Requests that produced this error are safe to retry.
    Nr0   r&   r&   r&   r'   r      r1   r   c                   @   r.   )/MissingEndpointForNonRegionalServiceClientErrorzXNo endpoint value was provided when trying to create a non-regional service client.
    Nr0   r&   r&   r&   r'   rG      r1   rG   )platformZoci.utilr   versionr   Zoci._vendor.requests.exceptionsr   ZBaseRequestExceptionr   ZBaseConnectTimeoutr   ZCLIENT_VERSIONZ
OS_VERSIONrB   rC   r   r/   r2   r3   r4   r8   r9   r:   r;   r<   r=   r>   r?   rD   
ValueErrorrG   r&   r&   r&   r'   <module>   s2   
<