Merge pull request #3614 from Ladas/openstack_missigng_list_unification_in_volumes_and_network
OpenStack missing list unification of Network and Volume
This commit is contained in:
commit
e0d62069bf
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_floating_ips(filters).body['floatingips'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(floating_network_id)
|
||||
if floating_ip = service.get_floating_ip(floating_network_id).body['floatingip']
|
||||
new(floating_ip)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_lb_health_monitors(filters).body['health_monitors'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(health_monitor_id)
|
||||
if health_monitor = service.get_lb_health_monitor(health_monitor_id).body['health_monitor']
|
||||
new(health_monitor)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_lb_members(filters).body['members'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(member_id)
|
||||
if member = service.get_lb_member(member_id).body['member']
|
||||
new(member)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_lb_pools(filters).body['pools'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(pool_id)
|
||||
if pool = service.get_lb_pool(pool_id).body['pool']
|
||||
new(pool)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_lb_vips(filters).body['vips'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(vip_id)
|
||||
if vip = service.get_lb_vip(vip_id).body['vip']
|
||||
new(vip)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_networks(filters).body['networks'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(network_id)
|
||||
if network = service.get_network(network_id).body['network']
|
||||
new(network)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_ports(filters).body['ports'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(port_id)
|
||||
if port = service.get_port(port_id).body['port']
|
||||
new(port)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_routers(filters).body['routers'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(router_id)
|
||||
if router = service.get_router(router_id).body['router']
|
||||
new(router)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_security_group_rules(filters).body['security_group_rules'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(sec_group_rule_id)
|
||||
if sec_group_rule = service.get_security_group_rule(sec_group_rule_id).body['security_group_rule']
|
||||
new(sec_group_rule)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_security_groups(filters).body['security_groups'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(security_group_id)
|
||||
if security_group = service.get_security_group(security_group_id).body['security_group']
|
||||
new(security_group)
|
||||
|
|
|
@ -19,6 +19,8 @@ module Fog
|
|||
load(service.list_subnets(filters).body['subnets'])
|
||||
end
|
||||
|
||||
alias_method :summary, :all
|
||||
|
||||
def get(subnet_id)
|
||||
if subnet = service.get_subnet(subnet_id).body['subnet']
|
||||
new(subnet)
|
||||
|
|
|
@ -2,13 +2,26 @@ module Fog
|
|||
module Volume
|
||||
class OpenStack
|
||||
class Real
|
||||
def list_snapshots(detailed=true, options={})
|
||||
path = detailed ? 'snapshots/detail' : 'snapshots'
|
||||
def list_snapshots(options = true, options_deprecated = {})
|
||||
if options.is_a?(Hash)
|
||||
path = 'snapshots'
|
||||
query = options
|
||||
else
|
||||
# Backwards compatibility layer, when 'detailed' boolean was sent as first param
|
||||
if options
|
||||
Fog::Logger.deprecation('Calling OpenStack[:volume].list_snapshots(true) is deprecated, use .list_snapshots_detailed instead')
|
||||
else
|
||||
Fog::Logger.deprecation('Calling OpenStack[:volume].list_snapshots(false) is deprecated, use .list_snapshots({}) instead')
|
||||
end
|
||||
path = options ? 'snapshots/detail' : 'snapshots'
|
||||
query = options_deprecated
|
||||
end
|
||||
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => path,
|
||||
:query => options
|
||||
:query => query
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
module Fog
|
||||
module Volume
|
||||
class OpenStack
|
||||
class Real
|
||||
def list_snapshots_detailed(options = {})
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'GET',
|
||||
:path => 'snapshots/detail',
|
||||
:query => options
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def list_snapshots_detailed(options = {})
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'snapshots' => [get_snapshot_details.body["snapshot"]]
|
||||
}
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue