mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Add default_for_az
attribute to subnet
* Add new attribute `default_for_az` to `Subnet` model; * Update parsers to take into account new attribute; * Fix comments and tests for `map_public_ip_on_launch` attribute.
This commit is contained in:
parent
298a99d91d
commit
d689de6c66
6 changed files with 33 additions and 23 deletions
|
@ -10,6 +10,7 @@ module Fog
|
||||||
attribute :availability_zone, :aliases => 'availabilityZone'
|
attribute :availability_zone, :aliases => 'availabilityZone'
|
||||||
attribute :tag_set, :aliases => 'tagSet'
|
attribute :tag_set, :aliases => 'tagSet'
|
||||||
attribute :map_public_ip_on_launch, :aliases => 'mapPublicIpOnLaunch'
|
attribute :map_public_ip_on_launch, :aliases => 'mapPublicIpOnLaunch'
|
||||||
|
attribute :default_for_az, :aliases => 'defaultForAz'
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
requires :state
|
requires :state
|
||||||
|
|
|
@ -32,6 +32,8 @@ module Fog
|
||||||
case name
|
case name
|
||||||
when 'subnetId', 'state', 'vpcId', 'cidrBlock', 'availableIpAddressCount', 'availabilityZone'
|
when 'subnetId', 'state', 'vpcId', 'cidrBlock', 'availableIpAddressCount', 'availabilityZone'
|
||||||
@subnet[name] = value
|
@subnet[name] = value
|
||||||
|
when 'mapPublicIpOnLaunch', 'defaultForAz'
|
||||||
|
@subnet[name] = value == 'true' ? true : false
|
||||||
when 'subnet'
|
when 'subnet'
|
||||||
@response['subnet'] = @subnet
|
@response['subnet'] = @subnet
|
||||||
when 'requestId'
|
when 'requestId'
|
||||||
|
|
|
@ -32,7 +32,7 @@ module Fog
|
||||||
case name
|
case name
|
||||||
when 'subnetId', 'state', 'vpcId', 'cidrBlock', 'availableIpAddressCount', 'availabilityZone'
|
when 'subnetId', 'state', 'vpcId', 'cidrBlock', 'availableIpAddressCount', 'availabilityZone'
|
||||||
@subnet[name] = value
|
@subnet[name] = value
|
||||||
when 'mapPublicIpOnLaunch'
|
when 'mapPublicIpOnLaunch', 'defaultForAz'
|
||||||
@subnet[name] = value == 'true' ? true : false
|
@subnet[name] = value == 'true' ? true : false
|
||||||
when 'item'
|
when 'item'
|
||||||
@response['subnetSet'] << @subnet
|
@response['subnetSet'] << @subnet
|
||||||
|
|
|
@ -18,15 +18,17 @@ module Fog
|
||||||
# * body<~Hash>:
|
# * body<~Hash>:
|
||||||
# * 'requestId'<~String> - Id of request
|
# * 'requestId'<~String> - Id of request
|
||||||
# * 'subnet'<~Array>:
|
# * 'subnet'<~Array>:
|
||||||
# * 'subnetId'<~String> - The Subnet's ID
|
# * 'subnetId'<~String> - The Subnet's ID
|
||||||
# * 'state'<~String> - The current state of the Subnet. ['pending', 'available']
|
# * 'state'<~String> - The current state of the Subnet. ['pending', 'available']
|
||||||
# * 'cidrBlock'<~String> - The CIDR block the Subnet covers.
|
# * 'cidrBlock'<~String> - The CIDR block the Subnet covers.
|
||||||
# * 'AvailableIpAddressCount'<~Integer> - The number of unused IP addresses in the subnet (the IP addresses for any stopped
|
# * 'availableIpAddressCount'<~Integer> - The number of unused IP addresses in the subnet (the IP addresses for any stopped
|
||||||
# instances are considered unavailable)
|
# instances are considered unavailable)
|
||||||
# * 'AvailabilityZone'<~String> - The Availability Zone the subnet is in
|
# * 'availabilityZone'<~String> - The Availability Zone the subnet is in
|
||||||
# * 'tagSet'<~Array>: Tags assigned to the resource.
|
# * 'tagSet'<~Array>: Tags assigned to the resource.
|
||||||
# * 'key'<~String> - Tag's key
|
# * 'key'<~String> - Tag's key
|
||||||
# * 'value'<~String> - Tag's value
|
# * 'value'<~String> - Tag's value
|
||||||
|
# * 'mapPublicIpOnLaunch'<~Boolean> - Indicates whether instances launched in this subnet receive a public IPv4 address.
|
||||||
|
# * 'defaultForAz'<~Boolean> - Indicates whether this is the default subnet for the Availability Zone.
|
||||||
#
|
#
|
||||||
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/2011-07-15/APIReference/ApiReference-query-CreateSubnet.html]
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/2011-07-15/APIReference/ApiReference-query-CreateSubnet.html]
|
||||||
def create_subnet(vpcId, cidrBlock, options = {})
|
def create_subnet(vpcId, cidrBlock, options = {})
|
||||||
|
@ -65,7 +67,9 @@ module Fog
|
||||||
'cidrBlock' => cidrBlock,
|
'cidrBlock' => cidrBlock,
|
||||||
'availableIpAddressCount' => "255",
|
'availableIpAddressCount' => "255",
|
||||||
'availabilityZone' => av_zone,
|
'availabilityZone' => av_zone,
|
||||||
'tagSet' => {}
|
'tagSet' => {},
|
||||||
|
'mapPublicIpOnLaunch' => true,
|
||||||
|
'defaultForAz' => true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add this subnet to the default network ACL
|
# Add this subnet to the default network ACL
|
||||||
|
|
|
@ -14,17 +14,18 @@ module Fog
|
||||||
# * body<~Hash>:
|
# * body<~Hash>:
|
||||||
# * 'requestId'<~String> - Id of request
|
# * 'requestId'<~String> - Id of request
|
||||||
# * 'subnetSet'<~Array>:
|
# * 'subnetSet'<~Array>:
|
||||||
# * 'subnetId'<~String> - The Subnet's ID
|
# * 'subnetId'<~String> - The Subnet's ID
|
||||||
# * 'state'<~String> - The current state of the Subnet. ['pending', 'available']
|
# * 'state'<~String> - The current state of the Subnet. ['pending', 'available']
|
||||||
# * 'vpcId'<~String> - The ID of the VPC the subnet is in
|
# * 'vpcId'<~String> - The ID of the VPC the subnet is in
|
||||||
# * 'cidrBlock'<~String> - The CIDR block the Subnet covers.
|
# * 'cidrBlock'<~String> - The CIDR block the Subnet covers.
|
||||||
# * 'availableIpAddressCount'<~Integer> - The number of unused IP addresses in the subnet (the IP addresses for any
|
# * 'availableIpAddressCount'<~Integer> - The number of unused IP addresses in the subnet (the IP addresses for any
|
||||||
# stopped instances are considered unavailable)
|
# stopped instances are considered unavailable)
|
||||||
# * 'availabilityZone'<~String> - The Availability Zone the subnet is in.
|
# * 'availabilityZone'<~String> - The Availability Zone the subnet is in.
|
||||||
# * 'tagSet'<~Array>: Tags assigned to the resource.
|
# * 'tagSet'<~Array>: Tags assigned to the resource.
|
||||||
# * 'key'<~String> - Tag's key
|
# * 'key'<~String> - Tag's key
|
||||||
# * 'value'<~String> - Tag's value
|
# * 'value'<~String> - Tag's value
|
||||||
# * 'instanceTenancy'<~String> - The allowed tenancy of instances launched into the Subnet.
|
# * 'mapPublicIpOnLaunch'<~Boolean> - Indicates whether instances launched in this subnet receive a public IPv4 address.
|
||||||
|
# * 'defaultForAz'<~Boolean> - Indicates whether this is the default subnet for the Availability Zone.
|
||||||
#
|
#
|
||||||
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/2011-07-15/APIReference/index.html?ApiReference-query-DescribeSubnets.html]
|
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/2011-07-15/APIReference/index.html?ApiReference-query-DescribeSubnets.html]
|
||||||
def describe_subnets(filters = {})
|
def describe_subnets(filters = {})
|
||||||
|
|
|
@ -8,6 +8,8 @@ Shindo.tests('Fog::Compute[:aws] | subnet requests', ['aws']) do
|
||||||
'availableIpAddressCount' => String,
|
'availableIpAddressCount' => String,
|
||||||
'availabilityZone' => String,
|
'availabilityZone' => String,
|
||||||
'tagSet' => Hash,
|
'tagSet' => Hash,
|
||||||
|
'mapPublicIpOnLaunch' => Fog::Boolean,
|
||||||
|
'defaultForAz' => Fog::Boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
@single_subnet_format = {
|
@single_subnet_format = {
|
||||||
|
@ -24,7 +26,7 @@ Shindo.tests('Fog::Compute[:aws] | subnet requests', ['aws']) do
|
||||||
'requestId' => String,
|
'requestId' => String,
|
||||||
'return' => Fog::Boolean
|
'return' => Fog::Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@vpc_network = '10.0.10.0/24'
|
@vpc_network = '10.0.10.0/24'
|
||||||
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => @vpc_network)
|
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => @vpc_network)
|
||||||
@vpc_id = @vpc.id
|
@vpc_id = @vpc.id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue