Module: CloudstackClient::Volume
- Defined in:
- lib/cloudstack_client/commands/volume.rb
Instance Method Summary collapse
-
#list_volumes(args = {}) ⇒ Object
Lists all volumes.
Instance Method Details
#list_volumes(args = {}) ⇒ Object
Lists all volumes.
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 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cloudstack_client/commands/volume.rb', line 8 def list_volumes(args = {}) params = { 'command' => 'listVolumes', 'listall' => true, } 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] if account = list_accounts(name: args[:account]).first params['domainid'] = account["domainid"] params['account'] = args[:account] end end if args[:project] project = get_project(args[:project]) unless project puts "Error: project #{args[:project]} not found." exit 1 end params['projectid'] = project['id'] end params['projectid'] = args[:project_id] if args[:project_id] params['type'] = args[:type] if args[:type] params['keyword'] = args[:keyword] if args[:keyword] params['name'] = args[:name] if args[:name] params['virtualmachineid'] = args[:virtual_machine_id] if args[:virtual_machine_id] params['tags'] = args[:tags] if args[:tags] params['podid'] = args[:pod_id] if args[:pod_id] params['isrecursive'] = args[:is_recursive] if args[:is_recursive] json = send_request(params) json['volume'] || [] end |