fog 0.6.0 → 0.7.0
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 +11 -6
- data/changelog.txt +49 -0
- data/fog.gemspec +5 -4
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/cloud_formation.rb +124 -0
- data/lib/fog/aws/elb.rb +4 -1
- data/lib/fog/aws/iam.rb +6 -0
- data/lib/fog/aws/parsers/cloud_formation/basic.rb +12 -0
- data/lib/fog/aws/parsers/cloud_formation/create_stack.rb +19 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stack_events.rb +31 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stack_resources.rb +31 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +72 -0
- data/lib/fog/aws/parsers/cloud_formation/get_template.rb +19 -0
- data/lib/fog/aws/parsers/cloud_formation/validate_template.rb +52 -0
- data/lib/fog/aws/parsers/iam/login_profile.rb +27 -0
- data/lib/fog/aws/parsers/iam/upload_server_certificate.rb +26 -0
- data/lib/fog/aws/parsers/rds/authorize_db_security_group_ingress.rb +38 -0
- data/lib/fog/aws/parsers/rds/create_db_instance.rb +34 -0
- data/lib/fog/aws/parsers/rds/create_db_instance_read_replica.rb +34 -0
- data/lib/fog/aws/parsers/rds/create_db_parameter_group.rb +35 -0
- data/lib/fog/aws/parsers/rds/create_db_security_group.rb +38 -0
- data/lib/fog/aws/parsers/rds/create_db_snapshot.rb +35 -0
- data/lib/fog/aws/parsers/rds/db_parser.rb +123 -0
- data/lib/fog/aws/parsers/rds/delete_db_instance.rb +35 -0
- data/lib/fog/aws/parsers/rds/delete_db_parameter_group.rb +27 -0
- data/lib/fog/aws/parsers/rds/delete_db_security_group.rb +33 -0
- data/lib/fog/aws/parsers/rds/delete_db_snapshot.rb +34 -0
- data/lib/fog/aws/parsers/rds/describe_db_instances.rb +36 -0
- data/lib/fog/aws/parsers/rds/describe_db_parameter_groups.rb +38 -0
- data/lib/fog/aws/parsers/rds/describe_db_parameters.rb +44 -0
- data/lib/fog/aws/parsers/rds/describe_db_security_groups.rb +39 -0
- data/lib/fog/aws/parsers/rds/describe_db_snapshots.rb +39 -0
- data/lib/fog/aws/parsers/rds/modify_db_instance.rb +34 -0
- data/lib/fog/aws/parsers/rds/modify_db_parameter_group.rb +28 -0
- data/lib/fog/aws/parsers/rds/reboot_db_instance.rb +35 -0
- data/lib/fog/aws/parsers/rds/restore_db_instance_from_db_snapshot.rb +34 -0
- data/lib/fog/aws/parsers/rds/restore_db_instance_to_point_in_time.rb +35 -0
- data/lib/fog/aws/parsers/rds/revoke_db_security_group_ingress.rb +39 -0
- data/lib/fog/aws/parsers/rds/security_group_parser.rb +39 -0
- data/lib/fog/aws/parsers/rds/snapshot_parser.rb +40 -0
- data/lib/fog/aws/rds.rb +161 -0
- data/lib/fog/aws/rds/models/parameter.rb +21 -0
- data/lib/fog/aws/rds/models/parameter_group.rb +36 -0
- data/lib/fog/aws/rds/models/parameter_groups.rb +27 -0
- data/lib/fog/aws/rds/models/parameters.rb +37 -0
- data/lib/fog/aws/rds/models/security_group.rb +73 -0
- data/lib/fog/aws/rds/models/security_groups.rb +43 -0
- data/lib/fog/aws/rds/models/server.rb +105 -0
- data/lib/fog/aws/rds/models/servers.rb +27 -0
- data/lib/fog/aws/rds/models/snapshot.rb +49 -0
- data/lib/fog/aws/rds/models/snapshots.rb +45 -0
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +71 -0
- data/lib/fog/aws/requests/cloud_formation/delete_stack.rb +30 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stack_events.rb +44 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb +43 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stacks.rb +42 -0
- data/lib/fog/aws/requests/cloud_formation/get_template.rb +32 -0
- data/lib/fog/aws/requests/cloud_formation/validate_template.rb +34 -0
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +4 -0
- data/lib/fog/aws/requests/iam/create_login_profile.rb +36 -0
- data/lib/fog/aws/requests/iam/delete_login_profile.rb +31 -0
- data/lib/fog/aws/requests/iam/delete_server_certificate.rb +32 -0
- data/lib/fog/aws/requests/iam/get_login_profile.rb +35 -0
- data/lib/fog/aws/requests/iam/update_login_profile.rb +33 -0
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +45 -0
- data/lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb +43 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +56 -0
- data/lib/fog/aws/requests/rds/create_db_instance_read_replica.rb +42 -0
- data/lib/fog/aws/requests/rds/create_db_parameter_group.rb +41 -0
- data/lib/fog/aws/requests/rds/create_db_security_group.rb +37 -0
- data/lib/fog/aws/requests/rds/create_db_snapshot.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_instance.rb +40 -0
- data/lib/fog/aws/requests/rds/delete_db_parameter_group.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_security_group.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_snapshot.rb +36 -0
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +42 -0
- data/lib/fog/aws/requests/rds/describe_db_parameter_groups.rb +45 -0
- data/lib/fog/aws/requests/rds/describe_db_parameters.rb +46 -0
- data/lib/fog/aws/requests/rds/describe_db_security_groups.rb +39 -0
- data/lib/fog/aws/requests/rds/describe_db_snapshots.rb +42 -0
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +54 -0
- data/lib/fog/aws/requests/rds/modify_db_parameter_group.rb +55 -0
- data/lib/fog/aws/requests/rds/reboot_db_instance.rb +34 -0
- data/lib/fog/aws/requests/rds/restore_db_instance_from_db_snapshot.rb +34 -0
- data/lib/fog/aws/requests/rds/restore_db_instance_to_point_in_time.rb +35 -0
- data/lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb +44 -0
- data/lib/fog/aws/simpledb.rb +21 -7
- data/lib/fog/bin.rb +2 -1
- data/lib/fog/bin/aws.rb +8 -0
- data/lib/fog/bin/virtual_box.rb +52 -0
- data/lib/fog/cdn/aws.rb +9 -8
- data/lib/fog/cdn/rackspace.rb +6 -6
- data/lib/fog/cdn/requests/rackspace/post_container.rb +30 -0
- data/lib/fog/cdn/requests/rackspace/put_container.rb +1 -1
- data/lib/fog/compute.rb +6 -3
- data/lib/fog/compute/aws.rb +11 -7
- data/lib/fog/compute/bluebox.rb +5 -6
- data/lib/fog/compute/brightbox.rb +3 -0
- data/lib/fog/compute/go_grid.rb +5 -6
- data/lib/fog/compute/linode.rb +5 -6
- data/lib/fog/compute/models/aws/flavors.rb +19 -18
- data/lib/fog/compute/models/aws/server.rb +23 -0
- data/lib/fog/compute/models/aws/tag.rb +1 -1
- data/lib/fog/compute/models/brightbox/server.rb +7 -1
- data/lib/fog/compute/models/virtual_box/medium.rb +87 -0
- data/lib/fog/compute/models/virtual_box/medium_format.rb +34 -0
- data/lib/fog/compute/models/virtual_box/mediums.rb +32 -0
- data/lib/fog/compute/models/virtual_box/nat_engine.rb +65 -0
- data/lib/fog/compute/models/virtual_box/nat_redirect.rb +91 -0
- data/lib/fog/compute/models/virtual_box/nat_redirects.rb +41 -0
- data/lib/fog/compute/models/virtual_box/network_adapter.rb +82 -0
- data/lib/fog/compute/models/virtual_box/network_adapters.rb +42 -0
- data/lib/fog/compute/models/virtual_box/server.rb +241 -0
- data/lib/fog/compute/models/virtual_box/servers.rb +41 -0
- data/lib/fog/compute/models/virtual_box/storage_controller.rb +83 -0
- data/lib/fog/compute/models/virtual_box/storage_controllers.rb +38 -0
- data/lib/fog/compute/models/voxel/servers.rb +7 -6
- data/lib/fog/compute/new_servers.rb +5 -6
- data/lib/fog/compute/parsers/aws/monitor_unmonitor_instances.rb +35 -0
- data/lib/fog/compute/rackspace.rb +7 -7
- data/lib/fog/compute/requests/aws/delete_tags.rb +12 -9
- data/lib/fog/compute/requests/aws/monitor_instances.rb +52 -0
- data/lib/fog/compute/requests/aws/revoke_security_group_ingress.rb +24 -8
- data/lib/fog/compute/requests/aws/unmonitor_instances.rb +53 -0
- data/lib/fog/compute/requests/brightbox/activate_console_server.rb +20 -0
- data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +20 -0
- data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +20 -0
- data/lib/fog/compute/slicehost.rb +5 -6
- data/lib/fog/compute/virtual_box.rb +48 -0
- data/lib/fog/compute/voxel.rb +30 -27
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/attributes.rb +3 -1
- data/lib/fog/core/collection.rb +2 -2
- data/lib/fog/core/credentials.rb +13 -3
- data/lib/fog/core/scp.rb +0 -4
- data/lib/fog/core/service.rb +0 -8
- data/lib/fog/core/ssh.rb +0 -4
- data/lib/fog/dns.rb +3 -3
- data/lib/fog/dns/aws.rb +8 -8
- data/lib/fog/dns/bluebox.rb +5 -7
- data/lib/fog/dns/dnsimple.rb +7 -7
- data/lib/fog/dns/linode.rb +5 -6
- data/lib/fog/dns/models/dnsimple/record.rb +11 -1
- data/lib/fog/dns/models/dnsimple/records.rb +7 -7
- data/lib/fog/dns/models/dnsimple/zones.rb +2 -1
- data/lib/fog/dns/requests/dnsimple/get_record.rb +34 -0
- data/lib/fog/dns/slicehost.rb +5 -6
- data/lib/fog/dns/zerigo.rb +5 -7
- data/lib/fog/providers.rb +2 -1
- data/lib/fog/providers/aws.rb +10 -8
- data/lib/fog/providers/virtual_box.rb +11 -0
- data/lib/fog/storage.rb +21 -0
- data/lib/fog/storage/aws.rb +16 -32
- data/lib/fog/storage/google.rb +6 -27
- data/lib/fog/storage/local.rb +7 -7
- data/lib/fog/storage/models/rackspace/directory.rb +1 -1
- data/lib/fog/storage/models/rackspace/file.rb +1 -0
- data/lib/fog/storage/rackspace.rb +5 -27
- data/lib/fog/storage/requests/aws/put_object.rb +2 -2
- data/lib/fog/storage/requests/aws/upload_part.rb +1 -1
- data/lib/fog/storage/requests/google/put_object.rb +2 -2
- data/lib/fog/storage/requests/rackspace/put_object.rb +1 -1
- data/tests/aws/requests/cloud_formation/stack_tests.rb +130 -0
- data/tests/aws/requests/iam/login_profile_tests.rb +64 -0
- data/tests/aws/requests/rds/helper.rb +169 -0
- data/tests/aws/requests/rds/instance_tests.rb +129 -0
- data/tests/aws/requests/rds/model_tests.rb +98 -0
- data/tests/aws/requests/rds/parameter_group_tests.rb +68 -0
- data/tests/aws/requests/rds/parameter_request_tests.rb +35 -0
- data/tests/compute/models/aws/server_monitor_tests.rb +47 -0
- data/tests/compute/models/server_tests.rb +7 -23
- data/tests/compute/parsers/aws/monitor_unmonitor_instances_tests.rb +49 -0
- data/tests/compute/requests/aws/security_group_tests.rb +69 -52
- data/tests/compute/requests/aws/tag_tests.rb +5 -5
- data/tests/compute/requests/brightbox/helper.rb +7 -6
- data/tests/compute/requests/brightbox/server_tests.rb +5 -0
- data/tests/compute/requests/voxel/server_tests.rb +2 -3
- data/tests/storage/requests/aws/bucket_tests.rb +10 -0
- metadata +148 -12
data/lib/fog/cdn/aws.rb
CHANGED
|
@@ -28,12 +28,6 @@ module Fog
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def self.reset_data(keys=data.keys)
|
|
32
|
-
for key in [*keys]
|
|
33
|
-
data.delete(key)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
31
|
def initialize(options={})
|
|
38
32
|
unless options.delete(:provider)
|
|
39
33
|
location = caller.first
|
|
@@ -43,13 +37,20 @@ module Fog
|
|
|
43
37
|
end
|
|
44
38
|
|
|
45
39
|
require 'mime/types'
|
|
46
|
-
@aws_access_key_id
|
|
47
|
-
@
|
|
40
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
|
41
|
+
@region = options[:region]
|
|
42
|
+
reset_data
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def reset_data
|
|
46
|
+
self.class.data[@region].delete(@aws_access_key_id)
|
|
47
|
+
@data = self.class.data[@region][@aws_access_key_id]
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def signature(params)
|
|
51
51
|
"foo"
|
|
52
52
|
end
|
|
53
|
+
|
|
53
54
|
end
|
|
54
55
|
|
|
55
56
|
class Real
|
data/lib/fog/cdn/rackspace.rb
CHANGED
|
@@ -11,6 +11,7 @@ module Fog
|
|
|
11
11
|
request_path 'fog/cdn/requests/rackspace'
|
|
12
12
|
request :get_containers
|
|
13
13
|
request :head_container
|
|
14
|
+
request :post_container
|
|
14
15
|
request :put_container
|
|
15
16
|
|
|
16
17
|
class Mock
|
|
@@ -21,12 +22,6 @@ module Fog
|
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
def self.reset_data(keys=data.keys)
|
|
25
|
-
for key in [*keys]
|
|
26
|
-
data.delete(key)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
25
|
def initialize(options={})
|
|
31
26
|
unless options.delete(:provider)
|
|
32
27
|
location = caller.first
|
|
@@ -36,6 +31,11 @@ module Fog
|
|
|
36
31
|
end
|
|
37
32
|
|
|
38
33
|
@rackspace_username = options[:rackspace_username]
|
|
34
|
+
reset_data
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def reset_data
|
|
38
|
+
self.class.data.delete(@rackspace_username)
|
|
39
39
|
@data = self.class.data[@rackspace_username]
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Rackspace
|
|
3
|
+
class CDN
|
|
4
|
+
class Real
|
|
5
|
+
|
|
6
|
+
# modify CDN properties for a container
|
|
7
|
+
#
|
|
8
|
+
# ==== Parameters
|
|
9
|
+
# * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
|
10
|
+
# # options<~Hash>:
|
|
11
|
+
# * 'X-CDN-Enabled'<~Boolean> - cdn status for container
|
|
12
|
+
# * 'X-CDN-URI'<~String> - cdn url for this container
|
|
13
|
+
# * 'X-TTL'<~String> - integer seconds before data expires, defaults to 86400 (1 day), in 3600..259200
|
|
14
|
+
# * 'X-Log-Retention'<~Boolean> - ?
|
|
15
|
+
# * 'X-User-Agent-ACL'<~String> - ?
|
|
16
|
+
# * 'X-Referrer-ACL'<~String> - ?
|
|
17
|
+
def post_container(name, options = {})
|
|
18
|
+
response = request(
|
|
19
|
+
:expects => [201, 202],
|
|
20
|
+
:headers => options,
|
|
21
|
+
:method => 'POST',
|
|
22
|
+
:path => CGI.escape(name)
|
|
23
|
+
)
|
|
24
|
+
response
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/fog/compute.rb
CHANGED
|
@@ -28,12 +28,15 @@ module Fog
|
|
|
28
28
|
when 'Rackspace'
|
|
29
29
|
require 'fog/compute/rackspace'
|
|
30
30
|
Fog::Rackspace::Compute.new(attributes)
|
|
31
|
-
when 'Voxel'
|
|
32
|
-
require 'fog/compute/voxel'
|
|
33
|
-
Fog::Voxel::Compute.new(attributes)
|
|
34
31
|
when 'Slicehost'
|
|
35
32
|
require 'fog/compute/slicehost'
|
|
36
33
|
Fog::Slicehost::Compute.new(attributes)
|
|
34
|
+
when 'VirtualBox'
|
|
35
|
+
require 'fog/compute/virtual_box'
|
|
36
|
+
Fog::VirtualBox::Compute.new(attributes)
|
|
37
|
+
when 'Voxel'
|
|
38
|
+
require 'fog/compute/voxel'
|
|
39
|
+
Fog::Voxel::Compute.new(attributes)
|
|
37
40
|
else
|
|
38
41
|
raise ArgumentError.new("#{provider} is not a recognized compute provider")
|
|
39
42
|
end
|
data/lib/fog/compute/aws.rb
CHANGED
|
@@ -69,6 +69,8 @@ module Fog
|
|
|
69
69
|
request :terminate_instances
|
|
70
70
|
request :start_instances
|
|
71
71
|
request :stop_instances
|
|
72
|
+
request :monitor_instances
|
|
73
|
+
request :unmonitor_instances
|
|
72
74
|
|
|
73
75
|
class Mock
|
|
74
76
|
|
|
@@ -122,12 +124,6 @@ module Fog
|
|
|
122
124
|
end
|
|
123
125
|
end
|
|
124
126
|
|
|
125
|
-
def self.reset_data(keys=data.keys)
|
|
126
|
-
for key in [*keys]
|
|
127
|
-
data.delete(key)
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
|
|
131
127
|
def initialize(options={})
|
|
132
128
|
unless options.delete(:provider)
|
|
133
129
|
location = caller.first
|
|
@@ -140,10 +136,16 @@ module Fog
|
|
|
140
136
|
|
|
141
137
|
@aws_access_key_id = options[:aws_access_key_id]
|
|
142
138
|
@region = options[:region] || 'us-east-1'
|
|
143
|
-
|
|
139
|
+
|
|
140
|
+
reset_data
|
|
144
141
|
@owner_id = @data[:owner_id]
|
|
145
142
|
end
|
|
146
143
|
|
|
144
|
+
def reset_data
|
|
145
|
+
self.class.data[@region].delete(@aws_access_key_id)
|
|
146
|
+
@data = self.class.data[@region][@aws_access_key_id]
|
|
147
|
+
end
|
|
148
|
+
|
|
147
149
|
end
|
|
148
150
|
|
|
149
151
|
class Real
|
|
@@ -188,6 +190,8 @@ module Fog
|
|
|
188
190
|
else
|
|
189
191
|
options[:region] ||= 'us-east-1'
|
|
190
192
|
@host = options[:host] || case options[:region]
|
|
193
|
+
when 'ap-northeast-1'
|
|
194
|
+
'ec2.ap-northeast-1.amazonaws.com'
|
|
191
195
|
when 'ap-southeast-1'
|
|
192
196
|
'ec2.ap-southeast-1.amazonaws.com'
|
|
193
197
|
when 'eu-west-1'
|
data/lib/fog/compute/bluebox.rb
CHANGED
|
@@ -33,12 +33,6 @@ module Fog
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
def self.reset_data(keys=data.keys)
|
|
37
|
-
for key in [*keys]
|
|
38
|
-
data.delete(key)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
36
|
def initialize(options={})
|
|
43
37
|
unless options.delete(:provider)
|
|
44
38
|
location = caller.first
|
|
@@ -48,6 +42,11 @@ module Fog
|
|
|
48
42
|
end
|
|
49
43
|
|
|
50
44
|
@bluebox_api_key = options[:bluebox_api_key]
|
|
45
|
+
reset_data
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def reset_data
|
|
49
|
+
self.class.data.delete(@bluebox_api_key)
|
|
51
50
|
@data = self.class.data[@bluebox_api_key]
|
|
52
51
|
end
|
|
53
52
|
|
|
@@ -26,6 +26,8 @@ module Fog
|
|
|
26
26
|
model :user
|
|
27
27
|
|
|
28
28
|
request_path 'fog/compute/requests/brightbox'
|
|
29
|
+
request :activate_console_server
|
|
30
|
+
request :add_listeners_load_balancer
|
|
29
31
|
request :add_nodes_load_balancer
|
|
30
32
|
request :create_api_client
|
|
31
33
|
request :create_cloud_ip
|
|
@@ -56,6 +58,7 @@ module Fog
|
|
|
56
58
|
request :list_users
|
|
57
59
|
request :list_zones
|
|
58
60
|
request :map_cloud_ip
|
|
61
|
+
request :remove_listeners_load_balancer
|
|
59
62
|
request :remove_nodes_load_balancer
|
|
60
63
|
request :reset_ftp_password_account
|
|
61
64
|
request :resize_server
|
data/lib/fog/compute/go_grid.rb
CHANGED
|
@@ -36,12 +36,6 @@ module Fog
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
def self.reset_data(keys=data.keys)
|
|
40
|
-
for key in [*keys]
|
|
41
|
-
data.delete(key)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
39
|
def initialize(options={})
|
|
46
40
|
unless options.delete(:provider)
|
|
47
41
|
location = caller.first
|
|
@@ -52,6 +46,11 @@ module Fog
|
|
|
52
46
|
|
|
53
47
|
@go_grid_api_key = options[:go_grid_api_key]
|
|
54
48
|
@go_grid_shared_secret = options[:go_grid_shared_secret]
|
|
49
|
+
reset_data
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def reset_data
|
|
53
|
+
self.class.data.delete(@go_grid_api_key)
|
|
55
54
|
@data = self.class.data[@go_grid_api_key]
|
|
56
55
|
end
|
|
57
56
|
|
data/lib/fog/compute/linode.rb
CHANGED
|
@@ -31,12 +31,6 @@ module Fog
|
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def self.reset_data(keys=data.keys)
|
|
35
|
-
for key in [*keys]
|
|
36
|
-
data.delete(key)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
34
|
def initialize(options={})
|
|
41
35
|
unless options.delete(:provider)
|
|
42
36
|
location = caller.first
|
|
@@ -46,6 +40,11 @@ module Fog
|
|
|
46
40
|
end
|
|
47
41
|
|
|
48
42
|
@linode_api_key = options[:linode_api_key]
|
|
43
|
+
reset_data
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def reset_data
|
|
47
|
+
self.class.data.delete(@linode_api_key)
|
|
49
48
|
@data = self.class.data[@linode_api_key]
|
|
50
49
|
end
|
|
51
50
|
|
|
@@ -5,6 +5,24 @@ module Fog
|
|
|
5
5
|
module AWS
|
|
6
6
|
class Compute
|
|
7
7
|
|
|
8
|
+
FLAVORS = [
|
|
9
|
+
{ :bits => 0, :cores => 2, :disk => 0, :id => 't1.micro', :name => 'Micro Instance', :ram => 613},
|
|
10
|
+
|
|
11
|
+
{ :bits => 32, :cores => 1, :disk => 160, :id => 'm1.small', :name => 'Small Instance', :ram => 1740.8},
|
|
12
|
+
{ :bits => 64, :cores => 4, :disk => 850, :id => 'm1.large', :name => 'Large Instance', :ram => 7680},
|
|
13
|
+
{ :bits => 64, :cores => 8, :disk => 1690, :id => 'm1.xlarge', :name => 'Extra Large Instance', :ram => 15360},
|
|
14
|
+
|
|
15
|
+
{ :bits => 32, :cores => 5, :disk => 350, :id => 'c1.medium', :name => 'High-CPU Medium', :ram => 1740.8},
|
|
16
|
+
{ :bits => 64, :cores => 20, :disk => 1690, :id => 'c1.xlarge', :name => 'High-CPU Extra Large', :ram => 7168},
|
|
17
|
+
|
|
18
|
+
{ :bits => 64, :cores => 6.5, :disk => 420, :id => 'm2.xlarge', :name => 'High-Memory Extra Large', :ram => 17510.4},
|
|
19
|
+
{ :bits => 64, :cores => 13, :disk => 850, :id => 'm2.2xlarge', :name => 'High Memory Double Extra Large', :ram => 35020.8},
|
|
20
|
+
{ :bits => 64, :cores => 26, :disk => 1690, :id => 'm2.4xlarge', :name => 'High Memory Quadruple Extra Large', :ram => 70041.6},
|
|
21
|
+
|
|
22
|
+
{ :bits => 64, :cores => 33.5, :disk => 1690, :id => 'cc1.4xlarge', :name => 'Cluster Compute Quadruple Extra Large', :ram => 23552},
|
|
23
|
+
{ :bits => 64, :cores => 33.5, :disk => 1690, :id => 'cg1.4xlarge', :name => 'Cluster GPU Quadruple Extra Large', :ram => 22528}
|
|
24
|
+
]
|
|
25
|
+
|
|
8
26
|
class Flavors < Fog::Collection
|
|
9
27
|
|
|
10
28
|
model Fog::AWS::Compute::Flavor
|
|
@@ -113,24 +131,7 @@ module Fog
|
|
|
113
131
|
#
|
|
114
132
|
|
|
115
133
|
def all
|
|
116
|
-
|
|
117
|
-
{ :bits => 0, :cores => 2, :disk => 0, :id => 't1.micro', :name => 'Micro Instance', :ram => 613},
|
|
118
|
-
|
|
119
|
-
{ :bits => 32, :cores => 1, :disk => 160, :id => 'm1.small', :name => 'Small Instance', :ram => 1740.8},
|
|
120
|
-
{ :bits => 64, :cores => 4, :disk => 850, :id => 'm1.large', :name => 'Large Instance', :ram => 7680},
|
|
121
|
-
{ :bits => 64, :cores => 8, :disk => 1690, :id => 'm1.xlarge', :name => 'Extra Large Instance', :ram => 15360},
|
|
122
|
-
|
|
123
|
-
{ :bits => 32, :cores => 5, :disk => 350, :id => 'c1.medium', :name => 'High-CPU Medium', :ram => 1740.8},
|
|
124
|
-
{ :bits => 64, :cores => 20, :disk => 1690, :id => 'c1.xlarge', :name => 'High-CPU Extra Large', :ram => 7168},
|
|
125
|
-
|
|
126
|
-
{ :bits => 64, :cores => 6.5, :disk => 420, :id => 'm2.xlarge', :name => 'High-Memory Extra Large', :ram => 17510.4},
|
|
127
|
-
{ :bits => 64, :cores => 13, :disk => 850, :id => 'm2.2xlarge', :name => 'High Memory Double Extra Large', :ram => 35020.8},
|
|
128
|
-
{ :bits => 64, :cores => 26, :disk => 1690, :id => 'm2.4xlarge', :name => 'High Memory Quadruple Extra Large', :ram => 70041.6},
|
|
129
|
-
|
|
130
|
-
{ :bits => 64, :cores => 33.5, :disk => 1690, :id => 'cc1.4xlarge', :name => 'Cluster Compute Quadruple Extra Large', :ram => 23552},
|
|
131
|
-
{ :bits => 64, :cores => 33.5, :disk => 1690, :id => 'cg1.4xlarge', :name => 'Cluster GPU Quadruple Extra Large', :ram => 22528}
|
|
132
|
-
]
|
|
133
|
-
load(data)
|
|
134
|
+
load(Fog::AWS::Compute::FLAVORS)
|
|
134
135
|
self
|
|
135
136
|
end
|
|
136
137
|
|
|
@@ -215,6 +215,29 @@ module Fog
|
|
|
215
215
|
connection.volumes(:server => self)
|
|
216
216
|
end
|
|
217
217
|
|
|
218
|
+
#I tried to call it monitoring= and be smart with attributes[]
|
|
219
|
+
#but in #save a merge_attribute is called after run_instance
|
|
220
|
+
#thus making an un-necessary request. Use this until finding a clever solution
|
|
221
|
+
def monitor=(boolean)
|
|
222
|
+
|
|
223
|
+
#we don't have a server yet. the status silently goes in the attributes for run_instances
|
|
224
|
+
if !identity
|
|
225
|
+
self.monitoring=boolean
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
case boolean
|
|
229
|
+
when true
|
|
230
|
+
response = connection.monitor_instances(identity)
|
|
231
|
+
when false
|
|
232
|
+
response = connection.unmonitor_instances(identity)
|
|
233
|
+
else
|
|
234
|
+
raise ArgumentError.new("only Boolean allowed here")
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
#set the attribute, there is only one instance_id here
|
|
238
|
+
response.body['instancesSet'][0]['monitoring'] == 'enabled' ? self.monitoring=true : self.monitoring=false
|
|
239
|
+
end
|
|
240
|
+
|
|
218
241
|
end
|
|
219
242
|
|
|
220
243
|
end
|
|
@@ -72,7 +72,7 @@ module Fog
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def private_ip_address
|
|
75
|
-
|
|
75
|
+
interfaces.first
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def public_ip_address
|
|
@@ -83,6 +83,12 @@ module Fog
|
|
|
83
83
|
status == 'active'
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
def activate_console
|
|
87
|
+
requires :identity
|
|
88
|
+
response = connection.activate_console_server(identity)
|
|
89
|
+
[response["console_url"], response["console_token"], response["console_token_expires"]]
|
|
90
|
+
end
|
|
91
|
+
|
|
86
92
|
def save
|
|
87
93
|
requires :image_id
|
|
88
94
|
options = {
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
require 'fog/core/model'
|
|
2
|
+
require 'fog/compute/models/virtual_box/medium_format'
|
|
3
|
+
|
|
4
|
+
module Fog
|
|
5
|
+
module VirtualBox
|
|
6
|
+
class Compute
|
|
7
|
+
|
|
8
|
+
class Medium < Fog::Model
|
|
9
|
+
|
|
10
|
+
identity :id
|
|
11
|
+
|
|
12
|
+
attribute :auto_reset
|
|
13
|
+
attribute :base
|
|
14
|
+
attribute :children
|
|
15
|
+
attribute :description
|
|
16
|
+
attribute :device_type
|
|
17
|
+
attribute :format
|
|
18
|
+
attribute :host_drive
|
|
19
|
+
attribute :id
|
|
20
|
+
attribute :last_access_error
|
|
21
|
+
attribute :location
|
|
22
|
+
attribute :logical_size
|
|
23
|
+
attribute :machine_ids
|
|
24
|
+
attribute :medium_format
|
|
25
|
+
attribute :name
|
|
26
|
+
attribute :parent
|
|
27
|
+
attribute :read_only
|
|
28
|
+
attribute :size
|
|
29
|
+
attribute :state
|
|
30
|
+
attribute :type
|
|
31
|
+
attribute :variant
|
|
32
|
+
|
|
33
|
+
def destroy
|
|
34
|
+
requires :raw
|
|
35
|
+
raw.close
|
|
36
|
+
true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
undef_method :medium_format
|
|
40
|
+
def medium_format
|
|
41
|
+
Fog::VirtualBox::Compute::MediumFormat.new(
|
|
42
|
+
:connection => connection,
|
|
43
|
+
:raw => raw.medium_format
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def save
|
|
48
|
+
requires :device_type, :location, :read_only
|
|
49
|
+
|
|
50
|
+
if File.exists?(location)
|
|
51
|
+
|
|
52
|
+
access_mode = if read_only
|
|
53
|
+
:access_mode_read_only
|
|
54
|
+
else
|
|
55
|
+
:access_mode_read_write
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
self.raw = connection.open_medium(location, device_type, access_mode)
|
|
59
|
+
|
|
60
|
+
else
|
|
61
|
+
|
|
62
|
+
raise Fog::Errors::Error.new('Creating a new medium is not yet implemented. Contributions welcome!')
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
def raw
|
|
70
|
+
@raw
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def raw=(new_raw)
|
|
74
|
+
@raw = new_raw
|
|
75
|
+
raw_attributes = {}
|
|
76
|
+
for key in [:auto_reset, :base, :children, :description, :device_type, :format, :host_drive, :id, :last_access_error, :location, :logical_size, :machine_ids, :medium_format, :name, :parent, :read_only, :size, :state, :type, :variant]
|
|
77
|
+
raw_attributes[key] = @raw.send(key)
|
|
78
|
+
end
|
|
79
|
+
merge_attributes(raw_attributes)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|