fog 0.3.22 → 0.3.23
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/Gemfile.lock +1 -1
- data/fog.gemspec +2 -2
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/models/compute/address.rb +6 -5
- data/lib/fog/aws/models/compute/addresses.rb +3 -3
- data/lib/fog/aws/models/compute/image.rb +7 -11
- data/lib/fog/aws/models/compute/images.rb +3 -3
- data/lib/fog/aws/models/compute/key_pair.rb +1 -1
- data/lib/fog/aws/models/compute/key_pairs.rb +4 -3
- data/lib/fog/aws/models/compute/security_group.rb +6 -6
- data/lib/fog/aws/models/compute/security_groups.rb +3 -3
- data/lib/fog/aws/models/compute/server.rb +15 -44
- data/lib/fog/aws/models/compute/servers.rb +3 -5
- data/lib/fog/aws/models/compute/snapshot.rb +4 -4
- data/lib/fog/aws/models/compute/snapshots.rb +3 -3
- data/lib/fog/aws/models/compute/tags.rb +4 -4
- data/lib/fog/aws/models/compute/volume.rb +7 -7
- data/lib/fog/aws/models/compute/volumes.rb +4 -4
- data/lib/fog/aws/models/storage/directories.rb +1 -1
- data/lib/fog/aws/models/storage/file.rb +9 -5
- data/lib/fog/aws/models/storage/files.rb +10 -9
- data/lib/fog/aws/parsers/storage/get_bucket.rb +19 -3
- data/lib/fog/aws/requests/storage/get_bucket.rb +1 -0
- data/lib/fog/bluebox/models/compute/server.rb +7 -13
- data/lib/fog/brightbox/models/compute/image.rb +4 -4
- data/lib/fog/brightbox/models/compute/server.rb +7 -7
- data/lib/fog/brightbox/models/compute/user.rb +3 -3
- data/lib/fog/core/attributes.rb +18 -26
- data/lib/fog/go_grid/models/compute/image.rb +2 -2
- data/lib/fog/go_grid/models/compute/server.rb +2 -2
- data/lib/fog/google/models/storage/directories.rb +1 -1
- data/lib/fog/google/models/storage/file.rb +9 -6
- data/lib/fog/google/models/storage/files.rb +10 -9
- data/lib/fog/google/parsers/storage/get_bucket.rb +19 -3
- data/lib/fog/google/requests/storage/get_bucket.rb +1 -0
- data/lib/fog/local/models/storage/file.rb +5 -2
- data/lib/fog/rackspace/models/compute/image.rb +3 -3
- data/lib/fog/rackspace/models/compute/server.rb +10 -10
- data/lib/fog/rackspace/models/storage/file.rb +8 -5
- data/lib/fog/rackspace/models/storage/files.rb +4 -4
- data/lib/fog/slicehost/models/compute/server.rb +7 -7
- data/lib/fog/terremark/models/shared/address.rb +2 -2
- data/lib/fog/terremark/models/shared/network.rb +2 -2
- data/lib/fog/terremark/models/shared/server.rb +13 -13
- data/lib/fog/terremark/models/shared/task.rb +3 -3
- data/lib/fog/terremark/models/shared/vdc.rb +4 -4
- metadata +3 -3
@@ -36,7 +36,7 @@ module Fog
|
|
36
36
|
def destroy
|
37
37
|
requires :id
|
38
38
|
|
39
|
-
connection.grid_server_delete(
|
39
|
+
connection.grid_server_delete(id)
|
40
40
|
true
|
41
41
|
end
|
42
42
|
|
@@ -48,7 +48,7 @@ module Fog
|
|
48
48
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
49
49
|
requires :server_id
|
50
50
|
|
51
|
-
data = connection.grid_server_add(
|
51
|
+
data = connection.grid_server_add(server_id, 'name' => name)
|
52
52
|
merge_attributes(data.body['image'])
|
53
53
|
true
|
54
54
|
end
|
@@ -24,13 +24,13 @@ module Fog
|
|
24
24
|
|
25
25
|
def destroy
|
26
26
|
requires :id
|
27
|
-
connection.grid_server_destroy(
|
27
|
+
connection.grid_server_destroy(id)
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
31
|
def image
|
32
32
|
requires :image_id
|
33
|
-
connection.grid_image_get(
|
33
|
+
connection.grid_image_get(image_id)
|
34
34
|
end
|
35
35
|
|
36
36
|
def ready?
|
@@ -25,7 +25,7 @@ module Fog
|
|
25
25
|
directory = new(:key => data['Name'])
|
26
26
|
options = {}
|
27
27
|
for k, v in data
|
28
|
-
if ['Delimiter', 'IsTruncated', 'Marker', 'MaxKeys', 'Prefix'].include?(k)
|
28
|
+
if ['CommonPrefixes', 'Delimiter', 'IsTruncated', 'Marker', 'MaxKeys', 'Prefix'].include?(k)
|
29
29
|
options[k] = v
|
30
30
|
end
|
31
31
|
end
|
@@ -11,7 +11,6 @@ module Fog
|
|
11
11
|
|
12
12
|
identity :key, :aliases => 'Key'
|
13
13
|
|
14
|
-
attr_writer :body
|
15
14
|
attribute :cache_control, :aliases => 'Cache-Control'
|
16
15
|
attribute :content_disposition, :aliases => 'Content-Disposition'
|
17
16
|
attribute :content_encoding, :aliases => 'Content-Encoding'
|
@@ -33,20 +32,24 @@ module Fog
|
|
33
32
|
end
|
34
33
|
|
35
34
|
def body
|
36
|
-
|
35
|
+
attributes[:body] ||= if last_modified && (file = collection.get(identity))
|
37
36
|
file.body
|
38
37
|
else
|
39
38
|
''
|
40
39
|
end
|
41
40
|
end
|
42
41
|
|
42
|
+
def body=(new_body)
|
43
|
+
attributes[:body] = new_body
|
44
|
+
end
|
45
|
+
|
43
46
|
def directory
|
44
47
|
@directory
|
45
48
|
end
|
46
49
|
|
47
50
|
def copy(target_directory_key, target_file_key)
|
48
51
|
requires :directory, :key
|
49
|
-
connection.copy_object(directory.key,
|
52
|
+
connection.copy_object(directory.key, key, target_directory_key, target_file_key)
|
50
53
|
target_directory = connection.directories.new(:key => target_directory_key)
|
51
54
|
target_directory.files.get(target_file_key)
|
52
55
|
end
|
@@ -54,7 +57,7 @@ module Fog
|
|
54
57
|
def destroy
|
55
58
|
requires :directory, :key
|
56
59
|
begin
|
57
|
-
connection.delete_object(directory.key,
|
60
|
+
connection.delete_object(directory.key, key)
|
58
61
|
rescue Excon::Errors::NotFound
|
59
62
|
end
|
60
63
|
true
|
@@ -63,7 +66,7 @@ module Fog
|
|
63
66
|
remove_method :owner=
|
64
67
|
def owner=(new_owner)
|
65
68
|
if new_owner
|
66
|
-
|
69
|
+
attributes[:owner] = {
|
67
70
|
:display_name => new_owner['DisplayName'],
|
68
71
|
:id => new_owner['ID']
|
69
72
|
}
|
@@ -105,7 +108,7 @@ module Fog
|
|
105
108
|
options['Content-Type'] = content_type if content_type
|
106
109
|
options['Expires'] = expires if expires
|
107
110
|
|
108
|
-
data = connection.put_object(directory.key,
|
111
|
+
data = connection.put_object(directory.key, key, body, options)
|
109
112
|
merge_attributes(data.headers)
|
110
113
|
if body.is_a?(String)
|
111
114
|
self.content_length = body.size
|
@@ -7,22 +7,23 @@ module Fog
|
|
7
7
|
|
8
8
|
class Files < Fog::Collection
|
9
9
|
|
10
|
-
attribute :
|
10
|
+
attribute :common_prefixes, :aliases => 'CommonPrefixes'
|
11
|
+
attribute :delimiter, :aliases => 'Delimiter'
|
11
12
|
attribute :directory
|
12
|
-
attribute :is_truncated,
|
13
|
-
attribute :marker,
|
14
|
-
attribute :max_keys,
|
15
|
-
attribute :prefix,
|
13
|
+
attribute :is_truncated, :aliases => 'IsTruncated'
|
14
|
+
attribute :marker, :aliases => 'Marker'
|
15
|
+
attribute :max_keys, :aliases => ['MaxKeys', 'max-keys']
|
16
|
+
attribute :prefix, :aliases => 'Prefix'
|
16
17
|
|
17
18
|
model Fog::Google::Storage::File
|
18
19
|
|
19
20
|
def all(options = {})
|
20
21
|
requires :directory
|
21
22
|
options = {
|
22
|
-
'delimiter' =>
|
23
|
-
'marker' =>
|
24
|
-
'max-keys' =>
|
25
|
-
'prefix' =>
|
23
|
+
'delimiter' => delimiter,
|
24
|
+
'marker' => marker,
|
25
|
+
'max-keys' => max_keys,
|
26
|
+
'prefix' => prefix
|
26
27
|
}.merge!(options)
|
27
28
|
options = options.reject {|key,value| value.nil? || value.to_s.empty?}
|
28
29
|
merge_attributes(options)
|
@@ -7,11 +7,21 @@ module Fog
|
|
7
7
|
|
8
8
|
def reset
|
9
9
|
@object = { 'Owner' => {} }
|
10
|
-
@response = { 'Contents' => [] }
|
10
|
+
@response = { 'Contents' => [], 'CommonPrefixes' => [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def start_element(name, attrs = [])
|
14
|
+
super
|
15
|
+
case name
|
16
|
+
when 'CommonPrefixes'
|
17
|
+
@in_common_prefixes = true
|
18
|
+
end
|
11
19
|
end
|
12
20
|
|
13
21
|
def end_element(name)
|
14
22
|
case name
|
23
|
+
when 'CommonPrefixes'
|
24
|
+
@in_common_prefixes = false
|
15
25
|
when 'Contents'
|
16
26
|
@response['Contents'] << @object
|
17
27
|
@object = { 'Owner' => {} }
|
@@ -27,13 +37,19 @@ module Fog
|
|
27
37
|
end
|
28
38
|
when 'LastModified'
|
29
39
|
@object['LastModified'] = Time.parse(@value)
|
30
|
-
when 'Marker', 'Name'
|
40
|
+
when 'Marker', 'Name'
|
31
41
|
@response[name] = @value
|
32
42
|
when 'MaxKeys'
|
33
43
|
@response['MaxKeys'] = @value.to_i
|
44
|
+
when 'Prefix'
|
45
|
+
if @in_common_prefixes
|
46
|
+
@response['CommonPrefixes'] << @value
|
47
|
+
else
|
48
|
+
@response[name] = @value
|
49
|
+
end
|
34
50
|
when 'Size'
|
35
51
|
@object['Size'] = @value.to_i
|
36
|
-
when '
|
52
|
+
when 'Delimiter', 'Key', 'StorageClass'
|
37
53
|
@object[name] = @value
|
38
54
|
end
|
39
55
|
end
|
@@ -27,6 +27,7 @@ module Fog
|
|
27
27
|
# * 'MaxKeys'<~Integer> - Maximum number of keys specified for query
|
28
28
|
# * 'Name'<~String> - Name of the bucket
|
29
29
|
# * 'Prefix'<~String> - Prefix specified for query
|
30
|
+
# * 'CommonPrefixes'<~Array> - Array of strings for common prefixes
|
30
31
|
# * 'Contents'<~Array>:
|
31
32
|
# * 'ETag'<~String>: Etag of object
|
32
33
|
# * 'Key'<~String>: Name of object
|
@@ -8,19 +8,22 @@ module Fog
|
|
8
8
|
|
9
9
|
identity :key, :aliases => 'Key'
|
10
10
|
|
11
|
-
attr_writer :body
|
12
11
|
attribute :content_length, :aliases => 'Content-Length'
|
13
12
|
# attribute :content_type, :aliases => 'Content-Type'
|
14
13
|
attribute :last_modified, :aliases => 'Last-Modified'
|
15
14
|
|
16
15
|
def body
|
17
|
-
|
16
|
+
attributes[:body] ||= if last_modified
|
18
17
|
collection.get(identity).body
|
19
18
|
else
|
20
19
|
''
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
23
|
+
def body=(new_body)
|
24
|
+
attributes[:body] = new_body
|
25
|
+
end
|
26
|
+
|
24
27
|
def directory
|
25
28
|
@directory
|
26
29
|
end
|
@@ -18,13 +18,13 @@ module Fog
|
|
18
18
|
def server=(new_server)
|
19
19
|
requires :id
|
20
20
|
|
21
|
-
|
21
|
+
self.server_id = new_server.id
|
22
22
|
end
|
23
23
|
|
24
24
|
def destroy
|
25
25
|
requires :id
|
26
26
|
|
27
|
-
connection.delete_image(
|
27
|
+
connection.delete_image(id)
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
@@ -36,7 +36,7 @@ module Fog
|
|
36
36
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
37
37
|
requires :server_id
|
38
38
|
|
39
|
-
data = connection.create_image(
|
39
|
+
data = connection.create_image(server_id, 'name' => name)
|
40
40
|
merge_attributes(data.body['image'])
|
41
41
|
true
|
42
42
|
end
|
@@ -22,24 +22,24 @@ module Fog
|
|
22
22
|
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
23
23
|
|
24
24
|
def initialize(attributes={})
|
25
|
-
|
25
|
+
self.flavor_id ||= 1
|
26
26
|
super
|
27
27
|
end
|
28
28
|
|
29
29
|
def destroy
|
30
30
|
requires :id
|
31
|
-
connection.delete_server(
|
31
|
+
connection.delete_server(id)
|
32
32
|
true
|
33
33
|
end
|
34
34
|
|
35
35
|
def flavor
|
36
36
|
requires :flavor_id
|
37
|
-
connection.flavors.get(
|
37
|
+
connection.flavors.get(flavor_id)
|
38
38
|
end
|
39
39
|
|
40
40
|
def image
|
41
41
|
requires :image_id
|
42
|
-
connection.images.get(
|
42
|
+
connection.images.get(image_id)
|
43
43
|
end
|
44
44
|
|
45
45
|
def images
|
@@ -66,12 +66,12 @@ module Fog
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def ready?
|
69
|
-
|
69
|
+
status == 'ACTIVE'
|
70
70
|
end
|
71
71
|
|
72
72
|
def reboot(type = 'SOFT')
|
73
73
|
requires :id
|
74
|
-
connection.reboot_server(
|
74
|
+
connection.reboot_server(id, type)
|
75
75
|
true
|
76
76
|
end
|
77
77
|
|
@@ -79,12 +79,12 @@ module Fog
|
|
79
79
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
80
80
|
requires :flavor_id, :image_id, :name
|
81
81
|
options = {
|
82
|
-
'metadata' =>
|
83
|
-
'name' =>
|
84
|
-
'personality' =>
|
82
|
+
'metadata' => metadata,
|
83
|
+
'name' => name,
|
84
|
+
'personality' => personality
|
85
85
|
}
|
86
86
|
options = options.reject {|key, value| value.nil?}
|
87
|
-
data = connection.create_server(
|
87
|
+
data = connection.create_server(flavor_id, image_id, options)
|
88
88
|
merge_attributes(data.body['server'])
|
89
89
|
true
|
90
90
|
end
|
@@ -8,33 +8,36 @@ module Fog
|
|
8
8
|
|
9
9
|
identity :key, :aliases => 'name'
|
10
10
|
|
11
|
-
attr_writer :body
|
12
11
|
attribute :content_length, :aliases => ['bytes', 'Content-Length'], :type => :integer
|
13
12
|
attribute :content_type, :aliases => ['content_type', 'Content-Type']
|
14
13
|
attribute :etag, :aliases => ['hash', 'Etag']
|
15
14
|
attribute :last_modified, :aliases => ['last_modified', 'Last-Modified'], :type => :time
|
16
15
|
|
17
16
|
def body
|
18
|
-
|
17
|
+
attributes[:body] ||= if last_modified
|
19
18
|
collection.get(identity).body
|
20
19
|
else
|
21
20
|
''
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
24
|
+
def body=(new_body)
|
25
|
+
attributes[:body] = new_body
|
26
|
+
end
|
27
|
+
|
25
28
|
def directory
|
26
29
|
@directory
|
27
30
|
end
|
28
31
|
|
29
32
|
def destroy
|
30
33
|
requires :directory, :key
|
31
|
-
connection.delete_object(directory.key,
|
34
|
+
connection.delete_object(directory.key, key)
|
32
35
|
true
|
33
36
|
end
|
34
37
|
|
35
38
|
def owner=(new_owner)
|
36
39
|
if new_owner
|
37
|
-
|
40
|
+
attributes[:owner] = {
|
38
41
|
:display_name => new_owner['DisplayName'],
|
39
42
|
:id => new_owner['ID']
|
40
43
|
}
|
@@ -54,7 +57,7 @@ module Fog
|
|
54
57
|
|
55
58
|
def save(options = {})
|
56
59
|
requires :body, :directory, :key
|
57
|
-
data = connection.put_object(directory.key,
|
60
|
+
data = connection.put_object(directory.key, key, body, options)
|
58
61
|
merge_attributes(data.headers)
|
59
62
|
if body.is_a?(String)
|
60
63
|
self.content_length = body.size
|
@@ -18,10 +18,10 @@ module Fog
|
|
18
18
|
def all(options = {})
|
19
19
|
requires :directory
|
20
20
|
options = {
|
21
|
-
'limit' =>
|
22
|
-
'marker' =>
|
23
|
-
'path' =>
|
24
|
-
'prefix' =>
|
21
|
+
'limit' => limit,
|
22
|
+
'marker' => marker,
|
23
|
+
'path' => path,
|
24
|
+
'prefix' => prefix
|
25
25
|
}.merge!(options)
|
26
26
|
merge_attributes(options)
|
27
27
|
parent = directory.collection.get(
|
@@ -23,24 +23,24 @@ module Fog
|
|
23
23
|
attr_writer :private_key, :private_key_path, :public_key, :public_key_path, :username
|
24
24
|
|
25
25
|
def initialize(attributes={})
|
26
|
-
|
26
|
+
self.flavor_id ||= 1
|
27
27
|
super
|
28
28
|
end
|
29
29
|
|
30
30
|
def destroy
|
31
31
|
requires :id
|
32
|
-
connection.delete_slice(
|
32
|
+
connection.delete_slice(id)
|
33
33
|
true
|
34
34
|
end
|
35
35
|
|
36
36
|
def flavor
|
37
37
|
requires :flavor_id
|
38
|
-
connection.flavors.get(
|
38
|
+
connection.flavors.get(flavor_id)
|
39
39
|
end
|
40
40
|
|
41
41
|
def image
|
42
42
|
requires :image_id
|
43
|
-
connection.images.get(
|
43
|
+
connection.images.get(image_id)
|
44
44
|
end
|
45
45
|
|
46
46
|
def private_key_path
|
@@ -62,12 +62,12 @@ module Fog
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def ready?
|
65
|
-
|
65
|
+
status == 'active'
|
66
66
|
end
|
67
67
|
|
68
68
|
def reboot(type = 'SOFT')
|
69
69
|
requires :id
|
70
|
-
connection.reboot_slice(
|
70
|
+
connection.reboot_slice(id, type)
|
71
71
|
true
|
72
72
|
end
|
73
73
|
|
@@ -75,7 +75,7 @@ module Fog
|
|
75
75
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity
|
76
76
|
requires :flavor_id, :image_id, :name
|
77
77
|
|
78
|
-
data = connection.create_slice(
|
78
|
+
data = connection.create_slice(flavor_id, image_id, name)
|
79
79
|
merge_attributes(data.body)
|
80
80
|
true
|
81
81
|
end
|
@@ -12,14 +12,14 @@ module Fog
|
|
12
12
|
|
13
13
|
def destroy
|
14
14
|
requires :id
|
15
|
-
connection.delete_public_ip(
|
15
|
+
connection.delete_public_ip(id)
|
16
16
|
true
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def href=(new_href)
|
22
|
-
|
22
|
+
self.id = new_href.split('/').last.to_i
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
@@ -17,13 +17,13 @@ module Fog
|
|
17
17
|
|
18
18
|
def ips
|
19
19
|
#Until there is a real model for these ?
|
20
|
-
connection.get_network_ips(
|
20
|
+
connection.get_network_ips(id).body['IpAddresses']
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def href=(new_href)
|
26
|
-
|
26
|
+
self.id = new_href.split('/').last.to_i
|
27
27
|
end
|
28
28
|
|
29
29
|
def type=(new_type); end
|