Class: CloudstackStats::Collect

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudstack_stats/collect.rb

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ Collect

Returns a new instance of Collect.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cloudstack_stats/collect.rb', line 8

def initialize(settings)
  @settings = settings.dup
  @config ||= CloudstackClient::Configuration.load(@settings)
  @cs ||= CloudstackClient::Client.new(
    @config[:url],
    @config[:api_key],
    @config[:secret_key]
  )
  @cs.debug = true if @settings[:debug]
  @cs
end

Instance Method Details

#account_statsObject



20
21
22
23
24
25
# File 'lib/cloudstack_stats/collect.rb', line 20

def 
  {
    type: "account",
    stats: @cs.list_accounts(client_options)
  }
end

#project_statsObject



27
28
29
30
31
32
# File 'lib/cloudstack_stats/collect.rb', line 27

def project_stats
  {
    type: "project",
    stats: @cs.list_projects(client_options)
  }
end