Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement euca-authorize/revoke in the same module

  • Loading branch information...
commit 219de8cbae09d2d4d7ea98a340a4ac5a6c7b6a7e 1 parent ea0431a
@gholms gholms authored
View
4 bin/euca-authorize
@@ -1,6 +1,6 @@
#!/usr/bin/python -tt
-import euca2ools.commands.ec2.authorize
+import euca2ools.commands.ec2.modifysecuritygrouprule
if __name__ == '__main__':
- euca2ools.commands.ec2.authorize.Authorize.run()
+ euca2ools.commands.ec2.modifysecuritygrouprule.AuthorizeSecurityGroupRule.run()
View
4 bin/euca-revoke
@@ -1,6 +1,6 @@
#!/usr/bin/python -tt
-import euca2ools.commands.ec2.revoke
+import euca2ools.commands.ec2.modifysecuritygrouprule
if __name__ == '__main__':
- euca2ools.commands.ec2.revoke.Revoke.run()
+ euca2ools.commands.ec2.modifysecuritygrouprule.RevokeSecurityGroupRule.run()
View
37 euca2ools/commands/ec2/authorize.py
@@ -1,37 +0,0 @@
-# Copyright 2009-2013 Eucalyptus Systems, Inc.
-#
-# Redistribution and use of this software in source and binary forms,
-# with or without modification, are permitted provided that the following
-# conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-from euca2ools.commands.ec2.modgroup import ModifySecurityGroupRequest
-
-
-class Authorize(ModifySecurityGroupRequest):
- DESCRIPTION = 'Add a rule to a security group that allows traffic to pass'
-
- @property
- def action(self):
- if self.args['egress']:
- return 'AuthorizeSecurityGroupEgress'
- else:
- return 'AuthorizeSecurityGroupIngress'
View
24 euca2ools/commands/ec2/modgroup.py → euca2ools/commands/ec2/modifysecuritygrouprule.py
@@ -32,7 +32,7 @@
from euca2ools.commands.ec2 import EC2Request, parse_ports
-class ModifySecurityGroupRequest(EC2Request):
+class _ModifySecurityGroupRule(EC2Request):
"""
The basis for security group-editing commands
"""
@@ -131,3 +131,25 @@ def print_result(self, _):
perm_str.append(self.params.get(
'IpPermissions.1.IpRanges.1.CidrIp'))
print self.tabify(perm_str)
+
+
+class AuthorizeSecurityGroupRule(_ModifySecurityGroupRule):
+ DESCRIPTION = 'Add a rule to a security group that allows traffic to pass'
+
+ @property
+ def action(self):
+ if self.args['egress']:
+ return 'AuthorizeSecurityGroupEgress'
+ else:
+ return 'AuthorizeSecurityGroupIngress'
+
+
+class RevokeSecurityGroupRule(_ModifySecurityGroupRule):
+ DESCRIPTION = 'Remove a rule from a security group'
+
+ @property
+ def action(self):
+ if self.args['egress']:
+ return 'RevokeSecurityGroupEgress'
+ else:
+ return 'RevokeSecurityGroupIngress'
View
37 euca2ools/commands/ec2/revoke.py
@@ -1,37 +0,0 @@
-# Copyright 2009-2013 Eucalyptus Systems, Inc.
-#
-# Redistribution and use of this software in source and binary forms,
-# with or without modification, are permitted provided that the following
-# conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-from euca2ools.commands.ec2.modgroup import ModifySecurityGroupRequest
-
-
-class Revoke(ModifySecurityGroupRequest):
- DESCRIPTION = 'Remove a rule from a security group'
-
- @property
- def action(self):
- if self.args['egress']:
- return 'RevokeSecurityGroupEgress'
- else:
- return 'RevokeSecurityGroupIngress'
Please sign in to comment.
Something went wrong with that request. Please try again.