Current File : //lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyo
�
��Xc@ s�ddlmZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZddl
mZmZddlmZddlmZdd	lmZdd
lmZddlZdeeefd��YZdS(
i����(tdivisionN(tArgtMutuallyExclusiveArgList(t
ArgumentError(tFileTransferProgressBarMixin(tb64encoded_file_contentstfilesize(t
EC2Request(t
S3AccessMixin(tResumeImport(t	GetObjecttImportInstancecB sAeZdZedddddldd�edddd	d
edddd
�eddddddd
edd�eddddd
edddd�eddddd
eddmdd�eedd ddldd!�ed"dd#dd$dd%��j�ed&ddldd'�ed(d)dd*d+ed,d-ddldd.�ed/d0d1ddldd2�ed3d4dd5dd6�ed7d8dd9dd:dd;�ed<d=dd>dd?dd@�edAdBddCd+eddDddE�edFddGddHd+e	ddI�eedJddKd+e
jddLddM�edNddd+eddOddP��edQddRddSddT�edUddVddWddX�edYd0d1ddZdd[�ed\dd]ddndd`�edaddbddcddd�eded0d1ddlde
j�edfd0d1ddlde
j�edgd0d1ddlde
j�gZdhgZdi�Zdj�Zdk�ZRS(os!Import an instance into the cloudtsourcetmetavartFILEtroute_tothelps3file containing the disk image to import (required)s-ts--instance-typetINSTANCETYPEtrequiredtdests LaunchSpecification.InstanceTypes,the type of instance to import to (required)s-fs--formatsDiskImage.1.Image.FormattFORMATsGthe image's format
                ("vmdk", "raw", or "vhd") (required)s-as--architecturetARCHs LaunchSpecification.Architectures0the instance's processor architecture (required)s-ps
--platformtPlatformtchoicestWindowstLinuxs*the instance's operating system (required)s-bs--buckets"the bucket to upload the volume tos--manifest-urltURLs#DiskImage.1.Image.ImportManifestUrlsNa pre-signed URL that points to the import
                    manifest to uses--prefixsUa prefix to add to the
                names of the volume parts as they are uploadeds-xs	--expirestDAYSttypetdefaultis\how long the import manifest should
                remain valid, in days (default: 30 days)s--no-uploadtactiont
store_trueshstart the import process, but do not actually upload
                the volume (see euca-resume-import)s-ds
--descriptiontDescriptions2a description for the import task (not the volume)s-gs--grouptGROUPsLaunchSpecification.GroupName.1s4name of the security group to create the instance ins-zs--availability-zonetZONEs.LaunchSpecification.Placement.AvailabilityZones(the zone in which to create the instances-ss
--volume-sizetGiBsDiskImage.1.Volume.Sizes'size of the volume to import to, in GiBs--image-sizesDiskImage.1.Image.BytestBYTESs-size of the image (required for non-raw filess--user-datatDATAs!LaunchSpecification.UserData.Datas#user data to supply to the instances--user-data-filesLaunchSpecification.UserDatasGfile
                    containing user data to supply to the instances--subnettSUBNETsLaunchSpecification.SubnetIdsO[VPC only] subnet
                to create the instance's network interface ins--private-ip-addresstADDRESSs$LaunchSpecification.PrivateIpAddresssc[VPC only] assign a specific primary private IP address
                to the instance's interfaces	--monitors&LaunchSpecification.Monitoring.Enableds+enable detailed monitoring for the instances&--instance-initiated-shutdown-behaviors5LaunchSpecification.InstanceInitiatedShutdownBehaviortstopt	terminatesXwhether to "stop"
                (default) or terminate the instance when it shuts downs--keysLaunchSpecification.KeyNametKEYPAIRsW[Eucalyptus only] name of the key pair to use when
                running the instances--ignore-region-affinitys	--dry-runs--dont-verify-formattvolumescC s�tj|�|j�|jdj�dkrM|jdj�|jd<n|jjd�s�|jddkr�tjj|j	d�}||jd<q�|jddkr�tjj
|j	d�}||jd<q�tdj|jd���n|jjd�s8t
j|jdd�}t|�|jd<n|j	jd�sZd
|j	d<n|j	ddkr|td
��ndS(NsDiskImage.1.Image.FormattVMDKtVHDtRAWsDiskImage.1.Image.BytesRs/argument --image-size is required for {0} filessDiskImage.1.Volume.Sizeiitexpiresis-argument -x/--expires: value must be positive(R,R-R.i@(Rt	configuretconfigure_s3_accesstparamstuppertgett	euca2oolstutiltget_filesizetargstget_vmdk_image_sizeRtformattmathtceiltint(tselft
image_sizetvol_size((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyR0s2

		
cC s�|jjd�rdS|jjd�r?|j|jd�n|jjd�s4djtj�|jd�}|jjd�r�dj|jd|f�}ntj|d|jd	d
|jdddj|jd|f��}|jjd�p�d
}|j	|d�}|j
jd|�||jd<n|j
�}|jjd�s�tj|d|jdd|ddd	|jd	d|jdd|jdd|jjdt��}|j�n|S(Ntdry_runtbuckets#DiskImage.1.Image.ImportManifestUrls{0}/{1}.manifest.xmlRtprefixt/tservicet
s3_servicetauthts3_authR/ii�Qsgenerated manifest GET URL: %st	no_uploadttasktconversionTasktconversionTaskIdt
show_progress(R8R4tensure_bucket_existsR:tuuidtuuid4tjoinR
t
from_othertget_presigned_url2tlogtinfoR2tsendR	tFalsetmain(R>tmanifest_keytgetobjtdaystget_urltresulttresume((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyRX�s6


cC s|j|d�dS(NRK(tprint_conversion_task(R>R]((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pytprint_result�sN(RR(sstopR)(t__name__t
__module__tDESCRIPTIONRtNonetTrueRRR=Rtbase64t	b64encodeRtargparsetSUPPRESStARGSt	LIST_TAGSR0RXR`(((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyR-s�							#(t
__future__RRhRfR;ROtrequestbuilderRRtrequestbuilder.exceptionsRtrequestbuilder.mixinsRteuca2ools.commands.argtypesRRteuca2ools.commands.ec2Rteuca2ools.commands.ec2.mixinsRt#euca2ools.commands.ec2.resumeimportR	teuca2ools.commands.s3.getobjectR
teuca2ools.utilR5R(((sI/usr/lib/python2.7/site-packages/euca2ools/commands/ec2/importinstance.pyt<module>s