You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/12/21 15:14:23 UTC

[1/6] git commit: docs: Fix a typo.

Updated Branches:
  refs/heads/trunk 9741e0005 -> 2311fda18


docs: Fix a typo.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5e4233cf
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5e4233cf
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5e4233cf

Branch: refs/heads/trunk
Commit: 5e4233cf4421fd45e8190104197ae07e78e12118
Parents: 9741e00
Author: Tomaz Muraus <to...@apache.org>
Authored: Sat Dec 21 14:51:50 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Dec 21 14:51:50 2013 +0100

----------------------------------------------------------------------
 docs/getting_started.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/5e4233cf/docs/getting_started.rst
----------------------------------------------------------------------
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index fbfb310..57e3fc7 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -13,7 +13,7 @@ Libcloud is available on PyPi. You can install latest stable version using pip:
 Installation (development version)
 ----------------------------------
 
-You can install latest development version from out Git repository:
+You can install latest development version from our Git repository:
 
 .. sourcecode:: bash
 


[6/6] git commit: Fix test failure in Python 2.5; enumerate in 2.5 doesn't support start argument.

Posted by to...@apache.org.
Fix test failure in Python 2.5; enumerate in 2.5 doesn't support start argument.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2311fda1
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2311fda1
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2311fda1

Branch: refs/heads/trunk
Commit: 2311fda184ae5bc03a6856560ee0da20d714f997
Parents: 20ed92e
Author: Tomaz Muraus <to...@apache.org>
Authored: Sat Dec 21 15:09:16 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Dec 21 15:10:55 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/ec2.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/2311fda1/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 7083453..90fc864 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -2241,7 +2241,9 @@ class BaseEC2NodeDriver(NodeDriver):
 
         if cidr_ips is not None:
             ip_ranges = {}
-            for index, cidr_ip in enumerate(cidr_ips, 1):
+            for index, cidr_ip in enumerate(cidr_ips):
+                index += 1
+
                 ip_ranges['IpPermissions.1.IpRanges.%s.CidrIp'
                           % (index)] = cidr_ip
 
@@ -2249,7 +2251,9 @@ class BaseEC2NodeDriver(NodeDriver):
 
         if group_pairs is not None:
             user_groups = {}
-            for index, group_pair in enumerate(group_pairs, 1):
+            for index, group_pair in enumerate(group_pairs):
+                index += 1
+
                 if 'group_id' in group_pair.keys():
                     user_groups['IpPermissions.1.Groups.%s.GroupId'
                                 % (index)] = group_pair['group_id']


[4/6] git commit: Update CHANGES.

Posted by to...@apache.org.
Update CHANGES.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/dcbfaa6c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/dcbfaa6c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/dcbfaa6c

Branch: refs/heads/trunk
Commit: dcbfaa6cfb4706909d0999036c917c6cb39acb5e
Parents: 850c992
Author: Tomaz Muraus <to...@apache.org>
Authored: Sat Dec 21 15:07:21 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Dec 21 15:07:21 2013 +0100

----------------------------------------------------------------------
 CHANGES | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/dcbfaa6c/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 801a02b..e5d489e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -96,6 +96,12 @@ Changes with Apache Libcloud in development
       (LIBCLOUD-463)
       [Chris DeRamus]
 
+    - Add extension methods for managing security group rules
+      (ex_authorize_security_group_ingress, ex_authorize_security_group_egress,
+      ex_revoke_security_group_ingress, ex_revoke_security_group_egress) to the
+      EC2 driver. (LIBCLOUD-466)
+      [Chris DeRamus]
+
   *) Storage
 
     - Allow user to specify 'Content-Disposition' header in the CloudFiles


[5/6] git commit: Fix indentation.

Posted by to...@apache.org.
Fix indentation.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/20ed92ed
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/20ed92ed
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/20ed92ed

Branch: refs/heads/trunk
Commit: 20ed92ed81fda068c2710ddc4c2d6bc101b54ede
Parents: dcbfaa6
Author: Tomaz Muraus <to...@apache.org>
Authored: Sat Dec 21 15:07:33 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Dec 21 15:07:33 2013 +0100

----------------------------------------------------------------------
 CHANGES | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/20ed92ed/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index e5d489e..0a75b5a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -87,20 +87,20 @@ Changes with Apache Libcloud in development
      (GITHUB-196)
      [Oleg Suharev]
 
-    - Add support for new "i2" instance types to Amazon EC2 driver. Also
-      update pricing file. (LIBCLOUD-465)
-      [Chris DeRamus]
-
-    - Allow user to specify VPC id when creating a security group in the EC2
-      driver by passing "vpc_id" argument to ex_create_security_group method.
-      (LIBCLOUD-463)
-      [Chris DeRamus]
-
-    - Add extension methods for managing security group rules
-      (ex_authorize_security_group_ingress, ex_authorize_security_group_egress,
-      ex_revoke_security_group_ingress, ex_revoke_security_group_egress) to the
-      EC2 driver. (LIBCLOUD-466)
-      [Chris DeRamus]
+   - Add support for new "i2" instance types to Amazon EC2 driver. Also
+     update pricing file. (LIBCLOUD-465)
+     [Chris DeRamus]
+
+   - Allow user to specify VPC id when creating a security group in the EC2
+     driver by passing "vpc_id" argument to ex_create_security_group method.
+     (LIBCLOUD-463)
+     [Chris DeRamus]
+
+   - Add extension methods for managing security group rules
+     (ex_authorize_security_group_ingress, ex_authorize_security_group_egress,
+     ex_revoke_security_group_ingress, ex_revoke_security_group_egress) to the
+     EC2 driver. (LIBCLOUD-466)
+     [Chris DeRamus]
 
   *) Storage
 


[3/6] git commit: Move "private" method to the end, add a docstrings.

Posted by to...@apache.org.
Move "private" method to the end, add a docstrings.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/850c9920
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/850c9920
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/850c9920

Branch: refs/heads/trunk
Commit: 850c992029ccfaab1131f069e5f3e7a6ff0cb4eb
Parents: 5739339
Author: Tomaz Muraus <to...@apache.org>
Authored: Sat Dec 21 15:05:03 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Dec 21 15:05:03 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/ec2.py | 77 +++++++++++++++++++-----------------
 1 file changed, 41 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/850c9920/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 805f025..7083453 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -776,42 +776,6 @@ class BaseEC2NodeDriver(NodeDriver):
                                      'description': description,
                                      'state': state})
 
-    def _get_common_security_group_params(self, group_id, protocol,
-                                          from_port, to_port, cidr_ips,
-                                          group_pairs):
-
-        params = {'GroupId': id,
-                  'IpPermissions.1.IpProtocol': protocol,
-                  'IpPermissions.1.FromPort': from_port,
-                  'IpPermissions.1.ToPort': to_port}
-
-        if cidr_ips is not None:
-            ip_ranges = {}
-            for index, cidr_ip in enumerate(cidr_ips, 1):
-                ip_ranges['IpPermissions.1.IpRanges.%s.CidrIp'
-                          % (index)] = cidr_ip
-
-            params.update(ip_ranges)
-
-        if group_pairs is not None:
-            user_groups = {}
-            for index, group_pair in enumerate(group_pairs, 1):
-                if 'group_id' in group_pair.keys():
-                    user_groups['IpPermissions.1.Groups.%s.GroupId'
-                                % (index)] = group_pair['group_id']
-
-                if 'group_name' in group_pair.keys():
-                    user_groups['IpPermissions.1.Groups.%s.GroupName'
-                                % (index)] = group_pair['group_name']
-
-                if 'user_id' in group_pair.keys():
-                    user_groups['IpPermissions.1.Groups.%s.UserId'
-                                % (index)] = group_pair['user_id']
-
-            params.update(user_groups)
-
-        return params
-
     def list_nodes(self, ex_node_ids=None):
         """
         List all nodes
@@ -2261,6 +2225,47 @@ class BaseEC2NodeDriver(NodeDriver):
         res = self.connection.request(self.path, params=params).object
         return self._get_terminate_boolean(res)
 
+    def _get_common_security_group_params(self, group_id, protocol,
+                                          from_port, to_port, cidr_ips,
+                                          group_pairs):
+        """
+        Return a dictionary with common query parameters which are used when
+        operating on security groups.
+
+        :rtype: ``dict``
+        """
+        params = {'GroupId': id,
+                  'IpPermissions.1.IpProtocol': protocol,
+                  'IpPermissions.1.FromPort': from_port,
+                  'IpPermissions.1.ToPort': to_port}
+
+        if cidr_ips is not None:
+            ip_ranges = {}
+            for index, cidr_ip in enumerate(cidr_ips, 1):
+                ip_ranges['IpPermissions.1.IpRanges.%s.CidrIp'
+                          % (index)] = cidr_ip
+
+            params.update(ip_ranges)
+
+        if group_pairs is not None:
+            user_groups = {}
+            for index, group_pair in enumerate(group_pairs, 1):
+                if 'group_id' in group_pair.keys():
+                    user_groups['IpPermissions.1.Groups.%s.GroupId'
+                                % (index)] = group_pair['group_id']
+
+                if 'group_name' in group_pair.keys():
+                    user_groups['IpPermissions.1.Groups.%s.GroupName'
+                                % (index)] = group_pair['group_name']
+
+                if 'user_id' in group_pair.keys():
+                    user_groups['IpPermissions.1.Groups.%s.UserId'
+                                % (index)] = group_pair['user_id']
+
+            params.update(user_groups)
+
+        return params
+
 
 class EC2NodeDriver(BaseEC2NodeDriver):
     """


[2/6] git commit: Issue: LIBCLOUD-466 Add ingress/egress VPC support to security group rules.

Posted by to...@apache.org.
Issue: LIBCLOUD-466 Add ingress/egress VPC support to security group rules.

Signed-off-by: Tomaz Muraus <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/57393395
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/57393395
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/57393395

Branch: refs/heads/trunk
Commit: 573933951172b0b23673dcb2689d1adc089dd144
Parents: 5e4233c
Author: Chris DeRamus <ch...@divvycloud.com>
Authored: Fri Dec 20 11:26:23 2013 -0500
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sat Dec 21 15:02:56 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/ec2.py                 | 256 +++++++++++++++++++
 .../ec2/authorize_security_group_egress.xml     |   4 +
 .../ec2/revoke_security_group_egress.xml        |   4 +
 .../ec2/revoke_security_group_ingress.xml       |   4 +
 libcloud/test/compute/test_ec2.py               |  32 +++
 5 files changed, 300 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/57393395/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 2f8dcfe..805f025 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -776,6 +776,42 @@ class BaseEC2NodeDriver(NodeDriver):
                                      'description': description,
                                      'state': state})
 
