mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
b1dc264a56
This commit adds support for the DigitalOcean v2 API. It implements all the compute actions.
45 lines
1.2 KiB
Ruby
45 lines
1.2 KiB
Ruby
module Fog
|
|
module Compute
|
|
class DigitalOceanV2
|
|
class Real
|
|
def disable_backups(id)
|
|
body = { :type => "disable_backups" }
|
|
|
|
encoded_body = Fog::JSON.encode(body)
|
|
|
|
request(
|
|
:expects => [201],
|
|
:headers => {
|
|
'Content-Type' => "application/json; charset=UTF-8",
|
|
},
|
|
:method => 'POST',
|
|
:path => "v2/droplets/#{id}/actions",
|
|
:body => encoded_body,
|
|
)
|
|
end
|
|
end
|
|
|
|
class Mock
|
|
def disable_backups(id)
|
|
response = Excon::Response.new
|
|
response.status = 201
|
|
response.body = {
|
|
'action' => {
|
|
'id' => Fog::Mock.random_numbers(1).to_i,
|
|
'status' => "in-progress",
|
|
'type' => "disable_backups",
|
|
'started_at' => "2014-11-14T16:31:00Z",
|
|
'completed_at' => null,
|
|
'resource_id' => id,
|
|
'resource_type' => "droplet",
|
|
'region' => "nyc3",
|
|
'region_slug' => "nyc3"
|
|
}
|
|
}
|
|
response
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|