fog 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +79 -2
- data/VERSION +1 -1
- data/fog.gemspec +28 -6
- data/lib/fog.rb +10 -7
- data/lib/fog/aws.rb +35 -9
- data/lib/fog/aws/ec2.rb +82 -69
- data/lib/fog/aws/models/ec2/address.rb +23 -1
- data/lib/fog/aws/models/ec2/addresses.rb +26 -2
- data/lib/fog/aws/models/ec2/instance.rb +135 -0
- data/lib/fog/aws/models/ec2/instances.rb +56 -0
- data/lib/fog/aws/models/ec2/key_pair.rb +17 -2
- data/lib/fog/aws/models/ec2/key_pairs.rb +29 -3
- data/lib/fog/aws/models/ec2/security_group.rb +41 -0
- data/lib/fog/aws/models/ec2/security_groups.rb +62 -0
- data/lib/fog/aws/models/ec2/snapshot.rb +12 -12
- data/lib/fog/aws/models/ec2/snapshots.rb +43 -21
- data/lib/fog/aws/models/ec2/volume.rb +21 -10
- data/lib/fog/aws/models/ec2/volumes.rb +30 -4
- data/lib/fog/aws/models/s3/buckets.rb +5 -8
- data/lib/fog/aws/models/s3/objects.rb +4 -7
- data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +63 -27
- data/lib/fog/aws/requests/ec2/create_security_group.rb +3 -3
- data/lib/fog/aws/requests/ec2/describe_images.rb +65 -35
- data/lib/fog/aws/requests/ec2/describe_instances.rb +2 -0
- data/lib/fog/aws/requests/ec2/get_console_output.rb +52 -21
- data/lib/fog/aws/requests/ec2/reboot_instances.rb +52 -19
- data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +63 -27
- data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
- data/lib/fog/aws/requests/ec2/terminate_instances.rb +14 -10
- data/lib/fog/aws/s3.rb +31 -35
- data/lib/fog/aws/simpledb.rb +19 -22
- data/lib/fog/collection.rb +3 -3
- data/lib/fog/connection.rb +2 -2
- data/lib/fog/errors.rb +1 -1
- data/lib/fog/model.rb +3 -3
- data/spec/aws/models/ec2/address_spec.rb +84 -0
- data/spec/aws/models/ec2/addresses_spec.rb +70 -0
- data/spec/aws/models/ec2/key_pair_spec.rb +84 -0
- data/spec/aws/models/ec2/key_pairs_spec.rb +71 -0
- data/spec/aws/models/ec2/security_group_spec.rb +84 -0
- data/spec/aws/models/ec2/security_groups_spec.rb +71 -0
- data/spec/aws/models/ec2/snapshot_spec.rb +93 -0
- data/spec/aws/models/ec2/snapshots_spec.rb +74 -0
- data/spec/aws/models/ec2/volume_spec.rb +84 -0
- data/spec/aws/models/ec2/volumes_spec.rb +70 -0
- data/spec/aws/models/s3/bucket_spec.rb +0 -1
- data/spec/aws/models/s3/buckets_spec.rb +2 -11
- data/spec/aws/requests/ec2/describe_security_groups_spec.rb +1 -1
- data/spec/aws/requests/ec2/get_console_output_spec.rb +9 -0
- data/spec/aws/requests/ec2/reboot_instances_spec.rb +11 -2
- data/spec/aws/requests/ec2/run_instances_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +26 -4
- data/LICENSE +0 -20
data/README.rdoc
CHANGED
@@ -1,7 +1,84 @@
|
|
1
1
|
= fog
|
2
2
|
|
3
|
-
|
3
|
+
fog helps you interact with cloud services. fog is a work in progress.
|
4
|
+
|
5
|
+
== Features
|
6
|
+
|
7
|
+
* Low level api calls
|
8
|
+
* Model level abstractions
|
9
|
+
* Mocks
|
10
|
+
|
11
|
+
== Supports
|
12
|
+
|
13
|
+
* AWS EC2 (missing security group mocking, just starting on models)
|
14
|
+
* AWS S3
|
15
|
+
* AWS SimpleDB (missing models)
|
16
|
+
|
17
|
+
== Synopsis
|
18
|
+
|
19
|
+
require 'fog'
|
20
|
+
|
21
|
+
# turn on mocking (if desired)
|
22
|
+
Fog.mock!
|
23
|
+
|
24
|
+
# initialize a connection
|
25
|
+
s3 = Fog::AWS::S3.new(
|
26
|
+
:aws_access_key_id => id,
|
27
|
+
:aws_secret_access_key => key
|
28
|
+
)
|
29
|
+
|
30
|
+
# low level requests
|
31
|
+
s3.put_bucket('bucketname')
|
32
|
+
s3.put_object('bucketname', 'objectname', 'objectbody')
|
33
|
+
|
34
|
+
s3.get_bucket('bucketname')
|
35
|
+
s3.get_object('bucketname', 'objectname')
|
36
|
+
|
37
|
+
s3.delete_object('bucketname', 'objectname')
|
38
|
+
s3.delete_bucket('bucketname')
|
39
|
+
|
40
|
+
# models
|
41
|
+
bucket = s3.buckets.create(:name => 'bucketname')
|
42
|
+
bucket.objects.create(:name => 'objectname', :body => 'objectbody')
|
43
|
+
|
44
|
+
bucket = s3.buckets.get('bucketname')
|
45
|
+
object = bucket.objects.get('objectname')
|
46
|
+
|
47
|
+
object.destroy
|
48
|
+
bucket.destroy
|
49
|
+
|
50
|
+
== Requirements
|
51
|
+
|
52
|
+
* ruby 1.8 or 1.9
|
53
|
+
* ruby-hmac
|
54
|
+
* mime-types
|
55
|
+
* nokogiri
|
56
|
+
|
57
|
+
== Install
|
58
|
+
|
59
|
+
sudo gem install fog
|
4
60
|
|
5
61
|
== Copyright
|
6
62
|
|
7
|
-
|
63
|
+
(The MIT License)
|
64
|
+
|
65
|
+
Copyright (c) 2009 {geemus (Wesley Beary)}[http://github.com/geemus]
|
66
|
+
|
67
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
68
|
+
a copy of this software and associated documentation files (the
|
69
|
+
"Software"), to deal in the Software without restriction, including
|
70
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
71
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
72
|
+
permit persons to whom the Software is furnished to do so, subject to
|
73
|
+
the following conditions:
|
74
|
+
|
75
|
+
The above copyright notice and this permission notice shall be
|
76
|
+
included in all copies or substantial portions of the Software.
|
77
|
+
|
78
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
79
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
80
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
81
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
82
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
83
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
84
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.10
|
data/fog.gemspec
CHANGED
@@ -5,21 +5,19 @@
|
|
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.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wesley Beary"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-30}
|
13
13
|
s.description = %q{brings clouds to you}
|
14
14
|
s.email = %q{me@geemus.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"
|
17
|
-
"README.rdoc"
|
16
|
+
"README.rdoc"
|
18
17
|
]
|
19
18
|
s.files = [
|
20
19
|
".document",
|
21
20
|
".gitignore",
|
22
|
-
"LICENSE",
|
23
21
|
"README.rdoc",
|
24
22
|
"Rakefile",
|
25
23
|
"VERSION",
|
@@ -34,8 +32,12 @@ Gem::Specification.new do |s|
|
|
34
32
|
"lib/fog/aws/ec2.rb",
|
35
33
|
"lib/fog/aws/models/ec2/address.rb",
|
36
34
|
"lib/fog/aws/models/ec2/addresses.rb",
|
35
|
+
"lib/fog/aws/models/ec2/instance.rb",
|
36
|
+
"lib/fog/aws/models/ec2/instances.rb",
|
37
37
|
"lib/fog/aws/models/ec2/key_pair.rb",
|
38
38
|
"lib/fog/aws/models/ec2/key_pairs.rb",
|
39
|
+
"lib/fog/aws/models/ec2/security_group.rb",
|
40
|
+
"lib/fog/aws/models/ec2/security_groups.rb",
|
39
41
|
"lib/fog/aws/models/ec2/snapshot.rb",
|
40
42
|
"lib/fog/aws/models/ec2/snapshots.rb",
|
41
43
|
"lib/fog/aws/models/ec2/volume.rb",
|
@@ -132,6 +134,16 @@ Gem::Specification.new do |s|
|
|
132
134
|
"lib/fog/model.rb",
|
133
135
|
"lib/fog/parser.rb",
|
134
136
|
"lib/fog/response.rb",
|
137
|
+
"spec/aws/models/ec2/address_spec.rb",
|
138
|
+
"spec/aws/models/ec2/addresses_spec.rb",
|
139
|
+
"spec/aws/models/ec2/key_pair_spec.rb",
|
140
|
+
"spec/aws/models/ec2/key_pairs_spec.rb",
|
141
|
+
"spec/aws/models/ec2/security_group_spec.rb",
|
142
|
+
"spec/aws/models/ec2/security_groups_spec.rb",
|
143
|
+
"spec/aws/models/ec2/snapshot_spec.rb",
|
144
|
+
"spec/aws/models/ec2/snapshots_spec.rb",
|
145
|
+
"spec/aws/models/ec2/volume_spec.rb",
|
146
|
+
"spec/aws/models/ec2/volumes_spec.rb",
|
135
147
|
"spec/aws/models/s3/bucket_spec.rb",
|
136
148
|
"spec/aws/models/s3/buckets_spec.rb",
|
137
149
|
"spec/aws/models/s3/object_spec.rb",
|
@@ -198,7 +210,17 @@ Gem::Specification.new do |s|
|
|
198
210
|
s.rubygems_version = %q{1.3.5}
|
199
211
|
s.summary = %q{fog = clouds + you}
|
200
212
|
s.test_files = [
|
201
|
-
"spec/aws/models/
|
213
|
+
"spec/aws/models/ec2/address_spec.rb",
|
214
|
+
"spec/aws/models/ec2/addresses_spec.rb",
|
215
|
+
"spec/aws/models/ec2/key_pair_spec.rb",
|
216
|
+
"spec/aws/models/ec2/key_pairs_spec.rb",
|
217
|
+
"spec/aws/models/ec2/security_group_spec.rb",
|
218
|
+
"spec/aws/models/ec2/security_groups_spec.rb",
|
219
|
+
"spec/aws/models/ec2/snapshot_spec.rb",
|
220
|
+
"spec/aws/models/ec2/snapshots_spec.rb",
|
221
|
+
"spec/aws/models/ec2/volume_spec.rb",
|
222
|
+
"spec/aws/models/ec2/volumes_spec.rb",
|
223
|
+
"spec/aws/models/s3/bucket_spec.rb",
|
202
224
|
"spec/aws/models/s3/buckets_spec.rb",
|
203
225
|
"spec/aws/models/s3/object_spec.rb",
|
204
226
|
"spec/aws/models/s3/objects_spec.rb",
|
data/lib/fog.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
+
__DIR__ = File.dirname(__FILE__)
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift __DIR__ unless
|
4
|
+
$LOAD_PATH.include?(__DIR__) ||
|
5
|
+
$LOAD_PATH.include?(File.expand_path(__DIR__))
|
6
|
+
|
1
7
|
module Fog
|
2
8
|
|
3
|
-
def self.
|
4
|
-
|
5
|
-
|
6
|
-
unless old_mocking == new_mocking
|
7
|
-
self.reload
|
8
|
-
end
|
9
|
+
def self.mock!
|
10
|
+
@mocking = true
|
11
|
+
self.reload
|
9
12
|
end
|
10
13
|
|
11
14
|
def self.mocking?
|
@@ -13,7 +16,7 @@ module Fog
|
|
13
16
|
end
|
14
17
|
|
15
18
|
def self.reload
|
16
|
-
load "
|
19
|
+
load "fog/aws.rb"
|
17
20
|
end
|
18
21
|
|
19
22
|
end
|
data/lib/fog/aws.rb
CHANGED
@@ -10,10 +10,9 @@ module Fog
|
|
10
10
|
module AWS
|
11
11
|
|
12
12
|
def self.reload
|
13
|
-
|
14
|
-
load "
|
15
|
-
load "
|
16
|
-
load "#{current_directory}/aws/s3.rb"
|
13
|
+
load "fog/aws/ec2.rb"
|
14
|
+
load "fog/aws/simpledb.rb"
|
15
|
+
load "fog/aws/s3.rb"
|
17
16
|
end
|
18
17
|
|
19
18
|
if Fog.mocking?
|
@@ -29,10 +28,37 @@ module Fog
|
|
29
28
|
sprintf("%0.10f", rand / 100).to_f
|
30
29
|
end
|
31
30
|
|
31
|
+
def self.console_output
|
32
|
+
'This is my console. There are many like it, but this one is mine. My console is my best friend. It is my life. I must master it as I master my life. My console, without me, is useless. Without my console, I am useless.'
|
33
|
+
end
|
34
|
+
|
32
35
|
def self.etag
|
33
36
|
hex(32)
|
34
37
|
end
|
35
38
|
|
39
|
+
def self.image
|
40
|
+
path = []
|
41
|
+
(rand(3) + 2).times do
|
42
|
+
path << letters(rand(9) + 8)
|
43
|
+
end
|
44
|
+
{
|
45
|
+
"imageOwnerId" => letters(rand(5) + 4),
|
46
|
+
"productCodes" => [],
|
47
|
+
"kernelId" => kernel_id,
|
48
|
+
"ramdiskId" => ramdisk_id,
|
49
|
+
"imageState" => "available",
|
50
|
+
"imageId" => image_id,
|
51
|
+
"architecture" => "i386",
|
52
|
+
"isPublic" => true,
|
53
|
+
"imageLocation" => path.join('/'),
|
54
|
+
"imageType" => "machine"
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.image_id
|
59
|
+
"ami-#{hex(8)}"
|
60
|
+
end
|
61
|
+
|
36
62
|
def self.key_fingerprint
|
37
63
|
fingerprint = []
|
38
64
|
20.times do
|
@@ -75,6 +101,10 @@ module Fog
|
|
75
101
|
numbers(12)
|
76
102
|
end
|
77
103
|
|
104
|
+
def self.ramdisk_id
|
105
|
+
"ari-#{hex(8)}"
|
106
|
+
end
|
107
|
+
|
78
108
|
def self.request_id
|
79
109
|
request_id = []
|
80
110
|
request_id << hex(8)
|
@@ -85,10 +115,6 @@ module Fog
|
|
85
115
|
request_id.join('-')
|
86
116
|
end
|
87
117
|
|
88
|
-
def self.ramdisk_id
|
89
|
-
"ari-#{hex(8)}"
|
90
|
-
end
|
91
|
-
|
92
118
|
def self.reservation_id
|
93
119
|
"r-#{hex(8)}"
|
94
120
|
end
|
@@ -135,7 +161,7 @@ module Fog
|
|
135
161
|
|
136
162
|
def self.base64(length)
|
137
163
|
random_selection(
|
138
|
-
"
|
164
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
139
165
|
length
|
140
166
|
)
|
141
167
|
end
|
data/lib/fog/aws/ec2.rb
CHANGED
@@ -20,75 +20,88 @@ module Fog
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.reload
|
23
|
-
|
24
|
-
load "
|
25
|
-
load "
|
26
|
-
load "
|
27
|
-
|
28
|
-
|
29
|
-
load "
|
30
|
-
load "
|
31
|
-
load "
|
32
|
-
load "
|
33
|
-
load "
|
34
|
-
load "
|
35
|
-
load "
|
36
|
-
load "
|
37
|
-
load "
|
38
|
-
load "
|
39
|
-
|
40
|
-
load "
|
41
|
-
load "
|
42
|
-
load "
|
43
|
-
load "
|
44
|
-
load "
|
45
|
-
load "
|
46
|
-
load "
|
47
|
-
load "
|
48
|
-
|
49
|
-
|
50
|
-
load "
|
51
|
-
load "
|
52
|
-
load "
|
53
|
-
load "
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
load "
|
58
|
-
load "
|
59
|
-
|
60
|
-
load "
|
61
|
-
load "
|
62
|
-
load "
|
63
|
-
load "
|
64
|
-
|
65
|
-
# TODO: require "
|
66
|
-
|
67
|
-
load "
|
68
|
-
|
69
|
-
|
70
|
-
load "
|
71
|
-
load "
|
72
|
-
load "
|
73
|
-
load "
|
74
|
-
|
75
|
-
# TODO: require "
|
76
|
-
load "
|
77
|
-
load "
|
78
|
-
|
79
|
-
|
80
|
-
load "
|
81
|
-
load "
|
82
|
-
|
83
|
-
|
84
|
-
# TODO: require "
|
85
|
-
|
86
|
-
|
87
|
-
load "
|
88
|
-
load "
|
89
|
-
load "
|
90
|
-
load "
|
91
|
-
|
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
|
+
load "fog/aws/models/ec2/address.rb"
|
30
|
+
load "fog/aws/models/ec2/addresses.rb"
|
31
|
+
load "fog/aws/models/ec2/key_pair.rb"
|
32
|
+
load "fog/aws/models/ec2/key_pairs.rb"
|
33
|
+
load "fog/aws/models/ec2/security_group.rb"
|
34
|
+
load "fog/aws/models/ec2/security_groups.rb"
|
35
|
+
load "fog/aws/models/ec2/snapshot.rb"
|
36
|
+
load "fog/aws/models/ec2/snapshots.rb"
|
37
|
+
load "fog/aws/models/ec2/volume.rb"
|
38
|
+
load "fog/aws/models/ec2/volumes.rb"
|
39
|
+
|
40
|
+
load "fog/aws/parsers/ec2/allocate_address.rb"
|
41
|
+
load "fog/aws/parsers/ec2/attach_volume.rb"
|
42
|
+
load "fog/aws/parsers/ec2/basic.rb"
|
43
|
+
load "fog/aws/parsers/ec2/create_key_pair.rb"
|
44
|
+
load "fog/aws/parsers/ec2/create_snapshot.rb"
|
45
|
+
load "fog/aws/parsers/ec2/create_volume.rb"
|
46
|
+
load "fog/aws/parsers/ec2/describe_addresses.rb"
|
47
|
+
load "fog/aws/parsers/ec2/describe_availability_zones.rb"
|
48
|
+
load "fog/aws/parsers/ec2/describe_images.rb"
|
49
|
+
load "fog/aws/parsers/ec2/describe_instances.rb"
|
50
|
+
load "fog/aws/parsers/ec2/describe_key_pairs.rb"
|
51
|
+
load "fog/aws/parsers/ec2/describe_regions.rb"
|
52
|
+
load "fog/aws/parsers/ec2/describe_security_groups.rb"
|
53
|
+
load "fog/aws/parsers/ec2/describe_snapshots.rb"
|
54
|
+
load "fog/aws/parsers/ec2/describe_volumes.rb"
|
55
|
+
load "fog/aws/parsers/ec2/detach_volume.rb"
|
56
|
+
load "fog/aws/parsers/ec2/get_console_output.rb"
|
57
|
+
load "fog/aws/parsers/ec2/run_instances.rb"
|
58
|
+
load "fog/aws/parsers/ec2/terminate_instances.rb"
|
59
|
+
|
60
|
+
load "fog/aws/requests/ec2/allocate_address.rb"
|
61
|
+
load "fog/aws/requests/ec2/associate_address.rb"
|
62
|
+
load "fog/aws/requests/ec2/attach_volume.rb"
|
63
|
+
load "fog/aws/requests/ec2/authorize_security_group_ingress.rb"
|
64
|
+
# TODO: require "fog/aws/requests/ec2/bundle_instance.rb"
|
65
|
+
# TODO: require "fog/aws/requests/ec2/cancel_bundle_task.rb"
|
66
|
+
# TODO: require "fog/aws/requests/ec2/confirm_product_instance.rb"
|
67
|
+
load "fog/aws/requests/ec2/create_key_pair.rb"
|
68
|
+
load "fog/aws/requests/ec2/create_security_group.rb"
|
69
|
+
load "fog/aws/requests/ec2/create_snapshot.rb"
|
70
|
+
load "fog/aws/requests/ec2/create_volume.rb"
|
71
|
+
load "fog/aws/requests/ec2/delete_key_pair.rb"
|
72
|
+
load "fog/aws/requests/ec2/delete_security_group.rb"
|
73
|
+
load "fog/aws/requests/ec2/delete_snapshot.rb"
|
74
|
+
load "fog/aws/requests/ec2/delete_volume.rb"
|
75
|
+
# TODO: require "fog/aws/requests/ec2/deregister_image.rb"
|
76
|
+
load "fog/aws/requests/ec2/describe_addresses.rb"
|
77
|
+
load "fog/aws/requests/ec2/describe_availability_zones.rb"
|
78
|
+
# TODO: require "fog/aws/requests/ec2/describe_bundle_tasks.rb"
|
79
|
+
# TODO: require "fog/aws/requests/ec2/describe_image_attribute.rb"
|
80
|
+
load "fog/aws/requests/ec2/describe_images.rb"
|
81
|
+
load "fog/aws/requests/ec2/describe_instances.rb"
|
82
|
+
load "fog/aws/requests/ec2/describe_key_pairs.rb"
|
83
|
+
load "fog/aws/requests/ec2/describe_regions.rb"
|
84
|
+
# TODO: require "fog/aws/requests/ec2/describe_reserved_instances.rb"
|
85
|
+
# TODO: require "fog/aws/requests/ec2/describe_reserved_instances_offerings.rb"
|
86
|
+
load "fog/aws/requests/ec2/describe_security_groups.rb"
|
87
|
+
load "fog/aws/requests/ec2/describe_snapshots.rb"
|
88
|
+
load "fog/aws/requests/ec2/describe_volumes.rb"
|
89
|
+
load "fog/aws/requests/ec2/detach_volume.rb"
|
90
|
+
load "fog/aws/requests/ec2/disassociate_address.rb"
|
91
|
+
load "fog/aws/requests/ec2/get_console_output.rb"
|
92
|
+
# TODO: require "fog/aws/requests/ec2/modify_image_attribute.rb"
|
93
|
+
# TODO: require "fog/aws/requests/ec2/modify_snapshot_attribute.rb"
|
94
|
+
# TODO: require "fog/aws/requests/ec2/monitor_instances.rb"
|
95
|
+
# TODO: require "fog/aws/requests/ec2/purchase_reserved_instances_offering.rb"
|
96
|
+
load "fog/aws/requests/ec2/reboot_instances.rb"
|
97
|
+
# TODO: require "fog/aws/requests/ec2/register_image.rb"
|
98
|
+
load "fog/aws/requests/ec2/release_address.rb"
|
99
|
+
# TODO: require "fog/aws/requests/ec2/reset_image_attributes.rb"
|
100
|
+
# TODO: require "fog/aws/requests/ec2/reset_snapshot_attributes.rb"
|
101
|
+
load "fog/aws/requests/ec2/revoke_security_group_ingress.rb"
|
102
|
+
load "fog/aws/requests/ec2/run_instances.rb"
|
103
|
+
load "fog/aws/requests/ec2/terminate_instances.rb"
|
104
|
+
# TODO: require "fog/aws/requests/ec2/unmonitor_instances.rb"
|
92
105
|
|
93
106
|
if Fog.mocking?
|
94
107
|
reset_data
|
@@ -7,17 +7,39 @@ module Fog
|
|
7
7
|
attribute :instance_id, 'instanceId'
|
8
8
|
attribute :public_ip, 'publicIp'
|
9
9
|
|
10
|
-
def
|
10
|
+
def addresses
|
11
|
+
@addresses
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(new_attributes = {})
|
15
|
+
new_attributes = {
|
16
|
+
:instance_id => ''
|
17
|
+
}.merge!(new_attributes)
|
18
|
+
super(new_attributes)
|
19
|
+
end
|
20
|
+
|
21
|
+
def destroy
|
11
22
|
connection.release_address(@public_ip)
|
12
23
|
true
|
13
24
|
end
|
14
25
|
|
26
|
+
def reload
|
27
|
+
new_attributes = addresses.get(@public_ip).attributes
|
28
|
+
merge_attributes(new_attributes)
|
29
|
+
end
|
30
|
+
|
15
31
|
def save
|
16
32
|
data = connection.allocate_address
|
17
33
|
@public_ip = data.body['publicIp']
|
18
34
|
true
|
19
35
|
end
|
20
36
|
|
37
|
+
private
|
38
|
+
|
39
|
+
def addresses=(new_addresses)
|
40
|
+
@addresses = new_addresses
|
41
|
+
end
|
42
|
+
|
21
43
|
end
|
22
44
|
|
23
45
|
end
|