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

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

Instance Attribute Summary

Attributes inherited from Collection

#response

Instance Method Summary collapse

Methods inherited from Collection

#destroy, #get, #load_response, #summary

Instance Method Details

#all(options = {}) ⇒ Object



11
12
13
# File 'lib/fog/openstack/metric/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/openstack/metric/models/metrics.rb', line 15

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

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



22
23
24
25
26
27
# File 'lib/fog/openstack/metric/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::OpenStack::Metric::NotFound
  nil
end