mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Merge pull request #355 from engineyard/classiclink-fixes
classic link enhancements
This commit is contained in:
commit
e37c1aa31e
13 changed files with 289 additions and 23 deletions
|
@ -125,14 +125,17 @@ module Fog
|
||||||
request :describe_vpcs
|
request :describe_vpcs
|
||||||
request :describe_vpc_attribute
|
request :describe_vpc_attribute
|
||||||
request :describe_vpc_classic_link
|
request :describe_vpc_classic_link
|
||||||
|
request :describe_vpc_classic_link_dns_support
|
||||||
request :detach_network_interface
|
request :detach_network_interface
|
||||||
request :detach_internet_gateway
|
request :detach_internet_gateway
|
||||||
request :detach_volume
|
request :detach_volume
|
||||||
request :detach_classic_link_vpc
|
request :detach_classic_link_vpc
|
||||||
request :disable_vpc_classic_link
|
request :disable_vpc_classic_link
|
||||||
|
request :disable_vpc_classic_link_dns_support
|
||||||
request :disassociate_address
|
request :disassociate_address
|
||||||
request :disassociate_route_table
|
request :disassociate_route_table
|
||||||
request :enable_vpc_classic_link
|
request :enable_vpc_classic_link
|
||||||
|
request :enable_vpc_classic_link_dns_support
|
||||||
request :get_console_output
|
request :get_console_output
|
||||||
request :get_password_data
|
request :get_password_data
|
||||||
request :import_key_pair
|
request :import_key_pair
|
||||||
|
|
|
@ -47,6 +47,40 @@ module Fog
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def classic_link_enabled?
|
||||||
|
requires :identity
|
||||||
|
service.describe_vpc_classic_link(:vpc_ids => [self.identity]).body['vpcSet'].first['classicLinkEnabled']
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def enable_classic_link
|
||||||
|
requires :identity
|
||||||
|
service.enable_vpc_classic_link(self.identity).body['return']
|
||||||
|
end
|
||||||
|
|
||||||
|
def disable_classic_link
|
||||||
|
requires :identity
|
||||||
|
service.disable_vpc_classic_link(self.identity).body['return']
|
||||||
|
end
|
||||||
|
|
||||||
|
def classic_link_dns_enabled?
|
||||||
|
requires :identity
|
||||||
|
service.describe_vpc_classic_link_dns_support(:vpc_ids => [self.identity]).body['vpcs'].first['classicLinkDnsSupported']
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def enable_classic_link_dns
|
||||||
|
requires :identity
|
||||||
|
service.enable_vpc_classic_link_dns_support(self.identity).body['return']
|
||||||
|
end
|
||||||
|
|
||||||
|
def disable_classic_link_dns
|
||||||
|
requires :identity
|
||||||
|
service.disable_vpc_classic_link_dns_support(self.identity).body['return']
|
||||||
|
end
|
||||||
|
|
||||||
# Create a vpc
|
# Create a vpc
|
||||||
#
|
#
|
||||||
# >> g = AWS.vpcs.new(:cidr_block => "10.1.2.0/24")
|
# >> g = AWS.vpcs.new(:cidr_block => "10.1.2.0/24")
|
||||||
|
|
|
@ -30,8 +30,10 @@ module Fog
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
case name
|
case name
|
||||||
when 'vpcId', 'classicLinkEnabled'
|
when 'vpcId'
|
||||||
@vpc[name] = value
|
@vpc[name] = value
|
||||||
|
when 'classicLinkEnabled'
|
||||||
|
@vpc[name] = value == 'true'
|
||||||
when 'item'
|
when 'item'
|
||||||
@response['vpcSet'] << @vpc
|
@response['vpcSet'] << @vpc
|
||||||
@vpc = { 'tagSet' => {} }
|
@vpc = { 'tagSet' => {} }
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
module Fog
|
||||||
|
module Parsers
|
||||||
|
module Compute
|
||||||
|
module AWS
|
||||||
|
class DescribeVpcClassicLinkDnsSupport < Fog::Parsers::Base
|
||||||
|
def reset
|
||||||
|
@vpc = {}
|
||||||
|
@response = { 'vpcs' => [] }
|
||||||
|
end
|
||||||
|
|
||||||
|
def end_element(name)
|
||||||
|
case name
|
||||||
|
when 'vpcId'
|
||||||
|
@vpc[name] = value
|
||||||
|
when 'classicLinkDnsSupported'
|
||||||
|
@vpc[name] = value == 'true'
|
||||||
|
when 'item'
|
||||||
|
@response['vpcs'] << @vpc
|
||||||
|
@vpc = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -26,7 +26,7 @@ module Fog
|
||||||
'DryRun' => dry_run,
|
'DryRun' => dry_run,
|
||||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||||
}.merge(Fog::AWS.indexed_param('SecurityGroupId', security_group_ids)))
|
}.merge(Fog::AWS.indexed_param('SecurityGroupId', security_group_ids)))
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -50,11 +50,11 @@ module Fog
|
||||||
'return' => true
|
'return' => true
|
||||||
}
|
}
|
||||||
unless dry_run
|
unless dry_run
|
||||||
instance['classicLinkSecurityGroups'] = security_group_ids
|
instance['classicLinkSecurityGroups'] = security_group_ids
|
||||||
instance['classicLinkVpcId'] = vpc_id
|
instance['classicLinkVpcId'] = vpc_id
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
elsif !instance
|
elsif !instance
|
||||||
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
||||||
elsif !vpc
|
elsif !vpc
|
||||||
raise Fog::Compute::AWS::NotFound.new("The VPC '#{vpc_id}' does not exist.")
|
raise Fog::Compute::AWS::NotFound.new("The VPC '#{vpc_id}' does not exist.")
|
||||||
|
|
|
@ -43,15 +43,16 @@ module Fog
|
||||||
response.status = 200
|
response.status = 200
|
||||||
vpc_id = Fog::AWS::Mock.vpc_id
|
vpc_id = Fog::AWS::Mock.vpc_id
|
||||||
vpc = {
|
vpc = {
|
||||||
'vpcId' => vpc_id,
|
'vpcId' => vpc_id,
|
||||||
'state' => 'pending',
|
'state' => 'pending',
|
||||||
'cidrBlock' => cidrBlock,
|
'cidrBlock' => cidrBlock,
|
||||||
'dhcpOptionsId' => Fog::AWS::Mock.request_id,
|
'dhcpOptionsId' => Fog::AWS::Mock.request_id,
|
||||||
'tagSet' => {},
|
'tagSet' => {},
|
||||||
'enableDnsSupport' => true,
|
'enableDnsSupport' => true,
|
||||||
'enableDnsHostnames' => false,
|
'enableDnsHostnames' => false,
|
||||||
'mapPublicIpOnLaunch'=> false,
|
'mapPublicIpOnLaunch' => false,
|
||||||
'classicLinkEnabled' => false
|
'classicLinkEnabled' => false,
|
||||||
|
'classicLinkDnsSupport' => false
|
||||||
}
|
}
|
||||||
self.data[:vpcs].push(vpc)
|
self.data[:vpcs].push(vpc)
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ module Fog
|
||||||
vpcs = apply_tag_filters(vpcs, options[:filters], 'vpcId') if options[:filters]
|
vpcs = apply_tag_filters(vpcs, options[:filters], 'vpcId') if options[:filters]
|
||||||
|
|
||||||
response.status = 200
|
response.status = 200
|
||||||
vpc_data = vpcs.collect do |vpc|
|
vpc_data = vpcs.collect do |vpc|
|
||||||
{
|
{
|
||||||
'vpcId' => vpc['vpcId'],
|
'vpcId' => vpc['vpcId'],
|
||||||
'classicLinkEnabled' => vpc['classicLinkEnabled'],
|
'classicLinkEnabled' => vpc['classicLinkEnabled'],
|
||||||
|
@ -56,6 +56,7 @@ module Fog
|
||||||
'requestId' => Fog::AWS::Mock.request_id,
|
'requestId' => Fog::AWS::Mock.request_id,
|
||||||
'vpcSet' => vpc_data
|
'vpcSet' => vpc_data
|
||||||
}
|
}
|
||||||
|
response
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class AWS
|
||||||
|
class Real
|
||||||
|
require 'fog/aws/parsers/compute/describe_vpc_classic_link_dns_support'
|
||||||
|
|
||||||
|
# escribes the ClassicLink DNS support status of one or more VPCs
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * options<~Hash>
|
||||||
|
# * vpc_ids<~Array> - An array of vpc ids to restrict results to
|
||||||
|
# * 'MaxResults' - Maximum number of items to return
|
||||||
|
# * 'NextToken' - The token for the next set of items to return
|
||||||
|
#
|
||||||
|
# ==== Returns
|
||||||
|
# * response<~Excon::Response>:
|
||||||
|
# * body<~Hash>:
|
||||||
|
# * 'requestId'<~String> - Id of the request
|
||||||
|
# * 'vpcs'<~Array> - Information about the ClassicLink DNS support status of the VPCs
|
||||||
|
# * 'vpcId'<~String>
|
||||||
|
# * 'classicLinkDnsSupported'<~Boolean>
|
||||||
|
#
|
||||||
|
# http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcClassicLinkDnsSupport.html
|
||||||
|
|
||||||
|
def describe_vpc_classic_link_dns_support(options={})
|
||||||
|
params = {}
|
||||||
|
params.merge!(Fog::AWS.indexed_param('VpcIds', options[:vpc_ids])) if options[:vpc_ids]
|
||||||
|
request({
|
||||||
|
'Action' => 'DescribeVpcClassicLinkDnsSupport',
|
||||||
|
'MaxResults' => options['MaxResults'],
|
||||||
|
'NextToken' => options['NextToken'],
|
||||||
|
:parser => Fog::Parsers::Compute::AWS::DescribeVpcClassicLinkDnsSupport.new
|
||||||
|
}.merge(params))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
def describe_vpc_classic_link_dns_support(options={})
|
||||||
|
response = Excon::Response.new
|
||||||
|
|
||||||
|
vpcs = self.data[:vpcs]
|
||||||
|
|
||||||
|
if options[:vpc_ids]
|
||||||
|
vpcs = vpcs.select { |v| options[:vpc_ids].include?(v['vpcId']) }
|
||||||
|
end
|
||||||
|
|
||||||
|
response.body = {'vpcs' => vpcs.map { |v| {"vpcId" => v['vpcId'], "classicLinkDnsSupported" => v['classicLinkDnsSupport']} } }
|
||||||
|
response
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -26,7 +26,6 @@ module Fog
|
||||||
'DryRun' => dry_run,
|
'DryRun' => dry_run,
|
||||||
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||||
)
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,12 +46,11 @@ module Fog
|
||||||
instance['classicLinkVpcId'] = nil
|
instance['classicLinkVpcId'] = nil
|
||||||
end
|
end
|
||||||
response
|
response
|
||||||
elsif !instance
|
elsif !instance
|
||||||
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
raise Fog::Compute::AWS::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
||||||
elsif !vpc
|
elsif !vpc
|
||||||
raise Fog::Compute::AWS::NotFound.new("The VPC '#{vpc_id}' does not exist.")
|
raise Fog::Compute::AWS::NotFound.new("The VPC '#{vpc_id}' does not exist.")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class AWS
|
||||||
|
class Real
|
||||||
|
require 'fog/aws/parsers/compute/basic'
|
||||||
|
|
||||||
|
# Disables DNS hostname resolution for ClassicLink
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * vpc_id<~String> - The ID of the ClassicLink-enabled VPC.
|
||||||
|
#
|
||||||
|
# ==== Returns
|
||||||
|
# * response<~Excon::Response>:
|
||||||
|
# * body<~Hash>:
|
||||||
|
# * 'requestId'<~String> - Id of the request
|
||||||
|
# * 'return'<~Boolean> - Whether the request succeeded
|
||||||
|
#
|
||||||
|
# http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DisableVpcClassicLinkDnsSupport.html
|
||||||
|
|
||||||
|
def disable_vpc_classic_link_dns_support(vpc_id)
|
||||||
|
request(
|
||||||
|
'Action' => 'DisableVpcClassicLinkDnsSupport',
|
||||||
|
'VpcId' => vpc_id,
|
||||||
|
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
def disable_vpc_classic_link_dns_support(vpc_id)
|
||||||
|
response = Excon::Response.new
|
||||||
|
unless vpc = self.data[:vpcs].find { |v| v['vpcId'] == vpc_id }
|
||||||
|
raise Fog::Compute::AWS::NotFound.new("The VPC '#{vpc_id}' does not exist")
|
||||||
|
end
|
||||||
|
vpc['classicLinkDnsSupport'] = false
|
||||||
|
response.body = {
|
||||||
|
'requestId' => Fog::AWS::Mock.request_id,
|
||||||
|
'return' => true
|
||||||
|
}
|
||||||
|
response
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,45 @@
|
||||||
|
module Fog
|
||||||
|
module Compute
|
||||||
|
class AWS
|
||||||
|
class Real
|
||||||
|
require 'fog/aws/parsers/compute/basic'
|
||||||
|
|
||||||
|
# Enables a VPC to support DNS hostname resolution for ClassicLink
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * vpc_id<~String> - The ID of the ClassicLink-enabled VPC.
|
||||||
|
#
|
||||||
|
# ==== Returns
|
||||||
|
# * response<~Excon::Response>:
|
||||||
|
# * body<~Hash>:
|
||||||
|
# * 'requestId'<~String> - Id of the request
|
||||||
|
# * 'return'<~Boolean> - Whether the request succeeded
|
||||||
|
#
|
||||||
|
# http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_EnableVpcClassicLinkDnsSupport.html
|
||||||
|
|
||||||
|
def enable_vpc_classic_link_dns_support(vpc_id)
|
||||||
|
request(
|
||||||
|
'Action' => 'EnableVpcClassicLinkDnsSupport',
|
||||||
|
'VpcId' => vpc_id,
|
||||||
|
:parser => Fog::Parsers::Compute::AWS::Basic.new
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Mock
|
||||||
|
def enable_vpc_classic_link_dns_support(vpc_id)
|
||||||
|
response = Excon::Response.new
|
||||||
|
unless vpc = self.data[:vpcs].find { |v| v['vpcId'] == vpc_id }
|
||||||
|
raise Fog::Compute::AWS::NotFound.new("The VPC '#{vpc_id}' does not exist")
|
||||||
|
end
|
||||||
|
vpc['classicLinkDnsSupport'] = true
|
||||||
|
response.body = {
|
||||||
|
'requestId' => Fog::AWS::Mock.request_id,
|
||||||
|
'return' => true
|
||||||
|
}
|
||||||
|
response
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,4 +1,26 @@
|
||||||
Shindo.tests("Fog::Compute[:aws] | vpc", ['aws']) do
|
Shindo.tests("Fog::Compute[:aws] | vpc", ['aws']) do
|
||||||
|
|
||||||
model_tests(Fog::Compute[:aws].vpcs, {:cidr_block => '10.0.10.0/28'}, true)
|
model_tests(Fog::Compute[:aws].vpcs, {:cidr_block => '10.0.10.0/28'}, true) do
|
||||||
|
tests("#enable_classic_link") do
|
||||||
|
returns(false) { @instance.classic_link_enabled? }
|
||||||
|
returns(true) { @instance.enable_classic_link }
|
||||||
|
returns(true) { @instance.classic_link_enabled? }
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#disable_classic_link") do
|
||||||
|
returns(true) { @instance.disable_classic_link }
|
||||||
|
returns(false) { @instance.classic_link_enabled? }
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#enable_classic_link_dns") do
|
||||||
|
returns(false) { @instance.classic_link_dns_enabled? }
|
||||||
|
returns(true) { @instance.enable_classic_link_dns }
|
||||||
|
returns(true) { @instance.classic_link_dns_enabled? }
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#disable_classic_link") do
|
||||||
|
returns(true) { @instance.disable_classic_link_dns }
|
||||||
|
returns(false) { @instance.classic_link_dns_enabled? }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,6 +42,13 @@ Shindo.tests('Fog::Compute[:aws] | vpc requests', ['aws']) do
|
||||||
'requestId' => String
|
'requestId' => String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@describe_vpc_classic_link_dns_support_format = {
|
||||||
|
"vpcs" => [{
|
||||||
|
"vpcId" => String,
|
||||||
|
"classicLinkDnsSupported" => Fog::Boolean
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
@vpc_id = nil
|
@vpc_id = nil
|
||||||
|
@ -126,14 +133,14 @@ Shindo.tests('Fog::Compute[:aws] | vpc requests', ['aws']) do
|
||||||
end
|
end
|
||||||
|
|
||||||
tests("describe_vpc_classic_link(:filters => {'tag-key' => 'foo'}").formats(@describe_vpcs_classic_link_format) do
|
tests("describe_vpc_classic_link(:filters => {'tag-key' => 'foo'}").formats(@describe_vpcs_classic_link_format) do
|
||||||
body = Fog::Compute[:aws].describe_vpc_classic_link(:filters => {'tag-key' => 'foo'})
|
body = Fog::Compute[:aws].describe_vpc_classic_link(:filters => {'tag-key' => 'foo'}).body
|
||||||
tests("returns 1 vpc").returns(1) { body['vpcSet'].size }
|
tests("returns 1 vpc").returns(1) { body['vpcSet'].size }
|
||||||
body
|
body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests("enable_vpc_classic_link").returns(true) do
|
tests("enable_vpc_classic_link").returns(true) do
|
||||||
Fog::Compute[:aws].enable_vpc_classic_link @vpc_id
|
Fog::Compute[:aws].enable_vpc_classic_link @vpc_id
|
||||||
body = Fog::Compute[:aws].describe_vpc_classic_link(:vpc_ids => [@vpc_id])
|
body = Fog::Compute[:aws].describe_vpc_classic_link(:vpc_ids => [@vpc_id]).body
|
||||||
body['vpcSet'].first['classicLinkEnabled']
|
body['vpcSet'].first['classicLinkEnabled']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -143,7 +150,7 @@ Shindo.tests('Fog::Compute[:aws] | vpc requests', ['aws']) do
|
||||||
@group = Fog::Compute[:aws].security_groups.create :name => 'test-group', :description => 'vpc security group'
|
@group = Fog::Compute[:aws].security_groups.create :name => 'test-group', :description => 'vpc security group'
|
||||||
|
|
||||||
tests("attach_classic_link_vpc") do
|
tests("attach_classic_link_vpc") do
|
||||||
Fog::Compute[:aws].attach_classic_link_vpc(@server.id, @vpc_id, [@group])
|
Fog::Compute[:aws].attach_classic_link_vpc(@server.id, @vpc_id, [@group.group_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
tests('describe_classic_link_instances').formats(@describe_classic_link_instances) do
|
tests('describe_classic_link_instances').formats(@describe_classic_link_instances) do
|
||||||
|
@ -154,7 +161,36 @@ Shindo.tests('Fog::Compute[:aws] | vpc requests', ['aws']) do
|
||||||
Fog::Compute[:aws].detach_classic_link_vpc(@server.id, @vpc_id)
|
Fog::Compute[:aws].detach_classic_link_vpc(@server.id, @vpc_id)
|
||||||
Fog::Compute[:aws].describe_classic_link_instances().body['instancesSet']
|
Fog::Compute[:aws].describe_classic_link_instances().body['instancesSet']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tests("enable_vpc_classic_link_dns_support('#{@vpc_id}')").formats(AWS::Compute::Formats::BASIC) do
|
||||||
|
body = Fog::Compute[:aws].enable_vpc_classic_link_dns_support(@vpc_id).body
|
||||||
|
body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#describe_vpc_classic_link_dns_support").formats(@describe_vpc_classic_link_dns_support_format) do
|
||||||
|
Fog::Compute[:aws].describe_vpc_classic_link_dns_support.body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#describe_vpc_classic_link_dns_support(:vpc_ids => ['#{@vpc_id}'])").formats(@describe_vpc_classic_link_dns_support_format) do
|
||||||
|
body = Fog::Compute[:aws].describe_vpc_classic_link_dns_support(:vpc_ids => [@vpc_id]).body
|
||||||
|
returns(1) { body['vpcs'].count }
|
||||||
|
returns(@vpc_id) { body['vpcs'].first['vpcId'] }
|
||||||
|
returns(true) { body['vpcs'].first['classicLinkDnsSupported'] }
|
||||||
|
body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("disable_vpc_classic_link_dns_support('#{@vpc_id}')").formats(AWS::Compute::Formats::BASIC) do
|
||||||
|
Fog::Compute[:aws].disable_vpc_classic_link_dns_support(@vpc_id).body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#describe_vpc_classic_link_dns_support(:vpc_ids => ['#{@vpc_id}'])").formats(@describe_vpc_classic_link_dns_support_format) do
|
||||||
|
body = Fog::Compute[:aws].describe_vpc_classic_link_dns_support(:vpc_ids => [@vpc_id]).body
|
||||||
|
returns(1) { body['vpcs'].count }
|
||||||
|
returns(@vpc_id) { body['vpcs'].first['vpcId'] }
|
||||||
|
returns(false) { body['vpcs'].first['classicLinkDnsSupported'] }
|
||||||
|
body
|
||||||
|
end
|
||||||
|
|
||||||
if !Fog.mocking?
|
if !Fog.mocking?
|
||||||
@server.destroy
|
@server.destroy
|
||||||
@server.wait_for {state == 'terminated'}
|
@server.wait_for {state == 'terminated'}
|
||||||
|
@ -162,7 +198,7 @@ Shindo.tests('Fog::Compute[:aws] | vpc requests', ['aws']) do
|
||||||
|
|
||||||
tests("disable_vpc_classic_link").returns(false) do
|
tests("disable_vpc_classic_link").returns(false) do
|
||||||
Fog::Compute[:aws].disable_vpc_classic_link @vpc_id
|
Fog::Compute[:aws].disable_vpc_classic_link @vpc_id
|
||||||
body = Fog::Compute[:aws].describe_vpc_classic_link(:vpc_ids => [@vpc_id])
|
body = Fog::Compute[:aws].describe_vpc_classic_link(:vpc_ids => [@vpc_id]).body
|
||||||
body['vpcSet'].first['classicLinkEnabled']
|
body['vpcSet'].first['classicLinkEnabled']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue