mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #3822 from rroa/bugfix/do_servers_filters
[DigitalOcean] Added filtering capabilities to servers request.
This commit is contained in:
commit
b6f8420836
2 changed files with 5 additions and 5 deletions
|
@ -15,7 +15,7 @@ module Fog
|
||||||
# @raise [Fog::Compute::DigitalOceanV2::ServiceError]
|
# @raise [Fog::Compute::DigitalOceanV2::ServiceError]
|
||||||
# @see https://developers.digitalocean.com/documentation/v2/#droplets
|
# @see https://developers.digitalocean.com/documentation/v2/#droplets
|
||||||
def all(filters = {})
|
def all(filters = {})
|
||||||
data = service.list_servers.body['droplets']
|
data = service.list_servers(filters).body['droplets']
|
||||||
load(data)
|
load(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,18 @@ module Fog
|
||||||
module Compute
|
module Compute
|
||||||
class DigitalOceanV2
|
class DigitalOceanV2
|
||||||
class Real
|
class Real
|
||||||
def list_servers
|
def list_servers(filters = {})
|
||||||
request(
|
request(
|
||||||
:expects => [200],
|
:expects => [200],
|
||||||
:method => 'GET',
|
:method => 'GET',
|
||||||
:path => '/v2/droplets'
|
:path => "/v2/droplets?#{filters.to_a.map { |x| "#{x[0]}=#{x[1]}" }.join("&")}"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# noinspection RubyStringKeysInHashInspection
|
# noinspection RubyStringKeysInHashInspection
|
||||||
class Mock
|
class Mock
|
||||||
def list_servers
|
def list_servers(filters = {})
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = {
|
response.body = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue