(self, request, tenant_id)
return json.dumps(keypair_response)
Returns a newly created key pair with the specified name.
        http://docs.rackspace.com/servers/api/v2/cs-devguide/content/UploadKeyPair.html
Returns a newly created key pair with the specified name.
        http://docs.rackspace.com/servers/api/v2/cs-devguide/content/UploadKeyPair.html
Returns a newly created key pair with the specified name . http : // docs . rackspace . com / servers / api / v2 / cs - devguide / content / UploadKeyPair . html
def create_key_pair(self, request, tenant_id):
        """
        Returns a newly created key pair with the specified name.
        http://docs.rackspace.com/servers/api/v2/cs-devguide/content/UploadKeyPair.html
        """
        try:
            content = json_from_request(request)
            keypair = content["keypair"]
            keypair_from_request = KeyPair(
                name=keypair["name"], public_key=keypair["public_key"])
        except (ValueError or KeyError):
            request.setResponseCode(400)
            return json.dumps(bad_request("Malformed request body", request))

        keypair_response = self._keypair_collection_for_tenant(
            tenant_id).create_keypair(keypair=keypair_from_request)
        return json.dumps(keypair_response)
def create_key_pair ( self , request , tenant_id ) : try : content = json_from_request ( request ) keypair = content [ "keypair" ] keypair_from_request = KeyPair ( name = keypair [ "name" ] , public_key = keypair [ "public_key" ] ) except ( ValueError or KeyError ) : request . setResponseCode ( 400 ) return json . dumps ( bad_request ( "Malformed request body" , request ) ) keypair_response = self . _keypair_collection_for_tenant ( tenant_id ) . create_keypair ( keypair = keypair_from_request ) return json . dumps ( keypair_response )