mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
git grep -l "Compute::AWS" -- lib/ | xargs sed -i "" "s/Compute::AWS/AWS::Compute/g"
This commit is contained in:
parent
6d45ed5eab
commit
af3564d0db
156 changed files with 350 additions and 350 deletions
|
@ -204,7 +204,7 @@ module Fog
|
|||
options = group_name
|
||||
elsif group_name
|
||||
if options.key?('GroupName')
|
||||
raise Fog::Compute::AWS::Error, 'Arguments specified both group_name and GroupName in options'
|
||||
raise Fog::AWS::Compute::Error, 'Arguments specified both group_name and GroupName in options'
|
||||
end
|
||||
options = options.clone
|
||||
options['GroupName'] = group_name
|
||||
|
@ -212,7 +212,7 @@ module Fog
|
|||
name_specified = options.key?('GroupName') && !options['GroupName'].nil?
|
||||
group_id_specified = options.key?('GroupId') && !options['GroupId'].nil?
|
||||
unless name_specified || group_id_specified
|
||||
raise Fog::Compute::AWS::Error, 'Neither GroupName nor GroupId specified'
|
||||
raise Fog::AWS::Compute::Error, 'Neither GroupName nor GroupId specified'
|
||||
end
|
||||
if name_specified && group_id_specified
|
||||
options.delete('GroupName')
|
||||
|
|
|
@ -634,7 +634,7 @@ module Fog
|
|||
raise if match.empty?
|
||||
raise case match[:code]
|
||||
when 'NotFound', 'Unknown'
|
||||
Fog::Compute::AWS::NotFound.slurp(error, match[:message])
|
||||
Fog::AWS::Compute::NotFound.slurp(error, match[:message])
|
||||
when 'RequestLimitExceeded'
|
||||
if @retry_request_limit_exceeded && retries < max_retries
|
||||
jitter = rand * 10 * @retry_jitter_magnitude
|
||||
|
@ -644,12 +644,12 @@ module Fog
|
|||
retries += 1
|
||||
retry
|
||||
elsif @retry_request_limit_exceeded
|
||||
Fog::Compute::AWS::RequestLimitExceeded.slurp(error, "Max retries exceeded (#{max_retries}) #{match[:code]} => #{match[:message]}")
|
||||
Fog::AWS::Compute::RequestLimitExceeded.slurp(error, "Max retries exceeded (#{max_retries}) #{match[:code]} => #{match[:message]}")
|
||||
else
|
||||
Fog::Compute::AWS::RequestLimitExceeded.slurp(error, "#{match[:code]} => #{match[:message]}")
|
||||
Fog::AWS::Compute::RequestLimitExceeded.slurp(error, "#{match[:code]} => #{match[:message]}")
|
||||
end
|
||||
else
|
||||
Fog::Compute::AWS::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
||||
Fog::AWS::Compute::Error.slurp(error, "#{match[:code]} => #{match[:message]}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module Fog
|
|||
module ServiceMethods
|
||||
def fetch_credentials(options)
|
||||
if options[:use_iam_profile] && Fog.mocking?
|
||||
return Fog::Compute::AWS::Mock.data[:iam_role_based_creds]
|
||||
return Fog::AWS::Compute::Mock.data[:iam_role_based_creds]
|
||||
end
|
||||
if options[:use_iam_profile]
|
||||
begin
|
||||
|
|
|
@ -64,7 +64,7 @@ module Fog
|
|||
end
|
||||
|
||||
def mock_compute
|
||||
@mock_compute ||= Fog::Compute::AWS.new(:aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key, :region => @region)
|
||||
@mock_compute ||= Fog::AWS::Compute.new(:aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key, :region => @region)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module Fog
|
|||
attribute :filters
|
||||
attribute :server
|
||||
|
||||
model Fog::Compute::AWS::Address
|
||||
model Fog::AWS::Compute::Address
|
||||
|
||||
# Used to create an IP address
|
||||
#
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class DhcpOptions < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::DhcpOption
|
||||
model Fog::AWS::Compute::DhcpOption
|
||||
|
||||
# Creates a new dhcp option
|
||||
#
|
||||
|
@ -17,7 +17,7 @@ module Fog
|
|||
# Returns the details of the new DHCP options
|
||||
#
|
||||
#>> AWS.dhcp_options.new
|
||||
#=> <Fog::Compute::AWS::DhcpOption
|
||||
#=> <Fog::AWS::Compute::DhcpOption
|
||||
#id=nil,
|
||||
#dhcp_configuration_set=nil,
|
||||
#tag_set=nil
|
||||
|
@ -38,10 +38,10 @@ module Fog
|
|||
# Returns an array of all DhcpOptions
|
||||
#
|
||||
#>> AWS.dhcp_options.all
|
||||
#<Fog::Compute::AWS::DhcpOptions
|
||||
#<Fog::AWS::Compute::DhcpOptions
|
||||
#filters={}
|
||||
#[
|
||||
#<Fog::Compute::AWS::DhcpOption
|
||||
#<Fog::AWS::Compute::DhcpOption
|
||||
#id="dopt-some-id",
|
||||
#dhcp_configuration_set={"vpcId"=>"vpc-some-id", "state"=>"available"},
|
||||
#tag_set={}
|
||||
|
@ -68,7 +68,7 @@ module Fog
|
|||
# ==== Returns
|
||||
#
|
||||
#>> AWS.dhcp_options.get("dopt-12345678")
|
||||
#=> <Fog::Compute::AWS::DhcpOption
|
||||
#=> <Fog::AWS::Compute::DhcpOption
|
||||
#id="dopt-12345678",
|
||||
#dhcp_configuration_set={"vpcId"=>"vpc-12345678", "state"=>"available"},
|
||||
#tag_set={}
|
||||
|
|
|
@ -907,7 +907,7 @@ module Fog
|
|||
]
|
||||
|
||||
class Flavors < Fog::Collection
|
||||
model Fog::Compute::AWS::Flavor
|
||||
model Fog::AWS::Compute::Flavor
|
||||
|
||||
# Returns an array of all flavors that have been created
|
||||
#
|
||||
|
@ -1031,7 +1031,7 @@ module Fog
|
|||
# ebs_optimized_available=false,
|
||||
# instance_store_volumes=0
|
||||
# >,
|
||||
# <Fog::Compute::AWS::Flavor
|
||||
# <Fog::AWS::Compute::Flavor
|
||||
# id="m3.xlarge",
|
||||
# bits=64,
|
||||
# cores=13,
|
||||
|
@ -1041,7 +1041,7 @@ module Fog
|
|||
# ebs_optimized_available=true,
|
||||
# instance_store_volumes=2
|
||||
# >,
|
||||
# <Fog::Compute::AWS::Flavor
|
||||
# <Fog::AWS::Compute::Flavor
|
||||
# id="m3.2xlarge",
|
||||
# bits=64,
|
||||
# cores=26,
|
||||
|
@ -1076,7 +1076,7 @@ module Fog
|
|||
#
|
||||
|
||||
def all
|
||||
load(Fog::Compute::AWS::FLAVORS)
|
||||
load(Fog::AWS::Compute::FLAVORS)
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class Images < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::Image
|
||||
model Fog::AWS::Compute::Image
|
||||
|
||||
# Creates a new Amazon machine image
|
||||
#
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class InternetGateways < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::InternetGateway
|
||||
model Fog::AWS::Compute::InternetGateway
|
||||
|
||||
# Creates a new internet gateway
|
||||
#
|
||||
|
@ -17,7 +17,7 @@ module Fog
|
|||
# Returns the details of the new InternetGateway
|
||||
#
|
||||
#>> AWS.internet_gateways.new
|
||||
#=> <Fog::Compute::AWS::InternetGateway
|
||||
#=> <Fog::AWS::Compute::InternetGateway
|
||||
#id=nil,
|
||||
#attachment_set=nil,
|
||||
#tag_set=nil
|
||||
|
@ -38,10 +38,10 @@ module Fog
|
|||
# Returns an array of all InternetGateways
|
||||
#
|
||||
#>> AWS.internet_gateways.all
|
||||
#<Fog::Compute::AWS::InternetGateways
|
||||
#<Fog::AWS::Compute::InternetGateways
|
||||
#filters={}
|
||||
#[
|
||||
#<Fog::Compute::AWS::InternetGateway
|
||||
#<Fog::AWS::Compute::InternetGateway
|
||||
#id="igw-some-id",
|
||||
#attachment_set={"vpcId"=>"vpc-some-id", "state"=>"available"},
|
||||
#tag_set={}
|
||||
|
@ -68,7 +68,7 @@ module Fog
|
|||
# ==== Returns
|
||||
#
|
||||
#>> AWS.internet_gateways.get("igw-12345678")
|
||||
#=> <Fog::Compute::AWS::InternetGateway
|
||||
#=> <Fog::AWS::Compute::InternetGateway
|
||||
#id="igw-12345678",
|
||||
#attachment_set={"vpcId"=>"vpc-12345678", "state"=>"available"},
|
||||
#tag_set={}
|
||||
|
|
|
@ -7,7 +7,7 @@ module Fog
|
|||
attribute :filters
|
||||
attribute :key_name
|
||||
|
||||
model Fog::Compute::AWS::KeyPair
|
||||
model Fog::AWS::Compute::KeyPair
|
||||
|
||||
# Used to create a key pair. There are 3 arguments and only name is required. You can generate a new key_pair as follows:
|
||||
# AWS.key_pairs.create(:name => "test", :fingerprint => "123", :private_key => '234234')
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
|
||||
# Add a new rule
|
||||
#
|
||||
# network_acl.add_rule(100, Fog::Compute::AWS::NetworkAcl::TCP, 'allow', '0.0.0.0/0', true, 'PortRange.From' => 22, 'PortRange.To' => 22)
|
||||
# network_acl.add_rule(100, Fog::AWS::Compute::NetworkAcl::TCP, 'allow', '0.0.0.0/0', true, 'PortRange.From' => 22, 'PortRange.To' => 22)
|
||||
#
|
||||
# ==== Parameters
|
||||
# * rule_number<~Integer> - The rule number for the entry, between 100 and 32766
|
||||
|
@ -91,7 +91,7 @@ module Fog
|
|||
|
||||
# Update a specific rule number
|
||||
#
|
||||
# network_acl.update_rule(100, Fog::Compute::AWS::NetworkAcl::TCP, 'allow', '0.0.0.0/0', true, 'PortRange.From' => 22, 'PortRange.To' => 22)
|
||||
# network_acl.update_rule(100, Fog::AWS::Compute::NetworkAcl::TCP, 'allow', '0.0.0.0/0', true, 'PortRange.From' => 22, 'PortRange.To' => 22)
|
||||
#
|
||||
# ==== Parameters
|
||||
# * rule_number<~Integer> - The rule number for the entry, between 100 and 32766
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class NetworkAcls < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::NetworkAcl
|
||||
model Fog::AWS::Compute::NetworkAcl
|
||||
|
||||
# Creates a new network ACL
|
||||
#
|
||||
|
@ -16,7 +16,7 @@ module Fog
|
|||
#
|
||||
# Returns the details of the new network ACL
|
||||
#
|
||||
#>> <Fog::Compute::AWS::NetworkAcl
|
||||
#>> <Fog::AWS::Compute::NetworkAcl
|
||||
# network_acl_id=nil,
|
||||
# vpc_id=nil,
|
||||
# default=nil,
|
||||
|
@ -42,7 +42,7 @@ module Fog
|
|||
# <Fog::AWS::Compute::NetworkAcls
|
||||
# filters={}
|
||||
# [
|
||||
# <Fog::Compute::AWS::NetworkAcl
|
||||
# <Fog::AWS::Compute::NetworkAcl
|
||||
# network_acl_id="acl-abcdefgh",
|
||||
# vpc_id="vpc-abcdefgh",
|
||||
# default=true,
|
||||
|
@ -93,7 +93,7 @@ module Fog
|
|||
# ==== Returns
|
||||
#
|
||||
#>> AWS.network_acls.get("acl-abcdefgh")
|
||||
# <Fog::Compute::AWS::NetworkAcl
|
||||
# <Fog::AWS::Compute::NetworkAcl
|
||||
# network_acl_id="acl-abcdefgh",
|
||||
# vpc_id="vpc-abcdefgh",
|
||||
# default=true,
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class NetworkInterfaces < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::NetworkInterface
|
||||
model Fog::AWS::Compute::NetworkInterface
|
||||
|
||||
# Creates a new network interface
|
||||
#
|
||||
|
@ -58,7 +58,7 @@ module Fog
|
|||
# <Fog::AWS::Compute::NetworkInterfaces
|
||||
# filters={}
|
||||
# [
|
||||
# <Fog::Compute::AWS::NetworkInterface
|
||||
# <Fog::AWS::Compute::NetworkInterface
|
||||
# network_interface_id="eni-da5dc7ca",
|
||||
# state=nil,
|
||||
# request_id=nil,
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class RouteTables < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::RouteTable
|
||||
model Fog::AWS::Compute::RouteTable
|
||||
|
||||
# Creates a new route table
|
||||
#
|
||||
|
@ -17,7 +17,7 @@ module Fog
|
|||
# Returns the details of the new route table
|
||||
#
|
||||
#>> AWS.route_tables.new
|
||||
# <Fog::Compute::AWS::RouteTable
|
||||
# <Fog::AWS::Compute::RouteTable
|
||||
# id=nil,
|
||||
# vpc_id=nil,
|
||||
# routes=nil,
|
||||
|
@ -40,10 +40,10 @@ module Fog
|
|||
# Returns an array of all route tables
|
||||
#
|
||||
#>> AWS.route_tables.all
|
||||
# <Fog::Compute::AWS::RouteTables
|
||||
# <Fog::AWS::Compute::RouteTables
|
||||
# filters={}
|
||||
# [
|
||||
# <Fog::Compute::AWS::RouteTable
|
||||
# <Fog::AWS::Compute::RouteTable
|
||||
# id="rtb-41e8552f",
|
||||
# TODO
|
||||
# >
|
||||
|
@ -70,7 +70,7 @@ module Fog
|
|||
# ==== Returns
|
||||
#
|
||||
#>> AWS.route_tables.get("rtb-41e8552f")
|
||||
# <Fog::Compute::AWS::RouteTable
|
||||
# <Fog::AWS::Compute::RouteTable
|
||||
# id="rtb-41e8552f",
|
||||
# TODO
|
||||
# >
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class SecurityGroups < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::SecurityGroup
|
||||
model Fog::AWS::Compute::SecurityGroup
|
||||
|
||||
# Creates a new security group
|
||||
#
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class Servers < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::Server
|
||||
model Fog::AWS::Compute::Server
|
||||
|
||||
# Creates a new server
|
||||
#
|
||||
|
@ -166,7 +166,7 @@ module Fog
|
|||
Fog.wait_for {
|
||||
begin
|
||||
service.create_tags(server.identity, tags)
|
||||
rescue Fog::Compute::AWS::NotFound
|
||||
rescue Fog::AWS::Compute::NotFound
|
||||
false
|
||||
end
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ module Fog
|
|||
|
||||
security_group = service.security_groups.get(server.groups.first)
|
||||
if security_group.nil?
|
||||
raise Fog::Compute::AWS::Error, "The security group" \
|
||||
raise Fog::AWS::Compute::Error, "The security group" \
|
||||
" #{server.groups.first} doesn't exist."
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module Fog
|
|||
attribute :filters
|
||||
attribute :volume
|
||||
|
||||
model Fog::Compute::AWS::Snapshot
|
||||
model Fog::AWS::Compute::Snapshot
|
||||
|
||||
def initialize(attributes)
|
||||
self.filters ||= { 'RestorableBy' => 'self' }
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class SpotRequests < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::SpotRequest
|
||||
model Fog::AWS::Compute::SpotRequest
|
||||
|
||||
def initialize(attributes)
|
||||
self.filters ||= {}
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class Subnets < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::Subnet
|
||||
model Fog::AWS::Compute::Subnet
|
||||
|
||||
# Creates a new subnet
|
||||
#
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class Tags < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::Tag
|
||||
model Fog::AWS::Compute::Tag
|
||||
|
||||
def initialize(attributes)
|
||||
self.filters ||= {}
|
||||
|
|
|
@ -118,7 +118,7 @@ module Fog
|
|||
end
|
||||
|
||||
def server=(_)
|
||||
raise NoMethodError, 'use Fog::Compute::AWS::Volume#attach(server, device)'
|
||||
raise NoMethodError, 'use Fog::AWS::Compute::Volume#attach(server, device)'
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -7,7 +7,7 @@ module Fog
|
|||
attribute :filters
|
||||
attribute :server
|
||||
|
||||
model Fog::Compute::AWS::Volume
|
||||
model Fog::AWS::Compute::Volume
|
||||
|
||||
# Used to create a volume. There are 3 arguments and availability_zone and size are required. You can generate a new key_pair as follows:
|
||||
# AWS.volumes.create(:availability_zone => 'us-east-1a', :size => 10)
|
||||
|
|
|
@ -6,7 +6,7 @@ module Fog
|
|||
class Vpcs < Fog::Collection
|
||||
attribute :filters
|
||||
|
||||
model Fog::Compute::AWS::VPC
|
||||
model Fog::AWS::Compute::VPC
|
||||
|
||||
# Creates a new VPC
|
||||
#
|
||||
|
|
|
@ -61,13 +61,13 @@ module Fog
|
|||
supported_actions = [ "InsufficientDataActions", "OKActions", "AlarmActions" ]
|
||||
found_actions = options.keys.select {|key| supported_actions.include? key }
|
||||
if found_actions.empty?
|
||||
raise Fog::Compute::AWS::Error.new("The request must contain at least one of #{supported_actions.join(", ")}'")
|
||||
raise Fog::AWS::Compute::Error.new("The request must contain at least one of #{supported_actions.join(", ")}'")
|
||||
end
|
||||
|
||||
requirements = [ "AlarmName", "ComparisonOperator", "EvaluationPeriods", "Namespace", "Period", "Statistic", "Threshold" ]
|
||||
requirements.each do |req|
|
||||
unless options.key?(req)
|
||||
raise Fog::Compute::AWS::Error.new("The request must contain a the parameter '%s'" % req)
|
||||
raise Fog::AWS::Compute::Error.new("The request must contain a the parameter '%s'" % req)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'AllocateAddress',
|
||||
'Domain' => domain,
|
||||
:parser => Fog::Parsers::Compute::AWS::AllocateAddress.new
|
||||
:parser => Fog::Parsers::AWS::Compute::AllocateAddress.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -28,7 +28,7 @@ module Fog
|
|||
class Mock
|
||||
def allocate_address(domain = 'standard')
|
||||
unless describe_addresses.body['addressesSet'].size < self.data[:limits][:addresses]
|
||||
raise Fog::Compute::AWS::Error, "AddressLimitExceeded => Too many addresses allocated"
|
||||
raise Fog::AWS::Compute::Error, "AddressLimitExceeded => Too many addresses allocated"
|
||||
end
|
||||
|
||||
response = Excon::Response.new
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
# {Amazon API Reference}[http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-AssignPrivateIpAddresses.html]
|
||||
def assign_private_ip_addresses(network_interface_id, options={})
|
||||
if options['PrivateIpAddresses'] && options['SecondaryPrivateIpAddressCount']
|
||||
raise Fog::Compute::AWS::Error.new("You may specify secondaryPrivateIpAddressCount or specific secondary private IP addresses, but not both.")
|
||||
raise Fog::AWS::Compute::Error.new("You may specify secondaryPrivateIpAddressCount or specific secondary private IP addresses, but not both.")
|
||||
end
|
||||
|
||||
if private_ip_addresses = options.delete('PrivateIpAddresses')
|
||||
|
@ -30,7 +30,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'AssignPrivateIpAddresses',
|
||||
'NetworkInterfaceId' => network_interface_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::AssignPrivateIpAddresses.new
|
||||
:parser => Fog::Parsers::AWS::Compute::AssignPrivateIpAddresses.new
|
||||
}.merge(options))
|
||||
end
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ module Fog
|
|||
class Mock
|
||||
def assign_private_ip_addresses(network_interface_id, options={})
|
||||
if options['PrivateIpAddresses'] && options['SecondaryPrivateIpAddressCount']
|
||||
raise Fog::Compute::AWS::Error.new("You may specify secondaryPrivateIpAddressCount or specific secondary private IP addresses, but not both.")
|
||||
raise Fog::AWS::Compute::Error.new("You may specify secondaryPrivateIpAddressCount or specific secondary private IP addresses, but not both.")
|
||||
end
|
||||
|
||||
response = Excon::Response.new
|
||||
|
|
|
@ -48,7 +48,7 @@ module Fog
|
|||
'PrivateIpAddress' => params[:private_ip_address],
|
||||
'AllowReassociation' => params[:allow_reassociation],
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::AssociateAddress.new
|
||||
:parser => Fog::Parsers::AWS::Compute::AssociateAddress.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -119,13 +119,13 @@ module Fog
|
|||
end
|
||||
response
|
||||
elsif !instance
|
||||
raise Fog::Compute::AWS::NotFound.new("You must specify either an InstanceId or a NetworkInterfaceID")
|
||||
raise Fog::AWS::Compute::NotFound.new("You must specify either an InstanceId or a NetworkInterfaceID")
|
||||
elsif !address
|
||||
raise Fog::Compute::AWS::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
|
||||
raise Fog::AWS::Compute::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
|
||||
elsif params[:network_interface_id].nil? && params[:allocation_id].nil?
|
||||
raise Fog::Compute::AWS::NotFound.new("You must specify an AllocationId when specifying a NetworkInterfaceID")
|
||||
raise Fog::AWS::Compute::NotFound.new("You must specify an AllocationId when specifying a NetworkInterfaceID")
|
||||
else (!instance.nil? && params[:network_interface_id].nil?) || (params[:instance_id].nil? && !params[:network_interface_id].nil?)
|
||||
raise Fog::Compute::AWS::Error.new("You must specify either an InstanceId or a NetworkInterfaceID")
|
||||
raise Fog::AWS::Compute::Error.new("You must specify either an InstanceId or a NetworkInterfaceID")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
|||
'DhcpOptionsId' => dhcp_options_id,
|
||||
'VpcId' => vpc_id,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -44,7 +44,7 @@ module Fog
|
|||
elsif !vpc_id
|
||||
message << 'The request must contain the parameter vpc_id'
|
||||
end
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
'Action' => 'AssociateRouteTable',
|
||||
'RouteTableId' => routeTableId,
|
||||
'SubnetId' => subnetId,
|
||||
:parser => Fog::Parsers::Compute::AWS::AssociateRouteTable.new
|
||||
:parser => Fog::Parsers::AWS::Compute::AssociateRouteTable.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -42,9 +42,9 @@ module Fog
|
|||
}
|
||||
response
|
||||
elsif routetable.nil?
|
||||
raise Fog::Compute::AWS::NotFound.new("The routeTable ID '#{routeTableId}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The routeTable ID '#{routeTableId}' does not exist")
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The subnet ID '#{subnetId}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The subnet ID '#{subnetId}' does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
'VpcId' => vpc_id,
|
||||
'InstanceId'=> instance_id,
|
||||
'DryRun' => dry_run,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
}.merge(Fog::AWS.indexed_param('SecurityGroupId', security_group_ids)))
|
||||
|
||||
end
|
||||
|
@ -38,10 +38,10 @@ module Fog
|
|||
instance = self.data[:instances][instance_id]
|
||||
if vpc && instance
|
||||
if instance['instanceState']['name'] != 'running' || instance['vpcId']
|
||||
raise Fog::Compute::AWS::Error.new("Client.InvalidInstanceID.NotLinkable => Instance #{instance_id} is unlinkable")
|
||||
raise Fog::AWS::Compute::Error.new("Client.InvalidInstanceID.NotLinkable => Instance #{instance_id} is unlinkable")
|
||||
end
|
||||
if instance['classicLinkVpcId']
|
||||
raise Fog::Compute::AWS::Error.new("Client.InvalidInstanceID.InstanceAlreadyLinked => Instance #{instance_id} is already linked")
|
||||
raise Fog::AWS::Compute::Error.new("Client.InvalidInstanceID.InstanceAlreadyLinked => Instance #{instance_id} is already linked")
|
||||
end
|
||||
|
||||
response.status = 200
|
||||
|
@ -55,9 +55,9 @@ module Fog
|
|||
end
|
||||
response
|
||||
elsif !instance
|
||||
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
||||
raise Fog::AWS::Compute::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
||||
elsif !vpc
|
||||
raise Fog::Compute::AWS::NotFound.new("The VPC '#{vpc_id}' does not exist.")
|
||||
raise Fog::AWS::Compute::NotFound.new("The VPC '#{vpc_id}' does not exist.")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ module Fog
|
|||
'InternetGatewayId' => internet_gateway_id,
|
||||
'VpcId' => vpc_id,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -43,7 +43,7 @@ module Fog
|
|||
elsif !vpc_id
|
||||
message << 'The request must contain the parameter vpc_id'
|
||||
end
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
'NetworkInterfaceId' => nic_id,
|
||||
'InstanceId' => instance_id,
|
||||
'DeviceIndex' => device_index,
|
||||
:parser => Fog::Parsers::Compute::AWS::AttachNetworkInterface.new
|
||||
:parser => Fog::Parsers::AWS::Compute::AttachNetworkInterface.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -35,9 +35,9 @@ module Fog
|
|||
if ! self.data[:instances].find{ |i,i_conf|
|
||||
i_conf['instanceId'] == instance_id
|
||||
}
|
||||
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The instance ID '#{instance_id}' does not exist")
|
||||
elsif self.data[:network_interfaces].find{ |ni,ni_conf| ni_conf['attachment']['instanceId'] == instance_id && ni_conf['attachment']['deviceIndex'] == device_index }
|
||||
raise Fog::Compute::AWS::Error.new("InvalidParameterValue => Instance '#{instance_id}' already has an interface attached at device index '#{device_index}'.")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidParameterValue => Instance '#{instance_id}' already has an interface attached at device index '#{device_index}'.")
|
||||
elsif self.data[:network_interfaces][nic_id]
|
||||
attachment = self.data[:network_interfaces][nic_id]['attachment']
|
||||
attachment['attachmentId'] = Fog::AWS::Mock.request_id
|
||||
|
@ -50,7 +50,7 @@ module Fog
|
|||
'attachmentId' => attachment['attachmentId']
|
||||
}
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The network interface '#{nic_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The network interface '#{nic_id}' does not exist")
|
||||
end
|
||||
|
||||
response
|
||||
|
|
|
@ -29,7 +29,7 @@ module Fog
|
|||
'InstanceId' => instance_id,
|
||||
'Device' => device,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::AttachVolume.new
|
||||
:parser => Fog::Parsers::AWS::Compute::AttachVolume.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -43,7 +43,7 @@ module Fog
|
|||
volume = self.data[:volumes][volume_id]
|
||||
if instance && volume
|
||||
unless volume['status'] == 'available'
|
||||
raise Fog::Compute::AWS::Error.new("Client.VolumeInUse => Volume #{volume_id} is unavailable")
|
||||
raise Fog::AWS::Compute::Error.new("Client.VolumeInUse => Volume #{volume_id} is unavailable")
|
||||
end
|
||||
|
||||
data = {
|
||||
|
@ -61,9 +61,9 @@ module Fog
|
|||
}.merge!(data)
|
||||
response
|
||||
elsif !instance
|
||||
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
||||
raise Fog::AWS::Compute::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
||||
elsif !volume
|
||||
raise Fog::Compute::AWS::NotFound.new("The volume '#{volume_id}' does not exist.")
|
||||
raise Fog::AWS::Compute::NotFound.new("The volume '#{volume_id}' does not exist.")
|
||||
end
|
||||
else
|
||||
message = 'MissingParameter => '
|
||||
|
@ -74,7 +74,7 @@ module Fog
|
|||
else
|
||||
message << 'The request must contain the parameter device'
|
||||
end
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'AuthorizeSecurityGroupEgress',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
}.merge!(options))
|
||||
end
|
||||
end
|
||||
|
@ -66,7 +66,7 @@ module Fog
|
|||
|
||||
response = Excon::Response.new
|
||||
group ||
|
||||
raise(Fog::Compute::AWS::NotFound.new("The security group '#{group_name}' does not exist"))
|
||||
raise(Fog::AWS::Compute::NotFound.new("The security group '#{group_name}' does not exist"))
|
||||
|
||||
verify_permission_options(options, group['vpcId'] != nil)
|
||||
|
||||
|
@ -75,11 +75,11 @@ module Fog
|
|||
normalized_permissions.each do |permission|
|
||||
if matching_group_permission = find_matching_permission_egress(group, permission)
|
||||
if permission['groups'].any? {|pg| matching_group_permission['groups'].include?(pg) }
|
||||
raise Fog::Compute::AWS::Error, "InvalidPermission.Duplicate => The permission '123' has already been authorized in the specified group"
|
||||
raise Fog::AWS::Compute::Error, "InvalidPermission.Duplicate => The permission '123' has already been authorized in the specified group"
|
||||
end
|
||||
|
||||
if permission['ipRanges'].any? {|pr| matching_group_permission['ipRanges'].include?(pr) }
|
||||
raise Fog::Compute::AWS::Error, "InvalidPermission.Duplicate => The permission '123' has already been authorized in the specified group"
|
||||
raise Fog::AWS::Compute::Error, "InvalidPermission.Duplicate => The permission '123' has already been authorized in the specified group"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'AuthorizeSecurityGroupIngress',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
}.merge!(options))
|
||||
end
|
||||
|
||||
|
@ -89,7 +89,7 @@ module Fog
|
|||
|
||||
response = Excon::Response.new
|
||||
group ||
|
||||
raise(Fog::Compute::AWS::NotFound.new("The security group '#{group_name}' does not exist"))
|
||||
raise(Fog::AWS::Compute::NotFound.new("The security group '#{group_name}' does not exist"))
|
||||
|
||||
verify_permission_options(options, group['vpcId'] != nil)
|
||||
|
||||
|
@ -98,11 +98,11 @@ module Fog
|
|||
normalized_permissions.each do |permission|
|
||||
if matching_group_permission = find_matching_permission(group, permission)
|
||||
if permission['groups'].any? {|pg| matching_group_permission['groups'].include?(pg) }
|
||||
raise Fog::Compute::AWS::Error, "InvalidPermission.Duplicate => The permission '123' has already been authorized in the specified group"
|
||||
raise Fog::AWS::Compute::Error, "InvalidPermission.Duplicate => The permission '123' has already been authorized in the specified group"
|
||||
end
|
||||
|
||||
if permission['ipRanges'].any? {|pr| matching_group_permission['ipRanges'].include?(pr) }
|
||||
raise Fog::Compute::AWS::Error, "InvalidPermission.Duplicate => The permission '123' has already been authorized in the specified group"
|
||||
raise Fog::AWS::Compute::Error, "InvalidPermission.Duplicate => The permission '123' has already been authorized in the specified group"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -128,17 +128,17 @@ module Fog
|
|||
|
||||
def verify_permission_options(options, is_vpc)
|
||||
if options.size <= 1
|
||||
raise Fog::Compute::AWS::Error.new("InvalidRequest => The request received was invalid.")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidRequest => The request received was invalid.")
|
||||
end
|
||||
if !is_vpc && options['IpProtocol'] && !['tcp', 'udp', 'icmp'].include?(options['IpProtocol'])
|
||||
raise Fog::Compute::AWS::Error.new("InvalidPermission.Malformed => Unsupported IP protocol \"#{options['IpProtocol']}\" - supported: [tcp, udp, icmp]")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidPermission.Malformed => Unsupported IP protocol \"#{options['IpProtocol']}\" - supported: [tcp, udp, icmp]")
|
||||
end
|
||||
if !is_vpc && (options['IpProtocol'] && (!options['FromPort'] || !options['ToPort']))
|
||||
raise Fog::Compute::AWS::Error.new("InvalidPermission.Malformed => TCP/UDP port (-1) out of range")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidPermission.Malformed => TCP/UDP port (-1) out of range")
|
||||
end
|
||||
if options.key?('IpPermissions')
|
||||
if !options['IpPermissions'].is_a?(Array) || options['IpPermissions'].empty?
|
||||
raise Fog::Compute::AWS::Error.new("InvalidRequest => The request received was invalid.")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidRequest => The request received was invalid.")
|
||||
end
|
||||
options['IpPermissions'].each {|p| verify_permission_options(p, is_vpc) }
|
||||
end
|
||||
|
@ -196,7 +196,7 @@ module Fog
|
|||
self.data[:security_groups][group_id]
|
||||
end
|
||||
security_group ||
|
||||
raise(Fog::Compute::AWS::NotFound.new("The security group '#{group_name || group_id}' does not exist"))
|
||||
raise(Fog::AWS::Compute::NotFound.new("The security group '#{group_name || group_id}' does not exist"))
|
||||
|
||||
{
|
||||
'groupName' => authorized_group['GroupName'] || security_group['groupName'],
|
||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'CancelSpotInstanceRequests',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::CancelSpotInstanceRequests.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CancelSpotInstanceRequests.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ module Fog
|
|||
spot_request = self.data[:spot_requests][spot_instance_request_id]
|
||||
|
||||
unless spot_request
|
||||
raise Fog::Compute::AWS::NotFound.new("The spot instance request ID '#{spot_instance_request_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The spot instance request ID '#{spot_instance_request_id}' does not exist")
|
||||
end
|
||||
|
||||
spot_request['fault']['code'] = 'request-cancelled'
|
||||
|
|
|
@ -28,7 +28,7 @@ module Fog
|
|||
'Name' => name,
|
||||
'Description' => description,
|
||||
'ClientToken' => client_token,
|
||||
:parser => Fog::Parsers::Compute::AWS::CopyImage.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CopyImage.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
|||
'SourceSnapshotId' => source_snapshot_id,
|
||||
'SourceRegion' => source_region,
|
||||
'Description' => options['Description'],
|
||||
:parser => Fog::Parsers::Compute::AWS::CopySnapshot.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CopySnapshot.new
|
||||
}
|
||||
params['Encrypted'] = true if options['Encrypted']
|
||||
params['KmsKeyId'] = options['KmsKeyId'] if options['Encrypted'] && options['KmsKeyId']
|
||||
|
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'CreateDhcpOptions',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateDhcpOptions.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateDhcpOptions.new
|
||||
}.merge!(params))
|
||||
end
|
||||
private
|
||||
|
|
|
@ -39,7 +39,7 @@ module Fog
|
|||
'Name' => name,
|
||||
'Description' => description,
|
||||
'NoReboot' => no_reboot.to_s,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateImage.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateImage.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
def create_internet_gateway()
|
||||
request({
|
||||
'Action' => 'CreateInternetGateway',
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateInternetGateway.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateInternetGateway.new
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'CreateKeyPair',
|
||||
'KeyName' => key_name,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateKeyPair.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateKeyPair.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -43,7 +43,7 @@ module Fog
|
|||
}.merge!(data)
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::Error.new("InvalidKeyPair.Duplicate => The keypair '#{key_name}' already exists.")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidKeyPair.Duplicate => The keypair '#{key_name}' already exists.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,7 +42,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'CreateNetworkAcl',
|
||||
'VpcId' => vpcId,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateNetworkAcl.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateNetworkAcl.new
|
||||
}.merge!(options))
|
||||
end
|
||||
end
|
||||
|
@ -54,7 +54,7 @@ module Fog
|
|||
id = Fog::AWS::Mock.network_acl_id
|
||||
|
||||
unless self.data[:vpcs].find { |s| s['vpcId'] == vpcId }
|
||||
raise Fog::Compute::AWS::Error.new("Unknown VPC '#{vpcId}' specified")
|
||||
raise Fog::AWS::Compute::Error.new("Unknown VPC '#{vpcId}' specified")
|
||||
end
|
||||
|
||||
data = {
|
||||
|
|
|
@ -35,7 +35,7 @@ module Fog
|
|||
'RuleAction' => rule_action,
|
||||
'Egress' => egress,
|
||||
'CidrBlock' => cidr_block,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
}.merge!(options))
|
||||
end
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ module Fog
|
|||
if self.data[:network_acls][network_acl_id]
|
||||
|
||||
if self.data[:network_acls][network_acl_id]['entrySet'].find { |r| r['ruleNumber'] == rule_number && r['egress'] == egress }
|
||||
raise Fog::Compute::AWS::Error.new("Already a rule with that number")
|
||||
raise Fog::AWS::Compute::Error.new("Already a rule with that number")
|
||||
end
|
||||
|
||||
data = {
|
||||
|
@ -71,7 +71,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The network ACL '#{network_acl_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The network ACL '#{network_acl_id}' does not exist")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'CreateNetworkInterface',
|
||||
'SubnetId' => subnetId,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateNetworkInterface.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateNetworkInterface.new
|
||||
}.merge!(options))
|
||||
end
|
||||
end
|
||||
|
@ -65,7 +65,7 @@ module Fog
|
|||
if subnetId
|
||||
subnet = self.data[:subnets].find{ |s| s['subnetId'] == subnetId }
|
||||
if subnet.nil?
|
||||
raise Fog::Compute::AWS::Error.new("Unknown subnet '#{subnetId}' specified")
|
||||
raise Fog::AWS::Compute::Error.new("Unknown subnet '#{subnetId}' specified")
|
||||
else
|
||||
id = Fog::AWS::Mock.network_interface_id
|
||||
cidr_block = IPAddress.parse(subnet['cidrBlock'])
|
||||
|
@ -75,7 +75,7 @@ module Fog
|
|||
options['GroupSet'].each do |group_id|
|
||||
group_obj = self.data[:security_groups][group_id]
|
||||
if group_obj.nil?
|
||||
raise Fog::Compute::AWS::Error.new("Unknown security group '#{group_id}' specified")
|
||||
raise Fog::AWS::Compute::Error.new("Unknown security group '#{group_id}' specified")
|
||||
end
|
||||
groups[group_id] = group_obj['groupName']
|
||||
end
|
||||
|
@ -93,7 +93,7 @@ module Fog
|
|||
end
|
||||
end
|
||||
elsif self.data[:network_interfaces].map{ |ni,ni_conf| ni_conf['privateIpAddress'] }.include?options['PrivateIpAddress']
|
||||
raise Fog::Compute::AWS::Error.new('InUse => The specified address is already in use.')
|
||||
raise Fog::AWS::Compute::Error.new('InUse => The specified address is already in use.')
|
||||
end
|
||||
|
||||
data = {
|
||||
|
|
|
@ -22,7 +22,7 @@ module Fog
|
|||
'Action' => 'CreatePlacementGroup',
|
||||
'GroupName' => name,
|
||||
'Strategy' => strategy,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
'Action' => 'CreateRoute',
|
||||
'RouteTableId' => route_table_id,
|
||||
'DestinationCidrBlock' => destination_cidr_block,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
}
|
||||
if internet_gateway_id
|
||||
request_vars['GatewayId'] = internet_gateway_id
|
||||
|
@ -45,13 +45,13 @@ module Fog
|
|||
if !route_table.nil? && destination_cidr_block
|
||||
if !internet_gateway_id.nil? || !instance_id.nil? || !network_interface_id.nil?
|
||||
if !internet_gateway_id.nil? && self.internet_gateways.all('internet-gateway-id'=>internet_gateway_id).first.nil?
|
||||
raise Fog::Compute::AWS::NotFound.new("The gateway ID '#{internet_gateway_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The gateway ID '#{internet_gateway_id}' does not exist")
|
||||
elsif !instance_id.nil? && self.servers.all('instance-id'=>instance_id).first.nil?
|
||||
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The instance ID '#{instance_id}' does not exist")
|
||||
elsif !network_interface_id.nil? && self.network_interfaces.all('networkInterfaceId'=>network_interface_id).first.nil?
|
||||
raise Fog::Compute::AWS::NotFound.new("The networkInterface ID '#{network_interface_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The networkInterface ID '#{network_interface_id}' does not exist")
|
||||
elsif !route_table['routeSet'].find { |route| route['destinationCidrBlock'].eql? destination_cidr_block }.nil?
|
||||
raise Fog::Compute::AWS::Error, "RouteAlreadyExists => The route identified by #{destination_cidr_block} already exists."
|
||||
raise Fog::AWS::Compute::Error, "RouteAlreadyExists => The route identified by #{destination_cidr_block} already exists."
|
||||
else
|
||||
response = Excon::Response.new
|
||||
route_table['routeSet'].push({
|
||||
|
@ -73,12 +73,12 @@ module Fog
|
|||
else
|
||||
message = 'MissingParameter => '
|
||||
message << 'The request must contain either a gateway id, a network interface id, or an instance id'
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
elsif route_table.nil?
|
||||
raise Fog::Compute::AWS::NotFound.new("The routeTable ID '#{route_table_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The routeTable ID '#{route_table_id}' does not exist")
|
||||
elsif destination_cidr_block.empty?
|
||||
raise Fog::Compute::AWS::InvalidParameterValue.new("Value () for parameter destinationCidrBlock is invalid. This is not a valid CIDR block.")
|
||||
raise Fog::AWS::Compute::InvalidParameterValue.new("Value () for parameter destinationCidrBlock is invalid. This is not a valid CIDR block.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'CreateRouteTable',
|
||||
'VpcId' => vpc_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateRouteTable.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateRouteTable.new
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -60,7 +60,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The vpc ID '#{vpc_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The vpc ID '#{vpc_id}' does not exist")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
'GroupName' => name,
|
||||
'GroupDescription' => description,
|
||||
'VpcId' => vpc_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateSecurityGroup.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateSecurityGroup.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ module Fog
|
|||
group_id = Fog::AWS::Mock.security_group_id
|
||||
|
||||
if self.data[:security_groups].find { |_,v| v['groupName'] == name }
|
||||
raise Fog::Compute::AWS::Error,
|
||||
raise Fog::AWS::Compute::Error,
|
||||
"InvalidGroup.Duplicate => The security group '#{name}' already exists"
|
||||
end
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ module Fog
|
|||
'Action' => 'CreateSnapshot',
|
||||
'Description' => description,
|
||||
'VolumeId' => volume_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateSnapshot.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateSnapshot.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
|||
'Bucket' => bucket,
|
||||
'Prefix' => prefix,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::SpotDatafeedSubscription.new
|
||||
:parser => Fog::Parsers::AWS::Compute::SpotDatafeedSubscription.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ module Fog
|
|||
'Action' => 'CreateSubnet',
|
||||
'VpcId' => vpcId,
|
||||
'CidrBlock' => cidrBlock,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateSubnet.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateSubnet.new
|
||||
}.merge!(options))
|
||||
end
|
||||
end
|
||||
|
@ -48,14 +48,14 @@ module Fog
|
|||
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
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'CreateTags',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ module Fog
|
|||
'Action' => 'CreateVolume',
|
||||
'AvailabilityZone' => availability_zone,
|
||||
'Size' => size,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateVolume.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateVolume.new
|
||||
}.merge(options))
|
||||
end
|
||||
end
|
||||
|
@ -55,11 +55,11 @@ module Fog
|
|||
if availability_zone && (size || options['SnapshotId'])
|
||||
snapshot = self.data[:snapshots][options['SnapshotId']]
|
||||
if options['SnapshotId'] && !snapshot
|
||||
raise Fog::Compute::AWS::NotFound.new("The snapshot '#{options['SnapshotId']}' does not exist.")
|
||||
raise Fog::AWS::Compute::NotFound.new("The snapshot '#{options['SnapshotId']}' does not exist.")
|
||||
end
|
||||
|
||||
if snapshot && size && size < snapshot['volumeSize']
|
||||
raise Fog::Compute::AWS::NotFound.new("The snapshot '#{options['SnapshotId']}' has size #{snapshot['volumeSize']} which is greater than #{size}.")
|
||||
raise Fog::AWS::Compute::NotFound.new("The snapshot '#{options['SnapshotId']}' has size #{snapshot['volumeSize']} which is greater than #{size}.")
|
||||
elsif snapshot && !size
|
||||
size = snapshot['volumeSize']
|
||||
end
|
||||
|
@ -67,28 +67,28 @@ module Fog
|
|||
if options['VolumeType'] == 'io1'
|
||||
iops = options['Iops']
|
||||
if !iops
|
||||
raise Fog::Compute::AWS::Error.new("InvalidParameterCombination => The parameter iops must be specified for io1 volumes.")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidParameterCombination => The parameter iops must be specified for io1 volumes.")
|
||||
end
|
||||
|
||||
if size < 10
|
||||
raise Fog::Compute::AWS::Error.new("InvalidParameterValue => Volume of #{size}GiB is too small; minimum is 10GiB.")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidParameterValue => Volume of #{size}GiB is too small; minimum is 10GiB.")
|
||||
end
|
||||
|
||||
if (iops_to_size_ratio = iops.to_f / size.to_f) > 30.0
|
||||
raise Fog::Compute::AWS::Error.new("InvalidParameterValue => Iops to volume size ratio of #{"%.1f" % iops_to_size_ratio} is too high; maximum is 30.0")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidParameterValue => Iops to volume size ratio of #{"%.1f" % iops_to_size_ratio} is too high; maximum is 30.0")
|
||||
end
|
||||
|
||||
if iops < 100
|
||||
raise Fog::Compute::AWS::Error.new("VolumeIOPSLimit => Volume iops of #{iops} is too low; minimum is 100.")
|
||||
raise Fog::AWS::Compute::Error.new("VolumeIOPSLimit => Volume iops of #{iops} is too low; minimum is 100.")
|
||||
end
|
||||
|
||||
if iops > 4000
|
||||
raise Fog::Compute::AWS::Error.new("VolumeIOPSLimit => Volume iops of #{iops} is too high; maximum is 4000.")
|
||||
raise Fog::AWS::Compute::Error.new("VolumeIOPSLimit => Volume iops of #{iops} is too high; maximum is 4000.")
|
||||
end
|
||||
end
|
||||
|
||||
if options['KmsKeyId'] && !options['Encrypted']
|
||||
raise Fog::Compute::AWS::Error.new("InvalidParameterDependency => The parameter KmsKeyId requires the parameter Encrypted to be set.")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidParameterDependency => The parameter KmsKeyId requires the parameter Encrypted to be set.")
|
||||
end
|
||||
|
||||
response.status = 200
|
||||
|
|
|
@ -31,7 +31,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'CreateVpc',
|
||||
'CidrBlock' => cidrBlock,
|
||||
:parser => Fog::Parsers::Compute::AWS::CreateVpc.new
|
||||
:parser => Fog::Parsers::AWS::Compute::CreateVpc.new
|
||||
}.merge!(options))
|
||||
end
|
||||
end
|
||||
|
@ -82,7 +82,7 @@ module Fog
|
|||
default_elb_group_name = "default_elb_#{Fog::Mock.random_hex(6)}"
|
||||
default_elb_group_id = Fog::AWS::Mock.security_group_id
|
||||
|
||||
Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:security_groups][default_elb_group_id] = {
|
||||
Fog::AWS::Compute::Mock.data[region][@aws_access_key_id][:security_groups][default_elb_group_id] = {
|
||||
'groupDescription' => 'default_elb security group',
|
||||
'groupName' => default_elb_group_name,
|
||||
'groupId' => default_elb_group_id,
|
||||
|
@ -94,7 +94,7 @@ module Fog
|
|||
default_group_name = 'default'
|
||||
default_group_id = Fog::AWS::Mock.security_group_id
|
||||
|
||||
Fog::Compute::AWS::Mock.data[region][@aws_access_key_id][:security_groups][default_group_id] = {
|
||||
Fog::AWS::Compute::Mock.data[region][@aws_access_key_id][:security_groups][default_group_id] = {
|
||||
'groupDescription' => default_group_name,
|
||||
'groupName' => default_group_name,
|
||||
'groupId' => default_group_id,
|
||||
|
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeleteDhcpOptions',
|
||||
'DhcpOptionsId' => dhcp_options_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ module Fog
|
|||
else
|
||||
message = 'MissingParameter => '
|
||||
message << 'The request must contain the parameter dhcp_options_id'
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeleteInternetGateway',
|
||||
'InternetGatewayId' => internet_gateway_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ module Fog
|
|||
else
|
||||
message = 'MissingParameter => '
|
||||
message << 'The request must contain the parameter internet_gateway_id'
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
'Action' => 'DeleteKeyPair',
|
||||
'KeyName' => key_name,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeleteNetworkAcl',
|
||||
'NetworkAclId' => network_acl_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ module Fog
|
|||
if self.data[:network_acls][network_acl_id]
|
||||
|
||||
if self.data[:network_acls][network_acl_id]['associationSet'].any?
|
||||
raise Fog::Compute::AWS::Error.new("ACL is in use")
|
||||
raise Fog::AWS::Compute::Error.new("ACL is in use")
|
||||
end
|
||||
|
||||
self.data[:network_acls].delete(network_acl_id)
|
||||
|
@ -43,7 +43,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The network ACL '#{network_acl_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The network ACL '#{network_acl_id}' does not exist")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
'NetworkAclId' => network_acl_id,
|
||||
'RuleNumber' => rule_number,
|
||||
'Egress' => egress,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ module Fog
|
|||
if self.data[:network_acls][network_acl_id]['entrySet'].find { |r| r['ruleNumber'] == rule_number && r['egress'] == egress }
|
||||
self.data[:network_acls][network_acl_id]['entrySet'].delete_if { |r| r['ruleNumber'] == rule_number && r['egress'] == egress }
|
||||
else
|
||||
raise Fog::Compute::AWS::Error.new("No rule with that number and egress value")
|
||||
raise Fog::AWS::Compute::Error.new("No rule with that number and egress value")
|
||||
end
|
||||
|
||||
response.status = 200
|
||||
|
@ -46,7 +46,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The network ACL '#{network_acl_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The network ACL '#{network_acl_id}' does not exist")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeleteNetworkInterface',
|
||||
'NetworkInterfaceId' => network_interface_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -30,7 +30,7 @@ module Fog
|
|||
if self.data[:network_interfaces][network_interface_id]
|
||||
|
||||
if self.data[:network_interfaces][network_interface_id]['attachment']['attachmentId']
|
||||
raise Fog::Compute::AWS::Error.new("Interface is in use")
|
||||
raise Fog::AWS::Compute::Error.new("Interface is in use")
|
||||
end
|
||||
|
||||
self.data[:network_interfaces].delete(network_interface_id)
|
||||
|
@ -42,7 +42,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The network interface '#{network_interface_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The network interface '#{network_interface_id}' does not exist")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
'Action' => 'DeletePlacementGroup',
|
||||
'GroupName' => name,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ module Fog
|
|||
'Action' => 'DeleteRoute',
|
||||
'RouteTableId' => route_table_id,
|
||||
'DestinationCidrBlock' => destination_cidr_block,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -43,12 +43,12 @@ module Fog
|
|||
response
|
||||
elsif route['gatewayId'] == "local"
|
||||
# Cannot delete the default route
|
||||
raise Fog::Compute::AWS::Error, "InvalidParameterValue => cannot remove local route #{destination_cidr_block} in route table #{route_table_id}"
|
||||
raise Fog::AWS::Compute::Error, "InvalidParameterValue => cannot remove local route #{destination_cidr_block} in route table #{route_table_id}"
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("no route with destination-cidr-block #{destination_cidr_block} in route table #{route_table_id}")
|
||||
raise Fog::AWS::Compute::NotFound.new("no route with destination-cidr-block #{destination_cidr_block} in route table #{route_table_id}")
|
||||
end
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("no route with destination-cidr-block #{destination_cidr_block} in route table #{route_table_id}")
|
||||
raise Fog::AWS::Compute::NotFound.new("no route with destination-cidr-block #{destination_cidr_block} in route table #{route_table_id}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeleteRouteTable',
|
||||
'RouteTableId' => route_table_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -38,9 +38,9 @@ module Fog
|
|||
}
|
||||
response
|
||||
elsif route_table.nil?
|
||||
raise Fog::Compute::AWS::NotFound.new("The routeTable ID '#{route_table_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The routeTable ID '#{route_table_id}' does not exist")
|
||||
elsif !route_table['associationSet'].empty?
|
||||
raise Fog::Compute::AWS::Error, "DependencyViolation => The routeTable '#{route_table_id}' has dependencies and cannot be deleted."
|
||||
raise Fog::AWS::Compute::Error, "DependencyViolation => The routeTable '#{route_table_id}' has dependencies and cannot be deleted."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module Fog
|
|||
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSecurityGroup.html]
|
||||
def delete_security_group(name, id = nil)
|
||||
if name && id
|
||||
raise Fog::Compute::AWS::Error.new("May not specify both group_name and group_id")
|
||||
raise Fog::AWS::Compute::Error.new("May not specify both group_name and group_id")
|
||||
end
|
||||
if name
|
||||
type_id = 'GroupName'
|
||||
|
@ -32,7 +32,7 @@ module Fog
|
|||
'Action' => 'DeleteSecurityGroup',
|
||||
type_id => identifier,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -40,11 +40,11 @@ module Fog
|
|||
class Mock
|
||||
def delete_security_group(name, id = nil)
|
||||
if name == 'default'
|
||||
raise Fog::Compute::AWS::Error.new("InvalidGroup.Reserved => The security group 'default' is reserved")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidGroup.Reserved => The security group 'default' is reserved")
|
||||
end
|
||||
|
||||
if name && id
|
||||
raise Fog::Compute::AWS::Error.new("May not specify both group_name and group_id")
|
||||
raise Fog::AWS::Compute::Error.new("May not specify both group_name and group_id")
|
||||
end
|
||||
|
||||
if name
|
||||
|
@ -52,7 +52,7 @@ module Fog
|
|||
end
|
||||
|
||||
unless self.data[:security_groups][id]
|
||||
raise Fog::Compute::AWS::NotFound.new("The security group '#{id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The security group '#{id}' does not exist")
|
||||
end
|
||||
|
||||
response = Excon::Response.new
|
||||
|
@ -93,11 +93,11 @@ module Fog
|
|||
end
|
||||
|
||||
unless used_by_groups.empty?
|
||||
raise Fog::Compute::AWS::Error.new("InvalidGroup.InUse => Group #{self.data[:owner_id]}:#{name} is used by groups: #{used_by_groups.uniq.join(" ")}")
|
||||
raise Fog::AWS::Compute::Error.new("InvalidGroup.InUse => Group #{self.data[:owner_id]}:#{name} is used by groups: #{used_by_groups.uniq.join(" ")}")
|
||||
end
|
||||
|
||||
if active_instances.any?
|
||||
raise Fog::Compute::AWS::Error.new("InUse => There are active instances using security group '#{name}'")
|
||||
raise Fog::AWS::Compute::Error.new("InUse => There are active instances using security group '#{name}'")
|
||||
end
|
||||
|
||||
self.data[:security_groups].delete(id)
|
||||
|
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
'Action' => 'DeleteSnapshot',
|
||||
'SnapshotId' => snapshot_id,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The snapshot '#{snapshot_id}' does not exist.")
|
||||
raise Fog::AWS::Compute::NotFound.new("The snapshot '#{snapshot_id}' does not exist.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeleteSpotDatafeedSubscription',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeleteSubnet',
|
||||
'SubnetId' => subnet_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ module Fog
|
|||
else
|
||||
message = 'MissingParameter => '
|
||||
message << 'The request must contain the parameter subnet_id'
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
|||
|
||||
request({
|
||||
'Action' => 'DeleteTags',
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module Fog
|
|||
'Action' => 'DeleteVolume',
|
||||
'VolumeId' => volume_id,
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -32,7 +32,7 @@ module Fog
|
|||
if volume = self.data[:volumes][volume_id]
|
||||
if volume["attachmentSet"].any?
|
||||
attach = volume["attachmentSet"].first
|
||||
raise Fog::Compute::AWS::Error.new("Client.VolumeInUse => Volume #{volume_id} is currently attached to #{attach["instanceId"]}")
|
||||
raise Fog::AWS::Compute::Error.new("Client.VolumeInUse => Volume #{volume_id} is currently attached to #{attach["instanceId"]}")
|
||||
end
|
||||
self.data[:deleted_at][volume_id] = Time.now
|
||||
volume['status'] = 'deleting'
|
||||
|
@ -43,7 +43,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The volume '#{volume_id}' does not exist.")
|
||||
raise Fog::AWS::Compute::NotFound.new("The volume '#{volume_id}' does not exist.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeleteVpc',
|
||||
'VpcId' => vpc_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||
:parser => Fog::Parsers::AWS::Compute::Basic.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ module Fog
|
|||
else
|
||||
message = 'MissingParameter => '
|
||||
message << 'The request must contain the parameter vpc_id'
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
request(
|
||||
'Action' => 'DeregisterImage',
|
||||
'ImageId' => image_id,
|
||||
:parser => Fog::Parsers::Compute::AWS::DeregisterImage.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DeregisterImage.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ module Fog
|
|||
if !instance_id
|
||||
message << 'The request must contain the parameter image_id'
|
||||
end
|
||||
raise Fog::Compute::AWS::Error.new(message)
|
||||
raise Fog::AWS::Compute::Error.new(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeAccountAttributes',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeAccountAttributes.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeAccountAttributes.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeAddresses',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeAddresses.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeAddresses.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeAvailabilityZones',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeAvailabilityZones.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeAvailabilityZones.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
|||
params.merge!(Fog::AWS.indexed_filters(options[:filters])) if options[:filters]
|
||||
request({
|
||||
'Action' => 'DescribeClassicLinkInstances',
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeClassicLinkInstances.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeClassicLinkInstances.new
|
||||
}.merge(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeDhcpOptions',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeDhcpOptions.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeDhcpOptions.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -51,7 +51,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeImages',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeImages.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeImages.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ module Fog
|
|||
'Action' => 'DescribeInstanceAttribute',
|
||||
'InstanceId' => instance_id,
|
||||
'Attribute' => attribute,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeInstanceAttribute.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeInstanceAttribute.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ module Fog
|
|||
end
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::AWS::NotFound.new("The Instance '#{instance_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The Instance '#{instance_id}' does not exist")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeInstanceStatus',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeInstanceStatus.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeInstanceStatus.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -81,7 +81,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeInstances',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeInstances.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeInstances.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
@ -178,7 +178,7 @@ module Fog
|
|||
|
||||
# Error if filtering for a brand new instance directly
|
||||
if (filters['instance-id'] || filters['instanceId']) && !brand_new_instances.empty?
|
||||
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{brand_new_instances.first['instanceId']}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The instance ID '#{brand_new_instances.first['instanceId']}' does not exist")
|
||||
end
|
||||
|
||||
# Otherwise don't include it in the list
|
||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeInternetGateways',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeInternetGateways.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeInternetGateways.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeKeyPairs',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeKeyPairs.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeKeyPairs.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -43,7 +43,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeNetworkAcls',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeNetworkAcls.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeNetworkAcls.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ module Fog
|
|||
'Action' => 'DescribeNetworkInterfaceAttribute',
|
||||
'NetworkInterfaceId' => network_interface_id,
|
||||
'Attribute' => attribute,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeNetworkInterfaceAttribute.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeNetworkInterfaceAttribute.new
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ module Fog
|
|||
|
||||
|
||||
unless network_interface
|
||||
raise Fog::Compute::AWS::NotFound.new("The network interface '#{network_interface_id}' does not exist")
|
||||
raise Fog::AWS::Compute::NotFound.new("The network interface '#{network_interface_id}' does not exist")
|
||||
end
|
||||
|
||||
response.status = 200
|
||||
|
@ -58,7 +58,7 @@ module Fog
|
|||
when 'description', 'groupSet', 'sourceDestCheck', 'attachment'
|
||||
response.body[attribute] = network_interface[attribute]
|
||||
else
|
||||
raise Fog::Compute::AWS::Error.new("Illegal attribute '#{attribute}' specified")
|
||||
raise Fog::AWS::Compute::Error.new("Illegal attribute '#{attribute}' specified")
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -57,7 +57,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeNetworkInterfaces',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeNetworkInterfaces.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeNetworkInterfaces.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribePlacementGroups',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribePlacementGroups.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribePlacementGroups.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeRegions',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeRegions.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeRegions.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeReservedInstances',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeReservedInstances.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeReservedInstances.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,7 +47,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeReservedInstancesOfferings',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeReservedInstancesOfferings.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeReservedInstancesOfferings.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -47,7 +47,7 @@ module Fog
|
|||
params = Fog::AWS.indexed_filters(filters)
|
||||
request({
|
||||
'Action' => 'DescribeRouteTables',
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeRouteTables.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeRouteTables.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeSecurityGroups',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeSecurityGroups.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeSecurityGroups.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,7 +44,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeSnapshots',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeSnapshots.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeSnapshots.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeSpotDatafeedSubscription',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::SpotDatafeedSubscription.new
|
||||
:parser => Fog::Parsers::AWS::Compute::SpotDatafeedSubscription.new
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeSpotInstanceRequests',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::SpotInstanceRequests.new
|
||||
:parser => Fog::Parsers::AWS::Compute::SpotInstanceRequests.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,7 +52,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeSpotPriceHistory',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeSpotPriceHistory.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeSpotPriceHistory.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
@ -82,14 +82,14 @@ module Fog
|
|||
zones = params['AvailabilityZone']
|
||||
if (!zones.nil? && !all_zones.include?([*zones].shuffle.first))
|
||||
az_error = "InvalidParameterValue => Invalid availability zone: [#{zones}]"
|
||||
raise Fog::Compute::AWS::Error, az_error
|
||||
raise Fog::AWS::Compute::Error, az_error
|
||||
end
|
||||
zones = all_zones if zones.nil?
|
||||
|
||||
max_results = params['MaxResults'] || Fog::Mock.random_numbers(3).to_i
|
||||
if !(max_results.is_a?(Integer) && max_results > 0)
|
||||
max_results_error = "InvalidParameterValue => Invalid value '#{max_results}' for maxResults"
|
||||
raise Fog::Compute::AWS::Error, max_results_error
|
||||
raise Fog::AWS::Compute::Error, max_results_error
|
||||
end
|
||||
|
||||
all_instance_types = flavors.map { |f| f.id }
|
||||
|
|
|
@ -37,7 +37,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeSubnets',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeSubnets.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeSubnets.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeTags',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeTags.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeTags.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeVolumeStatus',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeVolumeStatus.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeVolumeStatus.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
|||
request({
|
||||
'Action' => 'DescribeVolumes',
|
||||
:idempotent => true,
|
||||
:parser => Fog::Parsers::Compute::AWS::DescribeVolumes.new
|
||||
:parser => Fog::Parsers::AWS::Compute::DescribeVolumes.new
|
||||
}.merge!(params))
|
||||
end
|
||||
end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue