ó
è?F[c           @   s˜   d  d l  m Z m Z d  d l m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d	 e	 f d
 „  ƒ  YZ
 d e	 f d „  ƒ  YZ d S(   iÿÿÿÿ(   t	   EC2Objectt   TaggedEC2Object(   t   BlockDeviceMappingt   ProductCodesc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   d  S(   N(    (   t   selft   namet   attrst
   connection(    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   startElement   s    c         C   s    | d k r |  j  | ƒ n  d  S(   Nt   productCode(   t   append(   R   R   t   valueR   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt
   endElement   s    (   t   __name__t
   __module__R   R   (    (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR      s   	t   BillingProductsc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   d  S(   N(    (   R   R   R   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   %   s    c         C   s    | d k r |  j  | ƒ n  d  S(   Nt   billingProduct(   R
   (   R   R   R   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   (   s    (   R   R   R   R   (    (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   $   s   	t   Imagec           B   sþ   e  Z d  Z d d „ Z d „  Z d „  Z d „  Z d „  Z e	 e	 d „ Z
 d d d d d d d d d d e	 d d e	 d d d d d d d d e	 d	 „ Z e	 e	 d
 „ Z e	 d „ Z d d e	 d „ Z d d e	 d „ Z e	 d „ Z e	 d „ Z e	 d „ Z RS(   s!   
    Represents an EC2 Image
    c         C   sï   t  t |  ƒ j | ƒ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _	 t
 |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ t ƒ  |  _ t ƒ  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  S(   N(   t   superR   t   __init__t   Nonet   idt   locationt   statet   ownerIdt   owner_idt   owner_aliast   Falset	   is_publict   architecturet   platformt   typet	   kernel_idt
   ramdisk_idR   t   descriptionR   t   product_codesR   t   billing_productst   block_device_mappingt   root_device_typet   root_device_namet   virtualization_typet
   hypervisort   instance_lifecyclet   sriov_net_support(   R   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   2   s0    																				c         C   s   d |  j  S(   Ns   Image:%s(   R   (   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   __repr__L   s    c         C   s{   t  t |  ƒ j | | | ƒ } | d  k	 r. | S| d k rM t ƒ  |  _ |  j S| d k r` |  j S| d k rs |  j Sd  Sd  S(   Nt   blockDeviceMappingt   productCodest   billingProducts(   R   R   R   R   R   R%   R#   R$   (   R   R   R   R   t   retval(    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   O   s    c         C   s%  | d k r | |  _  n	| d k r0 | |  _ nñ| d k rH | |  _ nÙ| d k ri | |  _ | |  _ n¸| d k rÁ | d k r t |  _ q!| d k r¥ t |  _ q!t d | |  j  f ƒ ‚ n`| d	 k rÙ | |  _	 nH| d
 k rñ | |  _
 n0| d k r	| |  _ n| d k r!| |  _ n | d k r9| |  _ nè | d k rQ| |  _ nÐ | d k ri| |  _ n¸ | d k r| |  _ n  | d k r™| |  _ nˆ | d k r±| |  _ np | d k rÉ| |  _ nX | d k rá| |  _ n@ | d k rù| |  _ n( | d k r| |  _ n t |  | | ƒ d  S(   Nt   imageIdt   imageLocationt
   imageStatet   imageOwnerIdt   isPublict   falset   trues,   Unexpected value of isPublic %s for image %sR   t	   imageTypet   kernelIdt	   ramdiskIdt   imageOwnerAliasR   R   R"   t   rootDeviceTypet   rootDeviceNamet   virtualizationTypeR)   t   instanceLifecyclet   sriovNetSupport(   R   R   R   R   R   R   R   t   Truet	   ExceptionR   R   R    R!   R   R   R   R"   R&   R'   R(   R)   R*   R+   t   setattr(   R   R   R   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   ]   s^    	c         C   s   |  j  j | j  ƒ d  S(   N(   t   __dict__t   update(   R   t   updated(    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   _update’   s    c         C   s‚   |  j  j |  j g d | ƒ} t | ƒ d k r_ | d } | j |  j k r{ |  j | ƒ q{ n | r{ t d |  j ƒ ‚ n  |  j S(   sç  
        Update the image's state information by making a call to fetch
        the current image attributes from the service.

        :type validate: bool
        :param validate: By default, if EC2 returns no data about the
                         image the update method returns quietly.  If
                         the validate param is True, however, it will
                         raise a ValueError exception if no data is
                         returned from EC2.
        t   dry_runi    s   %s is not a valid Image ID(   R   t   get_all_imagesR   t   lenRG   t
   ValueErrorR   (   R   t   validateRH   t   rst   img(    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyRE   •   s    
i   s   m1.smallc         C   sj   |  j  j |  j | | | | | | | | |	 |
 | | | | | | | d | d | d | d | d | d | ƒS(   sZ  
        Runs this instance.

        :type min_count: int
        :param min_count: The minimum number of instances to start

        :type max_count: int
        :param max_count: The maximum number of instances to start

        :type key_name: string
        :param key_name: The name of the key pair with which to
            launch instances.

        :type security_groups: list of strings
        :param security_groups: The names of the security groups with which to
            associate instances.

        :type user_data: string
        :param user_data: The Base64-encoded MIME user data to be made
            available to the instance(s) in this reservation.

        :type instance_type: string
        :param instance_type: The type of instance to run:

            * t1.micro
            * m1.small
            * m1.medium
            * m1.large
            * m1.xlarge
            * m3.medium
            * m3.large
            * m3.xlarge
            * m3.2xlarge
            * c1.medium
            * c1.xlarge
            * m2.xlarge
            * m2.2xlarge
            * m2.4xlarge
            * cr1.8xlarge
            * hi1.4xlarge
            * hs1.8xlarge
            * cc1.4xlarge
            * cg1.4xlarge
            * cc2.8xlarge
            * g2.2xlarge
            * c3.large
            * c3.xlarge
            * c3.2xlarge
            * c3.4xlarge
            * c3.8xlarge
            * c4.large
            * c4.xlarge
            * c4.2xlarge
            * c4.4xlarge
            * c4.8xlarge
            * i2.xlarge
            * i2.2xlarge
            * i2.4xlarge
            * i2.8xlarge
            * t2.micro
            * t2.small
            * t2.medium

        :type placement: string
        :param placement: The Availability Zone to launch the instance into.

        :type kernel_id: string
        :param kernel_id: The ID of the kernel with which to launch the
            instances.

        :type ramdisk_id: string
        :param ramdisk_id: The ID of the RAM disk with which to launch the
            instances.

        :type monitoring_enabled: bool
        :param monitoring_enabled: Enable CloudWatch monitoring on
            the instance.

         :type subnet_id: string
        :param subnet_id: The subnet ID within which to launch the instances
            for VPC.

        :type private_ip_address: string
        :param private_ip_address: If you're using VPC, you can
            optionally use this parameter to assign the instance a
            specific available IP address from the subnet (e.g.,
            10.0.0.25).

        :type block_device_map: :class:`boto.ec2.blockdevicemapping.BlockDeviceMapping`
        :param block_device_map: A BlockDeviceMapping data structure
            describing the EBS volumes associated with the Image.

        :type disable_api_termination: bool
        :param disable_api_termination: If True, the instances will be locked
            and will not be able to be terminated via the API.

        :type instance_initiated_shutdown_behavior: string
        :param instance_initiated_shutdown_behavior: Specifies whether the
            instance stops or terminates on instance-initiated shutdown.
            Valid values are:

            * stop
            * terminate

        :type placement_group: string
        :param placement_group: If specified, this is the name of the placement
            group in which the instance(s) will be launched.

        :type additional_info: string
        :param additional_info: Specifies additional information to make
            available to the instance(s).

        :type security_group_ids: list of strings
        :param security_group_ids: The ID of the VPC security groups with
            which to associate instances.

        :type instance_profile_name: string
        :param instance_profile_name: The name of
            the IAM Instance Profile (IIP) to associate with the instances.

        :type instance_profile_arn: string
        :param instance_profile_arn: The Amazon resource name (ARN) of
            the IAM Instance Profile (IIP) to associate with the instances.

        :type tenancy: string
        :param tenancy: The tenancy of the instance you want to
            launch. An instance with a tenancy of 'dedicated' runs on
            single-tenant hardware and can only be launched into a
            VPC. Valid values are:"default" or "dedicated".
            NOTE: To use dedicated tenancy you MUST specify a VPC
            subnet-ID as well.

        :rtype: Reservation
        :return: The :class:`boto.ec2.instance.Reservation` associated with
                 the request for machines

        t   security_group_idst   additional_infot   instance_profile_namet   instance_profile_arnt   tenancyRH   (   R   t   run_instancesR   (   R   t	   min_countt	   max_countt   key_namet   security_groupst	   user_datat   addressing_typet   instance_typet	   placementR    R!   t   monitoring_enabledt	   subnet_idt   block_device_mapt   disable_api_terminationt$   instance_initiated_shutdown_behaviort   private_ip_addresst   placement_groupRO   RP   RQ   RR   RS   RH   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   runª   s    —	c         C   s   |  j  j |  j | d | ƒS(   NRH   (   R   t   deregister_imageR   (   R   t   delete_snapshotRH   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt
   deregisterP  s    	c         C   s%   |  j  j |  j d d | ƒ} | j S(   Nt   launchPermissionRH   (   R   t   get_image_attributeR   R   (   R   RH   t	   img_attrs(    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   get_launch_permissionsW  s
    		c         C   s%   |  j  j |  j d d | | d | ƒS(   NRh   t   addRH   (   R   t   modify_image_attributeR   (   R   t   user_idst   group_namesRH   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   set_launch_permissions_  s    c         C   s%   |  j  j |  j d d | | d | ƒS(   NRh   t   removeRH   (   R   Rm   R   (   R   Rn   Ro   RH   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   remove_launch_permissionsh  s    c         C   s   |  j  j |  j d d | ƒS(   NRh   RH   (   R   t   reset_image_attributeR   (   R   RH   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   reset_launch_attributesq  s    	c         C   s%   |  j  j |  j d d | ƒ} | j S(   Nt   kernelRH   (   R   Ri   R   Ru   (   R   RH   Rj   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt
   get_kernelx  s
    		c         C   s%   |  j  j |  j d d | ƒ} | j S(   Nt   ramdiskRH   (   R   Ri   R   Rw   (   R   RH   Rj   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   get_ramdisk€  s
    		N(   R   R   t   __doc__R   R   R,   R   R   RG   R   RE   Rd   Rg   Rk   Rp   Rr   Rt   Rv   Rx   (    (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   -   s8   			5			›t   ImageAttributec           B   s&   e  Z d d  „ Z d „  Z d „  Z RS(   c         C   s(   d  |  _ d  |  _ d  |  _ i  |  _ d  S(   N(   R   R   Ru   Rw   R   (   R   t   parent(    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   Š  s    			c         C   s/   | d k r' t  ƒ  |  j d <|  j d Sd  Sd  S(   NR-   R%   (   R   R   R   (   R   R   R   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR     s    c         C   sC  | d k r d |  _  n'| d k r] d |  j k rJ |  j d j | ƒ q?| g |  j d <nâ | d k r¢ d |  j k r |  j d j | ƒ q?| g |  j d <n | d k rç d |  j k rÔ |  j d j | ƒ q?| g |  j d <nX | d	 k rÿ | |  _ n@ | d
 k r| |  _ n( | d k r/| |  _ n t |  | | ƒ d  S(   NRh   t   launch_permissiont   groupt   groupst   userIdRn   R	   R#   R1   Ru   Rw   (   R   R   R
   t   image_idRu   Rw   RC   (   R   R   R   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   —  s*    N(   R   R   R   R   R   R   (    (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyRz   ‰  s   	t	   CopyImagec           B   s&   e  Z d d  „ Z d „  Z d „  Z RS(   c         C   s   | |  _  d  |  _ d  S(   N(   t   _parentR   R€   (   R   R{   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   ´  s    	c         C   s   d  S(   N(    (   R   R   R   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   ¸  s    c         C   s   | d k r | |  _  n  d  S(   NR1   (   R€   (   R   R   R   R   (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   »  s    N(   R   R   R   R   R   R   (    (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyR   ³  s   	N(   t   boto.ec2.ec2objectR    R   t   boto.ec2.blockdevicemappingR   t   listR   R   R   t   objectRz   R   (    (    (    s-   lib/python2.7/site-packages/boto/ec2/image.pyt   <module>   s   		ÿ ]*