fog-digitalocean 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -2
  3. data/README.md +1 -2
  4. data/lib/fog/bin/digitalocean.rb +30 -0
  5. data/lib/fog/digitalocean/compute.rb +27 -15
  6. data/lib/fog/digitalocean/models/compute/volume.rb +15 -0
  7. data/lib/fog/digitalocean/models/compute/volumes.rb +42 -0
  8. data/lib/fog/digitalocean/requests/compute/attach_volume.rb +122 -0
  9. data/lib/fog/digitalocean/requests/compute/create_server.rb +2 -0
  10. data/lib/fog/digitalocean/requests/compute/create_volume.rb +50 -0
  11. data/lib/fog/digitalocean/requests/compute/destroy_volume.rb +32 -0
  12. data/lib/fog/digitalocean/requests/compute/detach_volume.rb +121 -0
  13. data/lib/fog/digitalocean/requests/compute/get_image_details.rb +1 -1
  14. data/lib/fog/digitalocean/requests/compute/get_volume_details.rb +60 -0
  15. data/lib/fog/digitalocean/requests/compute/list_volume_actions.rb +64 -0
  16. data/lib/fog/digitalocean/requests/compute/list_volumes.rb +64 -0
  17. data/lib/fog/digitalocean/requests/compute/resize_volume.rb +65 -0
  18. data/lib/fog/digitalocean/version.rb +1 -1
  19. data/tests/digitalocean/requests/compute/attach_volume_tests.rb +10 -0
  20. data/tests/digitalocean/requests/compute/create_volume_tests.rb +10 -0
  21. data/tests/digitalocean/requests/{compute_v2 → compute}/list_ssh_keys_tests.rb +2 -2
  22. data/tests/digitalocean/requests/compute/list_volumes_tests.rb +23 -0
  23. metadata +21 -136
  24. data/benchs/each_provider.sh +0 -6
  25. data/benchs/each_service.sh +0 -6
  26. data/benchs/fog_vs.rb +0 -106
  27. data/benchs/load_times.rb +0 -37
  28. data/benchs/params.rb +0 -43
  29. data/benchs/parse_vs_push.rb +0 -67
  30. data/spec/fog/account_spec.rb +0 -14
  31. data/spec/fog/billing_spec.rb +0 -14
  32. data/spec/fog/bin/atmos_spec.rb +0 -33
  33. data/spec/fog/bin/aws_spec.rb +0 -98
  34. data/spec/fog/bin/baremetalcloud_spec.rb +0 -33
  35. data/spec/fog/bin/bluebox_spec.rb +0 -55
  36. data/spec/fog/bin/brightbox_spec.rb +0 -30
  37. data/spec/fog/bin/clodo_spec.rb +0 -9
  38. data/spec/fog/bin/cloudsigma_spec.rb +0 -9
  39. data/spec/fog/bin/cloudstack_spec.rb +0 -9
  40. data/spec/fog/bin/digitalocean_spec.rb +0 -9
  41. data/spec/fog/bin/dnsimple_spec.rb +0 -9
  42. data/spec/fog/bin/dnsmadeeasy_spec.rb +0 -9
  43. data/spec/fog/bin/dreamhost_spec.rb +0 -9
  44. data/spec/fog/bin/dynect_spec.rb +0 -9
  45. data/spec/fog/bin/ecloud_spec.rb +0 -10
  46. data/spec/fog/bin/fogdocker_spec.rb +0 -10
  47. data/spec/fog/bin/glesys_spec.rb +0 -10
  48. data/spec/fog/bin/gogrid_spec.rb +0 -10
  49. data/spec/fog/bin/google_spec.rb +0 -10
  50. data/spec/fog/bin/ibm_spec.rb +0 -10
  51. data/spec/fog/bin/internetarchive_spec.rb +0 -10
  52. data/spec/fog/bin/joyent_spec.rb +0 -10
  53. data/spec/fog/bin/linode_spec.rb +0 -10
  54. data/spec/fog/bin/local_spec.rb +0 -10
  55. data/spec/fog/bin/ninefold_spec.rb +0 -10
  56. data/spec/fog/bin/opennebula_spec.rb +0 -10
  57. data/spec/fog/bin/openstack_spec.rb +0 -10
  58. data/spec/fog/bin/openvz_spec.rb +0 -10
  59. data/spec/fog/bin/ovirt_spec.rb +0 -10
  60. data/spec/fog/bin/powerdns_spec.rb +0 -9
  61. data/spec/fog/bin/profitbricks_spec.rb +0 -10
  62. data/spec/fog/bin/rackspace_spec.rb +0 -10
  63. data/spec/fog/bin/rage4_spec.rb +0 -10
  64. data/spec/fog/bin/riakcs_spec.rb +0 -10
  65. data/spec/fog/bin/sakuracloud_spec.rb +0 -10
  66. data/spec/fog/bin/serverlove_spec.rb +0 -10
  67. data/spec/fog/bin/softlayer_spec.rb +0 -10
  68. data/spec/fog/bin/stormondemand_spec.rb +0 -10
  69. data/spec/fog/bin/vcloud_spec.rb +0 -10
  70. data/spec/fog/bin/vclouddirector_spec.rb +0 -10
  71. data/spec/fog/bin/vmfusion_spec.rb +0 -10
  72. data/spec/fog/bin/voxel_spec.rb +0 -10
  73. data/spec/fog/bin/vsphere_spec.rb +0 -10
  74. data/spec/fog/bin/xenserver_spec.rb +0 -10
  75. data/spec/fog/bin/zerigo_spec.rb +0 -10
  76. data/spec/fog/bin_spec.rb +0 -161
  77. data/spec/fog/cdn_spec.rb +0 -14
  78. data/spec/fog/compute_spec.rb +0 -19
  79. data/spec/fog/dns_spec.rb +0 -19
  80. data/spec/fog/identity_spec.rb +0 -14
  81. data/spec/fog/image_spec.rb +0 -14
  82. data/spec/fog/metering_spec.rb +0 -14
  83. data/spec/fog/monitoring_spec.rb +0 -14
  84. data/spec/fog/network_spec.rb +0 -14
  85. data/spec/fog/orchestration_spec.rb +0 -14
  86. data/spec/fog/storage_spec.rb +0 -14
  87. data/spec/fog/support_spec.rb +0 -14
  88. data/spec/fog/volume_spec.rb +0 -14
  89. data/spec/fog/vpn_spec.rb +0 -14
  90. data/spec/fog/xml/connection_spec.rb +0 -33
  91. data/spec/helpers/bin.rb +0 -34
  92. data/spec/spec_helper.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0d1f0a2b72384d646324f601ac5d312e6eee474
4
- data.tar.gz: 60140fa5a57daa971f1b7c7bd6d9b357f21abbf9
3
+ metadata.gz: 513a6875f022151b9545f3b3f4d7fe8236ce6508
4
+ data.tar.gz: 434ba36da2d1b3c13afdec9357e7268f46be641a
5
5
  SHA512:
6
- metadata.gz: 52d6d1c02d91a16f6e423d380e687bc65d643bcc5db2ca3e46ce0795691e886f0af70f6585f33f36433720c9889f17ec6f6a4de869b2bbd4f33a9dec9ca3cce1
7
- data.tar.gz: 6168e02e92c371ec028ce5bd69ed7d75707852623263cf1f55b23cbc0287e22b05530045f39e33c766f48f2f606a4983d045616818ab1309b777713bed2e5721
6
+ metadata.gz: e7a0835e58e814fcb07ad1c80f5accf14f8ec62c6365c64616e0524e6d7e06b6aa1f745b8528a09b7bf97d00a4859330b8c6c8f42393c4086126440f8a0a3d75
7
+ data.tar.gz: 30a58ff8c614d0c3d25a282be35d054cea85bb55ae17a8bcc3f114b886036e630bb464f166de39be3cabbd59e90fc060d7a161a018e5f5a3dda2474b3126de54
@@ -1,3 +1,15 @@
1
- ## 1.0.0 03/20/2016
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
2
4
 
3
- Initial Release of separate gem.
5
+ ## [0.2.0] - 2016-09-28
6
+ ### Added
7
+ - Volume Support
8
+ - Block Storage Support
9
+
10
+ ### Fixed
11
+ - Missing binary
12
+
13
+ ## [0.1.0] - 2016-03-20
14
+ ### Changed
15
+ - Port into a separate gem
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Fog::DigitalOcean
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/fog-digitalocean.svg)](http://badge.fury.io/rb/fog-digitalocean) [![Build Status](https://travis-ci.org/fog/fog-digitalocean.svg?branch=master)](https://travis-ci.org/fog/fog-digitalocean) [![Dependency Status](https://gemnasium.com/fog/fog-digitalocean.svg)](https://gemnasium.com/fog/fog-digitalocean) [![Coverage Status](https://coveralls.io/repos/github/fog/fog-digitalocean/badge.svg?branch=master)](https://coveralls.io/github/fog/fog-digitalocean?branch=master) [![Code Climate](https://codeclimate.com/github/fog/fog-digitalocean/badges/gpa.svg)](https://codeclimate.com/github/fog/fog-digitalocean) [![Join the chat at https://gitter.im/fog/fog-digitalocean](https://badges.gitter.im/fog/fog-digitalocean.svg)](https://gitter.im/fog/fog-digitalocean?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
+ [![Gem Version](https://badge.fury.io/rb/fog-digitalocean.svg)](https://badge.fury.io/rb/fog-digitalocean) [![Build Status](https://travis-ci.org/fog/fog-digitalocean.svg?branch=master)](https://travis-ci.org/fog/fog-digitalocean) [![Dependency Status](https://gemnasium.com/fog/fog-digitalocean.svg)](https://gemnasium.com/fog/fog-digitalocean) [![Coverage Status](https://coveralls.io/repos/github/fog/fog-digitalocean/badge.svg?branch=master)](https://coveralls.io/github/fog/fog-digitalocean?branch=master) [![Code Climate](https://codeclimate.com/github/fog/fog-digitalocean/badges/gpa.svg)](https://codeclimate.com/github/fog/fog-digitalocean) [![Join the chat at https://gitter.im/fog/fog-digitalocean](https://badges.gitter.im/fog/fog-digitalocean.svg)](https://gitter.im/fog/fog-digitalocean?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
 
5
5
  This is the plugin Gem to talk to [Digitalocean](http://digitalocean.org) clouds via fog.
6
6
 
@@ -49,7 +49,6 @@ require 'fog'
49
49
 
50
50
  docean = Fog::Compute.new({
51
51
  :provider => 'DigitalOcean',
52
- :version => 'V2',
53
52
  :digitalocean_token => 'poiuweoruwoeiuroiwuer', # your Access Token here
54
53
  })
55
54
  ```
@@ -0,0 +1,30 @@
1
+ class DigitalOcean < Fog::Bin
2
+ class << self
3
+ def class_for(key)
4
+ case key
5
+ when :compute
6
+ Fog::Compute::DigitalOcean
7
+ else
8
+ raise ArgumentError, "Unsupported #{self} service: #{key}"
9
+ end
10
+ end
11
+
12
+ def [](service)
13
+ @@connections ||= Hash.new do |hash, key|
14
+ hash[key] = case key
15
+ when :compute
16
+ Fog::Logger.warning("DigitalOcean[:compute] is not recommended, use Compute[:digitalocean] for portability")
17
+ Fog::Compute.new(:provider => 'DigitalOcean')
18
+ else
19
+ raise ArgumentError, "Unrecognized service: #{key.inspect}"
20
+ end
21
+ end
22
+ @@connections[service]
23
+ end
24
+
25
+ def services
26
+ Fog::DigitalOcean.services
27
+ end
28
+ end
29
+ end
30
+
@@ -16,40 +16,52 @@ module Fog
16
16
  collection :flavors
17
17
  model :ssh_key
18
18
  collection :ssh_keys
19
+ model :volume
20
+ collection :volumes
19
21
 
20
22
  request_path 'fog/digitalocean/requests/compute'
21
- request :change_kernel
23
+ request :list_volumes
24
+ request :create_volume
25
+ request :attach_volume
26
+ request :detach_volume
27
+ request :destroy_volume
28
+ request :list_volume_actions
29
+
30
+ request :list_servers
22
31
  request :create_server
23
- request :create_ssh_key
24
32
  request :destroy_server
25
- request :delete_ssh_key
33
+ request :get_server_details
34
+ request :change_kernel
26
35
  request :disable_backups
27
36
  request :enable_ipv6
28
37
  request :enable_private_networking
29
- request :get_droplet_action
30
- request :get_image_details
31
- request :get_server_details
32
- request :get_ssh_key
33
- request :list_droplet_actions
34
- request :list_flavors
35
- request :list_images
36
- request :list_regions
37
- request :list_servers
38
- request :list_ssh_keys
39
- request :password_reset
40
38
  request :power_cycle
41
39
  request :power_off
42
40
  request :power_on
43
41
  request :reboot_server
42
+ request :password_reset
44
43
  request :rebuild
45
44
  request :rename
46
45
  request :resize
47
46
  request :restore
48
47
  request :shutdown
49
48
  request :snapshot
50
- request :update_ssh_key
51
49
  request :upgrade
52
50
 
51
+ request :list_ssh_keys
52
+ request :create_ssh_key
53
+ request :get_ssh_key
54
+ request :update_ssh_key
55
+ request :delete_ssh_key
56
+
57
+ request :list_images
58
+ request :list_flavors
59
+ request :get_image_details
60
+
61
+ request :get_droplet_action
62
+ request :list_droplet_actions
63
+ request :list_regions
64
+
53
65
 
54
66
  class Mock
55
67
  def self.data
@@ -0,0 +1,15 @@
1
+ module Fog
2
+ module Compute
3
+ class DigitalOcean
4
+ class Volume < Fog::Model
5
+ identity :id
6
+ attribute :name
7
+ attribute :region
8
+ attribute :droplet_ids
9
+ attribute :description
10
+ attribute :size_gigabytes
11
+ attribute :created_at
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,42 @@
1
+ require 'fog/digitalocean/models/paging_collection'
2
+
3
+ module Fog
4
+ module Compute
5
+ class DigitalOcean
6
+ class Volumes < Fog::Compute::DigitalOcean::PagingCollection
7
+ model Fog::Compute::DigitalOcean::Volume
8
+
9
+ # Retrieves volumes
10
+ # @return [Fog::Compute::DigitalOcean::Volume]
11
+ # @raise [Fog::Compute::DigitalOcean::NotFound] - HTTP 404
12
+ # @raise [Fog::Compute::DigitalOcean::BadRequest] - HTTP 400
13
+ # @raise [Fog::Compute::DigitalOcean::InternalServerError] - HTTP 500
14
+ # @raise [Fog::Compute::DigitalOcean::ServiceError]
15
+ # @see https://developers.digitalocean.com/documentation/v2/#list-all-images
16
+ def all(filters = {})
17
+ data = service.list_volumes(filters)
18
+ links = data.body["links"]
19
+ get_paged_links(links)
20
+ volumes = data.body["volumes"]
21
+ load(volumes)
22
+ end
23
+
24
+ # Retrieves volume
25
+ # @param [String] id for volume to be returned
26
+ # @return [Fog::Compute::DigitalOcean:Image]
27
+ # @raise [Fog::Compute::DigitalOcean::NotFound] - HTTP 404
28
+ # @raise [Fog::Compute::DigitalOcean::BadRequest] - HTTP 400
29
+ # @raise [Fog::Compute::DigitalOcean::InternalServerError] - HTTP 500
30
+ # @raise [Fog::Compute::DigitalOcean::ServiceError]
31
+ # @see https://developers.digitalocean.com/documentation/v2/#retrieve-an-existing-image-by-id
32
+ def get(id)
33
+ volume = service.get_volume_details(id).body['volume']
34
+ new(volume) if volume
35
+ rescue Fog::Errors::NotFound
36
+ nil
37
+ end
38
+
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,122 @@
1
+ module Fog
2
+ module Compute
3
+ class DigitalOcean
4
+ class Real
5
+ def attach_volume(volume_id, droplet_id, region)
6
+ body = { :type => 'attach', droplet_id: droplet_id, region: region}
7
+
8
+ encoded_body = Fog::JSON.encode(body)
9
+
10
+ request(
11
+ :expects => [201],
12
+ :headers => {
13
+ 'Content-Type' => "application/json; charset=UTF-8",
14
+ },
15
+ :method => 'POST',
16
+ :path => "v2/volumes/#{volume_id}/actions",
17
+ :body => encoded_body,
18
+ )
19
+ end
20
+
21
+ def attach_volume_by_name(volume_name, droplet_id, region)
22
+ body = { :type => 'attach', volume_name: volume_name, droplet_id: droplet_id, region: region}
23
+
24
+ encoded_body = Fog::JSON.encode(body)
25
+
26
+ request(
27
+ :expects => [201],
28
+ :headers => {
29
+ 'Content-Type' => "application/json; charset=UTF-8",
30
+ },
31
+ :method => 'POST',
32
+ :path => "v2/volumes/actions",
33
+ :body => encoded_body,
34
+ )
35
+ end
36
+ end
37
+
38
+ class Mock
39
+ def attach_volume(volume_id, droplet_id, region)
40
+ response = Excon::Response.new
41
+ response.status = 201
42
+ response.body = {
43
+ "action" => {
44
+ "id" => 72531856,
45
+ "status" => "completed",
46
+ "type" => "attach_volume",
47
+ "started_at" => "2015-11-12T17:51:03Z",
48
+ "completed_at" => "2015-11-12T17:51:14Z",
49
+ "resource_id" => "null",
50
+ "resource_type" => "volume",
51
+ "region" => {
52
+ "name" => "New York 1",
53
+ "slug" => "nyc1",
54
+ "sizes" => [
55
+ "1gb",
56
+ "2gb",
57
+ "4gb",
58
+ "8gb",
59
+ "32gb",
60
+ "64gb",
61
+ "512mb",
62
+ "48gb",
63
+ "16gb"
64
+ ],
65
+ "features" => [
66
+ "private_networking",
67
+ "backups",
68
+ "ipv6",
69
+ "metadata"
70
+ ],
71
+ "available" => true
72
+ },
73
+ "region_slug" => "nyc1"
74
+ }
75
+ }
76
+
77
+ response
78
+ end
79
+ def attach_volume_by_name(volume_name, droplet_id, region)
80
+ response = Excon::Response.new
81
+ response.status = 201
82
+ response.body = {
83
+ "action" => {
84
+ "id" => 72531856,
85
+ "status" => "completed",
86
+ "type" => "attach_volume",
87
+ "started_at" => "2015-11-12T17:51:03Z",
88
+ "completed_at" => "2015-11-12T17:51:14Z",
89
+ "resource_id" => "null",
90
+ "resource_type" => "volume",
91
+ "region" => {
92
+ "name" => "New York 1",
93
+ "slug" => "nyc1",
94
+ "sizes" => [
95
+ "1gb",
96
+ "2gb",
97
+ "4gb",
98
+ "8gb",
99
+ "32gb",
100
+ "64gb",
101
+ "512mb",
102
+ "48gb",
103
+ "16gb"
104
+ ],
105
+ "features" => [
106
+ "private_networking",
107
+ "backups",
108
+ "ipv6",
109
+ "metadata"
110
+ ],
111
+ "available" => true
112
+ },
113
+ "region_slug" => "nyc1"
114
+ }
115
+ }
116
+
117
+ response
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
@@ -25,6 +25,8 @@ module Fog
25
25
  create_options[opt] = options[opt] if options[opt]
26
26
  end
27
27
 
28
+ create_options[:volume] = options[:volume] || []
29
+
28
30
  encoded_body = Fog::JSON.encode(create_options)
29
31
 
30
32
  request(
@@ -0,0 +1,50 @@
1
+ module Fog
2
+ module Compute
3
+ class DigitalOcean
4
+ # noinspection RubyStringKeysInHashInspection
5
+ class Real
6
+
7
+ def create_volume(options={})
8
+ create_options = {
9
+ :name => "name",
10
+ :region => "nyc1",
11
+ :size_gigabytes => 1
12
+ }.merge(options)
13
+
14
+ encoded_body = Fog::JSON.encode(create_options)
15
+
16
+ request(
17
+ :expects => [201],
18
+ :headers => {
19
+ 'Content-Type' => "application/json; charset=UTF-8",
20
+ },
21
+ :method => 'POST',
22
+ :path => '/v2/volumes',
23
+ :body => encoded_body,
24
+ )
25
+ end
26
+ end
27
+
28
+ # noinspection RubyStringKeysInHashInspection
29
+ class Mock
30
+ def create_volume(options)
31
+ response = Excon::Response.new
32
+ response.status = 201
33
+
34
+ response.body ={
35
+ 'volume' => {
36
+ "id" => Fog::Mock.random_numbers(6).to_i,
37
+ "fingerprint" => (["00"] * 16).join(':'),
38
+ "region" => options[:region],
39
+ "size_gigabytes" => 10,
40
+ "description" => options[:description],
41
+ "name" => options[:name]
42
+ }
43
+ }
44
+
45
+ response
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,32 @@
1
+ module Fog
2
+ module Compute
3
+ class DigitalOcean
4
+ # noinspection RubyStringKeysInHashInspection
5
+ class Real
6
+ def destroy_volume(id)
7
+ request(
8
+ :expects => [204],
9
+ :headers => {
10
+ 'Content-Type' => "application/json; charset=UTF-8",
11
+ },
12
+ :method => 'DELETE',
13
+ :path => "/v2/volumes/#{id}",
14
+ )
15
+ end
16
+ end
17
+
18
+ # noinspection RubyStringKeysInHashInspection
19
+ class Mock
20
+ def destroy_volume(id)
21
+ self.data[:volumes].select! do |key|
22
+ key["id"] != id
23
+ end
24
+
25
+ response = Excon::Response.new
26
+ response.status = 204
27
+ response
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,121 @@
1
+ module Fog
2
+ module Compute
3
+ class DigitalOcean
4
+ class Real
5
+ def detach_volume(volume_id, droplet_id, region)
6
+ body = { :type => 'detach', droplet_id: droplet_id, region: region}
7
+
8
+ encoded_body = Fog::JSON.encode(body)
9
+
10
+ request(
11
+ :expects => [201],
12
+ :headers => {
13
+ 'Content-Type' => "application/json; charset=UTF-8",
14
+ },
15
+ :method => 'POST',
16
+ :path => "v2/volumes/#{volume_id}/actions",
17
+ :body => encoded_body,
18
+ )
19
+ end
20
+ def detach_volume_by_name(volume_name, droplet_id, region)
21
+ body = { :type => 'detach', volume_name: volume_name, droplet_id: droplet_id, region: region}
22
+
23
+ encoded_body = Fog::JSON.encode(body)
24
+
25
+ request(
26
+ :expects => [201],
27
+ :headers => {
28
+ 'Content-Type' => "application/json; charset=UTF-8",
29
+ },
30
+ :method => 'POST',
31
+ :path => "v2/volumes/actions",
32
+ :body => encoded_body,
33
+ )
34
+ end
35
+ end
36
+
37
+ class Mock
38
+ def detach_volume(volume_id, droplet_id, region)
39
+ response = Excon::Response.new
40
+ response.status = 201
41
+ response.body = {
42
+ "action" => {
43
+ "id" => 68212773,
44
+ "status" => "in-progress",
45
+ "type" => "detach_volume",
46
+ "started_at" => "2015-10-15T17:46:15Z",
47
+ "completed_at" => null,
48
+ "resource_id" => null,
49
+ "resource_type" => "backend",
50
+ "region" => {
51
+ "name" => "New York 1",
52
+ "slug" => "nyc1",
53
+ "sizes" => [
54
+ "512mb",
55
+ "1gb",
56
+ "2gb",
57
+ "4gb",
58
+ "8gb",
59
+ "16gb",
60
+ "32gb",
61
+ "48gb",
62
+ "64gb"
63
+ ],
64
+ "features" => [
65
+ "private_networking",
66
+ "backups",
67
+ "ipv6",
68
+ "metadata"
69
+ ],
70
+ "available" => true
71
+ },
72
+ "region_slug" => "nyc1"
73
+ }
74
+ }
75
+
76
+ response
77
+ end
78
+ def detach_volume_by_name(volume_name, droplet_id, region)
79
+ response = Excon::Response.new
80
+ response.status = 201
81
+ response.body = {
82
+ "action" => {
83
+ "id" => 68212773,
84
+ "status" => "in-progress",
85
+ "type" => "detach_volume",
86
+ "started_at" => "2015-10-15T17:46:15Z",
87
+ "completed_at" => null,
88
+ "resource_id" => null,
89
+ "resource_type" => "backend",
90
+ "region" => {
91
+ "name" => "New York 1",
92
+ "slug" => "nyc1",
93
+ "sizes" => [
94
+ "512mb",
95
+ "1gb",
96
+ "2gb",
97
+ "4gb",
98
+ "8gb",
99
+ "16gb",
100
+ "32gb",
101
+ "48gb",
102
+ "64gb"
103
+ ],
104
+ "features" => [
105
+ "private_networking",
106
+ "backups",
107
+ "ipv6",
108
+ "metadata"
109
+ ],
110
+ "available" => true
111
+ },
112
+ "region_slug" => "nyc1"
113
+ }
114
+ }
115
+
116
+ response
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end