1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #652 from estonfer/master

Adds the ability to specify security groups by SecurityGroupId which is needed for VPC Security Groups
This commit is contained in:
Wesley Beary 2011-12-15 08:10:58 -08:00
commit 9c3bf8edcc
5 changed files with 8 additions and 3 deletions

View file

@ -7,8 +7,8 @@ module Fog
class SecurityGroup < Fog::Model
identity :name, :aliases => 'groupName'
attribute :description, :aliases => 'groupDescription'
attribute :group_id, :aliases => 'groupId'
attribute :ip_permissions, :aliases => 'ipPermissions'
attribute :owner_id, :aliases => 'ownerId'

View file

@ -34,6 +34,7 @@ module Fog
attribute :reason
attribute :root_device_name, :aliases => 'rootDeviceName'
attribute :root_device_type, :aliases => 'rootDeviceType'
attribute :security_group_ids, :aliases => 'securityGroupIds'
attribute :state, :aliases => 'instanceState', :squash => 'name'
attribute :state_reason, :aliases => 'stateReason'
attribute :subnet_id, :aliases => 'subnetId'
@ -45,7 +46,7 @@ module Fog
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
def initialize(attributes={})
self.groups ||= ["default"] unless attributes[:subnet_id]
self.groups ||= ["default"] unless (attributes[:subnet_id] || attributes[:security_group_ids])
self.flavor_id ||= 't1.micro'
self.image_id ||= begin
self.username = 'ubuntu'
@ -152,6 +153,7 @@ module Fog
'Placement.Tenancy' => tenancy,
'RamdiskId' => ramdisk_id,
'SecurityGroup' => groups,
'SecurityGroupId' => security_group_ids,
'SubnetId' => subnet_id,
'UserData' => user_data
}

View file

@ -40,7 +40,7 @@ module Fog
end
when 'groups'
@in_groups = false
when 'groupDescription', 'ownerId'
when 'groupDescription', 'ownerId', 'groupId'
@security_group[name] = value
when 'groupName'
if @in_groups

View file

@ -16,6 +16,7 @@ module Fog
# * 'requestId'<~String> - Id of request
# * 'securityGroupInfo'<~Array>:
# * 'groupDescription'<~String> - Description of security group
# * 'groupId'<~String> - ID of the security group.
# * 'groupName'<~String> - Name of security group
# * 'ipPermissions'<~Array>:
# * 'fromPort'<~Integer> - Start of port range (or -1 for ICMP wildcard)
@ -59,6 +60,7 @@ module Fog
aliases = {
'description' => 'groupDescription',
'group-name' => 'groupName',
'group-id' => 'groupId',
'owner-id' => 'ownerId'
}
permission_aliases = {

View file

@ -4,6 +4,7 @@ Shindo.tests('Fog::Compute[:aws] | security group requests', ['aws']) do
'requestId' => String,
'securityGroupInfo' => [{
'groupDescription' => String,
'groupId' => String,
'groupName' => String,
'ipPermissions' => [{
'fromPort' => Integer,