コード例 #1
0
    def import_keypair(self, xml_bytes, key_material):
        """Extract the key name and the fingerprint from the result.

        TODO: there is no corresponding method in the 2009-11-30 version
             of the ec2 wsdl. Delete this?
        """
        keypair_data = XML(xml_bytes)
        key_name = keypair_data.findtext("keyName")
        key_fingerprint = keypair_data.findtext("keyFingerprint")
        return model.Keypair(key_name, key_fingerprint, key_material)
コード例 #2
0
 def _parse_describe_keypairs(self, xml_bytes):
     results = []
     root = XML(xml_bytes)
     keypairs = root.find("keySet")
     if not keypairs:
         return results
     for keypair_data in keypairs:
         key_name = keypair_data.findtext("keyName")
         key_fingerprint = keypair_data.findtext("keyFingerprint")
         results.append(model.Keypair(key_name, key_fingerprint))
     return results
コード例 #3
0
    def create_keypair(self, xml_bytes):
        """Parse the XML returned by the C{CreateKeyPair} function.

        @param xml_bytes: XML bytes with a C{CreateKeyPairResponse} root
            element.
        @return: The L{Keypair} instance created.
        """
        keypair_data = XML(xml_bytes)
        key_name = keypair_data.findtext("keyName")
        key_fingerprint = keypair_data.findtext("keyFingerprint")
        key_material = keypair_data.findtext("keyMaterial")
        return model.Keypair(key_name, key_fingerprint, key_material)
コード例 #4
0
    def describe_keypairs(self, xml_bytes):
        """Parse the XML returned by the C{DescribeKeyPairs} function.

        @param xml_bytes: XML bytes with a C{DescribeKeyPairsResponse} root
            element.
        @return: a C{list} of L{Keypair}.
        """
        results = []
        root = XML(xml_bytes)
        keypairs = root.find("keySet")
        if keypairs is None:
            return results
        for keypair_data in keypairs:
            key_name = keypair_data.findtext("keyName")
            key_fingerprint = keypair_data.findtext("keyFingerprint")
            results.append(model.Keypair(key_name, key_fingerprint))
        return results
コード例 #5
0
 def import_keypair(self, xml_bytes, key_material):
     """Extract the key name and the fingerprint from the result."""
     keypair_data = XML(xml_bytes)
     key_name = keypair_data.findtext("keyName")
     key_fingerprint = keypair_data.findtext("keyFingerprint")
     return model.Keypair(key_name, key_fingerprint, key_material)
コード例 #6
0
 def _parse_create_keypair(self, xml_bytes):
     keypair_data = XML(xml_bytes)
     key_name = keypair_data.findtext("keyName")
     key_fingerprint = keypair_data.findtext("keyFingerprint")
     key_material = keypair_data.findtext("keyMaterial")
     return model.Keypair(key_name, key_fingerprint, key_material)