Add new ModifyInstanceKeypair API in Outscale EC2 driver Signed-off-by: Javier M. Mellid <jmun...@igalia.com>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e778636c Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e778636c Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e778636c Branch: refs/heads/trunk Commit: e778636ce7ee27ff9de8cc75eb2869fcb9ff8b66 Parents: d277e98 Author: Javier M. Mellid <jmun...@igalia.com> Authored: Mon Oct 3 14:07:54 2016 +0200 Committer: Anthony Shaw <anthonys...@apache.org> Committed: Fri Oct 7 13:23:41 2016 +1100 ---------------------------------------------------------------------- libcloud/compute/drivers/ec2.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/e778636c/libcloud/compute/drivers/ec2.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py index ec38dfd..cf338e1 100644 --- a/libcloud/compute/drivers/ec2.py +++ b/libcloud/compute/drivers/ec2.py @@ -6811,6 +6811,31 @@ class OutscaleNodeDriver(BaseEC2NodeDriver): sizes.append(NodeSize(driver=self, **attributes)) return sizes + def ex_modify_instance_keypair(self, instance_id, key_name=None): + """ + Modifies the keypair associated with a specified instance. + Once the modification done, you must restart the instance. + + :param instance_id: The ID of the instance + :type instance_id: ``string`` + + :param key_name: The name of the keypair + :type key_name: ``string`` + """ + + params = {'Action': 'ModifyInstanceKeypair'} + + params.update({'instanceId': instance_id}) + + if key_name is not None: + params.update({'keyName': key_name}) + + response = self.connection.request(self.path, params=params, + method='GET').object + + return (findtext(element=response, xpath='return', + namespace=OUTSCALE_NAMESPACE) == 'true') + def _to_quota(self, elem): """ To Quota