diff --git a/lib/fog/aws/models/compute/spot_request.rb b/lib/fog/aws/models/compute/spot_request.rb index f7a0c6194..cd7879d35 100644 --- a/lib/fog/aws/models/compute/spot_request.rb +++ b/lib/fog/aws/models/compute/spot_request.rb @@ -27,8 +27,6 @@ module Fog attribute :image_id, :aliases => 'LaunchSpecification.ImageId' attribute :monitoring, :aliases => 'LaunchSpecification.Monitoring' attribute :block_device_mapping, :aliases => 'LaunchSpecification.BlockDeviceMapping' - attribute :associate_public_ip, :aliases => 'associatePublicIP' - attribute :network_interfaces, :aliases => 'LaunchSpecification.NetworkInterface' attribute :subnet_id, :aliases => 'LaunchSpecification.SubnetId' attribute :iam_instance_profile, :aliases => 'LaunchSpecification.IamInstanceProfile' @@ -92,7 +90,6 @@ module Fog 'InstanceCount' => instance_count, 'LaunchGroup' => launch_group, 'LaunchSpecification.BlockDeviceMapping' => block_device_mapping, - 'LaunchSpecification.NetworkInterface' => network_interfaces, 'LaunchSpecification.KeyName' => key_name, 'LaunchSpecification.Monitoring.Enabled' => monitoring, 'LaunchSpecification.Placement.AvailabilityZone' => availability_zone, @@ -107,30 +104,6 @@ module Fog 'ValidUntil' => valid_until } options.delete_if {|key, value| value.nil?} - # If subnet is defined then this is a Virtual Private Cloud. - # subnet & security group cannot co-exist. Attempting to specify - # both subnet and groups will cause an error. Instead please make - # use of Security Group Ids when working in a VPC. - if subnet_id - options.delete('LaunchSpecification.SecurityGroup') - if associate_public_ip - options['LaunchSpecification.NetworkInterface.0.DeviceIndex'] = 0 - options['LaunchSpecification.NetworkInterface.0.AssociatePublicIpAddress'] = associate_public_ip - options['LaunchSpecification.NetworkInterface.0.SubnetId'] = options['SubnetId'] - options.delete('LaunchSpecification.SubnetId') - if options['LaunchSpecification.SecurityGroupId'].kind_of?(Array) - options['LaunchSpecification.SecurityGroupId'].each {|id| - options["LaunchSpecification.NetworkInterface.0.SecurityGroupId.#{options['LaunchSpecification.SecurityGroupId'].index(id)}"] = id - } - else - options['LaunchSpecification.NetworkInterface.0.SecurityGroupId.0'] = options['LaunchSpecification.SecurityGroupId'] - end - options.delete('LaunchSpecification.SecurityGroupId') - end - else - options.delete('SubnetId') - end - data = service.request_spot_instances(image_id, flavor_id, price, options).body spot_instance_request = data['spotInstanceRequestSet'].first spot_instance_request['launchSpecification'].each do |name,value| diff --git a/lib/fog/aws/requests/compute/request_spot_instances.rb b/lib/fog/aws/requests/compute/request_spot_instances.rb index b77059f60..4d0d72ac7 100644 --- a/lib/fog/aws/requests/compute/request_spot_instances.rb +++ b/lib/fog/aws/requests/compute/request_spot_instances.rb @@ -21,18 +21,6 @@ module Fog # * 'Ebs.NoDevice'<~String> - specifies that no device should be mapped # * 'Ebs.VolumeSize'<~String> - size of volume in GiBs required unless snapshot is specified # * 'Ebs.DeleteOnTermination'<~String> - specifies whether or not to delete the volume on instance termination - # * 'LaunchSpecification.NetworkInterfaces'<~Array>: array of hashes - # * 'NetworkInterfaceId'<~String> - An existing interface to attach to a single instance - # * 'DeviceIndex'<~String> - The device index. Applies both to attaching an existing network interface and creating a network interface - # * 'SubnetId'<~String> - The subnet ID. Applies only when creating a network interface - # * 'Description'<~String> - A description. Applies only when creating a network interface - # * 'PrivateIpAddress'<~String> - The primary private IP address. Applies only when creating a network interface - # * 'SecurityGroupId'<~Array> or <~String> - ids of security group(s) for network interface. Applies only when creating a network interface. - # * 'DeleteOnTermination'<~String> - Indicates whether to delete the network interface on instance termination. - # * 'PrivateIpAddresses.PrivateIpAddress'<~String> - The private IP address. This parameter can be used multiple times to specify explicit private IP addresses for a network interface, but only one private IP address can be designated as primary. - # * 'PrivateIpAddresses.Primary'<~Bool> - Indicates whether the private IP address is the primary private IP address. - # * 'SecondaryPrivateIpAddressCount'<~Bool> - The number of private IP addresses to assign to the network interface. - # * 'AssociatePublicIpAddress'<~String> - Indicates whether to assign a public IP address to an instance in a VPC. The public IP address is assigned to a specific network interface # * 'LaunchSpecification.KeyName'<~String> - Name of a keypair to add to booting instances # * 'LaunchSpecification.Monitoring.Enabled'<~Boolean> - Enables monitoring, defaults to disabled # * 'LaunchSpecification.SubnetId'<~String> - VPC subnet ID in which to launch the instance @@ -76,19 +64,6 @@ module Fog end end end - if network_interfaces = options.delete('LaunchSpecification.NetworkInterfaces') - network_interfaces.each_with_index do |mapping, index| - iface = format("LaunchSpecification.NetworkInterface.%d", index) - for key, value in mapping - case key - when "SecurityGroupId" - options.merge!(Fog::AWS.indexed_param("#{iface}.SecurityGroupId", [*value])) - else - options.merge!({ "#{iface}.#{key}" => value }) - end - end - end - end if security_groups = options.delete('LaunchSpecification.SecurityGroup') options.merge!(Fog::AWS.indexed_param('LaunchSpecification.SecurityGroup', [*security_groups])) end