class OpenStack::Nova::Compute::SimpleTenantUsage

Server usages for a tenant

Attributes

Public Class Methods

find_between_dates(scope, from_date, to_date) click to toggle source

Find all server usage between the given dates

Attributes

  • scope - ActiveResource scope (:all, :first, :last, :one or an id)

  • from_date - Initial date

  • to_date - Final date

# File lib/open_stack/nova/compute/simple_tenant_usage.rb, line 96
def self.find_between_dates(scope, from_date, to_date)
  find(scope, :params => {
      :start => from_date.utc.strftime(OpenStack::DATETIME_FORMAT),
      :end => to_date.utc.strftime(OpenStack::DATETIME_FORMAT)
  })

end
find_from_date(scope, from_date) click to toggle source

Find all server usage from a given date to the current one

Attributes

  • scope - ActiveResource scope (:all, :first, :last, :one or an id)

  • from_date - Initial date

# File lib/open_stack/nova/compute/simple_tenant_usage.rb, line 80
def self.find_from_date(scope, from_date)
  now = Time.now.utc

  find(scope, :params => {
      :start => from_date.utc.strftime(OpenStack::DATETIME_FORMAT),
      :end => now.strftime(OpenStack::DATETIME_FORMAT)
  })

end

Public Instance Methods

server_usages() click to toggle source

OpenStack::Nova::Compute::ServerUsage instances

# File lib/open_stack/nova/compute/simple_tenant_usage.rb, line 105
def server_usages
  @attributes[:server_usages].present? ? @attributes[:server_usages] : []
end
start() click to toggle source

The start date for the ServerUsage set

# File lib/open_stack/nova/compute/simple_tenant_usage.rb, line 110
def start
  DateTime.parse(@attributes[:start] + ' UTC')
end
stop() click to toggle source

The stop date for the ServerUsage set

# File lib/open_stack/nova/compute/simple_tenant_usage.rb, line 115
def stop
  DateTime.parse(@attributes[:stop] + ' UTC')
end