ó FRTc@sLdZddlZddlmZddlmZdefd„ƒYZdS(s Represents an EC2 Keypair iÿÿÿÿN(t EC2Object(tBotoClientErrortKeyPaircBsGeZdd„Zd„Zd„Zed„Zd„Zed„Z RS(cCs5tt|ƒj|ƒd|_d|_d|_dS(N(tsuperRt__init__tNonetnamet fingerprinttmaterial(tselft connection((s=/opt/freeware/lib/python2.7/site-packages/boto/ec2/keypair.pyR!s  cCs d|jS(Ns KeyPair:%s(R(R ((s=/opt/freeware/lib/python2.7/site-packages/boto/ec2/keypair.pyt__repr__'scCs\|dkr||_n@|dkr0||_n(|dkrH||_nt|||ƒdS(NtkeyNametkeyFingerprintt keyMaterial(RRRtsetattr(R RtvalueR ((s=/opt/freeware/lib/python2.7/site-packages/boto/ec2/keypair.pyt endElement*s      cCs|jj|jd|ƒS(sq Delete the KeyPair. :rtype: bool :return: True if successful, otherwise False. tdry_run(R tdelete_key_pairR(R R((s=/opt/freeware/lib/python2.7/site-packages/boto/ec2/keypair.pytdelete4scCs©|jr™tjj|ƒ}tjj|d|jƒ}tjj|ƒr\td|ƒ‚nt|dƒ}|j |jƒ|j ƒtj |dƒt Stdƒ‚dS(s Save the material (the unencrypted PEM encoded RSA private key) of a newly created KeyPair to a local file. :type directory_path: string :param directory_path: The fully qualified path to the directory in which the keypair will be saved. The keypair file will be named using the name of the keypair as the base name and .pem for the file extension. If a file of that name already exists in the directory, an exception will be raised and the old file will not be overwritten. :rtype: bool :return: True if successful. s%s.pems-%s already exists, it will not be overwrittentwbi€sKeyPair contains no materialN( Rtostpatht expandusertjoinRtexistsRtopentwritetclosetchmodtTrue(R tdirectory_patht file_pathtfp((s=/opt/freeware/lib/python2.7/site-packages/boto/ec2/keypair.pytsave=s  cCs[|j|jkr!tdƒ‚n|jjƒ}|j|}|j|jd|ƒ}|S(s  Create a new key pair of the same new in another region. Note that the new key pair will use a different ssh cert than the this key pair. After doing the copy, you will need to save the material associated with the new key pair (use the save method) to a local file. :type region: :class:`boto.ec2.regioninfo.RegionInfo` :param region: The region to which this security group will be copied. :rtype: :class:`boto.ec2.keypair.KeyPair` :return: The new key pair s!Unable to copy to the same RegionR(RtregionRR t get_paramstconnecttcreate_key_pair(R R$Rt conn_paramstrconntkp((s=/opt/freeware/lib/python2.7/site-packages/boto/ec2/keypair.pytcopy_to_region\s N( t__name__t __module__RRR RtFalseRR#R+(((s=/opt/freeware/lib/python2.7/site-packages/boto/ec2/keypair.pyRs    (t__doc__Rtboto.ec2.ec2objectRtboto.exceptionRR(((s=/opt/freeware/lib/python2.7/site-packages/boto/ec2/keypair.pyts