lib/fog/aws/requests/compute/create_subnet.rb in fog-aws-3.1.0 vs lib/fog/aws/requests/compute/create_subnet.rb in fog-aws-3.2.0

- old
+ new

@@ -1,8 +1,8 @@ module Fog - module Compute - class AWS + module AWS + class Compute class Real require 'ipaddress' require 'fog/aws/parsers/compute/create_subnet' # Creates a Subnet with the CIDR block you specify. @@ -34,11 +34,11 @@ def create_subnet(vpcId, cidrBlock, options = {}) request({ 'Action' => 'CreateSubnet', 'VpcId' => vpcId, 'CidrBlock' => cidrBlock, - :parser => Fog::Parsers::Compute::AWS::CreateSubnet.new + :parser => Fog::Parsers::AWS::Compute::CreateSubnet.new }.merge!(options)) end end class Mock @@ -46,17 +46,17 @@ av_zone = options['AvailabilityZone'].nil? ? 'us-east-1c' : options['AvailabilityZone'] Excon::Response.new.tap do |response| if cidrBlock && vpcId vpc = self.data[:vpcs].find{ |v| v['vpcId'] == vpcId } if vpc.nil? - raise Fog::Compute::AWS::NotFound.new("The vpc ID '#{vpcId}' does not exist") + raise Fog::AWS::Compute::NotFound.new("The vpc ID '#{vpcId}' does not exist") end if ! ::IPAddress.parse(vpc['cidrBlock']).include?(::IPAddress.parse(cidrBlock)) - raise Fog::Compute::AWS::Error.new("Range => The CIDR '#{cidrBlock}' is invalid.") + raise Fog::AWS::Compute::Error.new("Range => The CIDR '#{cidrBlock}' is invalid.") end self.data[:subnets].select{ |s| s['vpcId'] == vpcId }.each do |subnet| if ::IPAddress.parse(subnet['cidrBlock']).include?(::IPAddress.parse(cidrBlock)) - raise Fog::Compute::AWS::Error.new("Conflict => The CIDR '#{cidrBlock}' conflicts with another subnet") + raise Fog::AWS::Compute::Error.new("Conflict => The CIDR '#{cidrBlock}' conflicts with another subnet") end end response.status = 200 data = {