mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
create/delete for security groups
This commit is contained in:
parent
a6f52d5e1c
commit
c5f355130c
3 changed files with 65 additions and 2 deletions
|
@ -48,11 +48,28 @@ module Fog
|
||||||
}, Fog::Parsers::AWS::EC2::AllocateAddress.new)
|
}, Fog::Parsers::AWS::EC2::AllocateAddress.new)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Create a new security group
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# :group_name<~String>:: Name of the security group.
|
||||||
|
# :group_description<~String>:: Description of group.
|
||||||
|
#
|
||||||
|
# ==== Returns
|
||||||
|
# response::
|
||||||
|
# body<~Hash>::
|
||||||
|
# :return<~Boolean>:: success?
|
||||||
|
def create_security_group(name, description)
|
||||||
|
request({
|
||||||
|
'Action' => 'CreateSecurityGroup',
|
||||||
|
'GroupName' => name,
|
||||||
|
'GroupDescription' => CGI.escape(description)
|
||||||
|
}, Fog::Parsers::AWS::EC2::Basic.new)
|
||||||
|
end
|
||||||
|
|
||||||
# Create an EBS volume
|
# Create an EBS volume
|
||||||
#
|
#
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
# :availability_zone<~String>::
|
# :availability_zone<~String>:: availability zone to create volume in
|
||||||
# availability zone to create volume in
|
|
||||||
# :size<~Integer>:: Size in GiBs for volume. Must be between 1 and 1024.
|
# :size<~Integer>:: Size in GiBs for volume. Must be between 1 and 1024.
|
||||||
# :snapshot_id<~String>:: Optional, snapshot to create volume from
|
# :snapshot_id<~String>:: Optional, snapshot to create volume from
|
||||||
#
|
#
|
||||||
|
@ -74,6 +91,22 @@ module Fog
|
||||||
}, Fog::Parsers::AWS::EC2::CreateVolume.new)
|
}, Fog::Parsers::AWS::EC2::CreateVolume.new)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Delete a security group that you own
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# :group_name<~String>:: Name of the security group.
|
||||||
|
#
|
||||||
|
# ==== Returns
|
||||||
|
# response::
|
||||||
|
# body<~Hash>::
|
||||||
|
# :return<~Boolean>:: success?
|
||||||
|
def delete_security_group(name)
|
||||||
|
request({
|
||||||
|
'Action' => 'DeleteSecurityGroup',
|
||||||
|
'GroupName' => name
|
||||||
|
}, Fog::Parsers::AWS::EC2::Basic.new)
|
||||||
|
end
|
||||||
|
|
||||||
# Delete an EBS volume
|
# Delete an EBS volume
|
||||||
#
|
#
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
|
|
15
spec/aws/ec2/create_security_group_spec.rb
Normal file
15
spec/aws/ec2/create_security_group_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||||
|
|
||||||
|
describe 'EC2.create_security_group' do
|
||||||
|
|
||||||
|
after(:all) do
|
||||||
|
ec2.delete_security_group('fog_security_group')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should return proper attributes" do
|
||||||
|
actual = ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||||
|
actual.body[:request_id].should be_a(String)
|
||||||
|
[false, true].should include(actual.body[:return])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
15
spec/aws/ec2/delete_security_group_spec.rb
Normal file
15
spec/aws/ec2/delete_security_group_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||||
|
|
||||||
|
describe 'EC2.delete_security_group' do
|
||||||
|
|
||||||
|
before(:all) do
|
||||||
|
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should return proper attributes" do
|
||||||
|
actual = ec2.delete_security_group('fog_security_group')
|
||||||
|
actual.body[:request_id].should be_a(String)
|
||||||
|
[false, true].should include(actual.body[:return])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in a new issue