o ckF[?@spddlmZmZddlmZGdddeZGdddeZGdddeZGd d d e Z Gd d d e Z d S)) EC2ObjectTaggedEC2Object)BlockDeviceMappingc@eZdZddZddZdS) ProductCodescCdSNselfnameattrs connectionr r 0/usr/lib/python3/dist-packages/boto/ec2/image.py startElementzProductCodes.startElementcC|dkr ||dSdS)N productCodeappendr r valuerr r r endElementzProductCodes.endElementN__name__ __module__ __qualname__rrr r r rr rc@r)BillingProductscCrrr r r r rr%rzBillingProducts.startElementcCr)NbillingProductrrr r rr(rzBillingProducts.endElementNrr r r rr$rrcseZdZdZd"fdd ZddZfddZd d Zd d Zd#ddZ           d$ddZ d#ddZ d%ddZ  d&ddZ  d&ddZd%ddZd%ddZd%d d!ZZS)'Imagez! Represents an EC2 Image Ncstt||d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_t|_t|_d|_d|_d|_d|_d|_d|_d|_dS)NF)superr!__init__idlocationstateownerIdowner_id owner_alias is_public architectureplatformtype kernel_id ramdisk_idr descriptionr product_codesrbilling_productsblock_device_mappingroot_device_typeroot_device_namevirtualization_type hypervisorinstance_lifecyclesriov_net_support)r r __class__r rr#2s0 zImage.__init__cCs d|jS)NzImage:%s)r$)r r r r__repr__Ls zImage.__repr__csVtt||||}|dur|S|dkrt|_|jS|dkr"|jS|dkr)|jSdS)NblockDeviceMapping productCodesbillingProducts)r"r!rrr3r1r2)r r r rretvalr:r rrOszImage.startElementcCs|dkr ||_dS|dkr||_dS|dkr||_dS|dkr'||_||_dS|dkrF|dkr4d|_dS|dkr=d |_dStd ||jf|d krO||_dS|d krX||_dS|d kra||_ dS|dkrj||_ dS|dkrs||_ dS|dkr|||_ dS|dkr||_ dS|dkr||_dS|dkr||_dS|dkr||_dS|dkr||_dS|dkr||_dS|dkr||_dS|dkr||_dSt|||dS)NimageId imageLocation imageState imageOwnerIdisPublicfalseFtrueTz,Unexpected value of isPublic %s for image %sr+ imageTypekernelId ramdiskIdimageOwnerAliasr,r r0rootDeviceTyperootDeviceNamevirtualizationTyper7instanceLifecyclesriovNetSupport)r$r%r&r'r(r* Exceptionr+r-r.r/r)r,r r0r4r5r6r7r8r9setattrrr r rr]sb                    zImage.endElementcCs|j|jdSr)__dict__update)r updatedr r r_updatesz Image._updateFcCs\|jj|jg|d}t|dkr"|d}|j|jkr|||jS|r+td|j|jS)a 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. dry_runrz%s is not a valid Image ID)rget_all_imagesr$lenrV ValueErrorr&)r validaterXrsimgr r rrTs   z Image.updatem1.smallcCs>|jj|j||||||||| | | | | ||||||||||dS)aZ 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 )security_group_idsadditional_infoinstance_profile_nameinstance_profile_arntenancyrX)r run_instancesr$)r min_count max_countkey_namesecurity_groups user_dataaddressing_type instance_type placementr.r/monitoring_enabled subnet_idblock_device_mapdisable_api_termination$instance_initiated_shutdown_behaviorprivate_ip_addressplacement_grouprarbrcrdrerXr r rruns z Image.runcCs|jj|j||dS)NrW)rderegister_imager$)r delete_snapshotrXr r r deregisterP zImage.deregistercC|jj|jd|d}|jSNlaunchPermissionrW)rget_image_attributer$r r rX img_attrsr r rget_launch_permissionsW zImage.get_launch_permissionscC|jj|jdd|||dS)Nr}addrWrmodify_image_attributer$r user_ids group_namesrXr r rset_launch_permissions_ zImage.set_launch_permissionscCr)Nr}removerWrrr r rremove_launch_permissionshrzImage.remove_launch_permissionscCs|jj|jd|dSr|)rreset_image_attributer$)r rXr r rreset_launch_attributesqrzzImage.reset_launch_attributescCr{)NkernelrW)rr~r$rrr r r get_kernelxrzImage.get_kernelcCr{)NramdiskrW)rr~r$rrr r r get_ramdiskrzImage.get_ramdiskr)FF)r_r_NNNNr`NNNFNNFNNNNNNNNF)F)NNF)rrr__doc__r#r<rrrVrTrvryrrrrrr __classcell__r r r:rr!-sB 5   '    r!c@&eZdZdddZddZddZdS) ImageAttributeNcCsd|_d|_d|_i|_dSr)r rrr r parentr r rr#s zImageAttribute.__init__cCs"|dkrt|jd<|jdSdS)Nr=r3)rr r r r rrs  zImageAttribute.startElementcCs|dkr d|_dS|dkr$d|jvr|jd|dS|g|jd<dS|dkr?d|jvr7|jd|dS|g|jd<dS|dkrZd|jvrR|jd|dS|g|jd<dS|d krc||_dS|d krl||_dS|d kru||_dSt|||dS) Nr}launch_permissiongroupgroupsuserIdrrr1rArr)r r rimage_idrrrRrr r rrs*       zImageAttribute.endElementrrrrr#rrr r r rrs  rc@r) CopyImageNcCs||_d|_dSr)_parentrrr r rr#s zCopyImage.__init__cCrrr r r r rrrzCopyImage.startElementcCs|dkr ||_dSdS)NrA)rrr r rrs zCopyImage.endElementrrr r r rrs  rN) boto.ec2.ec2objectrrboto.ec2.blockdevicemappingrlistrrr!objectrrr r r rs   ^*