awsum 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +1 -0
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +44 -0
- data/LICENSE +19 -0
- data/README.rdoc +42 -0
- data/Rakefile +75 -0
- data/awsum.gemspec +199 -0
- data/lib/awsum.rb +20 -0
- data/lib/awsum/ec2.rb +741 -0
- data/lib/awsum/ec2/address.rb +67 -0
- data/lib/awsum/ec2/availability_zone.rb +16 -0
- data/lib/awsum/ec2/image.rb +62 -0
- data/lib/awsum/ec2/instance.rb +57 -0
- data/lib/awsum/ec2/keypair.rb +16 -0
- data/lib/awsum/ec2/parsers/address_parser.rb +61 -0
- data/lib/awsum/ec2/parsers/availability_zone_parser.rb +57 -0
- data/lib/awsum/ec2/parsers/image_parser.rb +74 -0
- data/lib/awsum/ec2/parsers/instance_parser.rb +90 -0
- data/lib/awsum/ec2/parsers/keypair_parser.rb +64 -0
- data/lib/awsum/ec2/parsers/purchase_reserved_instances_offering_parser.rb +34 -0
- data/lib/awsum/ec2/parsers/region_parser.rb +56 -0
- data/lib/awsum/ec2/parsers/register_image_parser.rb +34 -0
- data/lib/awsum/ec2/parsers/reserved_instance_parser.rb +64 -0
- data/lib/awsum/ec2/parsers/reserved_instances_offering_parser.rb +63 -0
- data/lib/awsum/ec2/parsers/security_group_parser.rb +106 -0
- data/lib/awsum/ec2/parsers/snapshot_parser.rb +64 -0
- data/lib/awsum/ec2/parsers/volume_parser.rb +77 -0
- data/lib/awsum/ec2/region.rb +54 -0
- data/lib/awsum/ec2/reserved_instance.rb +24 -0
- data/lib/awsum/ec2/reserved_instances_offering.rb +20 -0
- data/lib/awsum/ec2/security_group.rb +74 -0
- data/lib/awsum/ec2/snapshot.rb +23 -0
- data/lib/awsum/ec2/volume.rb +65 -0
- data/lib/awsum/error.rb +53 -0
- data/lib/awsum/net_fix.rb +100 -0
- data/lib/awsum/parser.rb +18 -0
- data/lib/awsum/requestable.rb +216 -0
- data/lib/awsum/s3.rb +220 -0
- data/lib/awsum/s3/bucket.rb +28 -0
- data/lib/awsum/s3/headers.rb +24 -0
- data/lib/awsum/s3/object.rb +138 -0
- data/lib/awsum/s3/parsers/bucket_parser.rb +43 -0
- data/lib/awsum/support.rb +94 -0
- data/spec/fixtures/ec2/addresses.xml +10 -0
- data/spec/fixtures/ec2/allocate_address.xml +5 -0
- data/spec/fixtures/ec2/associate_address.xml +5 -0
- data/spec/fixtures/ec2/attach_volume.xml +9 -0
- data/spec/fixtures/ec2/authorize_ip_access.xml +5 -0
- data/spec/fixtures/ec2/authorize_owner_group_access.xml +5 -0
- data/spec/fixtures/ec2/authorize_owner_group_access_error.xml +2 -0
- data/spec/fixtures/ec2/availability_zones.xml +16 -0
- data/spec/fixtures/ec2/available_volume.xml +14 -0
- data/spec/fixtures/ec2/create_key_pair.xml +29 -0
- data/spec/fixtures/ec2/create_security_group.xml +5 -0
- data/spec/fixtures/ec2/create_snapshot.xml +9 -0
- data/spec/fixtures/ec2/create_volume.xml +10 -0
- data/spec/fixtures/ec2/delete_key_pair.xml +5 -0
- data/spec/fixtures/ec2/delete_security_group.xml +5 -0
- data/spec/fixtures/ec2/delete_snapshot.xml +5 -0
- data/spec/fixtures/ec2/delete_volume.xml +5 -0
- data/spec/fixtures/ec2/deregister_image.xml +5 -0
- data/spec/fixtures/ec2/detach_volume.xml +9 -0
- data/spec/fixtures/ec2/disassociate_address.xml +5 -0
- data/spec/fixtures/ec2/image.xml +15 -0
- data/spec/fixtures/ec2/images.xml +77 -0
- data/spec/fixtures/ec2/instance.xml +36 -0
- data/spec/fixtures/ec2/instances.xml +88 -0
- data/spec/fixtures/ec2/internal_error.xml +2 -0
- data/spec/fixtures/ec2/invalid_amiid_error.xml +2 -0
- data/spec/fixtures/ec2/invalid_request_error.xml +2 -0
- data/spec/fixtures/ec2/key_pairs.xml +10 -0
- data/spec/fixtures/ec2/purchase_reserved_instances_offering.xml +5 -0
- data/spec/fixtures/ec2/purchase_reserved_instances_offerings.xml +6 -0
- data/spec/fixtures/ec2/regions.xml +14 -0
- data/spec/fixtures/ec2/register_image.xml +5 -0
- data/spec/fixtures/ec2/release_address.xml +5 -0
- data/spec/fixtures/ec2/reserved_instances.xml +18 -0
- data/spec/fixtures/ec2/reserved_instances_offering.xml +15 -0
- data/spec/fixtures/ec2/reserved_instances_offerings.xml +276 -0
- data/spec/fixtures/ec2/revoke_ip_access.xml +5 -0
- data/spec/fixtures/ec2/revoke_owner_group_access.xml +5 -0
- data/spec/fixtures/ec2/run_instances.xml +30 -0
- data/spec/fixtures/ec2/security_groups.xml +159 -0
- data/spec/fixtures/ec2/snapshots.xml +13 -0
- data/spec/fixtures/ec2/terminate_instances.xml +17 -0
- data/spec/fixtures/ec2/unassociated_address.xml +10 -0
- data/spec/fixtures/ec2/volumes.xml +23 -0
- data/spec/fixtures/errors/invalid_parameter_value.xml +2 -0
- data/spec/fixtures/s3/buckets.xml +2 -0
- data/spec/fixtures/s3/copy_failure.xml +23 -0
- data/spec/fixtures/s3/invalid_request_signature.xml +5 -0
- data/spec/fixtures/s3/keys.xml +2 -0
- data/spec/lib/awsum/ec2/address_spec.rb +149 -0
- data/spec/lib/awsum/ec2/availability_zones_spec.rb +21 -0
- data/spec/lib/awsum/ec2/image_spec.rb +92 -0
- data/spec/lib/awsum/ec2/instance_spec.rb +125 -0
- data/spec/lib/awsum/ec2/keypair_spec.rb +55 -0
- data/spec/lib/awsum/ec2/parsers/address_parser_spec.rb +51 -0
- data/spec/lib/awsum/ec2/parsers/availability_zone_parser_spec.rb +28 -0
- data/spec/lib/awsum/ec2/parsers/image_parser_spec.rb +66 -0
- data/spec/lib/awsum/ec2/parsers/instance_parser_spec.rb +75 -0
- data/spec/lib/awsum/ec2/parsers/keypair_parser_spec.rb +74 -0
- data/spec/lib/awsum/ec2/parsers/purchase_reserved_instances_offering_parser_spec.rb +14 -0
- data/spec/lib/awsum/ec2/parsers/region_parser_spec.rb +27 -0
- data/spec/lib/awsum/ec2/parsers/register_image_parser_spec.rb +15 -0
- data/spec/lib/awsum/ec2/parsers/reserved_instance_parser_spec.rb +35 -0
- data/spec/lib/awsum/ec2/parsers/reserved_instances_offering_parser_spec.rb +32 -0
- data/spec/lib/awsum/ec2/parsers/security_group_parser_spec.rb +78 -0
- data/spec/lib/awsum/ec2/parsers/snapshot_parser_spec.rb +30 -0
- data/spec/lib/awsum/ec2/parsers/volume_parser_spec.rb +35 -0
- data/spec/lib/awsum/ec2/region_spec.rb +73 -0
- data/spec/lib/awsum/ec2/reserved_instance_spec.rb +61 -0
- data/spec/lib/awsum/ec2/reserved_instances_offering_spec.rb +33 -0
- data/spec/lib/awsum/ec2/security_group_spec.rb +179 -0
- data/spec/lib/awsum/ec2/snapshots_spec.rb +69 -0
- data/spec/lib/awsum/ec2/volume_spec.rb +107 -0
- data/spec/lib/awsum/ec2_spec.rb +6 -0
- data/spec/lib/awsum/error_spec.rb +31 -0
- data/spec/lib/awsum/requestable_spec.rb +126 -0
- data/spec/lib/awsum/s3/bucket_spec.rb +95 -0
- data/spec/lib/awsum/s3/object_spec.rb +128 -0
- data/spec/lib/awsum/s3/parsers/bucket_parser_spec.rb +41 -0
- data/spec/lib/awsum/s3/parsers/object_parser_spec.rb +41 -0
- data/spec/spec_helper.rb +16 -0
- metadata +240 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
|
3
|
+
<requestId>10813f9b-f34c-4d71-84d4-30aceed5c1ab</requestId>
|
4
|
+
<reservationId>r-1463c87d</reservationId>
|
5
|
+
<ownerId>026338013131</ownerId>
|
6
|
+
<groupSet>
|
7
|
+
<item>
|
8
|
+
<groupId>default</groupId>
|
9
|
+
</item>
|
10
|
+
</groupSet>
|
11
|
+
<instancesSet>
|
12
|
+
<item>
|
13
|
+
<instanceId>i-f92fa890</instanceId>
|
14
|
+
<imageId>ami-dfa743b6</imageId>
|
15
|
+
<instanceState>
|
16
|
+
<code>0</code>
|
17
|
+
<name>pending</name>
|
18
|
+
</instanceState>
|
19
|
+
<privateDnsName/>
|
20
|
+
<dnsName/>
|
21
|
+
<reason/>
|
22
|
+
<amiLaunchIndex>0</amiLaunchIndex>
|
23
|
+
<instanceType>m1.small</instanceType>
|
24
|
+
<launchTime>2009-01-11T13:09:01.000Z</launchTime>
|
25
|
+
<placement>
|
26
|
+
<availabilityZone>us-east-1b</availabilityZone>
|
27
|
+
</placement>
|
28
|
+
</item>
|
29
|
+
</instancesSet>
|
30
|
+
</RunInstancesResponse>
|
@@ -0,0 +1,159 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
|
3
|
+
<requestId>b452331e-76d8-4f08-933e-be058e91e2c7</requestId>
|
4
|
+
<securityGroupInfo>
|
5
|
+
<item>
|
6
|
+
<ownerId>111111111111</ownerId>
|
7
|
+
<groupName>default</groupName>
|
8
|
+
<groupDescription>default group</groupDescription>
|
9
|
+
<ipPermissions>
|
10
|
+
<item>
|
11
|
+
<ipProtocol>tcp</ipProtocol>
|
12
|
+
<fromPort>0</fromPort>
|
13
|
+
<toPort>65535</toPort>
|
14
|
+
<groups>
|
15
|
+
<item>
|
16
|
+
<userId>111111111111</userId>
|
17
|
+
<groupName>default</groupName>
|
18
|
+
</item>
|
19
|
+
</groups>
|
20
|
+
<ipRanges/>
|
21
|
+
</item>
|
22
|
+
<item>
|
23
|
+
<ipProtocol>udp</ipProtocol>
|
24
|
+
<fromPort>0</fromPort>
|
25
|
+
<toPort>65535</toPort>
|
26
|
+
<groups>
|
27
|
+
<item>
|
28
|
+
<userId>111111111111</userId>
|
29
|
+
<groupName>default</groupName>
|
30
|
+
</item>
|
31
|
+
</groups>
|
32
|
+
<ipRanges/>
|
33
|
+
</item>
|
34
|
+
<item>
|
35
|
+
<ipProtocol>icmp</ipProtocol>
|
36
|
+
<fromPort>-1</fromPort>
|
37
|
+
<toPort>-1</toPort>
|
38
|
+
<groups>
|
39
|
+
<item>
|
40
|
+
<userId>111111111111</userId>
|
41
|
+
<groupName>default</groupName>
|
42
|
+
</item>
|
43
|
+
</groups>
|
44
|
+
<ipRanges/>
|
45
|
+
</item>
|
46
|
+
<item>
|
47
|
+
<ipProtocol>tcp</ipProtocol>
|
48
|
+
<fromPort>22</fromPort>
|
49
|
+
<toPort>22</toPort>
|
50
|
+
<groups/>
|
51
|
+
<ipRanges>
|
52
|
+
<item>
|
53
|
+
<cidrIp>0.0.0.0/0</cidrIp>
|
54
|
+
</item>
|
55
|
+
</ipRanges>
|
56
|
+
</item>
|
57
|
+
<item>
|
58
|
+
<ipProtocol>tcp</ipProtocol>
|
59
|
+
<fromPort>80</fromPort>
|
60
|
+
<toPort>80</toPort>
|
61
|
+
<groups/>
|
62
|
+
<ipRanges>
|
63
|
+
<item>
|
64
|
+
<cidrIp>0.0.0.0/0</cidrIp>
|
65
|
+
</item>
|
66
|
+
</ipRanges>
|
67
|
+
</item>
|
68
|
+
<item>
|
69
|
+
<ipProtocol>tcp</ipProtocol>
|
70
|
+
<fromPort>443</fromPort>
|
71
|
+
<toPort>443</toPort>
|
72
|
+
<groups/>
|
73
|
+
<ipRanges>
|
74
|
+
<item>
|
75
|
+
<cidrIp>0.0.0.0/0</cidrIp>
|
76
|
+
</item>
|
77
|
+
</ipRanges>
|
78
|
+
</item>
|
79
|
+
<item>
|
80
|
+
<ipProtocol>tcp</ipProtocol>
|
81
|
+
<fromPort>9111</fromPort>
|
82
|
+
<toPort>9111</toPort>
|
83
|
+
<groups/>
|
84
|
+
<ipRanges>
|
85
|
+
<item>
|
86
|
+
<cidrIp>0.0.0.0/0</cidrIp>
|
87
|
+
</item>
|
88
|
+
</ipRanges>
|
89
|
+
</item>
|
90
|
+
</ipPermissions>
|
91
|
+
</item>
|
92
|
+
<item>
|
93
|
+
<ownerId>111111111111</ownerId>
|
94
|
+
<groupName>webservers</groupName>
|
95
|
+
<groupDescription>web</groupDescription>
|
96
|
+
<ipPermissions>
|
97
|
+
<item>
|
98
|
+
<ipProtocol>tcp</ipProtocol>
|
99
|
+
<fromPort>1</fromPort>
|
100
|
+
<toPort>65535</toPort>
|
101
|
+
<groups>
|
102
|
+
<item>
|
103
|
+
<userId>111111111111</userId>
|
104
|
+
<groupName>default</groupName>
|
105
|
+
</item>
|
106
|
+
<item>
|
107
|
+
<userId>111111111111</userId>
|
108
|
+
<groupName>webservers</groupName>
|
109
|
+
</item>
|
110
|
+
</groups>
|
111
|
+
<ipRanges/>
|
112
|
+
</item>
|
113
|
+
<item>
|
114
|
+
<ipProtocol>udp</ipProtocol>
|
115
|
+
<fromPort>1</fromPort>
|
116
|
+
<toPort>65535</toPort>
|
117
|
+
<groups>
|
118
|
+
<item>
|
119
|
+
<userId>111111111111</userId>
|
120
|
+
<groupName>default</groupName>
|
121
|
+
</item>
|
122
|
+
<item>
|
123
|
+
<userId>111111111111</userId>
|
124
|
+
<groupName>webservers</groupName>
|
125
|
+
</item>
|
126
|
+
</groups>
|
127
|
+
<ipRanges/>
|
128
|
+
</item>
|
129
|
+
<item>
|
130
|
+
<ipProtocol>icmp</ipProtocol>
|
131
|
+
<fromPort>-1</fromPort>
|
132
|
+
<toPort>-1</toPort>
|
133
|
+
<groups>
|
134
|
+
<item>
|
135
|
+
<userId>111111111111</userId>
|
136
|
+
<groupName>default</groupName>
|
137
|
+
</item>
|
138
|
+
<item>
|
139
|
+
<userId>111111111111</userId>
|
140
|
+
<groupName>webservers</groupName>
|
141
|
+
</item>
|
142
|
+
</groups>
|
143
|
+
<ipRanges/>
|
144
|
+
</item>
|
145
|
+
<item>
|
146
|
+
<ipProtocol>tcp</ipProtocol>
|
147
|
+
<fromPort>80</fromPort>
|
148
|
+
<toPort>80</toPort>
|
149
|
+
<groups/>
|
150
|
+
<ipRanges>
|
151
|
+
<item>
|
152
|
+
<cidrIp>0.0.0.0/0</cidrIp>
|
153
|
+
</item>
|
154
|
+
</ipRanges>
|
155
|
+
</item>
|
156
|
+
</ipPermissions>
|
157
|
+
</item>
|
158
|
+
</securityGroupInfo>
|
159
|
+
</DescribeSecurityGroupsResponse>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
|
3
|
+
<requestId>d27d0c19-a117-49ff-958c-90722636145d</requestId>
|
4
|
+
<snapshotSet>
|
5
|
+
<item>
|
6
|
+
<snapshotId>snap-747c911d</snapshotId>
|
7
|
+
<volumeId>vol-44d6322d</volumeId>
|
8
|
+
<status>completed</status>
|
9
|
+
<startTime>2009-01-15T03:59:26.000Z</startTime>
|
10
|
+
<progress>100%</progress>
|
11
|
+
</item>
|
12
|
+
</snapshotSet>
|
13
|
+
</DescribeSnapshotsResponse>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
|
3
|
+
<requestId>f9fc94b2-2005-4304-8624-04baee17a574</requestId>
|
4
|
+
<instancesSet>
|
5
|
+
<item>
|
6
|
+
<instanceId>i-f92fa890</instanceId>
|
7
|
+
<shutdownState>
|
8
|
+
<code>32</code>
|
9
|
+
<name>shutting-down</name>
|
10
|
+
</shutdownState>
|
11
|
+
<previousState>
|
12
|
+
<code>16</code>
|
13
|
+
<name>running</name>
|
14
|
+
</previousState>
|
15
|
+
</item>
|
16
|
+
</instancesSet>
|
17
|
+
</TerminateInstancesResponse>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<DescribeAddressesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
|
3
|
+
<requestId>0a578151-76d1-4461-b1ce-ae36d39ec349</requestId>
|
4
|
+
<addressesSet>
|
5
|
+
<item>
|
6
|
+
<publicIp>127.0.0.1</publicIp>
|
7
|
+
<instanceId/>
|
8
|
+
</item>
|
9
|
+
</addressesSet>
|
10
|
+
</DescribeAddressesResponse>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<DescribeVolumesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
|
3
|
+
<requestId>f4786b8a-90e8-4570-a786-1076fba0eeae</requestId>
|
4
|
+
<volumeSet>
|
5
|
+
<item>
|
6
|
+
<volumeId>vol-44d6322d</volumeId>
|
7
|
+
<size>10</size>
|
8
|
+
<snapshotId/>
|
9
|
+
<availabilityZone>us-east-1b</availabilityZone>
|
10
|
+
<status>in-use</status>
|
11
|
+
<createTime>2009-01-14T03:57:08.000Z</createTime>
|
12
|
+
<attachmentSet>
|
13
|
+
<item>
|
14
|
+
<volumeId>vol-44d6322d</volumeId>
|
15
|
+
<instanceId>i-3f1cc856</instanceId>
|
16
|
+
<device>/dev/sdb</device>
|
17
|
+
<status>attached</status>
|
18
|
+
<attachTime>2009-01-14T04:34:35.000Z</attachTime>
|
19
|
+
</item>
|
20
|
+
</attachmentSet>
|
21
|
+
</item>
|
22
|
+
</volumeSet>
|
23
|
+
</DescribeVolumesResponse>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>1111111111111111111111111111111111111111111111111111111111111111</ID><DisplayName>AAAAAA</DisplayName></Owner><Buckets><Bucket><Name>test-bucket</Name><CreationDate>2008-12-04T16:08:03.000Z</CreationDate></Bucket><Bucket><Name>another-test-bucket</Name><CreationDate>2009-01-02T08:25:27.000Z</CreationDate></Bucket></Buckets></ListAllMyBucketsResult>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><StringToSignBytes>50 55 54 0a 59 57 59 34 4d 47 4a 6c 4d 6d 55 32 5a 44 59 35 4e 32 59 79 4f 57 45 35 5a 44 67 31 59 6a 67 33 59 54 51 35 4f 54 6b 79 4d 44 55 3d 0a 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 0a 54 75 65 2c 20 32 37 20 4a 61 6e 20 32 30 30 39 20 30 35 3a 31 38 3a 30 36 20 2b 30 32 30 30 0a 2f 61 77 73 75 6d 2d 74 65 73 74 2d 62 75 63 6b 65 74 2f 74 65 73 74 31 2e 74 78 74</StringToSignBytes><RequestId>508F513C9D42C30E</RequestId><HostId>98di22wxhjhz0gCgNTHjJsH+Ywogv244W+sua24060WKPIjt2GGEhc0iYIsmMvVi</HostId><SignatureProvided>ryk9uqNKaI1wRaH7XLikD+pnwpM=</SignatureProvided><StringToSign>PUT
|
2
|
+
YWY4MGJlMmU2ZDY5N2YyOWE5ZDg1Yjg3YTQ5OTkyMDU=
|
3
|
+
application/x-www-form-urlencoded
|
4
|
+
Tue, 27 Jan 2009 05:18:06 +0200
|
5
|
+
/awsum-test-bucket/test1.txt</StringToSign><AWSAccessKeyId>1NJXGWMY8MX5G7SE7XG2</AWSAccessKeyId></Error>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Name>test</Name><Prefix></Prefix><Marker></Marker><MaxKeys>1000</MaxKeys><IsTruncated>false</IsTruncated><Contents><Key>test/photo1.jpg</Key><LastModified>2008-12-07T13:47:59.000Z</LastModified><ETag>"03bde534951a1c099724f569a53acb1e"</ETag><Size>203841</Size><Owner><ID>1111111111111111111111111111111111111111111111111111111111111111</ID><DisplayName>AAAAAA</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents><Contents><Key>test/photo2.jpg</Key><LastModified>2008-12-07T13:48:13.000Z</LastModified><ETag>"14c3a2e9a40b0c33451627b8ffec6081"</ETag><Size>21102</Size><Owner><ID>1111111111111111111111111111111111111111111111111111111111111111</ID><DisplayName>AAAAAA</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents></ListBucketResult>
|
@@ -0,0 +1,149 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Awsum
|
4
|
+
describe Ec2 do
|
5
|
+
|
6
|
+
subject { Ec2.new('abc', 'xyz') }
|
7
|
+
let(:ec2) { subject }
|
8
|
+
|
9
|
+
describe "retrieving a list of addresses" do
|
10
|
+
before do
|
11
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=DescribeAddresses|, :body => fixture('ec2/addresses'), :status => 200)
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:result) { ec2.addresses }
|
15
|
+
|
16
|
+
it "should return an array of addresses" do
|
17
|
+
result.first.should be_a(Awsum::Ec2::Address)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "allocating an address" do
|
22
|
+
before do
|
23
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=AllocateAddress|, :body => fixture('ec2/allocate_address'), :status => 200)
|
24
|
+
end
|
25
|
+
|
26
|
+
let(:result) { ec2.allocate_address }
|
27
|
+
|
28
|
+
it "should return an address" do
|
29
|
+
result.should be_a(Awsum::Ec2::Address)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "associating an address" do
|
34
|
+
before do
|
35
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=AssociateAddress.*InstanceId=i-ABCDEF.*PublicIp=127.0.0.1|, :body => fixture('ec2/associate_address'), :status => 200)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should return true" do
|
39
|
+
ec2.associate_address('i-ABCDEF', '127.0.0.1').should be_true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "disassociating an address" do
|
44
|
+
before do
|
45
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=DisassociateAddress.*PublicIp=127.0.0.1|, :body => fixture('ec2/disassociate_address'), :status => 200)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return true" do
|
49
|
+
ec2.disassociate_address('127.0.0.1').should be_true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "releasing an address" do
|
54
|
+
before do
|
55
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=DescribeAddresses.*PublicIp.1=127.0.0.1|, :body => fixture('ec2/unassociated_address'), :status => 200)
|
56
|
+
|
57
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=ReleaseAddress.*PublicIp=127.0.0.1|, :body => fixture('ec2/release_address'), :status => 200)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should return true" do
|
61
|
+
ec2.release_address('127.0.0.1').should be_true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "trying to release an address that is associated" do
|
66
|
+
before do
|
67
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=DescribeAddresses.*PublicIp.1=127.0.0.1|, :body => fixture('ec2/addresses'), :status => 200)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should return true" do
|
71
|
+
expect { ec2.release_address('127.0.0.1') }.to raise_error
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "forcing the release of an address" do
|
76
|
+
before do
|
77
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=ReleaseAddress.*PublicIp=127.0.0.1|, :body => fixture('ec2/release_address'), :status => 200)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should return true" do
|
81
|
+
ec2.release_address!('127.0.0.1').should be_true
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "an associated address" do
|
86
|
+
before do
|
87
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=DescribeAddresses.*PublicIp.1=127.0.0.1|, :body => fixture('ec2/addresses'), :status => 200)
|
88
|
+
end
|
89
|
+
|
90
|
+
let(:address) { ec2.address('127.0.0.1') }
|
91
|
+
|
92
|
+
it "should return the instance it's associated with" do
|
93
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=DescribeInstances.*InstanceId.1=i-3f1cc856|, :body => fixture('ec2/instances'), :status => 200)
|
94
|
+
|
95
|
+
address.instance.should be_a(Awsum::Ec2::Instance)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should not be able to associate itself with an instance" do
|
99
|
+
expect { address.associate('i-123456') }.to raise_error
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should be able to force an association with an instance" do
|
103
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=AssociateAddress.*InstanceId=i-123456.*PublicIp=127.0.0.1|, :body => fixture('ec2/unassociated_address'), :status => 200)
|
104
|
+
|
105
|
+
address.associate!('i-123456').should be_true
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should be able to disassociate itself from instance" do
|
109
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=DisassociateAddress.*PublicIp=127.0.0.1|, :body => fixture('ec2/unassociated_address'), :status => 200)
|
110
|
+
|
111
|
+
address.disassociate.should be_true
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should raise an error if trying to release itself" do
|
115
|
+
expect { address.release }.to raise_error
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should be able to release itself by force" do
|
119
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=ReleaseAddress.*PublicIp=127.0.0.1|, :body => fixture('ec2/unassociated_address'), :status => 200)
|
120
|
+
|
121
|
+
address.release!.should be_true
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "an unassociated address" do
|
126
|
+
before do
|
127
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=DescribeAddresses.*PublicIp.1=127.0.0.1|, :body => fixture('ec2/unassociated_address'), :status => 200)
|
128
|
+
end
|
129
|
+
|
130
|
+
let(:address) { ec2.address('127.0.0.1') }
|
131
|
+
|
132
|
+
it "should be able to associate itself with an instance" do
|
133
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=AssociateAddress.*InstanceId=i-123456.*PublicIp=127.0.0.1|, :body => fixture('ec2/unassociated_address'), :status => 200)
|
134
|
+
|
135
|
+
address.associate('i-123456').should be_true
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should raise an error if trying to disassociate itself from an instance" do
|
139
|
+
expect { address.disassociate }.to raise_error
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should be able to release itself" do
|
143
|
+
FakeWeb.register_uri(:get, %r|https://ec2\.amazonaws\.com/?.*Action=ReleaseAddress.*PublicIp=127.0.0.1|, :body => fixture('ec2/unassociated_address'), :status => 200)
|
144
|
+
|
145
|
+
address.release.should be_true
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|