fog 1.28.0 → 1.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +111 -0
  3. data/CONTRIBUTING.md +255 -1
  4. data/Rakefile +1 -1
  5. data/fog.gemspec +41 -44
  6. data/lib/fog.rb +1 -0
  7. data/lib/fog/bin.rb +1 -0
  8. data/lib/fog/bin/openstack.rb +2 -0
  9. data/lib/fog/cloudsigma/mock_data.rb +37 -33
  10. data/lib/fog/dnsmadeeasy/models/dns/record.rb +1 -1
  11. data/lib/fog/fogdocker/requests/compute/api_version.rb +1 -1
  12. data/lib/fog/glesys/compute.rb +9 -1
  13. data/lib/fog/glesys/models/compute/server.rb +32 -21
  14. data/lib/fog/glesys/models/compute/ssh_key.rb +28 -0
  15. data/lib/fog/glesys/models/compute/ssh_keys.rb +21 -0
  16. data/lib/fog/glesys/requests/compute/edit.rb +11 -0
  17. data/lib/fog/glesys/requests/compute/ssh_key_add.rb +11 -0
  18. data/lib/fog/glesys/requests/compute/ssh_key_list.rb +11 -0
  19. data/lib/fog/glesys/requests/compute/ssh_key_remove.rb +11 -0
  20. data/lib/fog/google/compute.rb +2 -0
  21. data/lib/fog/google/models/compute/server.rb +14 -0
  22. data/lib/fog/google/requests/compute/start_server.rb +24 -0
  23. data/lib/fog/google/requests/compute/stop_server.rb +24 -0
  24. data/lib/fog/linode/compute.rb +7 -0
  25. data/lib/fog/linode/requests/compute/image_delete.rb +42 -0
  26. data/lib/fog/linode/requests/compute/image_list.rb +64 -0
  27. data/lib/fog/linode/requests/compute/linode_disk_createfromimage.rb +37 -0
  28. data/lib/fog/linode/requests/compute/linode_disk_duplicate.rb +33 -0
  29. data/lib/fog/linode/requests/compute/linode_disk_imagize.rb +37 -0
  30. data/lib/fog/linode/requests/compute/linode_disk_resize.rb +36 -0
  31. data/lib/fog/linode/requests/compute/linode_disk_update.rb +34 -0
  32. data/lib/fog/openstack.rb +1 -0
  33. data/lib/fog/openstack/compute.rb +12 -1
  34. data/lib/fog/openstack/core.rb +159 -5
  35. data/lib/fog/openstack/docs/planning.md +270 -0
  36. data/lib/fog/openstack/examples/planning/basics.rb +53 -0
  37. data/lib/fog/openstack/models/planning/plan.rb +81 -0
  38. data/lib/fog/openstack/models/planning/plans.rb +31 -0
  39. data/lib/fog/openstack/models/planning/role.rb +29 -0
  40. data/lib/fog/openstack/models/planning/roles.rb +16 -0
  41. data/lib/fog/openstack/planning.rb +235 -0
  42. data/lib/fog/openstack/requests/compute/get_hypervisor_statistics.rb +39 -0
  43. data/lib/fog/openstack/requests/identity/check_token.rb +4 -2
  44. data/lib/fog/openstack/requests/identity/validate_token.rb +4 -2
  45. data/lib/fog/openstack/requests/planning/add_role_to_plan.rb +40 -0
  46. data/lib/fog/openstack/requests/planning/create_plan.rb +33 -0
  47. data/lib/fog/openstack/requests/planning/delete_plan.rb +23 -0
  48. data/lib/fog/openstack/requests/planning/get_plan.rb +58 -0
  49. data/lib/fog/openstack/requests/planning/get_plan_templates.rb +28 -0
  50. data/lib/fog/openstack/requests/planning/list_plans.rb +60 -0
  51. data/lib/fog/openstack/requests/planning/list_roles.rb +38 -0
  52. data/lib/fog/openstack/requests/planning/patch_plan.rb +51 -0
  53. data/lib/fog/openstack/requests/planning/remove_role_from_plan.rb +32 -0
  54. data/lib/fog/ovirt/compute.rb +10 -0
  55. data/lib/fog/ovirt/models/compute/affinity_group.rb +25 -0
  56. data/lib/fog/ovirt/models/compute/affinity_groups.rb +20 -0
  57. data/lib/fog/ovirt/models/compute/server.rb +12 -0
  58. data/lib/fog/ovirt/models/compute/volume.rb +2 -0
  59. data/lib/fog/ovirt/requests/compute/add_to_affinity_group.rb +21 -0
  60. data/lib/fog/ovirt/requests/compute/create_affinity_group.rb +18 -0
  61. data/lib/fog/ovirt/requests/compute/destroy_affinity_group.rb +19 -0
  62. data/lib/fog/ovirt/requests/compute/get_affinity_group.rb +18 -0
  63. data/lib/fog/ovirt/requests/compute/list_affinity_group_vms.rb +22 -0
  64. data/lib/fog/ovirt/requests/compute/list_affinity_groups.rb +20 -0
  65. data/lib/fog/ovirt/requests/compute/mock_files/affinitygroup.xml +8 -0
  66. data/lib/fog/ovirt/requests/compute/mock_files/affinitygroup_vms.xml +9 -0
  67. data/lib/fog/ovirt/requests/compute/mock_files/affinitygroups.xml +17 -0
  68. data/lib/fog/ovirt/requests/compute/remove_from_affinity_group.rb +21 -0
  69. data/lib/fog/ovirt/requests/compute/update_interface.rb +18 -5
  70. data/lib/fog/rackspace/docs/block_storage.md +1 -1
  71. data/lib/fog/rackspace/docs/cdn_v2.md +1 -1
  72. data/lib/fog/rackspace/docs/compute_v2.md +1 -1
  73. data/lib/fog/rackspace/docs/getting_started.md +1 -1
  74. data/lib/fog/rackspace/docs/networking_v2.md +1 -1
  75. data/lib/fog/rackspace/docs/storage.md +1 -1
  76. data/lib/fog/rackspace/examples/README.md +1 -1
  77. data/lib/fog/rackspace/mock_data.rb +48 -48
  78. data/lib/fog/rackspace/models/networking_v2/security_group.rb +32 -0
  79. data/lib/fog/rackspace/models/networking_v2/security_group_rule.rb +38 -0
  80. data/lib/fog/rackspace/models/networking_v2/security_group_rules.rb +23 -0
  81. data/lib/fog/rackspace/models/networking_v2/security_groups.rb +23 -0
  82. data/lib/fog/rackspace/networking_v2.rb +24 -7
  83. data/lib/fog/rackspace/requests/networking_v2/create_security_group.rb +12 -0
  84. data/lib/fog/rackspace/requests/networking_v2/create_security_group_rule.rb +12 -0
  85. data/lib/fog/rackspace/requests/networking_v2/delete_security_group.rb +5 -0
  86. data/lib/fog/rackspace/requests/networking_v2/delete_security_group_rule.rb +5 -0
  87. data/lib/fog/rackspace/requests/networking_v2/list_security_group_rules.rb +5 -0
  88. data/lib/fog/rackspace/requests/networking_v2/list_security_groups.rb +5 -0
  89. data/lib/fog/rackspace/requests/networking_v2/show_security_group.rb +5 -0
  90. data/lib/fog/rackspace/requests/networking_v2/show_security_group_rule.rb +5 -0
  91. data/lib/fog/rackspace/requests/networking_v2/update_security_group.rb +12 -0
  92. data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +1 -1
  93. data/lib/fog/version.rb +1 -1
  94. data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +13 -4
  95. data/lib/fog/vsphere/requests/compute/vm_clone.rb +19 -6
  96. data/lib/fog/xenserver/requests/compute/create_vdi.rb +16 -6
  97. data/lib/tasks/changelog_task.rb +2 -1
  98. data/spec/fog/account_spec.rb +1 -2
  99. data/spec/fog/billing_spec.rb +1 -2
  100. data/spec/fog/bin/atmos_spec.rb +25 -2
  101. data/spec/fog/bin/aws_spec.rb +1 -2
  102. data/spec/fog/bin/baremetalcloud_spec.rb +25 -2
  103. data/spec/fog/bin/bluebox_spec.rb +47 -2
  104. data/spec/fog/bin/brightbox_spec.rb +1 -2
  105. data/spec/fog/bin/clodo_spec.rb +1 -2
  106. data/spec/fog/bin/cloudsigma_spec.rb +1 -2
  107. data/spec/fog/bin/cloudstack_spec.rb +1 -2
  108. data/spec/fog/bin/digitalocean_spec.rb +1 -2
  109. data/spec/fog/bin/dnsimple_spec.rb +1 -2
  110. data/spec/fog/bin/dnsmadeeasy_spec.rb +1 -2
  111. data/spec/fog/bin/dreamhost_spec.rb +1 -2
  112. data/spec/fog/bin/dynect_spec.rb +1 -2
  113. data/spec/fog/bin/powerdns_spec.rb +9 -0
  114. data/spec/fog/bin_spec.rb +4 -2
  115. data/spec/fog/cdn_spec.rb +1 -2
  116. data/spec/fog/compute_spec.rb +1 -2
  117. data/spec/fog/dns_spec.rb +1 -2
  118. data/spec/fog/identity_spec.rb +1 -2
  119. data/spec/fog/image_spec.rb +1 -2
  120. data/spec/fog/metering_spec.rb +1 -2
  121. data/spec/fog/monitoring_spec.rb +1 -2
  122. data/spec/fog/network_spec.rb +1 -2
  123. data/spec/fog/orchestration_spec.rb +1 -2
  124. data/spec/fog/storage_spec.rb +1 -2
  125. data/spec/fog/support_spec.rb +1 -2
  126. data/spec/fog/volume_spec.rb +1 -2
  127. data/spec/fog/vpn_spec.rb +1 -2
  128. data/spec/fog/xml/connection_spec.rb +1 -2
  129. data/spec/helpers/bin.rb +4 -0
  130. data/spec/spec_helper.rb +15 -0
  131. data/tests/compute/helper.rb +3 -0
  132. data/tests/glesys/requests/compute/helper.rb +66 -2
  133. data/tests/glesys/requests/compute/server_tests.rb +22 -6
  134. data/tests/glesys/requests/compute/ssh_key_tests.rb +47 -0
  135. data/tests/google/credentials_tests.rb +73 -0
  136. data/tests/helper.rb +5 -1
  137. data/tests/linode/requests/compute/linode_tests.rb +76 -3
  138. data/tests/openstack/authenticate_tests.rb +10 -0
  139. data/tests/openstack/models/planning/.gitkeep +0 -0
  140. data/tests/openstack/models/planning/plan_tests.rb +51 -0
  141. data/tests/openstack/models/planning/plans_tests.rb +18 -0
  142. data/tests/openstack/models/planning/role_tests.rb +14 -0
  143. data/tests/openstack/requests/planning/.gitkeep +0 -0
  144. data/tests/openstack/requests/planning/plan_tests.rb +65 -0
  145. data/tests/openstack/requests/planning/role_tests.rb +16 -0
  146. metadata +193 -75
  147. data/lib/fog/bin/atmos.rb +0 -29
  148. data/lib/fog/bin/local.rb +0 -29
  149. data/lib/fog/local.rb +0 -1
  150. data/lib/fog/local/core.rb +0 -9
  151. data/lib/fog/local/models/storage/directories.rb +0 -33
  152. data/lib/fog/local/models/storage/directory.rb +0 -53
  153. data/lib/fog/local/models/storage/file.rb +0 -132
  154. data/lib/fog/local/models/storage/files.rb +0 -84
  155. data/lib/fog/local/storage.rb +0 -96
  156. data/tests/local/models/directories_tests.rb +0 -17
  157. data/tests/local/models/directory_tests.rb +0 -16
  158. data/tests/local/models/file_tests.rb +0 -43
  159. data/tests/local/storage_tests.rb +0 -40
data/lib/fog.rb CHANGED
@@ -49,6 +49,7 @@ require 'fog/rage4'
49
49
  require 'fog/riakcs'
50
50
  require 'fog/openstack'
51
51
  require 'fog/ovirt'
52
+ require 'fog/powerdns'
52
53
  require 'fog/profitbricks'
53
54
  require 'fog/sakuracloud'
54
55
  require 'fog/serverlove'
@@ -81,6 +81,7 @@ require 'fog/bin/rage4'
81
81
  require 'fog/bin/riakcs'
82
82
  require 'fog/bin/openstack'
83
83
  require 'fog/bin/ovirt'
84
+ require 'fog/bin/powerdns'
84
85
  require 'fog/bin/profitbricks'
85
86
  require 'fog/bin/sakuracloud'
86
87
  require 'fog/bin/serverlove'
@@ -20,6 +20,8 @@ class OpenStack < Fog::Bin
20
20
  Fog::Orchestration::OpenStack
21
21
  when :baremetal
22
22
  Fog::Baremetal::OpenStack
23
+ when :planning
24
+ Fog::Openstack::Planning
23
25
  else
24
26
  raise ArgumentError, "Unrecognized service: #{key}"
25
27
  end
@@ -4,39 +4,43 @@ module Fog
4
4
  class Mock