+    def _get_common_security_group_params(self, group_id, protocol,
+                                          from_port, to_port, cidr_ips,
+                                          group_pairs):
+
+        params = {'GroupId': id,
+                  'IpPermissions.1.IpProtocol': protocol,
+                  'IpPermissions.1.FromPort': from_port,
+                  'IpPermissions.1.ToPort': to_port}
+
+        if cidr_ips is not None:
+            ip_ranges = {}
+            for index, cidr_ip in enumerate(cidr_ips, 1):
+                ip_ranges['IpPermissions.1.IpRanges.%s.CidrIp'
+                          % (index)] = cidr_ip
+
+            params.update(ip_ranges)
+
+        if group_pairs is not None:
+            user_groups = {}
+            for index, group_pair in enumerate(group_pairs, 1):
+                if 'group_id' in group_pair.keys():
+                    user_groups['IpPermissions.1.Groups.%s.GroupId'
+                                % (index)] = group_pair['group_id']
+
+                if 'group_name' in group_pair.keys():
+                    user_groups['IpPermissions.1.Groups.%s.GroupName'
+                                % (index)] = group_pair['group_name']
+
+                if 'user_id' in group_pair.keys():
+                    user_groups['IpPermissions.1.Groups.%s.UserId'
+                                % (index)] = group_pair['user_id']
+
+            params.update(user_groups)
+
+        return params
+
     def list_nodes(self, ex_node_ids=None):
         """
         List all nodes
@@ -1384,6 +1420,226 @@ class BaseEC2NodeDriver(NodeDriver):
             if e.args[0].find('InvalidPermission.Duplicate') == -1:
                 raise e
 
+    def ex_authorize_security_group_ingress(self, id, from_port, to_port,
+                                            cidr_ips=None, group_pairs=None,
+                                            protocol='tcp'):
+        """
+        Edit a Security Group to allow specific ingress traffic using
+        CIDR blocks or either a group ID, group name or user ID (account).
+
+        :param      id: The id of the security group to edit
+        :type       id: ``str``
+
+        :param      from_port: The beginning of the port range to open
+        :type       from_port: ``int``
+
+        :param      to_port: The end of the port range to open
+        :type       to_port: ``int``
+
+        :param      cidr_ips: The list of ip ranges to allow traffic for.
+        :type       cidr_ips: ``list``
+
+        :param      group_pairs: Source user/group pairs to allow traffic for.
+                    More info can be found at http://goo.gl/stBHJF
+
+                    EC2 Classic Example: To allow access from any system
+                    associated with the default group on account 1234567890
+
+                    [{'group_name': 'default', 'user_id': '1234567890'}]
+
+                    VPC Example: Allow access from any system associated with
+                    security group sg-47ad482e on your own account
+
+                    [{'group_id': ' sg-47ad482e'}]
+        :type       group_pairs: ``list`` of ``dict``
+
+        :param      protocol: tcp/udp/icmp
+        :type       protocol: ``str``
+
+        :rtype: ``bool``
+        """
+
+        params = self._get_common_security_group_params(id,
+                                                        protocol,
+                                                        from_port,
+                                                        to_port,
+                                                        cidr_ips,
+                                                        group_pairs)
+
+        params["Action"] = 'AuthorizeSecurityGroupIngress'
+
+        result = self.connection.request(self.path, params=params).object
+        element = findtext(element=result, xpath='return',
+                           namespace=NAMESPACE)
+
+        return element == 'true'
+
+    def ex_authorize_security_group_egress(self, id, from_port, to_port,
+                                           cidr_ips=None, group_pairs=None,
+                                           protocol='tcp'):
+        """
+        Edit a Security Group to allow specific egress traffic using
+        CIDR blocks or either a group ID, group name or user ID (account).
+        This call is not supported for EC2 classic and only works for VPC
+        groups.
+
+        :param      id: The id of the security group to edit
+        :type       id: ``str``
+
+        :param      from_port: The beginning of the port range to open
+        :type       from_port: ``int``
+
+        :param      to_port: The end of the port range to open
+        :type       to_port: ``int``
+
+        :param      cidr_ips: The list of ip ranges to allow traffic for.
+        :type       cidr_ips: ``list``
+
+        :param      group_pairs: Source user/group pairs to allow traffic for.
+                    More info can be found at http://goo.gl/stBHJF
+
+                    EC2 Classic Example: To allow access from any system
+                    associated with the default group on account 1234567890
+
+                    [{'group_name': 'default', 'user_id': '1234567890'}]
+
+                    VPC Example: Allow access from any system associated with
+                    security group sg-47ad482e on your own account
+
+                    [{'group_id': ' sg-47ad482e'}]
+        :type       group_pairs: ``list`` of ``dict``
+
+        :param      protocol: tcp/udp/icmp
+        :type       protocol: ``str``
+
+        :rtype: ``bool``
+        """
+
+        params = self._get_common_security_group_params(id,
+                                                        protocol,
+                                                        from_port,
+                                                        to_port,
+                                                        cidr_ips,
+                                                        group_pairs)
+
+        params["Action"] = 'AuthorizeSecurityGroupEgress'
+
+        result = self.connection.request(self.path, params=params).object
+        element = findtext(element=result, xpath='return',
+                           namespace=NAMESPACE)
+
+        return element == 'true'
+
+    def ex_revoke_security_group_ingress(self, id, from_port, to_port,
+                                         cidr_ips=None, group_pairs=None,
+                                         protocol='tcp'):
+        """
+        Edit a Security Group to revoke specific ingress traffic using
+        CIDR blocks or either a group ID, group name or user ID (account).
+
+        :param      id: The id of the security group to edit
+        :type       id: ``str``
+
+        :param      from_port: The beginning of the port range to open
+        :type       from_port: ``int``
+
+        :param      to_port: The end of the port range to open
+        :type       to_port: ``int``
+
+        :param      cidr_ips: The list of ip ranges to allow traffic for.
+        :type       cidr_ips: ``list``
+
+        :param      group_pairs: Source user/group pairs to allow traffic for.
+                    More info can be found at http://goo.gl/stBHJF
+
+                    EC2 Classic Example: To allow access from any system
+                    associated with the default group on account 1234567890
+
+                    [{'group_name': 'default', 'user_id': '1234567890'}]
+
+                    VPC Example: Allow access from any system associated with
+                    security group sg-47ad482e on your own account
+
+                    [{'group_id': ' sg-47ad482e'}]
+        :type       group_pairs: ``list`` of ``dict``
+
+        :param      protocol: tcp/udp/icmp
+        :type       protocol: ``str``
+
+        :rtype: ``bool``
+        """
+
+        params = self._get_common_security_group_params(id,
+                                                        protocol,
+                                                        from_port,
+                                                        to_port,
+                                                        cidr_ips,
+                                                        group_pairs)
+
+        params["Action"] = 'RevokeSecurityGroupIngress'
+
+        result = self.connection.request(self.path, params=params).object
+        element = findtext(element=result, xpath='return',
+                           namespace=NAMESPACE)
+
+        return element == 'true'
+
+    def ex_revoke_security_group_egress(self, id, from_port, to_port,
+                                        cidr_ips=None, group_pairs=None,
+                                        protocol='tcp'):
+        """
+        Edit a Security Group to revoke specific egress traffic using
+        CIDR blocks or either a group ID, group name or user ID (account).
+        This call is not supported for EC2 classic and only works for
+        VPC groups.
+
+        :param      id: The id of the security group to edit
+        :type       id: ``str``
+
+        :param      from_port: The beginning of the port range to open
+        :type       from_port: ``int``
+
+        :param      to_port: The end of the port range to open
+        :type       to_port: ``int``
+
+        :param      cidr_ips: The list of ip ranges to allow traffic for.
+        :type       cidr_ips: ``list``
+
+        :param      group_pairs: Source user/group pairs to allow traffic for.
+                    More info can be found at http://goo.gl/stBHJF
+
+                    EC2 Classic Example: To allow access from any system
+                    associated with the default group on account 1234567890
+
+                    [{'group_name': 'default', 'user_id': '1234567890'}]
+
+                    VPC Example: Allow access from any system associated with
+                    security group sg-47ad482e on your own account
+
+                    [{'group_id': ' sg-47ad482e'}]
+        :type       group_pairs: ``list`` of ``dict``
+
+        :param      protocol: tcp/udp/icmp
+        :type       protocol: ``str``
+
+        :rtype: ``bool``
+        """
+
+        params = self._get_common_security_group_params(id,
+                                                        protocol,
+                                                        from_port,
+                                                        to_port,
+                                                        cidr_ips,
+                                                        group_pairs)
+
+        params['Action'] = 'RevokeSecurityGroupEgress'
+
+        result = self.connection.request(self.path, params=params).object
+        element = findtext(element=result, xpath='return',
+                           namespace=NAMESPACE)
+
+        return element == 'true'
+
     def ex_authorize_security_group_permissive(self, name):
         """
         Edit a Security Group to allow all traffic.

