o
    f>hkK                     @   s   d Z ddlmZ ddlmZmZmZmZmZmZm	Z	 ddl
mZmZmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lm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 )a  
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Serverless
    This is the public Twilio REST API.

    NOTE: This class is auto generated by OpenAPI Generator.
    https://openapi-generator.tech
    Do not edit the class manually.
    )datetime)AnyDictListOptionalUnionIteratorAsyncIterator)deserialize	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       sv   e Zd ZdZ	ddedeeef dededee f
 fdd	Z	e
dddZdddZdddZd
efddZ  ZS )DeploymentInstanceaJ  
    :ivar sid: The unique string that we created to identify the Deployment resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Deployment resource.
    :ivar service_sid: The SID of the Service that the Deployment resource is associated with.
    :ivar environment_sid: The SID of the Environment for the Deployment.
    :ivar build_sid: The SID of the Build for the deployment.
    :ivar date_created: The date and time in GMT when the Deployment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar date_updated: The date and time in GMT when the Deployment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar url: The absolute URL of the Deployment resource.
    Nversionpayloadservice_sidenvironment_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _t	|d| _
t	|d| _|d| _|||pB| jd	| _d | _d S )
Nr   account_sidr   r   	build_siddate_createddate_updatedurlr   r   r   )super__init__getr   r   r   r   r   r
   iso8601_datetimer   r   r   	_solution_context)selfr   r   r   r   r   	__class__ k/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/serverless/v1/service/environment/deployment.pyr   %   s$   
zDeploymentInstance.__init__returnDeploymentContextc                 C   s6   | j du rt| j| jd | jd | jd d| _ | j S )z
        Generate an instance context for the instance, the context is capable of
        performing various actions. All instance actions are proxied to the context

        :returns: DeploymentContext for this DeploymentInstance
        Nr   r   r   r   )r#   r*   _versionr"   r$   r'   r'   r(   _proxyC   s   
zDeploymentInstance._proxyc                 C   s
   | j  S )a
        Fetch the DeploymentInstance


        :returns: The fetched DeploymentInstance
        )r-   fetchr,   r'   r'   r(   r/   T   s   
zDeploymentInstance.fetchc                    s   | j  I dH S ){
        Asynchronous coroutine to fetch the DeploymentInstance


        :returns: The fetched DeploymentInstance
        N)r-   fetch_asyncr,   r'   r'   r(   r1   ]   s   zDeploymentInstance.fetch_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr'   r'   r(   	<genexpr>l       z.DeploymentInstance.__repr__.<locals>.<genexpr>z,<Twilio.Serverless.V1.DeploymentInstance {}>joinr"   itemsr8   r$   contextr'   r'   r(   __repr__f      
zDeploymentInstance.__repr__N)r)   r*   )r)   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   r/   r1   rD   __classcell__r'   r'   r%   r(   r      s&    


		r   c                       sX   e Zd Zdedededef fddZdefdd	Zdefd
dZdefddZ	  Z
S )r*   r   r   r   r   c                    s2   t  | |||d| _djdi | j| _dS )ar  
        Initialize the DeploymentContext

        :param version: Version that contains the resource
        :param service_sid: The SID of the Service to fetch the Deployment resource from.
        :param environment_sid: The SID of the Environment used by the Deployment to fetch.
        :param sid: The SID that identifies the Deployment resource to fetch.
        r   zH/Services/{service_sid}/Environments/{environment_sid}/Deployments/{sid}Nr'   r   r   r"   r8   _uri)r$   r   r   r   r   r%   r'   r(   r   r   s   zDeploymentContext.__init__r)   c                 C   sL   t i }d|d< | jjd| j|d}t| j|| jd | jd | jd dS )	r.   application/jsonAcceptGETmethoduriheadersr   r   r   r   )r   ofr+   r/   rO   r   r"   r$   rV   r   r'   r'   r(   r/      s   
zDeploymentContext.fetchc                    sT   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r0   rP   rQ   rR   rS   Nr   r   r   r   )r   rW   r+   r1   rO   r   r"   rX   r'   r'   r(   r1      s   
zDeploymentContext.fetch_asyncc                 C   r2   )r3   r4   c                 s   r5   r6   r7   r9   r'   r'   r(   r=      r>   z-DeploymentContext.__repr__.<locals>.<genexpr>z+<Twilio.Serverless.V1.DeploymentContext {}>r?   rB   r'   r'   r(   rD      rE   zDeploymentContext.__repr__)rG   rH   rI   r   rK   r   r   r/   r1   rD   rM   r'   r'   r%   r(   r*   p   s    r*   c                   @   s4   e Zd Zdeeef defddZdefddZdS )DeploymentPager   r)   c                 C   s   t | j|| jd | jd dS )zp
        Build an instance of DeploymentInstance

        :param payload: Payload response from the API
        r   r   r   r   )r   r+   r"   )r$   r   r'   r'   r(   get_instance   s   zDeploymentPage.get_instancec                 C      dS )r3   z%<Twilio.Serverless.V1.DeploymentPage>r'   r,   r'   r'   r(   rD         zDeploymentPage.__repr__N)	rG   rH   rI   r   rK   r   r   r[   rD   r'   r'   r'   r(   rY      s    rY   c                	       s   e Zd Zdededef fddZejejfdeee	f dee
e	f defd	d
Zejejfdeee	f dee
e	f defddZ		d*dee dee dee fddZ		d*dee dee dee fddZ		d*dee dee dee fddZ		d*dee dee dee fddZejejejfdeee	f deee	f deee	f defddZejejejfdeee	f deee	f deee	f defddZdedefdd Zdedefd!d"Zd#edefd$d%Zd#edefd&d'Zdefd(d)Z  Z S )+DeploymentListr   r   r   c                    s0   t  | ||d| _djdi | j| _dS )a+  
        Initialize the DeploymentList

        :param version: Version that contains the resource
        :param service_sid: The SID of the Service to read the Deployment resources from.
        :param environment_sid: The SID of the Environment used by the Deployment resources to read.

        rZ   zB/Services/{service_sid}/Environments/{environment_sid}/DeploymentsNr'   rN   )r$   r   r   r   r%   r'   r(   r      s   	zDeploymentList.__init__r   	is_pluginr)   c                 C   sh   t |t|d}t ddi}d|d< d|d< | jjd| j||d}t| j|| jd | jd	 d
S )z
        Create the DeploymentInstance

        :param build_sid: The SID of the Build for the Deployment.
        :param is_plugin: Whether the Deployment is a plugin.

        :returns: The created DeploymentInstance
        BuildSidIsPluginContent-Type!application/x-www-form-urlencodedrP   rQ   POSTrT   rU   datarV   r   r   rZ   )	r   rW   r   boolean_to_stringr+   createrO   r   r"   r$   r   r_   rg   rV   r   r'   r'   r(   ri      s"   
zDeploymentList.createc                    sp   t |t|d}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 dS )z
        Asynchronously create the DeploymentInstance

        :param build_sid: The SID of the Build for the Deployment.
        :param is_plugin: Whether the Deployment is a plugin.

        :returns: The created DeploymentInstance
        r`   rc   rd   rP   rQ   re   rf   Nr   r   rZ   )	r   rW   r   rh   r+   create_asyncrO   r   r"   rj   r'   r'   r(   rk     s$   
zDeploymentList.create_asyncNlimit	page_sizec                 C   s0   | j ||}| j|d d}| j ||d S )a`  
        Streams DeploymentInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        rm   rm   rl   )r+   read_limitspagestreamr$   rl   rm   limitsrp   r'   r'   r(   rq   ;  s   zDeploymentList.streamc                    s8   | j ||}| j|d dI dH }| j ||d S )ao  
        Asynchronously streams DeploymentInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        rm   rn   Nrl   )r+   ro   
page_asyncstream_asyncrr   r'   r'   r(   ru   T  s   zDeploymentList.stream_asyncc                 C   s   t | j||dS )a  
        Lists DeploymentInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: list that will contain up to limit results
        rl   rm   )listrq   r$   rl   rm   r'   r'   r(   rw   m  s   zDeploymentList.listc                    s&   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists DeploymentInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: list that will contain up to limit results
        c                    s   g | z3 d H W }|q6 S rF   r'   )r:   recordr'   r'   r(   
<listcomp>  s
    z-DeploymentList.list_async.<locals>.<listcomp>rv   N)ru   rx   r'   r'   r(   
list_async  s   
zDeploymentList.list_async
page_tokenpage_numberc                 C   sN   t |||d}t ddi}d|d< | jjd| j||d}t| j|| jS )ay  
        Retrieve a single page of DeploymentInstance records from the API.
        Request is executed immediately

        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of DeploymentInstance
        	PageTokenr   PageSizerc   rd   rP   rQ   rR   rT   rU   paramsrV   )r   rW   r+   rp   rO   rY   r"   r$   r|   r}   rm   rg   rV   responser'   r'   r(   rp     s   
zDeploymentList.pagec                    sV   t |||d}t ddi}d|d< | jjd| j||dI dH }t| j|| jS )	a  
        Asynchronously retrieve a single page of DeploymentInstance records from the API.
        Request is executed immediately

        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of DeploymentInstance
        r~   rc   rd   rP   rQ   rR   r   N)r   rW   r+   rt   rO   rY   r"   r   r'   r'   r(   rt     s   
zDeploymentList.page_async
target_urlc                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of DeploymentInstance records from the API.
        Request is executed immediately

        :param target_url: API-generated URL for the requested results page

        :returns: Page of DeploymentInstance
        rR   )r+   domaintwiliorequestrY   r"   r$   r   r   r'   r'   r(   get_page  s   	zDeploymentList.get_pagec                    s*   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of DeploymentInstance records from the API.
        Request is executed immediately

        :param target_url: API-generated URL for the requested results page

        :returns: Page of DeploymentInstance
        rR   N)r+   r   r   request_asyncrY   r"   r   r'   r'   r(   get_page_async  s   	zDeploymentList.get_page_asyncr   c                 C      t | j| jd | jd |dS z
        Constructs a DeploymentContext

        :param sid: The SID that identifies the Deployment resource to fetch.
        r   r   r   r*   r+   r"   r$   r   r'   r'   r(   r         zDeploymentList.getc                 C   r   r   r   r   r'   r'   r(   __call__	  r   zDeploymentList.__call__c                 C   r\   )r3   z%<Twilio.Serverless.V1.DeploymentList>r'   r,   r'   r'   r(   rD     r]   zDeploymentList.__repr__)NN)!rG   rH   rI   r   rK   r   r   unsetr   objectboolr   ri   rk   r   intr   rq   r	   ru   r   rw   r{   rY   rp   rt   r   r   r*   r    r   rD   rM   r'   r'   r%   r(   r^      s    


'


'







#



!r^   N)rJ   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r*   rY   r^   r'   r'   r'   r(   <module>   s    $WQ