o
    ɶd                     @   s   d dl mZ d dlmZ d dlmZ d dlmZmZ d dlm	Z	 d dl
mZmZ d dlmZ d dlmZmZmZ d	d
lmZ edZG dd deZdS )    )absolute_import)requests)six)retrycircuit_breaker)
BaseClient)get_config_value_or_defaultvalidate_config)Signer)Sentinel#get_signer_from_authentication_typeAUTHENTICATION_TYPE_FIELD_NAME   )budget_type_mappingZMissingc                   @   sh   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS )BudgetClientzB
    Use the Budgets API to manage budgets and budget alerts.
    c              
   K   s  t ||dd d|v r|d }n"t|v rt|}nt|d |d |d |dt|d|dd	}d
|dddi |dd|dtj|dd}d|v rY|d|d< |ddu retj|d< d|v rp|d|d< t	d||t
fi || _|d| _|d| _dS )a  
        Creates a new service client

        :param dict config:
            Configuration keys and values as per `SDK and Tool Configuration <https://docs.cloud.oracle.com/Content/API/Concepts/sdkconfig.htm>`__.
            The :py:meth:`~oci.config.from_file` method can be used to load configuration from a file. Alternatively, a ``dict`` can be passed. You can validate_config
            the dict using :py:meth:`~oci.config.validate_config`

        :param str service_endpoint: (optional)
            The endpoint of the service to call using this client. For example ``https://iaas.us-ashburn-1.oraclecloud.com``. If this keyword argument is
            not provided then it will be derived using the region in the config parameter. You should only provide this keyword argument if you have an explicit
            need to specify a service endpoint.

        :param timeout: (optional)
            The connection and read timeouts for the client. The default values are connection timeout 10 seconds and read timeout 60 seconds. This keyword argument can be provided
            as a single float, in which case the value provided is used for both the read and connection timeouts, or as a tuple of two floats. If
            a tuple is provided then the first value is used as the connection timeout and the second value as the read timeout.
        :type timeout: float or tuple(float, float)

        :param signer: (optional)
            The signer to use when signing requests made by the service client. The default is to use a :py:class:`~oci.signer.Signer` based on the values
            provided in the config parameter.

            One use case for this parameter is for `Instance Principals authentication <https://docs.cloud.oracle.com/Content/Identity/Tasks/callingservicesfrominstances.htm>`__
            by passing an instance of :py:class:`~oci.auth.signers.InstancePrincipalsSecurityTokenSigner` as the value for this keyword argument
        :type signer: :py:class:`~oci.signer.AbstractBaseSigner`

        :param obj retry_strategy: (optional)
            A retry strategy to apply to all calls made by this service client (i.e. at the client level). There is no retry strategy applied by default.
            Retry strategies can also be applied at the operation level by passing a ``retry_strategy`` keyword argument as part of calling the operation.
            Any value provided at the operation level will override whatever is specified at the client level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY`
            is also available. The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

        :param obj circuit_breaker_strategy: (optional)
            A circuit breaker strategy to apply to all calls made by this service client (i.e. at the client level).
            This client uses :py:data:`~oci.circuit_breaker.DEFAULT_CIRCUIT_BREAKER_STRATEGY` as default if no circuit breaker strategy is provided.
            The specifics of circuit breaker strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/circuit_breakers.html>`__.

        :param function circuit_breaker_callback: (optional)
            Callback function to receive any exceptions triggerred by the circuit breaker.

        :param bool client_level_realm_specific_endpoint_template_enabled: (optional)
            A boolean flag to indicate whether or not this client should be created with realm specific endpoint template enabled or disable. By default, this will be set as None.

        :param allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this client should allow control characters in the response object. By default, the client will not
            allow control characters to be in the response object.
        signer)r   tenancyuserfingerprintZkey_filepass_phraseZkey_content)r   r   r   Zprivate_key_file_locationr   Zprivate_key_contentTservice_endpointz	/20190111z.https://usage.{region}.oci.{secondLevelDomain}skip_deserializationFcircuit_breaker_strategy5client_level_realm_specific_endpoint_template_enabled)Zregional_clientr   	base_pathZservice_endpoint_templateZ#service_endpoint_template_per_realmr   r   r   timeoutNallow_control_charsZbudgetretry_strategycircuit_breaker_callback)r	   getr   r   r
   r   r   ZGLOBAL_CIRCUIT_BREAKER_STRATEGYZ DEFAULT_CIRCUIT_BREAKER_STRATEGYr   r   base_clientr   r   )selfconfigkwargsr   Zbase_client_init_kwargs r$   <usr/lib/python3.10/site-packages/oci/budget/budget_client.py__init__   s>   3





zBudgetClient.__init__c                    sx  dg}d}d}d}d}g d  fddt |D }	|	r$td	|	d|i}
d
d t |
D }
t |
D ]\}}|du sMt|t jrTt| dkrTtd|q7dd|	dt
|	dt
d}dd t |D }| jj|	d| jd}|rt|tjs| j| | j| || j |j| jj|||
||d|	d|||dS | jj|||
||d|	d|||d
S )a  
        Creates a new Alert Rule.


        :param str budget_id: (required)
            The unique budget OCID.

        :param oci.budget.models.CreateAlertRuleDetails create_alert_rule_details: (required)
            Details for the new Alert Rule.

        :param str opc_retry_token: (optional)
            A token that uniquely identifies a request so it can be retried, in case of a timeout or
            server error, without risk of executing that same action again. Retry tokens expire after 24
            hours, but can be invalidated before then due to conflicting operations. For example, if a resource
            has been deleted and purged from the system, then a retry of the original creation request
            might be rejected.

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.budget.models.AlertRule`
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/create_alert_rule.py.html>`__ to see an example of how to use create_alert_rule API.
        budgetId/budgets/{budgetId}/alertRulesPOSTcreate_alert_rulezPhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/AlertRule/CreateAlertRuler   r   opc_retry_tokenopc_request_idc                       g | ]}| vr|qS r$   r$   .0_keyZexpected_kwargsr$   r%   
<listcomp>       z2BudgetClient.create_alert_rule.<locals>.<listcomp>z*create_alert_rule got unknown kwargs: {!r}c                 S      i | ]\}}|t ur||qS r$   missingr0   kvr$   r$   r%   
<dictcomp>       z2BudgetClient.create_alert_rule.<locals>.<dictcomp>Nr   7Parameter {} cannot be None, whitespace or empty stringapplication/jsonr,   r-   acceptcontent-typezopc-retry-tokenopc-request-idc                 S   &   i | ]\}}|t ur|d ur||qS Nr6   r8   r$   r$   r%   r;         & r   Zoperation_retry_strategyZclient_retry_strategy	AlertRuler   
resource_pathmethodpath_paramsheader_paramsbodyresponse_typer   operation_nameapi_reference_linkrequired_arguments)r   iterkeys
ValueErrorformat	iteritems
isinstancestring_typeslenstripr   r7   r    get_preferred_retry_strategyr   r   NoneRetryStrategyadd_opc_retry_token_if_neededadd_opc_client_retries_headeradd_circuit_breaker_callbackr   make_retrying_callcall_api)r!   	budget_idZcreate_alert_rule_detailsr#   rQ   rI   rJ   rO   rP   extra_kwargsrK   r9   r:   rL   r   r$   r2   r%   r*   r   st   ($

zBudgetClient.create_alert_rulec                    s  g }d}d}d}d}g d  fddt |D }|r#td|d	d	|d
t|dtd}	dd t |	D }	| jj|d| j	d}
|
rvt
|
tjsb| j|	 | j|	 |
| j |
j| jj|||	|d|d|||d
S | jj|||	|d|d|||d	S )aZ  
        Creates a new budget.


        :param oci.budget.models.CreateBudgetDetails create_budget_details: (required)
            Details for the new budget.

        :param str opc_retry_token: (optional)
            A token that uniquely identifies a request so it can be retried, in case of a timeout or
            server error, without risk of executing that same action again. Retry tokens expire after 24
            hours, but can be invalidated before then due to conflicting operations. For example, if a resource
            has been deleted and purged from the system, then a retry of the original creation request
            might be rejected.

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.budget.models.Budget`
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/create_budget.py.html>`__ to see an example of how to use create_budget API.
        /budgetsr)   create_budgetzJhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/Budget/CreateBudgetr+   c                    r.   r$   r$   r/   r2   r$   r%   r3     r4   z.BudgetClient.create_budget.<locals>.<listcomp>z&create_budget got unknown kwargs: {!r}r>   r,   r-   r?   c                 S   rC   rD   r6   r8   r$   r$   r%   r;     rE   z.BudgetClient.create_budget.<locals>.<dictcomp>r   rF   Budgetr   )	rI   rJ   rL   rM   rN   r   rO   rP   rQ   )r   rR   rS   rT   r   r7   rU   r    rZ   r   rV   r   r[   r\   r]   r^   r   r_   r`   )r!   Zcreate_budget_detailsr#   rQ   rI   rJ   rO   rP   rb   rL   r   r$   r2   r%   rd      sb   %

zBudgetClient.create_budgetc                    sh  ddg}d}d}d}d}g d  fdd	t |D }	|	r%td
|	||d}
dd t |
D }
t |
D ]\}}|du sOt|t jrVt| dkrVtd|q9dd|	dt
|	dt
d}dd t |D }| jj|	d| jd}|rt|tjs| j| || j |j| jj|||
||	d|||d	S | jj|||
||	d|||dS )a  
        Deletes a specified Alert Rule resource.


        :param str budget_id: (required)
            The unique budget OCID.

        :param str alert_rule_id: (required)
            The unique Alert Rule OCID.

        :param str if_match: (optional)
            For optimistic concurrency control. In the PUT or DELETE call
            for a resource, set the `if-match` parameter to the value of the
            etag from a previous GET or POST response for that resource.
            The resource will be updated or deleted only if the etag you
            provide matches the resource's current etag value.

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type None
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/delete_alert_rule.py.html>`__ to see an example of how to use delete_alert_rule API.
        r'   alertRuleId,/budgets/{budgetId}/alertRules/{alertRuleId}DELETEdelete_alert_rulezPhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/AlertRule/DeleteAlertRuler   r   if_matchr-   c                    r.   r$   r$   r/   r2   r$   r%   r3   v  r4   z2BudgetClient.delete_alert_rule.<locals>.<listcomp>z*delete_alert_rule got unknown kwargs: {!r}r'   rf   c                 S   r5   r$   r6   r8   r$   r$   r%   r;     r<   z2BudgetClient.delete_alert_rule.<locals>.<dictcomp>Nr   r=   r>   rk   r-   r@   rA   zif-matchrB   c                 S   rC   rD   r6   r8   r$   r$   r%   r;     rE   r   rF   r   rI   rJ   rK   rL   r   rO   rP   rQ   r   rR   rS   rT   rU   rV   rW   rX   rY   r   r7   r    rZ   r   r   r[   r]   r^   r   r_   r`   r!   ra   alert_rule_idr#   rQ   rI   rJ   rO   rP   rb   rK   r9   r:   rL   r   r$   r2   r%   ri   A  sl   ($

zBudgetClient.delete_alert_rulec                    sd  dg}d}d}d}d}g d  fddt |D }|r$td	|d|i}	d
d t |	D }	t |	D ]\}
}|du sMt|t jrTt| dkrTtd|
q7dd|	dt
|	dt
d}dd t |D }| jj|	d| jd}|rt|tjs| j| || j |j| jj|||	||	d|||d	S | jj|||	||	d|||dS )a  
        Deletes a specified budget resource.


        :param str budget_id: (required)
            The unique budget OCID.

        :param str if_match: (optional)
            For optimistic concurrency control. In the PUT or DELETE call
            for a resource, set the `if-match` parameter to the value of the
            etag from a previous GET or POST response for that resource.
            The resource will be updated or deleted only if the etag you
            provide matches the resource's current etag value.

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type None
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/delete_budget.py.html>`__ to see an example of how to use delete_budget API.
        r'   /budgets/{budgetId}rh   delete_budgetzJhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/Budget/DeleteBudgetrj   c                    r.   r$   r$   r/   r2   r$   r%   r3     r4   z.BudgetClient.delete_budget.<locals>.<listcomp>z&delete_budget got unknown kwargs: {!r}c                 S   r5   r$   r6   r8   r$   r$   r%   r;     r<   z.BudgetClient.delete_budget.<locals>.<dictcomp>Nr   r=   r>   rk   r-   rm   c                 S   rC   rD   r6   r8   r$   r$   r%   r;     rE   r   rF   r   rn   ro   r!   ra   r#   rQ   rI   rJ   rO   rP   rb   rK   r9   r:   rL   r   r$   r2   r%   rs     sj   %$

zBudgetClient.delete_budgetc                    sb  ddg}d}d}d}d}g d  fdd	t |D }	|	r%td
|	||d}
dd t |
D }
t |
D ]\}}|du sOt|t jrVt| dkrVtd|q9dd|	dt
d}dd t |D }| jj|	d| jd}|rt|tjs| j| || j |j| jj|||
|d|	d|||d
S | jj|||
|d|	d|||d	S )a  
        Gets an Alert Rule for a specified budget.


        :param str budget_id: (required)
            The unique budget OCID.

        :param str alert_rule_id: (required)
            The unique Alert Rule OCID.

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.budget.models.AlertRule`
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/get_alert_rule.py.html>`__ to see an example of how to use get_alert_rule API.
        r'   rf   rg   GETget_alert_rulezMhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/AlertRule/GetAlertRuler   r   r-   c                    r.   r$   r$   r/   r2   r$   r%   r3   @  r4   z/BudgetClient.get_alert_rule.<locals>.<listcomp>z'get_alert_rule got unknown kwargs: {!r}rl   c                 S   r5   r$   r6   r8   r$   r$   r%   r;   J  r<   z/BudgetClient.get_alert_rule.<locals>.<dictcomp>Nr   r=   r>   r-   r@   rA   rB   c                 S   rC   rD   r6   r8   r$   r$   r%   r;   U  rE   r   rF   rG   r   	rI   rJ   rK   rL   rN   r   rO   rP   rQ   ro   rp   r$   r2   r%   rv     sn   !$
zBudgetClient.get_alert_rulec                    s^  dg}d}d}d}d}g d  fddt |D }|r$td	|d|i}	d
d t |	D }	t |	D ]\}
}|du sMt|t jrTt| dkrTtd|
q7dd|	dt
d}dd t |D }| jj|	d| jd}|rt|tjs| j| || j |j| jj|||	|d|	d|||d
S | jj|||	|d|	d|||d	S )a9  
        Gets a budget by the identifier.


        :param str budget_id: (required)
            The unique budget OCID.

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.budget.models.Budget`
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/get_budget.py.html>`__ to see an example of how to use get_budget API.
        r'   rr   ru   
get_budgetzGhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/Budget/GetBudgetrw   c                    r.   r$   r$   r/   r2   r$   r%   r3     r4   z+BudgetClient.get_budget.<locals>.<listcomp>z#get_budget got unknown kwargs: {!r}c                 S   r5   r$   r6   r8   r$   r$   r%   r;     r<   z+BudgetClient.get_budget.<locals>.<dictcomp>Nr   r=   r>   r-   rx   c                 S   rC   rD   r6   r8   r$   r$   r%   r;     rE   r   rF   re   r   ry   ro   rt   r$   r2   r%   rz   w  sl   $
zBudgetClient.get_budgetc                    s8  dg}d}d}d}d}g d  fddt |D }|r$td	|d|i}	d
d t |	D }	t |	D ]\}
}|du sMt|t jrTt| dkrTtd|
q7d|v rjddg}|d |vrjtd|d|v rddg}|d |vrtd|d|v rddg}|d |vrtd||	dt
|	dt
|	dt
|	dt
|	dt
|	dt
d}dd t |D }d d |	d!t
d"}d#d t |D }| jj|	d$| jd%}|r	t|tjs| j| || j |j| jj|||	||d&|	d'|||d(S | jj|||	||d&|	d'|||d(
S ))a
  
        Returns a list of Alert Rules for a specified budget.


        :param str budget_id: (required)
            The unique budget OCID.

        :param int limit: (optional)
            The maximum number of items to return.

        :param str page: (optional)
            The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.

        :param str sort_order: (optional)
            The sort order to use, either 'asc' or 'desc'.

            Allowed values are: "ASC", "DESC"

        :param str sort_by: (optional)
            The field to sort by. If not specified, the default is timeCreated.
            The default sort order for timeCreated is DESC.
            The default sort order for displayName is ASC in alphanumeric order.

            Allowed values are: "timeCreated", "displayName"

        :param str lifecycle_state: (optional)
            The current state of the resource to filter by.

            Allowed values are: "ACTIVE", "INACTIVE"

        :param str display_name: (optional)
            A user-friendly name. This does not have to be unique, and it's changeable.

            Example: `My new resource`

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.budget.models.AlertRuleSummary`
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/list_alert_rules.py.html>`__ to see an example of how to use list_alert_rules API.
        r'   r(   ru   list_alert_ruleszVhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/AlertRuleSummary/ListAlertRules)	r   r   limitpage
sort_ordersort_bylifecycle_statedisplay_namer-   c                    r.   r$   r$   r/   r2   r$   r%   r3   #  r4   z1BudgetClient.list_alert_rules.<locals>.<listcomp>z)list_alert_rules got unknown kwargs: {!r}c                 S   r5   r$   r6   r8   r$   r$   r%   r;   ,  r<   z1BudgetClient.list_alert_rules.<locals>.<dictcomp>Nr   r=   r~   ASCDESC2Invalid value for `sort_order`, must be one of {0}r   timeCreateddisplayName/Invalid value for `sort_by`, must be one of {0}r   ACTIVEINACTIVE7Invalid value for `lifecycle_state`, must be one of {0}r|   r}   r   )r|   r}   	sortOrdersortBylifecycleStater   c                 S   rC   rD   r6   r8   r$   r$   r%   r;   O  rE   r>   r-   rx   c                 S   rC   rD   r6   r8   r$   r$   r%   r;   V  rE   r   rF   zlist[AlertRuleSummary]r   )
rI   rJ   rK   query_paramsrL   rN   r   rO   rP   rQ   ro   )r!   ra   r#   rQ   rI   rJ   rO   rP   rb   rK   r9   r:   sort_order_allowed_valuessort_by_allowed_valueslifecycle_state_allowed_valuesr   rL   r   r$   r2   r%   r{     s   :$






zBudgetClient.list_alert_rulesc                    s  dg}d}d}d}d}g d  fddt |D }|r$td	|d
|v r9ddg}	|d
 |	vr9td|	d|v rNddg}
