poolparty 1.6.6 → 1.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -3
- data/lib/poolparty/chef_solo.rb +0 -1
- metadata +12 -69
- data/vendor/gems/amazon-ec2/ChangeLog +0 -304
- data/vendor/gems/amazon-ec2/LICENSE +0 -66
- data/vendor/gems/amazon-ec2/README.rdoc +0 -359
- data/vendor/gems/amazon-ec2/README_dev.rdoc +0 -10
- data/vendor/gems/amazon-ec2/Rakefile +0 -70
- data/vendor/gems/amazon-ec2/VERSION +0 -1
- data/vendor/gems/amazon-ec2/amazon-ec2.gemspec +0 -142
- data/vendor/gems/amazon-ec2/bin/ec2-gem-example.rb +0 -137
- data/vendor/gems/amazon-ec2/bin/ec2-gem-profile.rb +0 -10
- data/vendor/gems/amazon-ec2/bin/ec2sh +0 -62
- data/vendor/gems/amazon-ec2/bin/setup.rb +0 -29
- data/vendor/gems/amazon-ec2/deps.rip +0 -1
- data/vendor/gems/amazon-ec2/lib/AWS/Autoscaling/autoscaling.rb +0 -273
- data/vendor/gems/amazon-ec2/lib/AWS/Autoscaling.rb +0 -70
- data/vendor/gems/amazon-ec2/lib/AWS/Cloudwatch/monitoring.rb +0 -80
- data/vendor/gems/amazon-ec2/lib/AWS/Cloudwatch.rb +0 -32
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/availability_zones.rb +0 -29
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/console.rb +0 -25
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/devpay.rb +0 -18
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/elastic_ips.rb +0 -86
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/image_attributes.rb +0 -133
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/images.rb +0 -117
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/instances.rb +0 -249
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/keypairs.rb +0 -47
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/products.rb +0 -21
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/security_groups.rb +0 -164
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/snapshots.rb +0 -80
- data/vendor/gems/amazon-ec2/lib/AWS/EC2/volumes.rb +0 -100
- data/vendor/gems/amazon-ec2/lib/AWS/EC2.rb +0 -33
- data/vendor/gems/amazon-ec2/lib/AWS/ELB/load_balancers.rb +0 -178
- data/vendor/gems/amazon-ec2/lib/AWS/ELB.rb +0 -71
- data/vendor/gems/amazon-ec2/lib/AWS/RDS/rds.rb +0 -522
- data/vendor/gems/amazon-ec2/lib/AWS/RDS.rb +0 -73
- data/vendor/gems/amazon-ec2/lib/AWS/exceptions.rb +0 -200
- data/vendor/gems/amazon-ec2/lib/AWS/responses.rb +0 -21
- data/vendor/gems/amazon-ec2/lib/AWS.rb +0 -304
- data/vendor/gems/amazon-ec2/perftools/ec2prof +0 -0
- data/vendor/gems/amazon-ec2/perftools/ec2prof-results.dot +0 -132
- data/vendor/gems/amazon-ec2/perftools/ec2prof-results.txt +0 -100
- data/vendor/gems/amazon-ec2/perftools/ec2prof.symbols +0 -102
- data/vendor/gems/amazon-ec2/test/test_Autoscaling_groups.rb +0 -337
- data/vendor/gems/amazon-ec2/test/test_EC2.rb +0 -68
- data/vendor/gems/amazon-ec2/test/test_EC2_availability_zones.rb +0 -49
- data/vendor/gems/amazon-ec2/test/test_EC2_console.rb +0 -54
- data/vendor/gems/amazon-ec2/test/test_EC2_elastic_ips.rb +0 -144
- data/vendor/gems/amazon-ec2/test/test_EC2_image_attributes.rb +0 -238
- data/vendor/gems/amazon-ec2/test/test_EC2_images.rb +0 -229
- data/vendor/gems/amazon-ec2/test/test_EC2_instances.rb +0 -611
- data/vendor/gems/amazon-ec2/test/test_EC2_keypairs.rb +0 -123
- data/vendor/gems/amazon-ec2/test/test_EC2_products.rb +0 -48
- data/vendor/gems/amazon-ec2/test/test_EC2_responses.rb +0 -53
- data/vendor/gems/amazon-ec2/test/test_EC2_s3_xmlsimple.rb +0 -80
- data/vendor/gems/amazon-ec2/test/test_EC2_security_groups.rb +0 -205
- data/vendor/gems/amazon-ec2/test/test_EC2_snapshots.rb +0 -83
- data/vendor/gems/amazon-ec2/test/test_EC2_volumes.rb +0 -142
- data/vendor/gems/amazon-ec2/test/test_ELB_load_balancers.rb +0 -239
- data/vendor/gems/amazon-ec2/test/test_RDS.rb +0 -354
- data/vendor/gems/amazon-ec2/test/test_helper.rb +0 -23
- data/vendor/gems/amazon-ec2/wsdl/2007-08-29.ec2.wsdl +0 -1269
- data/vendor/gems/amazon-ec2/wsdl/2008-02-01.ec2.wsdl +0 -1614
- data/vendor/gems/amazon-ec2/wsdl/2008-05-05.ec2.wsdl +0 -2052
- data/vendor/gems/amazon-ec2/wsdl/2008-12-01.ec2.wsdl +0 -2354
- data/vendor/gems/amazon-ec2/wsdl/2009-10-31.ec2.wsdl +0 -4261
- data/vendor/gems/amazon-ec2/wsdl/2009-11-30.ec2.wsdl +0 -4668
@@ -1,54 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Amazon Web Services EC2 Query API Ruby library
|
3
|
-
#
|
4
|
-
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
|
-
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
|
-
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
|
-
#++
|
10
|
-
|
11
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
12
|
-
|
13
|
-
context "The EC2 console " do
|
14
|
-
|
15
|
-
before do
|
16
|
-
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
|
-
|
18
|
-
@get_console_output_response_body = <<-RESPONSE
|
19
|
-
<GetConsoleOutputResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
20
|
-
<instanceId>i-28a64341</instanceId>
|
21
|
-
<timestamp>2007-01-03 15:00:00</timestamp>
|
22
|
-
<output>
|
23
|
-
YyB2ZXJzaW9uIDQuMC4xIDIwMDUwNzI3IChSZWQgSGF0IDQuMC4xLTUpKSAjMSBTTVAgVGh1IE9j
|
24
|
-
dCAyNiAwODo0MToyNiBTQVNUIDIwMDYKQklPUy1wcm92aWRlZCBwaHlzaWNhbCBSQU0gbWFwOgpY
|
25
|
-
ZW46IDAwMDAwMDAwMDAwMDAwMDAgLSAwMDAwMDAwMDZhNDAwMDAwICh1c2FibGUpCjk4ME1CIEhJ
|
26
|
-
R0hNRU0gYXZhaWxhYmxlLgo3MjdNQiBMT1dNRU0gYXZhaWxhYmxlLgpOWCAoRXhlY3V0ZSBEaXNh
|
27
|
-
YmxlKSBwcm90ZWN0aW9uOiBhY3RpdmUKSVJRIGxvY2t1cCBkZXRlY3Rpb24gZGlzYWJsZWQKQnVp
|
28
|
-
bHQgMSB6b25lbGlzdHMKS2VybmVsIGNvbW1hbmQgbGluZTogcm9vdD0vZGV2L3NkYTEgcm8gNApF
|
29
|
-
bmFibGluZyBmYXN0IEZQVSBzYXZlIGFuZCByZXN0b3JlLi4uIGRvbmUuCg==
|
30
|
-
</output>
|
31
|
-
</GetConsoleOutputResponse>
|
32
|
-
RESPONSE
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
specify "should return info written to a specific instances console" do
|
38
|
-
@ec2.stubs(:make_request).with('GetConsoleOutput', {"InstanceId"=>"i-2ea64347"}).
|
39
|
-
returns stub(:body => @get_console_output_response_body, :is_a? => true)
|
40
|
-
@ec2.get_console_output( :instance_id => "i-2ea64347" ).should.be.an.instance_of Hash
|
41
|
-
response = @ec2.get_console_output( :instance_id => "i-2ea64347" )
|
42
|
-
response.instanceId.should.equal "i-28a64341"
|
43
|
-
response.timestamp.should.equal "2007-01-03 15:00:00"
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
specify "method get_console_output should raise an exception when called without nil/empty string arguments" do
|
48
|
-
lambda { @ec2.get_console_output() }.should.raise(AWS::ArgumentError)
|
49
|
-
lambda { @ec2.get_console_output(:instance_id => nil) }.should.raise(AWS::ArgumentError)
|
50
|
-
lambda { @ec2.get_console_output(:instance_id => "") }.should.raise(AWS::ArgumentError)
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
end
|
@@ -1,144 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Amazon Web Services EC2 Query API Ruby library
|
3
|
-
#
|
4
|
-
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
|
-
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
|
-
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
|
-
#++
|
10
|
-
|
11
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
12
|
-
|
13
|
-
context "EC2 elastic IP addresses " do
|
14
|
-
|
15
|
-
before do
|
16
|
-
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
|
-
|
18
|
-
@allocate_address_body = <<-RESPONSE
|
19
|
-
<AllocateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
|
20
|
-
<publicIp>67.202.55.255</publicIp>
|
21
|
-
</AllocateAddressResponse>
|
22
|
-
RESPONSE
|
23
|
-
|
24
|
-
@describe_addresses_response_body = <<-RESPONSE
|
25
|
-
<DescribeAddressesResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
|
26
|
-
<addressesSet>
|
27
|
-
<item>
|
28
|
-
<instanceId>i-28a64341</instanceId>
|
29
|
-
<publicIp>67.202.55.255</publicIp>
|
30
|
-
</item>
|
31
|
-
</addressesSet>
|
32
|
-
</DescribeAddressesResponse>
|
33
|
-
RESPONSE
|
34
|
-
|
35
|
-
@release_address_response_body = <<-RESPONSE
|
36
|
-
<ReleaseAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
|
37
|
-
<return>true</return>
|
38
|
-
</ReleaseAddressResponse>
|
39
|
-
RESPONSE
|
40
|
-
|
41
|
-
@associate_address_response_body = <<-RESPONSE
|
42
|
-
<AssociateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
|
43
|
-
<return>true</return>
|
44
|
-
</AssociateAddressResponse>
|
45
|
-
RESPONSE
|
46
|
-
|
47
|
-
@disassociate_address_response_body = <<-RESPONSE
|
48
|
-
<DisassociateAddressResponse xmlns="http://ec2.amazonaws.com/doc/2008-02-01">
|
49
|
-
<return>true</return>
|
50
|
-
</DisassociateAddressResponse>
|
51
|
-
RESPONSE
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
specify "should be able to be created" do
|
57
|
-
@ec2.stubs(:make_request).with('AllocateAddress', {}).
|
58
|
-
returns stub(:body => @allocate_address_body, :is_a? => true)
|
59
|
-
|
60
|
-
@ec2.allocate_address.should.be.an.instance_of Hash
|
61
|
-
|
62
|
-
response = @ec2.allocate_address
|
63
|
-
response.publicIp.should.equal "67.202.55.255"
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
#specify "method create_keypair should reject bad arguments" do
|
68
|
-
# @ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}).
|
69
|
-
# returns stub(:body => @create_keypair_response_body, :is_a? => true)
|
70
|
-
#
|
71
|
-
# lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(AWS::ArgumentError)
|
72
|
-
# lambda { @ec2.create_keypair() }.should.raise(AWS::ArgumentError)
|
73
|
-
# lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(AWS::ArgumentError)
|
74
|
-
# lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(AWS::ArgumentError)
|
75
|
-
#end
|
76
|
-
|
77
|
-
|
78
|
-
specify "should be able to be described with describe_addresses" do
|
79
|
-
@ec2.stubs(:make_request).with('DescribeAddresses', {"PublicIp.1"=>"67.202.55.255"}).
|
80
|
-
returns stub(:body => @describe_addresses_response_body, :is_a? => true)
|
81
|
-
|
82
|
-
@ec2.describe_addresses( :public_ip => "67.202.55.255" ).should.be.an.instance_of Hash
|
83
|
-
|
84
|
-
response = @ec2.describe_addresses( :public_ip => "67.202.55.255" )
|
85
|
-
response.addressesSet.item[0].instanceId.should.equal "i-28a64341"
|
86
|
-
response.addressesSet.item[0].publicIp.should.equal "67.202.55.255"
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
specify "should be able to be released with release_address" do
|
91
|
-
@ec2.stubs(:make_request).with('ReleaseAddress', {"PublicIp" => "67.202.55.255"}).
|
92
|
-
returns stub(:body => @release_address_response_body, :is_a? => true)
|
93
|
-
|
94
|
-
@ec2.release_address( :public_ip => "67.202.55.255" ).should.be.an.instance_of Hash
|
95
|
-
|
96
|
-
response = @ec2.release_address( :public_ip => "67.202.55.255" )
|
97
|
-
response.return.should.equal "true"
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
specify "should be able to be associated with an instance with associate_address" do
|
102
|
-
@ec2.stubs(:make_request).with('AssociateAddress', {"InstanceId" => "i-2ea64347", "PublicIp"=>"67.202.55.255"}).
|
103
|
-
returns stub(:body => @associate_address_response_body, :is_a? => true)
|
104
|
-
|
105
|
-
@ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" ).should.be.an.instance_of Hash
|
106
|
-
|
107
|
-
response = @ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" )
|
108
|
-
response.return.should.equal "true"
|
109
|
-
end
|
110
|
-
|
111
|
-
|
112
|
-
specify "method associate_address should reject bad arguments" do
|
113
|
-
@ec2.stubs(:make_request).with('AssociateAddress', {"InstanceId" => "i-2ea64347", "PublicIp"=>"67.202.55.255"}).
|
114
|
-
returns stub(:body => @associate_address_response_body, :is_a? => true)
|
115
|
-
|
116
|
-
lambda { @ec2.associate_address( :instance_id => "i-2ea64347", :public_ip => "67.202.55.255" ) }.should.not.raise(AWS::ArgumentError)
|
117
|
-
lambda { @ec2.associate_address() }.should.raise(AWS::ArgumentError)
|
118
|
-
lambda { @ec2.associate_address( :instance_id => nil ) }.should.raise(AWS::ArgumentError)
|
119
|
-
lambda { @ec2.associate_address( :public_ip => "" ) }.should.raise(AWS::ArgumentError)
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
specify "should be able to be disassociated with an instance with disassociate_address" do
|
124
|
-
@ec2.stubs(:make_request).with('DisassociateAddress', {'PublicIp' => '67.202.55.255'}).
|
125
|
-
returns stub(:body => @disassociate_address_response_body, :is_a? => true)
|
126
|
-
|
127
|
-
@ec2.disassociate_address( :public_ip => "67.202.55.255" ).should.be.an.instance_of Hash
|
128
|
-
|
129
|
-
response = @ec2.disassociate_address( :public_ip => "67.202.55.255" )
|
130
|
-
response.return.should.equal "true"
|
131
|
-
end
|
132
|
-
|
133
|
-
|
134
|
-
specify "method disassociate_address should reject bad arguments" do
|
135
|
-
@ec2.stubs(:make_request).with('DisassociateAddress', {'PublicIp' => '67.202.55.255'}).
|
136
|
-
returns stub(:body => @disassociate_address_response_body, :is_a? => true)
|
137
|
-
|
138
|
-
lambda { @ec2.disassociate_address( :public_ip => "67.202.55.255" ) }.should.not.raise(AWS::ArgumentError)
|
139
|
-
lambda { @ec2.disassociate_address() }.should.raise(AWS::ArgumentError)
|
140
|
-
lambda { @ec2.disassociate_address( :public_ip => "" ) }.should.raise(AWS::ArgumentError)
|
141
|
-
end
|
142
|
-
|
143
|
-
|
144
|
-
end
|
@@ -1,238 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Amazon Web Services EC2 Query API Ruby library
|
3
|
-
#
|
4
|
-
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
|
-
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
|
-
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
|
-
#++
|
10
|
-
|
11
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
12
|
-
|
13
|
-
context "EC2 image_attributes " do
|
14
|
-
|
15
|
-
before do
|
16
|
-
@ec2 = AWS::EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
|
17
|
-
|
18
|
-
@modify_image_attribute_response_body = <<-RESPONSE
|
19
|
-
<ModifyImageAttributeResponse xm-lns="http://ec2.amazonaws.com/doc/2007-03-01">
|
20
|
-
<return>true</return>
|
21
|
-
</ModifyImageAttributeResponse>
|
22
|
-
RESPONSE
|
23
|
-
|
24
|
-
@reset_image_attribute_response_body = <<-RESPONSE
|
25
|
-
<ResetImageAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
|
26
|
-
<return>true</return>
|
27
|
-
</ResetImageAttributeResponse>
|
28
|
-
RESPONSE
|
29
|
-
|
30
|
-
@describe_image_attribute_response_body_launch_permissions = <<-RESPONSE
|
31
|
-
<DescribeImageAttributeResponse xm-lns="http://ec2.amazonaws.com/doc/2007-03-01">
|
32
|
-
<imageId>ami-61a54008</imageId>
|
33
|
-
<launchPermission>
|
34
|
-
<item>
|
35
|
-
<group>all</group>
|
36
|
-
</item>
|
37
|
-
<item>
|
38
|
-
<userId>495219933132</userId>
|
39
|
-
</item>
|
40
|
-
</launchPermission>
|
41
|
-
</DescribeImageAttributeResponse>
|
42
|
-
RESPONSE
|
43
|
-
|
44
|
-
@describe_image_attribute_response_body_product_codes = <<-RESPONSE
|
45
|
-
<DescribeImageAttributeResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-03">
|
46
|
-
<imageId>ami-61a54008</imageId>
|
47
|
-
<productCodes>
|
48
|
-
<item>
|
49
|
-
<productCode>774F4FF8</productCode>
|
50
|
-
</item>
|
51
|
-
</productCodes>
|
52
|
-
</DescribeImageAttributeResponse>
|
53
|
-
RESPONSE
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
specify "should be able to be changed with modify_image_attribute (with :attribute and single value :user_id and :group)" do
|
59
|
-
@ec2.stubs(:make_request).with('ModifyImageAttribute', {"ImageId"=>"ami-61a54008",
|
60
|
-
"Attribute"=>"launchPermission",
|
61
|
-
"OperationType"=>"add",
|
62
|
-
"UserId.1"=>"123",
|
63
|
-
"Group.1"=>"all"}).
|
64
|
-
returns stub(:body => @modify_image_attribute_response_body, :is_a? => true)
|
65
|
-
@ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id=>["123"], :group=>["all"]).should.be.an.instance_of Hash
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
specify "should be able to be changed with modify_image_attribute ( with :attribute but specifying :group only)" do
|
70
|
-
@ec2.stubs(:make_request).with('ModifyImageAttribute', {"ImageId"=>"ami-61a54008",
|
71
|
-
"Attribute"=>"launchPermission",
|
72
|
-
"OperationType"=>"add",
|
73
|
-
"Group.1"=>"all"}).
|
74
|
-
returns stub(:body => @modify_image_attribute_response_body, :is_a? => true)
|
75
|
-
@ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]).should.be.an.instance_of Hash
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
specify "should be able to be changed with modify_image_attribute ( with :operation_type 'remove')" do
|
80
|
-
@ec2.stubs(:make_request).with('ModifyImageAttribute', {"ImageId"=>"ami-61a54008",
|
81
|
-
"Attribute"=>"launchPermission",
|
82
|
-
"OperationType"=>"remove",
|
83
|
-
"Group.1"=>"all"}).
|
84
|
-
returns stub(:body => @modify_image_attribute_response_body, :is_a? => true)
|
85
|
-
@ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"remove", :group=>["all"]).should.be.an.instance_of Hash
|
86
|
-
end
|
87
|
-
|
88
|
-
|
89
|
-
specify "should be able to be changed with modify_image_attribute ( with :attribute but specifying :user_id only)" do
|
90
|
-
@ec2.stubs(:make_request).with('ModifyImageAttribute', {"ImageId"=>"ami-61a54008",
|
91
|
-
"Attribute"=>"launchPermission",
|
92
|
-
"OperationType"=>"add",
|
93
|
-
"UserId.1"=>"123"}).returns stub(:body => @modify_image_attribute_response_body, :is_a? => true)
|
94
|
-
|
95
|
-
@ec2.modify_image_attribute(:image_id=>"ami-61a54008",
|
96
|
-
:attribute=>"launchPermission",
|
97
|
-
:operation_type=>"add",
|
98
|
-
:user_id=>["123"]).should.be.an.instance_of Hash
|
99
|
-
end
|
100
|
-
|
101
|
-
|
102
|
-
specify "should be able to be changed with modify_image_attribute ( with :attribute=>'productCodes')" do
|
103
|
-
@ec2.stubs(:make_request).with('ModifyImageAttribute', {"ImageId"=>"ami-61a54008",
|
104
|
-
"Attribute"=>"productCodes",
|
105
|
-
"OperationType"=>"",
|
106
|
-
"ProductCode.1"=>"774F4FF8"}).returns stub(:body => @modify_image_attribute_response_body, :is_a? => true)
|
107
|
-
|
108
|
-
@ec2.modify_image_attribute(:image_id=>"ami-61a54008",
|
109
|
-
:attribute=>"productCodes",
|
110
|
-
:product_code=>["774F4FF8"]).should.be.an.instance_of Hash
|
111
|
-
end
|
112
|
-
|
113
|
-
|
114
|
-
specify "should be able to be changed with modify_image_attribute ( with :attribute and multiple :user_id and :group elements)" do
|
115
|
-
@ec2.stubs(:make_request).with('ModifyImageAttribute', {"ImageId"=>"ami-61a54008",
|
116
|
-
"Attribute"=>"launchPermission",
|
117
|
-
"OperationType"=>"add",
|
118
|
-
"UserId.1"=>"123",
|
119
|
-
"UserId.2"=>"345",
|
120
|
-
"Group.1"=>"123",
|
121
|
-
"Group.2"=>"all"}).returns stub(:body => @modify_image_attribute_response_body, :is_a? => true)
|
122
|
-
|
123
|
-
@ec2.modify_image_attribute(:image_id=>"ami-61a54008",
|
124
|
-
:attribute=>"launchPermission",
|
125
|
-
:operation_type=>"add",
|
126
|
-
:user_id=>["123", "345"],
|
127
|
-
:group=>["123", "all"]).should.be.an.instance_of Hash
|
128
|
-
end
|
129
|
-
|
130
|
-
|
131
|
-
specify "should raise an exception when modify_image_attribute is called with incorrect arguments" do
|
132
|
-
# method args can't be nil or empty
|
133
|
-
lambda { @ec2.modify_image_attribute() }.should.raise(AWS::ArgumentError)
|
134
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
|
135
|
-
|
136
|
-
# :image_id option must be not be empty or nil
|
137
|
-
lambda { @ec2.modify_image_attribute(:image_id=>nil, :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
138
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"", :attribute=>"launchPermission", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
139
|
-
|
140
|
-
# :attribute currently has two options which are 'launchPermission' and 'productCodes, it should fail with any other value, nil, or empty
|
141
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil, :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
142
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
143
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo", :operation_type=>"add", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
144
|
-
|
145
|
-
# :attribute => 'launchPermission' option should fail if neither :group nor :user_id are also provided
|
146
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add") }.should.raise(AWS::ArgumentError)
|
147
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => nil) }.should.raise(AWS::ArgumentError)
|
148
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :group => "") }.should.raise(AWS::ArgumentError)
|
149
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => nil) }.should.raise(AWS::ArgumentError)
|
150
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"add", :user_id => "") }.should.raise(AWS::ArgumentError)
|
151
|
-
|
152
|
-
# :attribute => 'productCodes' option should fail if :product_code isn't also provided
|
153
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>nil) }.should.raise(AWS::ArgumentError)
|
154
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes", :product_code=>"") }.should.raise(AWS::ArgumentError)
|
155
|
-
|
156
|
-
# :operation_type currently has two options which are 'add' and 'remove', and it should fail with any other, nil or empty
|
157
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>nil, :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
158
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
159
|
-
lambda { @ec2.modify_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission", :operation_type=>"foo", :group=>["all"]) }.should.raise(AWS::ArgumentError)
|
160
|
-
end
|
161
|
-
|
162
|
-
|
163
|
-
specify "method describe_image_attribute should return the proper attributes when called with launchPermission" do
|
164
|
-
@ec2.stubs(:make_request).with('DescribeImageAttribute', {"ImageId"=>"ami-61a54008",
|
165
|
-
"Attribute"=>"launchPermission" }).
|
166
|
-
returns stub(:body => @describe_image_attribute_response_body_launch_permissions, :is_a? => true)
|
167
|
-
|
168
|
-
@ec2.describe_image_attribute(:image_id => "ami-61a54008", :attribute => "launchPermission").
|
169
|
-
should.be.an.instance_of Hash
|
170
|
-
|
171
|
-
response = @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission")
|
172
|
-
response.imageId.should.equal "ami-61a54008"
|
173
|
-
response.launchPermission.item[0].group.should.equal "all"
|
174
|
-
response.launchPermission.item[1].userId.should.equal "495219933132"
|
175
|
-
end
|
176
|
-
|
177
|
-
|
178
|
-
specify "method describe_image_attribute should return the proper attributes when called with productCodes" do
|
179
|
-
@ec2.stubs(:make_request).with('DescribeImageAttribute', {"ImageId"=>"ami-61a54008",
|
180
|
-
"Attribute"=>"productCodes" }).
|
181
|
-
returns stub(:body => @describe_image_attribute_response_body_product_codes, :is_a? => true)
|
182
|
-
|
183
|
-
@ec2.describe_image_attribute(:image_id => "ami-61a54008", :attribute => "productCodes").
|
184
|
-
should.be.an.instance_of Hash
|
185
|
-
|
186
|
-
response = @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"productCodes")
|
187
|
-
response.imageId.should.equal "ami-61a54008"
|
188
|
-
response.productCodes.item[0].productCode.should.equal "774F4FF8"
|
189
|
-
end
|
190
|
-
|
191
|
-
|
192
|
-
specify "should raise an exception when describe_image_attribute is called with incorrect arguments" do
|
193
|
-
# method args can't be nil or empty
|
194
|
-
lambda { @ec2.describe_image_attribute() }.should.raise(AWS::ArgumentError)
|
195
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
|
196
|
-
|
197
|
-
# :image_id option must be not be empty or nil w/ launchPermission
|
198
|
-
lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
|
199
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
|
200
|
-
|
201
|
-
# :image_id option must be not be empty or nil w/ productCodes
|
202
|
-
lambda { @ec2.describe_image_attribute(:image_id=>nil, :attribute=>"productCodes") }.should.raise(AWS::ArgumentError)
|
203
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"", :attribute=>"productCodes") }.should.raise(AWS::ArgumentError)
|
204
|
-
|
205
|
-
# :attribute currently has two options which are 'launchPermission' and 'productCodes', it should fail with any other values,
|
206
|
-
# nil, or empty
|
207
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWS::ArgumentError)
|
208
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWS::ArgumentError)
|
209
|
-
lambda { @ec2.describe_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWS::ArgumentError)
|
210
|
-
end
|
211
|
-
|
212
|
-
|
213
|
-
specify "should be able to reset attributes with reset_image_attribute " do
|
214
|
-
@ec2.stubs(:make_request).with('ResetImageAttribute', {"ImageId"=>"ami-61a54008",
|
215
|
-
"Attribute"=>"launchPermission"}).
|
216
|
-
returns stub(:body => @reset_image_attribute_response_body, :is_a? => true)
|
217
|
-
@ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission").should.be.an.instance_of Hash
|
218
|
-
@ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"launchPermission").return.should.equal "true"
|
219
|
-
end
|
220
|
-
|
221
|
-
|
222
|
-
specify "should raise an exception when reset_image_attribute is called with incorrect arguments" do
|
223
|
-
# method args can't be nil or empty
|
224
|
-
lambda { @ec2.reset_image_attribute() }.should.raise(AWS::ArgumentError)
|
225
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"") }.should.raise(AWS::ArgumentError)
|
226
|
-
|
227
|
-
# :image_id option must be not be empty or nil
|
228
|
-
lambda { @ec2.reset_image_attribute(:image_id=>nil, :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
|
229
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"", :attribute=>"launchPermission") }.should.raise(AWS::ArgumentError)
|
230
|
-
|
231
|
-
# :attribute currently has one option which is 'launchPermission', it should fail with any other value, nil, or empty
|
232
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>nil) }.should.raise(AWS::ArgumentError)
|
233
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"") }.should.raise(AWS::ArgumentError)
|
234
|
-
lambda { @ec2.reset_image_attribute(:image_id=>"ami-61a54008", :attribute=>"foo") }.should.raise(AWS::ArgumentError)
|
235
|
-
end
|
236
|
-
|
237
|
-
|
238
|
-
end
|