U
    W¨+dÆ  ã                   @   sd   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 )c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚDetailsz–
    A dict object that contains name/value pairs which provide
    more detailed information about the status of the system
    or the instance.
    c                 C   s   d S ©N© ©ÚselfÚnameÚattrsÚ
connectionr   r   ú;/tmp/pip-unpacked-wheel-dlxw5sjy/boto/ec2/instancestatus.pyÚstartElement    s    zDetails.startElementc                 C   s4   |dkr|| _ n |dkr$|| | j < nt| ||ƒ d S )Nr   Ústatus)Ú_nameÚsetattr©r   r   Úvaluer   r   r   r	   Ú
endElement#   s
    zDetails.endElementN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   r   r   r   r   r	   r      s   r   c                   @   s2   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ ZdS )ÚEventaN  
    A status event for an instance.

    :ivar code: A string indicating the event type.
    :ivar description: A string describing the reason for the event.
    :ivar not_before: A datestring describing the earliest time for
        the event.
    :ivar not_after: A datestring describing the latest time for
        the event.
    Nc                 C   s   || _ || _|| _|| _d S r   )ÚcodeÚdescriptionÚ
not_beforeÚ	not_after)r   r   r   r   r   r   r   r	   Ú__init__8   s    zEvent.__init__c                 C   s
   d| j  S )NzEvent:%s)r   ©r   r   r   r	   Ú__repr__?   s    zEvent.__repr__c                 C   s   d S r   r   r   r   r   r	   r
   B   s    zEvent.startElementc                 C   sP   |dkr|| _ n<|dkr || _n,|dkr0|| _n|dkr@|| _nt| ||ƒ d S )Nr   r   Z	notBeforeZnotAfter)r   r   r   r   r   r   r   r   r	   r   E   s    zEvent.endElement)NNNN©r   r   r   r   r   r   r
   r   r   r   r   r	   r   ,   s       ÿ
r   c                   @   s2   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ ZdS )ÚStatusz÷
    A generic Status object used for system status and instance status.

    :ivar status: A string indicating overall status.
    :ivar details: A dict containing name-value pairs which provide
        more details about the current status.
    Nc                 C   s   || _ |stƒ }|| _d S r   )r   r   Údetails)r   r   r   r   r   r	   r   [   s    zStatus.__init__c                 C   s
   d| j  S )Nz	Status:%s)r   r   r   r   r	   r   a   s    zStatus.__repr__c                 C   s   |dkr| j S d S )Nr   )r   r   r   r   r	   r
   d   s    zStatus.startElementc                 C   s    |dkr|| _ nt| ||ƒ d S )Nr   )r   r   r   r   r   r	   r   i   s    zStatus.endElement)NNr   r   r   r   r	   r   R   s
   
r   c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚEventSetc                 C   s$   |dkrt ƒ }|  |¡ |S d S d S ©NÚitem)r   Úappend)r   r   r   r   Úeventr   r   r	   r
   r   s
    
zEventSet.startElementc                 C   s   t | ||ƒ d S r   )r   r   r   r   r	   r   z   s    zEventSet.endElementN)r   r   r   r
   r   r   r   r   r	   r    p   s   r    c                   @   s2   e Zd ZdZddd„Zdd„ Zdd„ Zd	d
„ ZdS )ÚInstanceStatusa%  
    Represents an EC2 Instance status as reported by
    DescribeInstanceStatus request.

    :ivar id: The instance identifier.
    :ivar zone: The availability zone of the instance.
    :ivar events: A list of events relevant to the instance.
    :ivar state_code: An integer representing the current state
        of the instance.
    :ivar state_name: A string describing the current state
        of the instance.
    :ivar system_status: A Status object that reports impaired
        functionality that stems from issues related to the systems
        that support an instance, such as such as hardware failures
        and network connectivity problems.
    :ivar instance_status: A Status object that reports impaired
        functionality that arises from problems internal to the instance.
    Nc                 C   s2   || _ || _|| _|| _|| _tƒ | _tƒ | _d S r   )ÚidÚzoneÚeventsÚ
state_codeÚ
state_namer   Úsystem_statusÚinstance_status)r   r&   r'   r(   r)   r*   r   r   r	   r   ’   s    zInstanceStatus.__init__c                 C   s
   d| j  S )NzInstanceStatus:%s)r&   r   r   r   r	   r   œ   s    zInstanceStatus.__repr__c                 C   s:   |dkrt ƒ | _| jS |dkr$| jS |dkr2| jS d S d S )NZ	eventsSetZsystemStatusZinstanceStatus)r    r(   r+   r,   r   r   r   r	   r
   Ÿ   s    zInstanceStatus.startElementc                 C   sT   |dkr|| _ n@|dkr || _n0|dkr4t|ƒ| _n|dkrD|| _nt| ||ƒ d S )NZ
instanceIdZavailabilityZoner   r   )r&   r'   Úintr)   r*   r   r   r   r   r	   r   ª   s    zInstanceStatus.endElement)NNNNNr   r   r   r   r	   r%   ~   s       ÿ

r%   c                   @   s*   e Zd ZdZd	dd„Zdd„ Zdd„ ZdS )
ÚInstanceStatusSetaž  
    A list object that contains the results of a call to
    DescribeInstanceStatus request.  Each element of the
    list will be an InstanceStatus object.

    :ivar next_token: If the response was truncated by
        the EC2 service, the next_token attribute of the
        object will contain the string that needs to be
        passed in to the next request to retrieve the next
        set of results.
    Nc                 C   s   t  | ¡ || _d | _d S r   )Úlistr   r   Ú
next_token)r   r   r   r   r	   r   Ä   s    
zInstanceStatusSet.__init__c                 C   s$   |dkrt ƒ }|  |¡ |S d S d S r!   )r%   r#   )r   r   r   r   r   r   r   r	   r
   É   s
    
zInstanceStatusSet.startElementc                 C   s   |dkr|| _ t| ||ƒ d S )NZ	nextToken)r0   r   r   r   r   r	   r   Ñ   s    zInstanceStatusSet.endElement)N)r   r   r   r   r   r
   r   r   r   r   r	   r.   ·   s   
r.   N)	Údictr   Úobjectr   r   r/   r    r%   r.   r   r   r   r	   Ú<module>   s
   &9