fog 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/fog +18 -11
- data/fog.gemspec +43 -14
- data/lib/fog.rb +7 -1
- data/lib/fog/aws/ec2.rb +0 -7
- data/lib/fog/aws/models/ec2/address.rb +22 -26
- data/lib/fog/aws/models/ec2/addresses.rb +7 -22
- data/lib/fog/aws/models/ec2/instance.rb +2 -15
- data/lib/fog/aws/models/ec2/instances.rb +6 -23
- data/lib/fog/aws/models/ec2/key_pair.rb +2 -17
- data/lib/fog/aws/models/ec2/key_pairs.rb +6 -23
- data/lib/fog/aws/models/ec2/security_group.rb +18 -22
- data/lib/fog/aws/models/ec2/security_groups.rb +6 -23
- data/lib/fog/aws/models/ec2/snapshot.rb +2 -15
- data/lib/fog/aws/models/ec2/snapshots.rb +7 -20
- data/lib/fog/aws/models/ec2/volume.rb +23 -22
- data/lib/fog/aws/models/ec2/volumes.rb +8 -22
- data/lib/fog/aws/models/s3/bucket.rb +1 -1
- data/lib/fog/aws/models/s3/buckets.rb +3 -20
- data/lib/fog/aws/models/s3/objects.rb +11 -22
- data/lib/fog/aws/requests/ec2/allocate_address.rb +1 -1
- data/lib/fog/aws/requests/ec2/associate_address.rb +2 -2
- data/lib/fog/aws/requests/ec2/attach_volume.rb +2 -2
- data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/ec2/create_key_pair.rb +2 -2
- data/lib/fog/aws/requests/ec2/create_security_group.rb +2 -2
- data/lib/fog/aws/requests/ec2/create_snapshot.rb +2 -2
- data/lib/fog/aws/requests/ec2/create_volume.rb +3 -3
- data/lib/fog/aws/requests/ec2/delete_key_pair.rb +1 -1
- data/lib/fog/aws/requests/ec2/delete_security_group.rb +2 -2
- data/lib/fog/aws/requests/ec2/delete_snapshot.rb +2 -2
- data/lib/fog/aws/requests/ec2/delete_volume.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_addresses.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_images.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_instances.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_regions.rb +1 -1
- data/lib/fog/aws/requests/ec2/describe_security_groups.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_snapshots.rb +2 -2
- data/lib/fog/aws/requests/ec2/describe_volumes.rb +2 -2
- data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -2
- data/lib/fog/aws/requests/ec2/disassociate_address.rb +2 -2
- data/lib/fog/aws/requests/ec2/get_console_output.rb +2 -2
- data/lib/fog/aws/requests/ec2/reboot_instances.rb +2 -2
- data/lib/fog/aws/requests/ec2/release_address.rb +2 -2
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/ec2/run_instances.rb +2 -2
- data/lib/fog/aws/requests/ec2/terminate_instances.rb +2 -2
- data/lib/fog/aws/requests/s3/copy_object.rb +2 -2
- data/lib/fog/aws/requests/s3/delete_bucket.rb +3 -3
- data/lib/fog/aws/requests/s3/delete_object.rb +2 -2
- data/lib/fog/aws/requests/s3/get_bucket.rb +2 -2
- data/lib/fog/aws/requests/s3/get_bucket_location.rb +2 -2
- data/lib/fog/aws/requests/s3/get_object.rb +2 -2
- data/lib/fog/aws/requests/s3/get_request_payment.rb +2 -2
- data/lib/fog/aws/requests/s3/get_service.rb +1 -1
- data/lib/fog/aws/requests/s3/head_object.rb +1 -1
- data/lib/fog/aws/requests/s3/put_bucket.rb +1 -1
- data/lib/fog/aws/requests/s3/put_object.rb +2 -2
- data/lib/fog/aws/requests/s3/put_request_payment.rb +1 -1
- data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -1
- data/lib/fog/aws/requests/simpledb/delete_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -1
- data/lib/fog/aws/requests/simpledb/domain_metadata.rb +2 -2
- data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
- data/lib/fog/aws/requests/simpledb/list_domains.rb +1 -1
- data/lib/fog/aws/requests/simpledb/put_attributes.rb +1 -1
- data/lib/fog/aws/requests/simpledb/select.rb +1 -1
- data/lib/fog/aws/s3.rb +0 -7
- data/lib/fog/aws/simpledb.rb +0 -4
- data/lib/fog/collection.rb +35 -7
- data/lib/fog/connection.rb +10 -130
- data/lib/fog/model.rb +18 -13
- data/lib/fog/parser.rb +0 -5
- data/lib/fog/rackspace.rb +35 -15
- data/lib/fog/rackspace/files.rb +36 -6
- data/lib/fog/rackspace/models/servers/server.rb +2 -16
- data/lib/fog/rackspace/models/servers/servers.rb +6 -21
- data/lib/fog/rackspace/requests/files/delete_container.rb +38 -0
- data/lib/fog/rackspace/requests/files/delete_object.rb +39 -0
- data/lib/fog/rackspace/requests/files/get_container.rb +61 -0
- data/lib/fog/rackspace/requests/files/get_containers.rb +5 -7
- data/lib/fog/rackspace/requests/files/head_container.rb +44 -0
- data/lib/fog/rackspace/requests/files/head_containers.rb +1 -1
- data/lib/fog/rackspace/requests/files/put_container.rb +38 -0
- data/lib/fog/rackspace/requests/files/put_object.rb +41 -0
- data/lib/fog/rackspace/requests/servers/create_image.rb +6 -0
- data/lib/fog/rackspace/requests/servers/create_server.rb +21 -2
- data/lib/fog/rackspace/requests/servers/delete_server.rb +18 -3
- data/lib/fog/rackspace/requests/servers/get_server_details.rb +17 -5
- data/lib/fog/rackspace/requests/servers/list_addresses.rb +52 -0
- data/lib/fog/rackspace/requests/servers/list_flavors.rb +2 -4
- data/lib/fog/rackspace/requests/servers/list_flavors_detail.rb +41 -0
- data/lib/fog/rackspace/requests/servers/list_images.rb +1 -1
- data/lib/fog/rackspace/requests/servers/list_images_detail.rb +1 -1
- data/lib/fog/rackspace/requests/servers/list_private_addresses.rb +50 -0
- data/lib/fog/rackspace/requests/servers/list_public_addresses.rb +50 -0
- data/lib/fog/rackspace/requests/servers/list_servers.rb +11 -2
- data/lib/fog/rackspace/requests/servers/list_servers_detail.rb +17 -2
- data/lib/fog/rackspace/requests/servers/reboot_server.rb +3 -6
- data/lib/fog/rackspace/requests/servers/update_server.rb +18 -5
- data/lib/fog/rackspace/servers.rb +20 -0
- data/spec/aws/models/ec2/address_spec.rb +4 -4
- data/spec/aws/models/ec2/instance_spec.rb +6 -6
- data/spec/aws/models/ec2/key_pair_spec.rb +5 -5
- data/spec/aws/models/ec2/security_group_spec.rb +5 -5
- data/spec/aws/models/ec2/snapshot_spec.rb +8 -8
- data/spec/aws/models/ec2/snapshots_spec.rb +6 -6
- data/spec/aws/models/ec2/volume_spec.rb +6 -5
- data/spec/aws/models/ec2/volumes_spec.rb +4 -4
- data/spec/aws/requests/ec2/associate_address_spec.rb +2 -2
- data/spec/aws/requests/ec2/attach_volume_spec.rb +2 -2
- data/spec/aws/requests/ec2/create_key_pair_spec.rb +1 -1
- data/spec/aws/requests/ec2/create_security_group_spec.rb +1 -1
- data/spec/aws/requests/ec2/create_snapshot_spec.rb +1 -1
- data/spec/aws/requests/ec2/delete_security_group_spec.rb +1 -1
- data/spec/aws/requests/ec2/delete_snapshot_spec.rb +1 -1
- data/spec/aws/requests/ec2/delete_volume_spec.rb +2 -2
- data/spec/aws/requests/ec2/describe_addresses_spec.rb +1 -1
- data/spec/aws/requests/ec2/describe_instances_spec.rb +1 -1
- data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +1 -1
- data/spec/aws/requests/ec2/describe_security_groups_spec.rb +1 -1
- data/spec/aws/requests/ec2/describe_snapshots_spec.rb +1 -1
- data/spec/aws/requests/ec2/describe_volumes_spec.rb +1 -1
- data/spec/aws/requests/ec2/detach_volume_spec.rb +1 -1
- data/spec/aws/requests/ec2/disassociate_address_spec.rb +1 -1
- data/spec/aws/requests/ec2/get_console_output_spec.rb +1 -1
- data/spec/aws/requests/ec2/reboot_instances_spec.rb +1 -1
- data/spec/aws/requests/ec2/release_address_spec.rb +1 -1
- data/spec/aws/requests/ec2/terminate_instances_spec.rb +1 -1
- data/spec/aws/requests/s3/copy_object_spec.rb +4 -5
- data/spec/aws/requests/s3/delete_bucket_spec.rb +3 -4
- data/spec/aws/requests/s3/delete_object_spec.rb +2 -3
- data/spec/aws/requests/s3/get_bucket_location_spec.rb +1 -1
- data/spec/aws/requests/s3/get_bucket_spec.rb +4 -6
- data/spec/aws/requests/s3/get_object_spec.rb +6 -10
- data/spec/aws/requests/s3/get_request_payment_spec.rb +1 -1
- data/spec/aws/requests/s3/head_object_spec.rb +2 -4
- data/spec/aws/requests/s3/put_object_spec.rb +4 -7
- data/spec/aws/requests/s3/put_request_payment_spec.rb +1 -1
- data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +1 -1
- data/spec/aws/requests/simpledb/delete_attributes_spec.rb +1 -1
- data/spec/aws/requests/simpledb/domain_metadata_spec.rb +1 -1
- data/spec/aws/requests/simpledb/get_attributes_spec.rb +1 -1
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +1 -1
- data/spec/rackspace/requests/files/delete_container_spec.rb +24 -0
- data/spec/rackspace/requests/files/delete_object_spec.rb +37 -0
- data/spec/rackspace/requests/files/get_container_spec.rb +33 -0
- data/spec/rackspace/requests/files/get_containers_spec.rb +12 -1
- data/spec/rackspace/requests/files/head_container_spec.rb +30 -0
- data/spec/rackspace/requests/files/head_containers_spec.rb +9 -1
- data/spec/rackspace/requests/files/put_container_spec.rb +15 -0
- data/spec/rackspace/requests/files/put_object_spec.rb +20 -0
- data/spec/rackspace/requests/servers/create_image_spec.rb +16 -2
- data/spec/rackspace/requests/servers/create_server_spec.rb +1 -1
- data/spec/rackspace/requests/servers/delete_image_spec.rb +32 -0
- data/spec/rackspace/requests/servers/delete_server_spec.rb +1 -1
- data/spec/rackspace/requests/servers/get_server_details_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_addresses_spec.rb +34 -0
- data/spec/rackspace/requests/servers/list_flavors_detail_spec.rb +17 -0
- data/spec/rackspace/requests/servers/list_flavors_spec.rb +6 -3
- data/spec/rackspace/requests/servers/list_images_detail_spec.rb +18 -0
- data/spec/rackspace/requests/servers/list_images_spec.rb +5 -2
- data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +32 -0
- data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +32 -0
- data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +1 -1
- data/spec/rackspace/requests/servers/reboot_server_spec.rb +31 -0
- data/spec/rackspace/requests/servers/update_server_spec.rb +33 -0
- data/spec/spec_helper.rb +5 -1
- metadata +50 -14
- data/benchs/headers_split_vs_match.rb +0 -18
- data/benchs/stripping.rb +0 -26
- data/lib/fog/errors.rb +0 -145
- data/lib/fog/response.rb +0 -12
- data/spec/rackspace/requests/servers/delete_image.rb +0 -12
- data/spec/rackspace/requests/servers/list_images_detail.rb +0 -12
- data/spec/rackspace/requests/servers/reboot_server.rb +0 -12
- data/spec/rackspace/requests/servers/update_server.rb +0 -12
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.30
|
data/bin/fog
CHANGED
@@ -5,11 +5,7 @@ require 'yaml'
|
|
5
5
|
|
6
6
|
def credentials
|
7
7
|
@credentials ||= begin
|
8
|
-
|
9
|
-
YAML.load(File.open(File.expand_path(ARGV[0])).read)
|
10
|
-
elsif File.exists?(File.expand_path('~/.fog'))
|
11
|
-
YAML.load(File.open(File.expand_path('~/.fog')).read)
|
12
|
-
end
|
8
|
+
YAML.load(File.open(File.expand_path('~/.fog')).read)
|
13
9
|
end
|
14
10
|
end
|
15
11
|
|
@@ -76,9 +72,20 @@ module Rackspace
|
|
76
72
|
end
|
77
73
|
end
|
78
74
|
|
79
|
-
ARGV
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
75
|
+
if ARGV[0]
|
76
|
+
result = eval(ARGV[0])
|
77
|
+
result = case result
|
78
|
+
when Fog::Collection
|
79
|
+
result.map {|model| model.attributes.reject {|key, value| key == :owner}}
|
80
|
+
when Fog::Model
|
81
|
+
result.attributes
|
82
|
+
end
|
83
|
+
print(Marshal.dump(result))
|
84
|
+
else
|
85
|
+
ARGV.clear # Avoid passing args to IRB
|
86
|
+
IRB.setup(nil)
|
87
|
+
@irb = IRB::Irb.new(nil)
|
88
|
+
IRB.conf[:MAIN_CONTEXT] = @irb.context
|
89
|
+
@irb.context.workspace = IRB::WorkSpace.new(binding)
|
90
|
+
catch(:IRB_EXIT) { @irb.eval_input }
|
91
|
+
end
|
data/fog.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fog}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.30"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["geemus (Wesley Beary)"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-11-14}
|
13
13
|
s.default_executable = %q{fog}
|
14
14
|
s.description = %q{brings clouds to you}
|
15
15
|
s.email = %q{me@geemus.com}
|
@@ -24,10 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
26
|
"benchs/fog_vs.rb",
|
27
|
-
"benchs/headers_split_vs_match.rb",
|
28
27
|
"benchs/params.rb",
|
29
28
|
"benchs/parse_vs_push.rb",
|
30
|
-
"benchs/stripping.rb",
|
31
29
|
"bin/fog",
|
32
30
|
"fog.gemspec",
|
33
31
|
"lib/fog.rb",
|
@@ -133,29 +131,37 @@ Gem::Specification.new do |s|
|
|
133
131
|
"lib/fog/aws/simpledb.rb",
|
134
132
|
"lib/fog/collection.rb",
|
135
133
|
"lib/fog/connection.rb",
|
136
|
-
"lib/fog/errors.rb",
|
137
134
|
"lib/fog/model.rb",
|
138
135
|
"lib/fog/parser.rb",
|
139
136
|
"lib/fog/rackspace.rb",
|
140
137
|
"lib/fog/rackspace/files.rb",
|
141
138
|
"lib/fog/rackspace/models/servers/server.rb",
|
142
139
|
"lib/fog/rackspace/models/servers/servers.rb",
|
140
|
+
"lib/fog/rackspace/requests/files/delete_container.rb",
|
141
|
+
"lib/fog/rackspace/requests/files/delete_object.rb",
|
142
|
+
"lib/fog/rackspace/requests/files/get_container.rb",
|
143
143
|
"lib/fog/rackspace/requests/files/get_containers.rb",
|
144
|
+
"lib/fog/rackspace/requests/files/head_container.rb",
|
144
145
|
"lib/fog/rackspace/requests/files/head_containers.rb",
|
146
|
+
"lib/fog/rackspace/requests/files/put_container.rb",
|
147
|
+
"lib/fog/rackspace/requests/files/put_object.rb",
|
145
148
|
"lib/fog/rackspace/requests/servers/create_image.rb",
|
146
149
|
"lib/fog/rackspace/requests/servers/create_server.rb",
|
147
150
|
"lib/fog/rackspace/requests/servers/delete_image.rb",
|
148
151
|
"lib/fog/rackspace/requests/servers/delete_server.rb",
|
149
152
|
"lib/fog/rackspace/requests/servers/get_server_details.rb",
|
153
|
+
"lib/fog/rackspace/requests/servers/list_addresses.rb",
|
150
154
|
"lib/fog/rackspace/requests/servers/list_flavors.rb",
|
155
|
+
"lib/fog/rackspace/requests/servers/list_flavors_detail.rb",
|
151
156
|
"lib/fog/rackspace/requests/servers/list_images.rb",
|
152
157
|
"lib/fog/rackspace/requests/servers/list_images_detail.rb",
|
158
|
+
"lib/fog/rackspace/requests/servers/list_private_addresses.rb",
|
159
|
+
"lib/fog/rackspace/requests/servers/list_public_addresses.rb",
|
153
160
|
"lib/fog/rackspace/requests/servers/list_servers.rb",
|
154
161
|
"lib/fog/rackspace/requests/servers/list_servers_detail.rb",
|
155
162
|
"lib/fog/rackspace/requests/servers/reboot_server.rb",
|
156
163
|
"lib/fog/rackspace/requests/servers/update_server.rb",
|
157
164
|
"lib/fog/rackspace/servers.rb",
|
158
|
-
"lib/fog/response.rb",
|
159
165
|
"spec/aws/models/ec2/address_spec.rb",
|
160
166
|
"spec/aws/models/ec2/addresses_spec.rb",
|
161
167
|
"spec/aws/models/ec2/instance_spec.rb",
|
@@ -224,20 +230,30 @@ Gem::Specification.new do |s|
|
|
224
230
|
"spec/aws/requests/simpledb/put_attributes_spec.rb",
|
225
231
|
"spec/aws/requests/simpledb/select_spec.rb",
|
226
232
|
"spec/lorem.txt",
|
233
|
+
"spec/rackspace/requests/files/delete_container_spec.rb",
|
234
|
+
"spec/rackspace/requests/files/delete_object_spec.rb",
|
235
|
+
"spec/rackspace/requests/files/get_container_spec.rb",
|
227
236
|
"spec/rackspace/requests/files/get_containers_spec.rb",
|
237
|
+
"spec/rackspace/requests/files/head_container_spec.rb",
|
228
238
|
"spec/rackspace/requests/files/head_containers_spec.rb",
|
239
|
+
"spec/rackspace/requests/files/put_container_spec.rb",
|
240
|
+
"spec/rackspace/requests/files/put_object_spec.rb",
|
229
241
|
"spec/rackspace/requests/servers/create_image_spec.rb",
|
230
242
|
"spec/rackspace/requests/servers/create_server_spec.rb",
|
231
|
-
"spec/rackspace/requests/servers/
|
243
|
+
"spec/rackspace/requests/servers/delete_image_spec.rb",
|
232
244
|
"spec/rackspace/requests/servers/delete_server_spec.rb",
|
233
245
|
"spec/rackspace/requests/servers/get_server_details_spec.rb",
|
246
|
+
"spec/rackspace/requests/servers/list_addresses_spec.rb",
|
247
|
+
"spec/rackspace/requests/servers/list_flavors_detail_spec.rb",
|
234
248
|
"spec/rackspace/requests/servers/list_flavors_spec.rb",
|
235
|
-
"spec/rackspace/requests/servers/
|
249
|
+
"spec/rackspace/requests/servers/list_images_detail_spec.rb",
|
236
250
|
"spec/rackspace/requests/servers/list_images_spec.rb",
|
251
|
+
"spec/rackspace/requests/servers/list_private_addresses_spec.rb",
|
252
|
+
"spec/rackspace/requests/servers/list_public_addresses_spec.rb",
|
237
253
|
"spec/rackspace/requests/servers/list_servers_detail_spec.rb",
|
238
254
|
"spec/rackspace/requests/servers/list_servers_spec.rb",
|
239
|
-
"spec/rackspace/requests/servers/
|
240
|
-
"spec/rackspace/requests/servers/
|
255
|
+
"spec/rackspace/requests/servers/reboot_server_spec.rb",
|
256
|
+
"spec/rackspace/requests/servers/update_server_spec.rb",
|
241
257
|
"spec/spec.opts",
|
242
258
|
"spec/spec_helper.rb"
|
243
259
|
]
|
@@ -315,20 +331,30 @@ Gem::Specification.new do |s|
|
|
315
331
|
"spec/aws/requests/simpledb/list_domains_spec.rb",
|
316
332
|
"spec/aws/requests/simpledb/put_attributes_spec.rb",
|
317
333
|
"spec/aws/requests/simpledb/select_spec.rb",
|
334
|
+
"spec/rackspace/requests/files/delete_container_spec.rb",
|
335
|
+
"spec/rackspace/requests/files/delete_object_spec.rb",
|
336
|
+
"spec/rackspace/requests/files/get_container_spec.rb",
|
318
337
|
"spec/rackspace/requests/files/get_containers_spec.rb",
|
338
|
+
"spec/rackspace/requests/files/head_container_spec.rb",
|
319
339
|
"spec/rackspace/requests/files/head_containers_spec.rb",
|
340
|
+
"spec/rackspace/requests/files/put_container_spec.rb",
|
341
|
+
"spec/rackspace/requests/files/put_object_spec.rb",
|
320
342
|
"spec/rackspace/requests/servers/create_image_spec.rb",
|
321
343
|
"spec/rackspace/requests/servers/create_server_spec.rb",
|
322
|
-
"spec/rackspace/requests/servers/
|
344
|
+
"spec/rackspace/requests/servers/delete_image_spec.rb",
|
323
345
|
"spec/rackspace/requests/servers/delete_server_spec.rb",
|
324
346
|
"spec/rackspace/requests/servers/get_server_details_spec.rb",
|
347
|
+
"spec/rackspace/requests/servers/list_addresses_spec.rb",
|
348
|
+
"spec/rackspace/requests/servers/list_flavors_detail_spec.rb",
|
325
349
|
"spec/rackspace/requests/servers/list_flavors_spec.rb",
|
326
|
-
"spec/rackspace/requests/servers/
|
350
|
+
"spec/rackspace/requests/servers/list_images_detail_spec.rb",
|
327
351
|
"spec/rackspace/requests/servers/list_images_spec.rb",
|
352
|
+
"spec/rackspace/requests/servers/list_private_addresses_spec.rb",
|
353
|
+
"spec/rackspace/requests/servers/list_public_addresses_spec.rb",
|
328
354
|
"spec/rackspace/requests/servers/list_servers_detail_spec.rb",
|
329
355
|
"spec/rackspace/requests/servers/list_servers_spec.rb",
|
330
|
-
"spec/rackspace/requests/servers/
|
331
|
-
"spec/rackspace/requests/servers/
|
356
|
+
"spec/rackspace/requests/servers/reboot_server_spec.rb",
|
357
|
+
"spec/rackspace/requests/servers/update_server_spec.rb",
|
332
358
|
"spec/spec_helper.rb"
|
333
359
|
]
|
334
360
|
|
@@ -337,15 +363,18 @@ Gem::Specification.new do |s|
|
|
337
363
|
s.specification_version = 3
|
338
364
|
|
339
365
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
366
|
+
s.add_runtime_dependency(%q<excon>, [">= 0"])
|
340
367
|
s.add_runtime_dependency(%q<mime-types>, [">= 0"])
|
341
368
|
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
342
369
|
s.add_runtime_dependency(%q<ruby-hmac>, [">= 0"])
|
343
370
|
else
|
371
|
+
s.add_dependency(%q<excon>, [">= 0"])
|
344
372
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
345
373
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
346
374
|
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
347
375
|
end
|
348
376
|
else
|
377
|
+
s.add_dependency(%q<excon>, [">= 0"])
|
349
378
|
s.add_dependency(%q<mime-types>, [">= 0"])
|
350
379
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
351
380
|
s.add_dependency(%q<ruby-hmac>, [">= 0"])
|
data/lib/fog.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'rubygems'
|
3
2
|
require 'base64'
|
4
3
|
require 'cgi'
|
5
4
|
require 'digest/md5'
|
@@ -7,6 +6,8 @@ require 'hmac-sha1'
|
|
7
6
|
require 'hmac-sha2'
|
8
7
|
require 'json'
|
9
8
|
require 'mime/types'
|
9
|
+
require 'nokogiri'
|
10
|
+
require 'time'
|
10
11
|
|
11
12
|
__DIR__ = File.dirname(__FILE__)
|
12
13
|
|
@@ -26,6 +27,11 @@ module Fog
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def self.reload
|
30
|
+
load "fog/collection.rb"
|
31
|
+
load "fog/connection.rb"
|
32
|
+
load "fog/model.rb"
|
33
|
+
load "fog/parser.rb"
|
34
|
+
|
29
35
|
load "fog/aws.rb"
|
30
36
|
load "fog/rackspace.rb"
|
31
37
|
end
|
data/lib/fog/aws/ec2.rb
CHANGED
@@ -20,12 +20,6 @@ module Fog
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.reload
|
23
|
-
load "fog/collection.rb"
|
24
|
-
load "fog/connection.rb"
|
25
|
-
load "fog/model.rb"
|
26
|
-
load "fog/parser.rb"
|
27
|
-
load "fog/response.rb"
|
28
|
-
|
29
23
|
load "fog/aws/models/ec2/address.rb"
|
30
24
|
load "fog/aws/models/ec2/addresses.rb"
|
31
25
|
load "fog/aws/models/ec2/instance.rb"
|
@@ -172,7 +166,6 @@ module Fog
|
|
172
166
|
response = @connection.request({
|
173
167
|
:body => body,
|
174
168
|
:expects => 200,
|
175
|
-
:error_parser => Fog::Errors::Parser.new,
|
176
169
|
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded' },
|
177
170
|
:host => @host,
|
178
171
|
:method => 'POST',
|
@@ -4,19 +4,9 @@ module Fog
|
|
4
4
|
|
5
5
|
class Address < Fog::Model
|
6
6
|
|
7
|
-
|
8
|
-
attribute :public_ip, 'publicIp'
|
9
|
-
|
10
|
-
def addresses
|
11
|
-
@addresses
|
12
|
-
end
|
7
|
+
identity :public_ip, 'publicIp'
|
13
8
|
|
14
|
-
|
15
|
-
new_attributes = {
|
16
|
-
:instance_id => ''
|
17
|
-
}.merge!(new_attributes)
|
18
|
-
super(new_attributes)
|
19
|
-
end
|
9
|
+
attribute :instance_id, 'instanceId'
|
20
10
|
|
21
11
|
def destroy
|
22
12
|
connection.release_address(@public_ip)
|
@@ -24,18 +14,10 @@ module Fog
|
|
24
14
|
end
|
25
15
|
|
26
16
|
def instance=(new_instance)
|
27
|
-
if
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
@instance_id = new_instance.instance_id
|
32
|
-
connection.associate_address(@instance_id, @public_ip)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def reload
|
37
|
-
if new_address = addresses.get(@public_ip)
|
38
|
-
merge_attributes(new_address.attributes)
|
17
|
+
if new_instance
|
18
|
+
associate(new_instance)
|
19
|
+
else
|
20
|
+
disassociate
|
39
21
|
end
|
40
22
|
end
|
41
23
|
|
@@ -50,8 +32,22 @@ module Fog
|
|
50
32
|
|
51
33
|
private
|
52
34
|
|
53
|
-
def
|
54
|
-
|
35
|
+
def associate(new_instance)
|
36
|
+
if new_record?
|
37
|
+
@instance = new_instance
|
38
|
+
else
|
39
|
+
@instance = nil
|
40
|
+
@instance_id = new_instance.instance_id
|
41
|
+
connection.associate_address(@instance_id, @public_ip)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def disassociate
|
46
|
+
@instance = nil
|
47
|
+
@instance_id = nil
|
48
|
+
unless new_record?
|
49
|
+
connection.disassociate_address(@public_ip)
|
50
|
+
end
|
55
51
|
end
|
56
52
|
|
57
53
|
end
|
@@ -13,22 +13,21 @@ module Fog
|
|
13
13
|
attribute :public_ip
|
14
14
|
attribute :instance
|
15
15
|
|
16
|
+
model Fog::AWS::EC2::Address
|
17
|
+
|
16
18
|
def initialize(attributes)
|
17
19
|
@public_ip ||= []
|
18
20
|
super
|
19
21
|
end
|
20
22
|
|
21
|
-
def all(public_ip =
|
23
|
+
def all(public_ip = @public_ip)
|
22
24
|
data = connection.describe_addresses(public_ip).body
|
23
25
|
addresses = Fog::AWS::EC2::Addresses.new({
|
24
26
|
:connection => connection,
|
25
27
|
:public_ip => public_ip
|
26
28
|
}.merge!(attributes))
|
27
29
|
data['addressesSet'].each do |address|
|
28
|
-
addresses <<
|
29
|
-
:addresses => addresses,
|
30
|
-
:connection => connection
|
31
|
-
}.merge!(address))
|
30
|
+
addresses << new(address.reject {|key, value| value.nil? || value.empty? })
|
32
31
|
end
|
33
32
|
if instance
|
34
33
|
addresses = addresses.select {|address| address.instance_id == instance.id}
|
@@ -36,30 +35,16 @@ module Fog
|
|
36
35
|
addresses
|
37
36
|
end
|
38
37
|
|
39
|
-
def create
|
40
|
-
address = new
|
41
|
-
address.save
|
42
|
-
address
|
43
|
-
end
|
44
|
-
|
45
38
|
def get(public_ip)
|
46
39
|
if public_ip
|
47
40
|
all(public_ip).first
|
48
41
|
end
|
49
|
-
rescue
|
42
|
+
rescue Excon::Errors::BadRequest
|
50
43
|
nil
|
51
44
|
end
|
52
45
|
|
53
|
-
def new
|
54
|
-
|
55
|
-
:addresses => self,
|
56
|
-
:connection => connection,
|
57
|
-
:instance => instance
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
def reload
|
62
|
-
all(public_ip)
|
46
|
+
def new(attributes = {})
|
47
|
+
super({ :instance => instance }.merge!(attributes))
|
63
48
|
end
|
64
49
|
|
65
50
|
end
|
@@ -4,12 +4,13 @@ module Fog
|
|
4
4
|
|
5
5
|
class Instance < Fog::Model
|
6
6
|
|
7
|
+
identity :instance_id, 'instanceId'
|
8
|
+
|
7
9
|
attribute :ami_launch_index, 'amiLaunchIndex'
|
8
10
|
attribute :availability_zone, 'availabilityZone'
|
9
11
|
attribute :dns_name, 'dnsName'
|
10
12
|
attribute :group_id, 'groupId'
|
11
13
|
attribute :image_id, 'imageId'
|
12
|
-
attribute :instance_id, 'instanceId'
|
13
14
|
attribute :instance_state, 'instanceState'
|
14
15
|
attribute :instance_type, 'instanceType'
|
15
16
|
attribute :kernel_id, 'kernelId'
|
@@ -47,10 +48,6 @@ module Fog
|
|
47
48
|
@key_name = new_keypair.name
|
48
49
|
end
|
49
50
|
|
50
|
-
def instances
|
51
|
-
@instances
|
52
|
-
end
|
53
|
-
|
54
51
|
def monitoring=(new_monitoring)
|
55
52
|
if new_monitoring.is_a?(Hash)
|
56
53
|
@monitoring = new_monitoring['state']
|
@@ -67,12 +64,6 @@ module Fog
|
|
67
64
|
end
|
68
65
|
end
|
69
66
|
|
70
|
-
def reload
|
71
|
-
if new_instance = instances.get(@instance_id)
|
72
|
-
merge_attributes(new_instance.attributes)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
67
|
def save
|
77
68
|
options = {}
|
78
69
|
if @availability_zone
|
@@ -118,10 +109,6 @@ module Fog
|
|
118
109
|
end
|
119
110
|
end
|
120
111
|
|
121
|
-
def instances=(new_instances)
|
122
|
-
@instances = new_instances
|
123
|
-
end
|
124
|
-
|
125
112
|
end
|
126
113
|
|
127
114
|
end
|
@@ -10,12 +10,14 @@ module Fog
|
|
10
10
|
|
11
11
|
attribute :instance_id
|
12
12
|
|
13
|
+
model Fog::AWS::EC2::Instance
|
14
|
+
|
13
15
|
def initialize(attributes)
|
14
16
|
@instance_id ||= []
|
15
17
|
super
|
16
18
|
end
|
17
19
|
|
18
|
-
def all(instance_id =
|
20
|
+
def all(instance_id = @instance_id)
|
19
21
|
data = connection.describe_instances(instance_id).body
|
20
22
|
instances = Fog::AWS::EC2::Instances.new({
|
21
23
|
:connection => connection,
|
@@ -24,41 +26,22 @@ module Fog
|
|
24
26
|
data['reservationSet'].each do |reservation|
|
25
27
|
reservation['instancesSet'].each do |instance|
|
26
28
|
instances << Fog::AWS::EC2::Instance.new({
|
27
|
-
:
|
28
|
-
:
|
29
|
+
:collection => instances,
|
30
|
+
:connection => connection
|
29
31
|
}.merge!(instance))
|
30
32
|
end
|
31
33
|
end
|
32
34
|
instances
|
33
35
|
end
|
34
36
|
|
35
|
-
def create(attributes = {})
|
36
|
-
instance = new(attributes)
|
37
|
-
instance.save
|
38
|
-
instance
|
39
|
-
end
|
40
|
-
|
41
37
|
def get(instance_id)
|
42
38
|
if instance_id
|
43
39
|
all(instance_id).first
|
44
40
|
end
|
45
|
-
rescue
|
41
|
+
rescue Excon::Errors::BadRequest
|
46
42
|
nil
|
47
43
|
end
|
48
44
|
|
49
|
-
def new(attributes = {})
|
50
|
-
Fog::AWS::EC2::Instance.new(
|
51
|
-
attributes.merge!(
|
52
|
-
:connection => connection,
|
53
|
-
:instances => self
|
54
|
-
)
|
55
|
-
)
|
56
|
-
end
|
57
|
-
|
58
|
-
def reload
|
59
|
-
all(instance_id)
|
60
|
-
end
|
61
|
-
|
62
45
|
end
|
63
46
|
|
64
47
|
end
|