|d |
vrNtd|
d|v rcddg}|d |vrctd|d|v rxg d}|d |vrxtd|||dt|dt|d
t|dt|dt|dt|dtd}dd t |D }dd|d td!}d"d t |D }| jj|d#| j	d$}|rt
|tjs| j| || j |j| jj||||d%|d&|||d'
S | jj||||d%|d&|||d'	S )(a  
        Gets a list of budgets in a compartment.

        By default, ListBudgets returns budgets of the 'COMPARTMENT' target type, and the budget records with only one target compartment OCID.

        To list all budgets, set the targetType query parameter to ALL (for example: 'targetType=ALL').

        Additional targetTypes would be available in future releases. Clients should ignore new targetTypes,
        or upgrade to the latest version of the client SDK to handle new targetTypes.


        :param str compartment_id: (required)
            The ID of the compartment in which to list resources.

        :param int limit: (optional)
            The maximum number of items to return.

        :param str page: (optional)
            The page token representing the page at which to start retrieving results. This is usually retrieved from a previous list call.

        :param str sort_order: (optional)
            The sort order to use, either 'asc' or 'desc'.

            Allowed values are: "ASC", "DESC"

        :param str sort_by: (optional)
            The field to sort by. If not specified, the default is timeCreated.
            The default sort order for timeCreated is DESC.
            The default sort order for displayName is ASC in alphanumeric order.

            Allowed values are: "timeCreated", "displayName"

        :param str lifecycle_state: (optional)
            The current state of the resource to filter by.

            Allowed values are: "ACTIVE", "INACTIVE"

        :param str display_name: (optional)
            A user-friendly name. This does not have to be unique, and it's changeable.

            Example: `My new resource`

        :param str target_type: (optional)
            The type of target to filter by:
              * ALL - List all budgets
              * COMPARTMENT - List all budgets with targetType == "COMPARTMENT"
              * TAG - List all budgets with targetType == "TAG"

            Allowed values are: "ALL", "COMPARTMENT", "TAG"

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.budget.models.BudgetSummary`
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/list_budgets.py.html>`__ to see an example of how to use list_budgets API.
        compartmentIdrc   ru   list_budgetszPhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/BudgetSummary/ListBudgets)
r   r   r|   r}   r~   r   r   r   target_typer-   c                    r.   r$   r$   r/   r2   r$   r%   r3     r4   z-BudgetClient.list_budgets.<locals>.<listcomp>z%list_budgets got unknown kwargs: {!r}r~   r   r   r   r   r   r   r   r   r   r   r   r   )ZALLZCOMPARTMENTZTAGz3Invalid value for `target_type`, must be one of {0}r|   r}   r   )r   r|   r}   r   r   r   r   Z
targetTypec                 S   rC   rD   r6   r8   r$   r$   r%   r;     rE   z-BudgetClient.list_budgets.<locals>.<dictcomp>r>   r-   rx   c                 S   rC   rD   r6   r8   r$   r$   r%   r;     rE   r   rF   zlist[BudgetSummary]r   )	rI   rJ   r   rL   rN   r   rO   rP   rQ   )r   rR   rS   rT   r   r7   rU   r    rZ   r   rV   r   r[   r]   r^   r   r_   r`   )r!   Zcompartment_idr#   rQ   rI   rJ   rO   rP   rb   r   r   r   Ztarget_type_allowed_valuesr   rL   r   r$   r2   r%   r   z  s   I








zBudgetClient.list_budgetsc                    sp  ddg}d}d}d}d}	g d  fdd	t |D }
|
r%td
|
||d}dd t |D }t |D ]\}}|du sOt|t jrVt| dkrVtd|q9dd|	dt
|	dt
d}dd t |D }| jj|	d| jd}|rt|tjs| j| || j |j| jj|||||d|	d||	|dS | jj|||||d|	d||	|d
S )a  
        Update an Alert Rule for the budget identified by the OCID.


        :param str budget_id: (required)
            The unique budget OCID.

        :param str alert_rule_id: (required)
            The unique Alert Rule OCID.

        :param oci.budget.models.UpdateAlertRuleDetails update_alert_rule_details: (required)
            The information to be updated.

        :param str if_match: (optional)
            For optimistic concurrency control. In the PUT or DELETE call
            for a resource, set the `if-match` parameter to the value of the
            etag from a previous GET or POST response for that resource.
            The resource will be updated or deleted only if the etag you
            provide matches the resource's current etag value.

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.budget.models.AlertRule`
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/update_alert_rule.py.html>`__ to see an example of how to use update_alert_rule API.
        r'   rf   rg   PUTupdate_alert_rulezPhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/AlertRule/UpdateAlertRulerj   c                    r.   r$   r$   r/   r2   r$   r%   r3   b  r4   z2BudgetClient.update_alert_rule.<locals>.<listcomp>z*update_alert_rule got unknown kwargs: {!r}rl   c                 S   r5   r$   r6   r8   r$   r$   r%   r;   l  r<   z2BudgetClient.update_alert_rule.<locals>.<dictcomp>Nr   r=   r>   rk   r-   rm   c                 S   rC   rD   r6   r8   r$   r$   r%   r;   x  rE   r   rF   rG   r   rH   ro   )r!   ra   rq   Zupdate_alert_rule_detailsr#   rQ   rI   rJ   rO   rP   rb   rK   r9   r:   rL   r   r$   r2   r%   r   *  st   +$

zBudgetClient.update_alert_rulec                    sl  dg}d}d}d}d}g d  fddt |D }	|	r$td	|	d|i}
d
d t |
D }
t |
D ]\}}|du sMt|t jrTt| dkrTtd|q7dd|	dt
|	dt
d}dd t |D }| jj|	d| jd}|rt|tjs| j| || j |j| jj|||
||d|	d|||dS | jj|||
||d|	d|||d
S )aZ  
        Update a budget identified by the OCID.


        :param str budget_id: (required)
            The unique budget OCID.

        :param oci.budget.models.UpdateBudgetDetails update_budget_details: (required)
            The information to be updated.

        :param str if_match: (optional)
            For optimistic concurrency control. In the PUT or DELETE call
            for a resource, set the `if-match` parameter to the value of the
            etag from a previous GET or POST response for that resource.
            The resource will be updated or deleted only if the etag you
            provide matches the resource's current etag value.

        :param str opc_request_id: (optional)
            The client request ID for tracing.

        :param obj retry_strategy: (optional)
            A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.

            This should be one of the strategies available in the :py:mod:`~oci.retry` module. This operation will not retry by default, users can also use the convenient :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY` provided by the SDK to enable retries for it.
            The specifics of the default retry strategy are described `here <https://docs.oracle.com/en-us/iaas/tools/python/latest/sdk_behaviors/retries.html>`__.

            To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.

        :param bool allow_control_chars: (optional)
            allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object.
            By default, the response will not allow control characters in strings

        :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.budget.models.Budget`
        :rtype: :class:`~oci.response.Response`

        :example:
        Click `here <https://docs.cloud.oracle.com/en-us/iaas/tools/python-sdk-examples/latest/budget/update_budget.py.html>`__ to see an example of how to use update_budget API.
        r'   rr   r   update_budgetzJhttps://docs.oracle.com/iaas/api/#/en/budgets/20190111/Budget/UpdateBudgetrj   c                    r.   r$   r$   r/   r2   r$   r%   r3     r4   z.BudgetClient.update_budget.<locals>.<listcomp>z&update_budget got unknown kwargs: {!r}c                 S   r5   r$   r6   r8   r$   r$   r%   r;     r<   z.BudgetClient.update_budget.<locals>.<dictcomp>Nr   r=   r>   rk   r-   rm   c                 S   rC   rD   r6   r8   r$   r$   r%   r;     rE   r   rF   re   r   rH   ro   )r!   ra   Zupdate_budget_detailsr#   rQ   rI   rJ   rO   rP   rb   rK   r9   r:   rL   r   r$   r2   r%   r     sr   ($

zBudgetClient.update_budgetN)__name__
__module____qualname____doc__r&   r*   rd   ri   rs   rv   rz   r{   r   r   r   r$   r$   r$   r%   r      s    Xo`kgd` $ 1rr   N)
__future__r   Zoci._vendorr   r   ocir   r   Zoci.base_clientr   Z
oci.configr   r	   Z
oci.signerr
   Zoci.utilr   r   r   Zmodelsr   r7   objectr   r$   r$   r$   r%   <module>   s   