U
    ^g%ikK                     @   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                       sx   e Zd ZdZdeeeef eeee d fddZ	e
dddd	Zd dd
dZd dddZed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| _|||p| 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
   Ziso8601_datetimer   r   r   	_solution_context)selfr   r   r   r   r   	__class__ w/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/serverless/v1/service/environment/deployment.pyr   %   s$    zDeploymentInstance.__init__DeploymentContextreturnc                 C   s6   | j dkr0t| 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   s$   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s   s   | ]\}}d  ||V  qdS z{}={}Nformat.0kvr&   r&   r'   	<genexpr>l   s     z.DeploymentInstance.__repr__.<locals>.<genexpr>z,<Twilio.Serverless.V1.DeploymentInstance {}>joinr!   itemsr6   r#   contextr&   r&   r'   __repr__f   s    zDeploymentInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   r/   r1   rA   __classcell__r&   r&   r$   r'   r      s    
		r   c                       sR   e Zd Zeeeed fddZedddZedddZedd	d
Z	  Z
S )r(   )r   r   r   r   c                    s.   t  | |||d| _djf | 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}Nr   r   r!   r6   _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/   rJ   r   r!   r#   rQ   r   r&   r&   r'   r/      s    
zDeploymentContext.fetchc                    sR   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r0   rK   rL   rM   rN   Nr   r   r   r   )r   rR   r+   r1   rJ   r   r!   rS   r&   r&   r'   r1      s    
  zDeploymentContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r2   r3   c                 s   s   | ]\}}d  ||V  qdS r4   r5   r7   r&   r&   r'   r;      s     z-DeploymentContext.__repr__.<locals>.<genexpr>z+<Twilio.Serverless.V1.DeploymentContext {}>r<   r?   r&   r&   r'   rA      s    zDeploymentContext.__repr__)rB   rC   rD   r   rF   r   r   r/   r1   rA   rH   r&   r&   r$   r'   r(   p   s      r(   c                   @   s2   e Zd Zeeef edddZedddZdS )DeploymentPage)r   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_instancer)   c                 C   s   dS )r2   z%<Twilio.Serverless.V1.DeploymentPage>r&   r,   r&   r&   r'   rA      s    zDeploymentPage.__repr__N)	rB   rC   rD   r   rF   r   r   rV   rA   r&   r&   r&   r'   rT      s   rT   c                       s  e Zd Zeeed fddZejejfeee	f ee
e	f edddZejejfeee	f ee
e	f edddZd%ee ee ee d
ddZd&ee ee ee d
ddZd'ee ee ee d
ddZd(ee ee ee d
ddZejejejfeee	f eee	f eee	f edddZejejejfeee	f eee	f eee	f edddZeedddZeedddZeedddZeedd d!Zed"d#d$Z  Z S ))DeploymentList)r   r   r   c                    s,   t  | ||d| _djf | 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.

        rU   zB/Services/{service_sid}/Environments/{environment_sid}/DeploymentsNrI   )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
        ZBuildSidZIsPluginContent-Type!application/x-www-form-urlencodedrK   rL   POSTrO   rP   datarQ   r   r   rU   )	r   rR   r   boolean_to_stringr+   createrJ   r   r!   r#   r   rX   r^   rQ   r   r&   r&   r'   r`      s(       zDeploymentList.createc                    sn   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
        rY   rZ   r[   rK   rL   r\   r]   Nr   r   rU   )	r   rR   r   r_   r+   create_asyncrJ   r   r!   ra   r&   r&   r'   rb     s(       zDeploymentList.create_asyncN)limit	page_sizer*   c                 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
        rd   rd   rc   )r+   read_limitspagestreamr#   rc   rd   Zlimitsrg   r&   r&   r'   rh   ;  s    zDeploymentList.streamc                    s6   | 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
        rd   re   Nrc   )r+   rf   
page_asyncstream_asyncri   r&   r&   r'   rk   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
        rc   rd   )listrh   r#   rc   rd   r&   r&   r'   rm   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 )Nr&   )r8   recordr&   r&   r'   
<listcomp>  s   z-DeploymentList.list_async.<locals>.<listcomp>rl   N)rk   rn   r&   r&   r'   
list_async  s    
zDeploymentList.list_async)
page_tokenpage_numberrd   r*   c                 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
        Z	PageTokenr   ZPageSizerZ   r[   rK   rL   rM   rO   rP   paramsrQ   )r   rR   r+   rg   rJ   rT   r!   r#   rr   rs   rd   r^   rQ   responser&   r&   r'   rg     s       zDeploymentList.pagec                    sT   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
        rt   rZ   r[   rK   rL   rM   ru   N)r   rR   r+   rj   rJ   rT   r!   rw   r&   r&   r'   rj     s       zDeploymentList.page_async)
target_urlr*   c                 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
        rM   )r+   domaintwiliorequestrT   r!   r#   ry   rx   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
        rM   N)r+   rz   r{   Zrequest_asyncrT   r!   r}   r&   r&   r'   get_page_async  s    	zDeploymentList.get_page_async)r   r*   c                 C   s   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      s    zDeploymentList.getc                 C   s   t | j| jd | jd |dS r   r   r   r&   r&   r'   __call__	  s    zDeploymentList.__call__r)   c                 C   s   dS )r2   z%<Twilio.Serverless.V1.DeploymentList>r&   r,   r&   r&   r'   rA     s    zDeploymentList.__repr__)NN)NN)NN)NN)!rB   rC   rD   r   rF   r   r   unsetr   objectboolr   r`   rb   r   intr   rh   r	   rk   r   rm   rq   rT   rg   rj   r~   r   r(   r    r   rA   rH   r&   r&   r$   r'   rW      s   

'

'        


#


!rW   N)rE   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   r(   rT   rW   r&   r&   r&   r'   <module>   s   $WQ