http://git-wip-us.apache.org/repos/asf/libcloud/blob/57393395/libcloud/test/compute/fixtures/ec2/authorize_security_group_egress.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/ec2/authorize_security_group_egress.xml b/libcloud/test/compute/fixtures/ec2/authorize_security_group_egress.xml
new file mode 100644
index 0000000..41e7e46
--- /dev/null
+++ b/libcloud/test/compute/fixtures/ec2/authorize_security_group_egress.xml
@@ -0,0 +1,4 @@
+<AuthorizeSecurityGroupEgressResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
+  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
+  <return>true</return>
+</AuthorizeSecurityGroupEgressResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/57393395/libcloud/test/compute/fixtures/ec2/revoke_security_group_egress.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/ec2/revoke_security_group_egress.xml b/libcloud/test/compute/fixtures/ec2/revoke_security_group_egress.xml
new file mode 100644
index 0000000..248fbb7
--- /dev/null
+++ b/libcloud/test/compute/fixtures/ec2/revoke_security_group_egress.xml
@@ -0,0 +1,4 @@
+<RevokeSecurityGroupEgressResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
+  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
+  <return>true</return>
+</RevokeSecurityGroupEgressResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/57393395/libcloud/test/compute/fixtures/ec2/revoke_security_group_ingress.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/ec2/revoke_security_group_ingress.xml b/libcloud/test/compute/fixtures/ec2/revoke_security_group_ingress.xml
new file mode 100644
index 0000000..26708da
--- /dev/null
+++ b/libcloud/test/compute/fixtures/ec2/revoke_security_group_ingress.xml
@@ -0,0 +1,4 @@
+<RevokeSecurityGroupIngressResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
+  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
+  <return>true</return>
+</RevokeSecurityGroupIngressResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/57393395/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 4364d69..1a843fd 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -220,6 +220,38 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
                                                        '0.0.0.0/0')
         self.assertTrue(resp)
 
