Class: Fog::OpenStack::Compute::Services

Inherits:
Fog::OpenStack::Collection show all
Defined in:
lib/fog/openstack/compute/models/services.rb

Instance Attribute Summary

Attributes inherited from Fog::OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from Fog::OpenStack::Collection

#destroy, #find_by_id, #load_response

Instance Method Details

#all(options = {}) ⇒ Object Also known as: summary



10
11
12
# File 'lib/fog/openstack/compute/models/services.rb', line 10

def all(options = {})
  load_response(service.list_services(options), 'services')
end

#details(options = {}) ⇒ Object



16
17
18
19
# File 'lib/fog/openstack/compute/models/services.rb', line 16

def details(options = {})
  Fog::Logger.deprecation('Calling OpenStack[:compute].services.details is deprecated, use .services.all')
  all(options)
end

#get(service_id) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fog/openstack/compute/models/services.rb', line 21

def get(service_id)
  # OpenStack API currently does not support getting single service from it
  # There is a blueprint https://blueprints.launchpad.net/nova/+spec/get-service-by-id
  # with spec proposal patch https://review.openstack.org/#/c/172412/ but this is abandoned.
  serv = service.list_services.body['services'].detect do |s|
    s['id'] == service_id
  end
  new(serv) if serv
rescue Fog::OpenStack::Compute::NotFound
  nil
end