Module: CloudstackClient::Configuration

Defined in:
lib/cloudstack_client/commands/configuration.rb

Instance Method Summary collapse

Instance Method Details

#list_configurations(args = {}) ⇒ Object

List configuration.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cloudstack_client/commands/configuration.rb', line 8

def list_configurations(args = {})
  params = {
    'command' => 'listConfigurations',
  }

  if args[:zone]
    zone = get_zone(args[:zone])
    unless zone 
      puts "Error: Zone #{args[:zone]} not found"
      exit 1
    end
    params['zoneid'] = zone['id']  
  end

  if args[:account]
     = list_accounts({name: args[:account]}).first
    unless 
      puts "Error: Account #{args[:account]} not found."
      exit 1
    end
    params['domainid'] = ["domainid"]
    params['account'] = args[:account]
  end

  params['name'] = args[:name] if args[:name]
  params['keyword'] = args[:keyword] if args[:keyword]
  params['category'] = args[:category] if args[:category]

  json = send_request(params)
  json['configuration'] || []
end