Class: Fog::Metric::OpenStack::Metrics

Inherits:
OpenStack::Collection show all
Defined in:
lib/fog/metric/openstack/models/metrics.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from OpenStack::Collection

#destroy, #get, #load_response, #summary

Instance Method Details

#all(options = {}) ⇒ Object



11
12
13
# File 'lib/fog/metric/openstack/models/metrics.rb', line 11

def all(options = {})
  load_response(service.list_metrics(options))
end

#find_by_id(metric_id) ⇒ Object



15
16
17
18
19
20
# File 'lib/fog/metric/openstack/models/metrics.rb', line 15

def find_by_id(metric_id)
  resource = service.get_metric(metric_id).body
  new(resource)
rescue Fog::Metric::OpenStack::NotFound
  nil
end

#find_measures_by_id(metric_id, options = {}) ⇒ Object



22
23
24
25
26
27
# File 'lib/fog/metric/openstack/models/metrics.rb', line 22

def find_measures_by_id(metric_id, options = {})
  resource = service.get_metric_measures(metric_id, options).body
  new(resource)
rescue Fog::Metric::OpenStack::NotFound
  nil
end