lib/fog/aws/requests/ec2/create_volume.rb in fog-0.0.56 vs lib/fog/aws/requests/ec2/create_volume.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/create_volume' # Create an EBS volume # # ==== Parameters # * availability_zone<~String> - availability zone to create volume in @@ -19,28 +20,23 @@ # * 'size'<~Integer> - Size in GiBs for volume # * 'snapshotId'<~String> - Snapshot volume was created from, if any # * 'status's<~String> - State of volume # * 'volumeId'<~String> - Reference to volume def create_volume(availability_zone, size, snapshot_id = nil) - request({ - 'Action' => 'CreateVolume', - 'AvailabilityZone' => availability_zone, - 'Size' => size, - 'SnapshotId' => snapshot_id - }, Fog::Parsers::AWS::EC2::CreateVolume.new) + request( + 'Action' => 'CreateVolume', + 'AvailabilityZone' => availability_zone, + 'Size' => size, + 'SnapshotId' => snapshot_id, + :parser => Fog::Parsers::AWS::EC2::CreateVolume.new + ) end end - end - end -else + class Mock - module Fog - module AWS - class EC2 - def create_volume(availability_zone, size, snapshot_id = nil) response = Excon::Response.new if availability_zone && size response.status = 200 volume_id = Fog::AWS::Mock.volume_id @@ -51,11 +47,11 @@ 'size' => size, 'snapshotId' => snapshot_id || '', 'status' => 'creating', 'volumeId' => volume_id } - Fog::AWS::EC2.data[:volumes][volume_id] = data + @data[:volumes][volume_id] = data response.body = { 'requestId' => Fog::AWS::Mock.request_id }.merge!(data.reject {|key,value| !['availabilityZone','createTime','size','snapshotId','status','volumeId'].include?(key) }) else response.status = 400 @@ -72,7 +68,6 @@ end end end end - end