5
5
  def self.mock_data
6
6
  {
7
- :volumes => {},
8
- :servers => {},
9
- :vlans => {},
10
- :ips => {},
11
- :profile => {:login_sms=>false,
12
- :town=>"",
13
- :postcode=>"",
14
- :reseller=>"",
15
- :has_autotopup=>false,
16
- :currency=>"CHF",
17
- :state=>"REGULAR",
18
- :uuid=>"6c2203a1-a2e6-433f-aeab-b976b8cd3d18",
19
- :company=>"",
20
- :api_https_only=>false,
21
- :my_notes=>"",
22
- :key_auth=>false,
23
- :email=>"MyFirstName.MyLasttName@MyCompany.com",
24
- :bank_reference=>"mmlastname278",
25
- :first_name=>"MyFirstName",
26
- :meta =>"",
27
- :phone=>"",
28
- :language=>"EN",
29
- :vat=>"",
30
- :last_name=>"MyLasttName",
31
- :title=>"",
32
- :mailing_list=>true,
33
- :autotopup_amount=>0.0,
34
- :country=>"",
35
- :address=>""},
36
- :subscriptions => {},
37
- :current_usage => {},
38
- :balance => {:balance => 100, :currency => 'CHF'},
39
-
7
+ :volumes => {},
8
+ :servers => {},
9
+ :vlans => {},
10
+ :ips => {},
11
+ :profile => {
12
+ :login_sms => false,
13
+ :town => "",
14
+ :postcode => "",
15
+ :reseller => "",
16
+ :has_autotopup => false,
17
+ :currency => "CHF",
18
+ :state => "REGULAR",
19
+ :uuid => "6c2203a1-a2e6-433f-aeab-b976b8cd3d18",
20
+ :company => "",
21
+ :api_https_only => false,
22
+ :my_notes => "",
23
+ :key_auth => false,
24
+ :email => "MyFirstName.MyLasttName@MyCompany.com",
25
+ :bank_reference => "mmlastname278",
26
+ :first_name => "MyFirstName",
27
+ :meta =>"",
28
+ :phone => "",
29
+ :language => "EN",
30
+ :vat => "",
31
+ :last_name => "MyLasttName",
32
+ :title => "",
33
+ :mailing_list => true,
34
+ :autotopup_amount => 0.0,
35
+ :country => "",
36
+ :address => ""
37
+ },
38
+ :subscriptions => {},
39
+ :current_usage => {},
40
+ :balance => {
41
+ :balance => 100,
42
+ :currency => 'CHF'
43
+ }
40
44
  }
41
45
  end
42
46
  end
@@ -28,7 +28,7 @@ module Fog
28
28
  end
29
29
 
30
30
  def destroy
31
- service.delete_record(zone.domain, identity)
31
+ service.delete_record(zone.id, identity)
32
32
  true
33
33
  end
34
34
 
@@ -3,7 +3,7 @@ module Fog
3
3
  class Fogdocker
4
4
  class Real
5
5
  def api_version
6
- Docker.version
6
+ Docker.version(@connection)
7
7
  end
8
8
  end
9
9
  class Mock
@@ -14,11 +14,14 @@ module Fog
14
14
  model :template
15
15
  collection :ips
16
16
  model :ip
17
+ collection :ssh_keys
18
+ model :ssh_key
17
19
 
18
20
  request_path 'fog/glesys/requests/compute'
19
21
 
20
22
  # Server
21
23
  request :create
24
+ request :edit
22
25
  request :destroy
23
26
  request :list_servers
24
27
  request :server_details
@@ -39,6 +42,11 @@ module Fog
39
42
  request :ip_add
40
43
  request :ip_remove
41
44
 
45
+ # SSH keys
46
+ request :ssh_key_list
47
+ request :ssh_key_add
48
+ request :ssh_key_remove
49
+
42
50
  class Mock
43
51
  def initialize(options={})
44
52
  @api_url = options[:glesys_api_url] || API_URL
@@ -120,7 +128,7 @@ module Fog
120
128
  end
121
129
 
122
130
  def urlencode(hash)
123
- hash.to_a.map! { |k, v| "#{k}=#{v.to_s}" }.join("&")
131
+ hash.to_a.map! { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join("&")
124
132
  end
125
133
  end
126
134
  end
@@ -53,28 +53,39 @@ module Fog
53
53
  end
54
54
 
55
55
  def save
56
- raise "Operation not supported" if self.identity
57
- requires :hostname, :rootpassword
58
-
59
- options = {
60
- :datacenter => datacenter || "Falkenberg",
61
- :platform => platform || "Xen",
62
- :hostname => hostname,
63
- :templatename => templatename || "Debian-6 x64",
64
- :disksize => disksize || "10",
65
- :memorysize => memorysize || "512",
66
- :cpucores => cpucores || "1",
67
- :rootpassword => rootpassword,
68
- :transfer => transfer || "500",
69
- :bandwidth => bandwidth || "10",
70
- }
71
-
72
- # optional options when creating a server:
73
- [:ip, :ipv6, :description].each do |k|
74
- options[k] = attributes[k] if attributes[k]
56
+ if self.identity
57
+ options = {
58
+ :serverid => self.identity,
59
+ :disksize => disksize,
60
+ :memorysize => memorysize,
61
+ :cpucores => cpucores,
62
+ :hostname => hostname,
63
+ :bandwidth => bandwidth
64
+ }
65
+ data = service.edit(options)
66
+ else
67
+ requires :hostname, :rootpassword
68
+
69
+ options = {
70
+ :datacenter => datacenter || "Falkenberg",
71
+ :platform => platform || "OpenVz",
72
+ :hostname => hostname,
73
+ :templatename => templatename || "Debian 7.0 64-bit",
74
+ :disksize => disksize || "10",
75
+ :memorysize => memorysize || "512",
76
+ :cpucores => cpucores || "1",
77
+ :rootpassword => rootpassword,
78
+ :transfer => transfer || "500",
79
+ :bandwidth => bandwidth || "10",
80
+ }
81
+
82
+ # optional options when creating a server:
83
+ [:ip, :ipv6, :description].each do |k|
84
+ options[k] = attributes[k] if attributes[k]
85
+ end
86
+
87
+ data = service.create(options)
75
88
  end
76
-
77
- data = service.create(options)
78
89
  merge_attributes(data.body['response']['server'])
79
90
  data.status == 200 ? true : false
80
91
  end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module Compute
3
+ class Glesys
4
+ class SshKey < Fog::Model
5
+ identity :id
6
+
7
+ attribute :description
8
+ attribute :data
9
+
10
+ def save
11
+ requires :description, :data
12
+
13
+ merge_attributes(service.ssh_key_add(:description => description,
14
+ :sshkey => data
15
+ ).body["response"]["sshkey"])
16
+ true
17
+ end
18
+
19
+ def destroy
20
+ requires :id
21
+
22
+ service.ssh_key_remove(:sshkeyids => id)
23
+ true
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ require "fog/glesys/models/compute/ssh_key"
2
+
3
+ module Fog
4
+ module Compute
5
+ class Glesys
6
+ class SshKeys < Fog::Collection
7
+ model Fog::Compute::Glesys::SshKey
8
+
9
+ def all
10
+ data = service.ssh_key_list.body["response"]["sshkeys"]
11
+ load(data)
12
+ end
13
+
14
+ def get(id)
15
+ hash = service.ssh_key_list.body["response"]["sshkeys"].find{|a| a["id"] == id}
16
+ hash.nil? ? nil : new(hash)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ module Fog
2
+ module Compute
3
+ class Glesys
4
+ class Real
5
+ def edit(options = {})
6
+ request('server/edit/',options)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Fog
2
+ module Compute
3
+ class Glesys
4
+ class Real
5
+ def ssh_key_add(options)
6
+ request("sshkey/add", options)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Fog
2
+ module Compute
3
+ class Glesys
4
+ class Real
5
+ def ssh_key_list(options = {})
6
+ request("sshkey/list", options)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Fog
2
+ module Compute
3
+ class Glesys
4
+ class Real
5
+ def ssh_key_remove(options)
6
+ request("sshkey/remove", options)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -147,6 +147,8 @@ module Fog
147
147
  request :delete_server_access_config
148
148
  request :update_url_map
149
149
  request :validate_url_map
150
+ request :start_server
151
+ request :stop_server
150
152
 
151
153
  model_path 'fog/google/models/compute'
152
154
  model :server
@@ -129,6 +129,20 @@ module Fog
129
129
  Fog::Compute::Google::Operations.new(:service => service).get(data.body['name'], data.body['zone'])
130
130
  end
131
131
 
132
+ def start
133
+ requires :identity, :zone
134
+
135
+ data = service.start_server(identity, zone_name)
136
+ Fog::Compute::Google::Operations.new(:service => service).get(data.body['name'], data.body['zone'])
137
+ end
138
+
139
+ def stop
140
+ requires :identity, :zone
141
+
142
+ data = service.stop_server(identity, zone_name)
143
+ Fog::Compute::Google::Operations.new(:service => service).get(data.body['name'], data.body['zone'])
144
+ end
145
+
132
146
  def serial_port_output
133
147
  requires :identity, :zone
134
148
 
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Compute
3
+ class Google
4
+ class Mock
5
+ def start_server(identity, zone_name)
6
+ Fog::Mock.not_implemented
7
+ end
8
+ end
9
+
10
+ class Real
11
+ def start_server(identity, zone_name)
12
+ api_method = @compute.instances.start
13
+ parameters = {
14
+ 'project' => @project,
15
+ 'zone' => zone_name,
16
+ 'instance' => identity,
17
+ }
18
+
19
+ request(api_method, parameters)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Compute
3
+ class Google
4
+ class Mock
5
+ def stop_server(identity, zone_name)
6
+ Fog::Mock.not_implemented
7
+ end
8
+ end
9
+
10
+ class Real
11
+ def stop_server(identity, zone_name)
12
+ api_method = @compute.instances.stop
13
+ parameters = {
14
+ 'project' => @project,
15
+ 'zone' => zone_name,
16
+ 'instance' => identity,
17
+ }
18
+
19
+ request(api_method, parameters)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -33,8 +33,15 @@ module Fog
33
33
  request :linode_disk_create
34
34
  request :linode_disk_list
35
35
  request :linode_disk_delete
36
+ request :linode_disk_resize
37
+ request :linode_disk_update
38
+ request :linode_disk_imagize
39
+ request :linode_disk_duplicate
36
40
  request :linode_disk_createfromdistribution
37
41
  request :linode_disk_createfromstackscript
42
+ request :linode_disk_createfromimage
43
+ request :image_list
44
+ request :image_delete
38
45
  request :linode_ip_list
39
46
  request :linode_ip_addprivate
40
47
  request :linode_config_list
@@ -0,0 +1,42 @@
1
+ module Fog
2
+ module Compute
3
+ class Linode
4
+ class Real
5
+ def image_delete(image_id)
6
+ request(
7
+ :expects => 200,
8
+ :method => 'GET',
9
+ :query => {
10
+ :api_action => 'image.delete',
11
+ :imageId => image_id
12
+ }
13
+ )
14
+ end
15
+ end
16
+
17
+ class Mock
18
+ def image_delete(image_id, status='available')
19
+ size = rand(1..999999)
20
+ response = Excon::Response.new
21
+ response.status = 200
22
+ response.body = {
23
+ "ERRORARRAY" => [],
24
+ "ACTION" => "image.delete",
25
+ "DATA" => { "LAST_USED_DT" => "2014-07-21 12:31:54.0",
26
+ "DESCRIPTION" => "Fog Mock Linode Image #{image_id}",
27
+ "LABEL" => "test_#{image_id}_image",
28
+ "STATUS" => status,
29
+ "SIZE" => size,
30
+ "ISPUBLIC" => rand(0..1),
31
+ "CREATE_DT" => "2014-06-23 13:45:12.0",
32
+ "USED" => rand(1..size),
33
+ "FS_TYPE" => "ext4",
34
+ "USERID" => Fog::Mock.random_numbers(4),
35
+ "IMAGEID" => image_id }
36
+ }
37
+ response
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end