lib/fog/aws/requests/ec2/describe_security_groups.rb in fog-0.0.56 vs lib/fog/aws/requests/ec2/describe_security_groups.rb in fog-0.0.57

- old
+ new

@@ -1,10 +1,11 @@ -unless Fog.mocking? +module Fog + module AWS + module EC2 + class Real - module Fog - module AWS - class EC2 + require 'fog/aws/parsers/ec2/describe_security_groups' # Describe all or specified security groups # # ==== Parameters # * group_name<~Array> - List of groups to describe, defaults to all @@ -27,31 +28,26 @@ # * 'toPort'<~Integer> - End of port range (or -1 for ICMP wildcard) # * 'ownerId'<~String> - AWS Access Key Id of the owner of the security group def describe_security_groups(group_name = []) params = AWS.indexed_param('GroupName', group_name) request({ - 'Action' => 'DescribeSecurityGroups', - }.merge!(params), Fog::Parsers::AWS::EC2::DescribeSecurityGroups.new) + 'Action' => 'DescribeSecurityGroups', + :parser => Fog::Parsers::AWS::EC2::DescribeSecurityGroups.new + }.merge!(params)) end end - end - end -else + class Mock - module Fog - module AWS - class EC2 - def describe_security_groups(group_name = []) response = Excon::Response.new group_name = [*group_name] if group_name != [] - security_group_info = Fog::AWS::EC2.data[:security_groups].reject {|key, value| !group_name.include?(key)}.values + security_group_info = @data[:security_groups].reject {|key, value| !group_name.include?(key)}.values else - security_group_info = Fog::AWS::EC2.data[:security_groups].values + security_group_info = @data[:security_groups].values end if group_name.length == 0 || group_name.length == security_group_info.length response.status = 200 response.body = { 'requestId' => Fog::AWS::Mock.request_id, @@ -65,7 +61,6 @@ end end end end - end