Last active
December 30, 2015 09:39
-
-
Save Kami/7810989 to your computer and use it in GitHub Desktop.
[RFC] Proposal for the SSH key pair management methods to be promoted to be a part of a base compute base in Libcloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NodeDriver(object): | |
| # ... | |
| def create_node(self, ..., key_pair_name=None): | |
| """ | |
| :param key_pair_name: Optional name of an existing key pair to use, | |
| :type key_pair_name: ``str`` | |
| """ | |
| pass | |
| def list_key_pairs(self): | |
| """ | |
| List all the available key pair objects. | |
| :rtype: ``list`` of :class:`.KeyPair` objects | |
| """ | |
| pass | |
| def create_key_pair(self, name): | |
| """ | |
| Create a new key pair object. | |
| :param name: Key pair name. | |
| :type name: ``str`` | |
| """ | |
| pass | |
| def import_key_pair_from_string(self, name, key_material): | |
| """ | |
| Import a new public key from string. | |
| :param name: Key pair name. | |
| :type name: ``str`` | |
| :param key_material: Public key material. | |
| :type key_material: ``str`` | |
| :rtype: :class:`.KeyPair` object | |
| """ | |
| pass | |
| def import_key_pair_from_string(self, name, key_file_path): | |
| """ | |
| Import a new public key from string. | |
| :param name: Key pair name. | |
| :type name: ``str`` | |
| :param key_file_path: Path to the public key file. | |
| :type key_file_path: ``str`` | |
| :rtype: :class:`.KeyPair` object | |
| """ | |
| pass | |
| def delete_key_pair(self, key_pair): | |
| """ | |
| Delete an existing key pair. | |
| :param key_pair: Key pair object. | |
| :type key_pair: :class`.KeyPair` | |
| """ | |
| pass | |
| class KeyPair(object): | |
| """ | |
| Represents a SSH key pair. | |
| """ | |
| def __init__(self, name, public_key, fingerprint, driver=driver, private_key=None, | |
| extra=None): | |
| """ | |
| Constructor. | |
| :keyword name: Name of the key pair object. | |
| :type name: ``str`` | |
| :keyword fingerprint: Key fingerprint. | |
| :type fingerprint: ``str`` | |
| :keyword public_key: Public key in OpenSSH format. | |
| :type public_key: ``str`` | |
| :keyword private_key: Private key in PEM format. | |
| :type private_key: ``str`` | |
| :keyword extra: Provider specific attributes associated with this | |
| keyp air. | |
| :type extra: ``dict`` | |
| """ | |
| self.name = name | |
| self.fingerprint = fingerprint | |
| self.public_key = public_key | |
| self.private_key = private_key | |
| self.driver = driver | |
| self.extra = extra or {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment