summaryrefslogtreecommitdiff
path: root/boto/ec2/keypair.py
diff options
context:
space:
mode:
authorDaniel Lindsley <daniel@toastdriven.com>2013-09-11 17:31:24 -0700
committerDaniel Lindsley <daniel@toastdriven.com>2013-09-11 18:23:51 -0700
commit530b1aa08e03a28a1c789db45c1936bc0d56344f (patch)
treeb5801d42147426d5a30562425fa0f4a1ea4812f5 /boto/ec2/keypair.py
parent6c5a394670aef55435e24423fd26e56a0b3b3489 (diff)
downloadboto-530b1aa08e03a28a1c789db45c1936bc0d56344f.tar.gz
Added ``dry_run`` to. All. The. Things.
Diffstat (limited to 'boto/ec2/keypair.py')
-rw-r--r--boto/ec2/keypair.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/boto/ec2/keypair.py b/boto/ec2/keypair.py
index 65c95908..c15a0984 100644
--- a/boto/ec2/keypair.py
+++ b/boto/ec2/keypair.py
@@ -14,7 +14,7 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
-# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
@@ -28,7 +28,7 @@ from boto.ec2.ec2object import EC2Object
from boto.exception import BotoClientError
class KeyPair(EC2Object):
-
+
def __init__(self, connection=None):
EC2Object.__init__(self, connection)
self.name = None
@@ -48,20 +48,20 @@ class KeyPair(EC2Object):
else:
setattr(self, name, value)
- def delete(self):
+ def delete(self, dry_run=False):
"""
Delete the KeyPair.
-
+
:rtype: bool
:return: True if successful, otherwise False.
"""
- return self.connection.delete_key_pair(self.name)
+ return self.connection.delete_key_pair(self.name, dry_run=dry_run)
def save(self, directory_path):
"""
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
@@ -71,7 +71,7 @@ class KeyPair(EC2Object):
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.
"""
@@ -88,7 +88,7 @@ class KeyPair(EC2Object):
else:
raise BotoClientError('KeyPair contains no material')
- def copy_to_region(self, region):
+ def copy_to_region(self, region, dry_run=False):
"""
Create a new key pair of the same new in another region.
Note that the new key pair will use a different ssh
@@ -106,7 +106,7 @@ class KeyPair(EC2Object):
raise BotoClientError('Unable to copy to the same Region')
conn_params = self.connection.get_params()
rconn = region.connect(**conn_params)
- kp = rconn.create_key_pair(self.name)
+ kp = rconn.create_key_pair(self.name, dry_run=dry_run)
return kp