+    def test_authorize_security_group_ingress(self):
+        ranges = ['1.1.1.1/32', '2.2.2.2/32']
+        resp = self.driver.ex_authorize_security_group_ingress('sg-42916629', 22, 22, cidr_ips=ranges)
+        self.assertTrue(resp)
+        groups = [{'group_id': 'sg-949265ff'}]
+        resp = self.driver.ex_authorize_security_group_ingress('sg-42916629', 22, 23, group_pairs=groups)
+        self.assertTrue(resp)
+
+    def test_authorize_security_group_egress(self):
+        ranges = ['1.1.1.1/32', '2.2.2.2/32']
+        resp = self.driver.ex_authorize_security_group_ingress('sg-42916629', 22, 22, cidr_ips=ranges)
+        self.assertTrue(resp)
+        groups = [{'group_id': 'sg-949265ff'}]
+        resp = self.driver.ex_authorize_security_group_ingress('sg-42916629', 22, 22, group_pairs=groups)
+        self.assertTrue(resp)
+
+    def test_revoke_security_group_ingress(self):
+        ranges = ['1.1.1.1/32', '2.2.2.2/32']
+        resp = self.driver.ex_authorize_security_group_ingress('sg-42916629', 22, 22, cidr_ips=ranges)
+        self.assertTrue(resp)
+        groups = [{'group_id': 'sg-949265ff'}]
+        resp = self.driver.ex_authorize_security_group_ingress('sg-42916629', 22, 22, group_pairs=groups)
+        self.assertTrue(resp)
+
+    def test_revoke_security_group_egress(self):
+        ranges = ['1.1.1.1/32', '2.2.2.2/32']
+        resp = self.driver.ex_authorize_security_group_ingress('sg-42916629', 22, 22, cidr_ips=ranges)
+        self.assertTrue(resp)
+        groups = [{'group_id': 'sg-949265ff'}]
+        resp = self.driver.ex_authorize_security_group_ingress('sg-42916629', 22, 22, group_pairs=groups)
+        self.assertTrue(resp)
+
     def test_reboot_node(self):
         node = Node('i-4382922a', None, None, None, None, self.driver)
         ret = self.driver.reboot_node(node)