Module: Fog::Metering

Defined in:
lib/fog/metering.rb,
lib/fog/openstack/metering.rb,
lib/fog/openstack/models/metering/resource.rb,
lib/fog/openstack/models/metering/resources.rb,
lib/fog/openstack/requests/metering/get_samples.rb,
lib/fog/openstack/requests/metering/list_meters.rb,
lib/fog/openstack/requests/metering/get_resource.rb,
lib/fog/openstack/requests/metering/get_statistics.rb,
lib/fog/openstack/requests/metering/list_resources.rb

Defined Under Namespace

Classes: OpenStack

Class Method Summary collapse

Class Method Details

.[](provider) ⇒ Object



4
5
6
# File 'lib/fog/metering.rb', line 4

def self.[](provider)
  self.new(:provider => provider)
end

.new(attributes) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/metering.rb', line 8

def self.new(attributes)
  attributes = attributes.dup # Prevent delete from having side effects
  provider = attributes.delete(:provider).to_s.downcase.to_sym
  if self.providers.include?(provider)
    require "fog/#{provider}/metering"
    return Fog::Metering.const_get(Fog.providers[provider]).new(attributes)
  end

  raise ArgumentError.new("#{provider} has no identity service")
end

.providersObject



19
20
21
# File 'lib/fog/metering.rb', line 19

def self.providers
  Fog.services[:metering]
end