1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/digitalocean/requests/compute_v2/disable_backups.rb
bryanl b1dc264a56 support DigitalOcean v2 compute API
This commit adds support for the DigitalOcean v2 API. It implements all the compute actions.
2015-09-23 14:30:00 -04:00

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