cloudn_cli 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d3e7c5c8dedd1933c60f278ecb7bfc7207539a27
4
+ data.tar.gz: 1ba67cf707cb3a9ceb9b75e10b09a1cd1ca96043
5
+ SHA512:
6
+ metadata.gz: ce8194f55730af02f3c2e5b16cf8c8332933cfc96b518d10221323c0329032fceb9dfeced2b81feaf66ff35bf7dcbe7cf59db899ebea71159c828a544f326f06
7
+ data.tar.gz: 4842d5f2050f5ef26681cda4306c3369a7faf74b55543a8f5b5afd173c060ac9329066fe168837302cfaa55ff74eb230c4b89bee1493050ec0f76e669059c225
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cloudn_cli.gemspec
4
+ gemspec
@@ -0,0 +1,18 @@
1
+ # Copyright (C) 2013 NTT Communications
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
@@ -0,0 +1,117 @@
1
+ # Cloudn CLI
2
+
3
+ Cloudn CLI is command line tool for calling CloudStack API easily.
4
+
5
+ You can use this for your environment, or for commercial services such as Cloudn which is provided by NTT Communications.
6
+
7
+ Also, you can refer the list of all the APIs with following URL.
8
+
9
+ http://cloudstack.apache.org/docs/api/
10
+
11
+ ## Installation
12
+ This step will be shown how to use Cloudn CLI.
13
+
14
+ We can roughly divide into two steps , one is the preparing part for executing the Ruby because Cloudn CLI is made by Ruby, and another one is environment settings for local.
15
+
16
+ ## Setup the Ruby
17
+
18
+ At first, rbenv should be installed, which is tool for version administration of Ruby.
19
+ If you haven't installed git, please install that before this step.
20
+
21
+ 1.Copy the rbenv from github
22
+
23
+ $ git clone git://github.com/sstephenson/rbenv.git .rbenv
24
+
25
+ 2.Register the environment variables
26
+
27
+ $ echo 'export PATH="~/.rbenv/bin:$PATH"' >> ~/.bash_profile
28
+ $ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
29
+ $ source ~/.bash_profile
30
+
31
+ 3.Install some necessary packages
32
+
33
+ $ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
34
+ $ yum install readline libtool openssl openssl-devel
35
+
36
+ 4.Installing the Ruby by using rbenv
37
+
38
+ $ rbenv install 2.0.0-p353
39
+ $ rbenv global 2.0.0-p353
40
+ $ ruby --version
41
+
42
+ ## Setup the Cloudn CLI
43
+ In this step, cloning Cloudn CLI and follow some necessary steps to execute
44
+
45
+ 1.Clone the Cloudn CLI to your machine
46
+
47
+ $ git clone https://github.com/nttcom/cloudn-cli.git
48
+
49
+ 2.Install some necessary packages
50
+
51
+ $ gem install bundler rb-readline
52
+ $ rbenv rehash
53
+ $ bundle install --path=vender/bundle
54
+
55
+ 3.Register the environment variables
56
+
57
+ $ echo 'export PATH=$PATH:/<Your directory>/bin' >> ~/.bash_profile source ~/.bash_profile
58
+
59
+ 4.Describe your settings which are api key, secret key, end endpoint of API into config.yml
60
+
61
+ $ vi config.yml
62
+
63
+ 5.Execute Cloudn CLI, and you can call any api refering the list of APIs
64
+
65
+ $ cloudn_cli
66
+ `> listUsers`
67
+
68
+ ## Commands
69
+ Cloudn CLI has some original commands as follows
70
+
71
+ 1.Refer the commands you can execute
72
+
73
+ > help
74
+
75
+ 2.Terminate the Cloudn CLI
76
+
77
+ > exit
78
+
79
+ 3.Display the current settings
80
+
81
+ > config
82
+
83
+ 4.Display the description of APIs
84
+
85
+ > doc <name of APIs>
86
+
87
+ 5.Change the format of return value
88
+
89
+ > format <xml | json>
90
+
91
+ 6.Choose the return value attribute
92
+
93
+ > raw true | false
94
+
95
+ 7.Choose the accounts which you want
96
+
97
+ > user <name of account>
98
+
99
+ 8.Display all the accounts in your config.yml
100
+
101
+ > users
102
+
103
+ 9.To be implemented
104
+
105
+ > eval
106
+
107
+ ## Contributing
108
+
109
+ 1.Fork it
110
+
111
+ 2.Create your feature branch (`git checkout -b my-new-feature`)
112
+
113
+ 3.Commit your changes (`git commit -am 'Add some feature'`)
114
+
115
+ 4.Push to the branch (`git push origin my-new-feature`)
116
+
117
+ 5.Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ ["authorizeSecurityGroupIngress","authorizeSecurityGroupEgress","restoreVirtualMachine","suspendProject","revokeSecurityGroupIngress","revokeSecurityGroupEgress","disassociateIpAddress","dissociateLun","reconnectHost","cancelHostMaintenance","cancelStorageMaintenance","queryAsyncJobResult","detachVolume","detachIso","prepareTemplate","prepareHostForMaintenance","attachVolume","attachIso","createLoadBalancerRule","createSecurityGroup","createPod","createZone","createStoragePool","createVpnGateway","createAutoScaleVmGroup","createPrivateGateway","createVolume","createVPC","createCondition","createAutoScaleVmProfile","createAccount","createNetworkOffering","createVpnCustomerGateway","createLunOnFiler","createProject","createVlanIpRange","createDomain","createSnapshotPolicy","createDiskOffering","createPortForwardingRule","createIpForwardingRule","createVpnConnection","createLBStickinessPolicy","createVPCOffering","createNetwork","createRemoteAccessVpn","createInstanceGroup","createAutoScalePolicy","createServiceOffering","createTemplate","createNetworkACL","createTags","createVolumeOnFiler","createStaticRoute","createUser","createStorageNetworkIpRange","createPool","createFirewallRule","createPhysicalNetwork","createCounter","createSnapshot","createVirtualRouterElement","createSSHKeyPair","markDefaultZoneForAccount","startSystemVm","startRouter","startVirtualMachine","addTrafficMonitor","addNetscalerLoadBalancer","addCluster","addS3","addAccountToProject","addExternalLoadBalancer","addVpnUser","addSecondaryStorage","addTrafficType","addNiciraNvpDevice","addHost","addF5LoadBalancer","addNetworkDevice","addSrxFirewall","addSwift","addExternalFirewall","addNetworkServiceProvider","restartNetwork","restartVPC","ldapConfig","ldapRemove","enableAccount","enableStorageMaintenance","enableCiscoNexusVSM","enableStaticNat","enableUser","enableAutoScaleVmGroup","configureSrxFirewall","configureF5LoadBalancer","configureVirtualRouterElement","configureNetscalerLoadBalancer","getCloudIdentifier","getVMPassword","getUser","getApiLimit","stopSystemVm","stopRouter","stopVirtualMachine","copyIso","copyTemplate","resizeVolume","resetApiLimit","resetPasswordForVirtualMachine","resetVpnConnection","listInstanceGroups","listPhysicalNetworks","listNetworks","listCapabilities","listClusters","listResourceLimits","listFirewallRules","listSupportedNetworkServices","listLoadBalancerRules","listAutoScalePolicies","listNiciraNvpDevices","listF5LoadBalancerNetworks","listTemplatePermissions","listProjects","listSystemVms","listPortForwardingRules","listExternalFirewalls","listVpnGateways","listLoadBalancerRuleInstances","listHosts","listPools","listCounters","listConfigurations","listUsageRecords","listStoragePools","listSnapshots","listZones","listServiceOfferings","listCiscoNexusVSMs","listNetworkServiceProviders","listCapacity","listDiskOfferings","listLBStickinessPolicies","listSrxFirewallNetworks","listSecurityGroups","listConditions","listSwifts","listHypervisorCapabilities","listTags","listRouters","listTrafficTypes","listProjectInvitations","listIsos","listUsers","listSSHKeyPairs","listPrivateGateways","listUsageTypes","listDomainChildren","listDomains","listExternalLoadBalancers","listNetscalerLoadBalancers","listS3s","listHypervisors","listAccounts","listNetworkDevice","listVlanIpRanges","listTrafficTypeImplementors","listStorageNetworkIpRange","listIsoPermissions","listSnapshotPolicies","listAutoScaleVmGroups","listProjectAccounts","listAutoScaleVmProfiles","listApis","listVPCs","listF5LoadBalancers","listVpnCustomerGateways","listNetworkOfferings","listVirtualMachines","listNetscalerLoadBalancerNetworks","listOsCategories","listVirtualRouterElements","listLunsOnFiler","listAsyncJobs","listOsTypes","listNetworkACLs","listVolumesOnFiler","listEventTypes","listRemoteAccessVpns","listAlerts","listVPCOfferings","listNiciraNvpDeviceNetworks","listEvents","listTemplates","listPublicIpAddresses","listIpForwardingRules","listSrxFirewalls","listVpnConnections","listTrafficMonitors","listVpnUsers","listStaticRoutes","listVolumes","listPods","uploadVolume","uploadCustomCertificate","removeFromLoadBalancerRule","removeVpnUser","deleteLoadBalancerRule","deleteProjectInvitation","deleteSecurityGroup","deleteAccountFromProject","deleteNetworkDevice","deletePod","deleteSrxFirewall","deleteSnapshotPolicies","deleteZone","deleteNiciraNvpDevice","deleteStoragePool","deleteVpnGateway","deleteAutoScaleVmGroup","deleteTrafficMonitor","deletePrivateGateway","deleteVolume","deleteVPC","deleteCondition","deleteAutoScaleVmProfile","deleteAccount","deleteFirewallRule","deleteNetworkOffering","deleteVpnCustomerGateway","deleteProject","deletePhysicalNetwork","deleteDomain","deleteDiskOffering","deleteExternalLoadBalancer","deletePortForwardingRule","deleteCluster","deleteIpForwardingRule","deleteVpnConnection","deleteLBStickinessPolicy","deleteVPCOffering","deleteNetwork","deleteRemoteAccessVpn","deleteInstanceGroup","deleteAutoScalePolicy","deleteServiceOffering","deleteTemplate","deleteSnapshot","deleteNetworkACL","deleteTags","deleteStaticRoute","deleteTrafficType","deleteHost","deleteUser","deleteStorageNetworkIpRange","deleteExternalFirewall","deletePool","deleteCiscoNexusVSM","deleteNetscalerLoadBalancer","deleteVlanIpRange","deleteCounter","deleteF5LoadBalancer","deleteIso","deleteNetworkServiceProvider","deleteSSHKeyPair","activateProject","migrateSystemVm","migrateVolume","migrateVirtualMachine","lockAccount","lockUser","recoverVirtualMachine","extractVolume","extractIso","extractTemplate","deployVirtualMachine","rebootSystemVm","rebootRouter","rebootVirtualMachine","destroySystemVm","destroyRouter","destroyVolumeOnFiler","destroyLunOnFiler","destroyVirtualMachine","associateIpAddress","associateLun","modifyPool","updateLoadBalancerRule","updateDomain","updateInstanceGroup","updateDiskOffering","updateVirtualMachine","updateVPCOffering","updatePortForwardingRule","updateCluster","updateHost","updateUser","updateVPC","updateHostPassword","updatePod","updateConfiguration","updateStorageNetworkIpRange","updateIsoPermissions","updateResourceLimit","updateTrafficType","updateAccount","updateStoragePool","updateResourceCount","updateNetwork","updateZone","updateNetworkOffering","updatePhysicalNetwork","updateProjectInvitation","updateAutoScalePolicy","updateTemplatePermissions","updateProject","updateVpnCustomerGateway","updateServiceOffering","updateTemplate","updateIso","updateNetworkServiceProvider","updateAutoScaleVmProfile","updateHypervisorCapabilities","updateAutoScaleVmGroup","disableAccount","disableAutoScaleVmGroup","disableCiscoNexusVSM","disableStaticNat","disableUser","generateUsageRecords","changeServiceForVirtualMachine","changeServiceForSystemVm","changeServiceForRouter","registerUserKeys","registerIso","registerSSHKeyPair","registerTemplate","assignToLoadBalancerRule","assignVirtualMachine"]
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../lib/cloudn_cli/shell"
3
+
4
+ source_dir = File.dirname(__FILE__)
5
+ Cloudn::Shell.new(File.expand_path("~/.config.yml", File.dirname(__FILE__)))
@@ -0,0 +1,6 @@
1
+ import json
2
+ from precache import precached_verbs
3
+
4
+ f = open("precache.json", "w")
5
+ print json.dumps(precached_verbs)
6
+ json.dump(precached_verbs, f)
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cloudn_cli/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cloudn_cli"
8
+ spec.version = Cloudn::Shell::VERSION
9
+ spec.authors = [""]
10
+ spec.email = [""]
11
+ spec.description = %q{Shell for Cloudn API}
12
+ spec.summary = %q{Shell for Cloudn API}
13
+ spec.homepage = ""
14
+ spec.license = ""
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+
25
+ spec.add_dependency("termcolor")
26
+ spec.add_dependency("crack")
27
+ spec.add_dependency("coderay")
28
+ spec.add_dependency("httpclient")
29
+ end
30
+
@@ -0,0 +1,14 @@
1
+ :url: "<Set your default endpoint of CloudStack APIs>"
2
+ :raw_output: true
3
+ :json: true
4
+ :users:
5
+ :<Set your name 1>:
6
+ :api_key: "<Set your api key>"
7
+ :secret_key: "<Set your secret key>"
8
+ :url: "<Set your endpoint of CloudStack API>"
9
+ :api_location: "Cloudn"
10
+ :<Set your name 2>:
11
+ :api_key: "<Set your api key>"
12
+ :secret_key: "<Set your secret key>"
13
+ :url: "<Set your endpoint of CloudStack API>"
14
+ :api_location: "Cloudn"
@@ -0,0 +1 @@
1
+ {"authorizeSecurityGroupIngress":[["account","cidrlist","domainid","endport","icmpcode","icmptype","isAsync","projectid","protocol","securitygroupid","securitygroupname","startport","usersecuritygrouplist"],"Authorizes a particular ingress rule for this security group\nArgs: account cidrlist domainid endport icmpcode icmptype isAsync projectid protocol securitygroupid securitygroupname startport usersecuritygrouplist",[]],"authorizeSecurityGroupEgress":[["account","cidrlist","domainid","endport","icmpcode","icmptype","isAsync","projectid","protocol","securitygroupid","securitygroupname","startport","usersecuritygrouplist"],"Authorizes a particular egress rule for this security group\nArgs: account cidrlist domainid endport icmpcode icmptype isAsync projectid protocol securitygroupid securitygroupname startport usersecuritygrouplist",[]],"restoreVirtualMachine":[["isAsync","virtualmachineid"],"Restore a VM to original template or specific snapshot\nRequired args: virtualmachineid\nArgs: isAsync virtualmachineid",["virtualmachineid"]],"suspendProject":[["id","isAsync"],"Suspends a project\nRequired args: id\nArgs: id isAsync",["id"]],"revokeSecurityGroupIngress":[["id","isAsync"],"Deletes a particular ingress rule from this security group\nRequired args: id\nArgs: id isAsync",["id"]],"revokeSecurityGroupEgress":[["id","isAsync"],"Deletes a particular egress rule from this security group\nRequired args: id\nArgs: id isAsync",["id"]],"disassociateIpAddress":[["id","isAsync"],"Disassociates an ip address from the account.\nRequired args: id\nArgs: id isAsync",["id"]],"dissociateLun":[["iqn","isAsync","path"],"Dissociate a LUN\nRequired args: iqn path\nArgs: iqn isAsync path",["iqn","path"]],"reconnectHost":[["id","isAsync"],"Reconnects a host.\nRequired args: id\nArgs: id isAsync",["id"]],"cancelHostMaintenance":[["id","isAsync"],"Cancels host maintenance.\nRequired args: id\nArgs: id isAsync",["id"]],"cancelStorageMaintenance":[["id","isAsync"],"Cancels maintenance for primary storage\nRequired args: id\nArgs: id isAsync",["id"]],"queryAsyncJobResult":[["isAsync","jobid"],"Retrieves the current status of asynchronous job.\nRequired args: jobid\nArgs: isAsync jobid",["jobid"]],"detachVolume":[["deviceid","id","isAsync","virtualmachineid"],"Detaches a disk volume from a virtual machine.\nArgs: deviceid id isAsync virtualmachineid",[]],"detachIso":[["isAsync","virtualmachineid"],"Detaches any ISO file (if any) currently attached to a virtual machine.\nRequired args: virtualmachineid\nArgs: isAsync virtualmachineid",["virtualmachineid"]],"prepareTemplate":[["isAsync","templateid","zoneid"],"load template into primary storage\nRequired args: templateid zoneid\nArgs: isAsync templateid zoneid",["templateid","zoneid"]],"prepareHostForMaintenance":[["id","isAsync"],"Prepares a host for maintenance.\nRequired args: id\nArgs: id isAsync",["id"]],"attachVolume":[["deviceid","id","isAsync","virtualmachineid"],"Attaches a disk volume to a virtual machine.\nRequired args: id virtualmachineid\nArgs: deviceid id isAsync virtualmachineid",["id","virtualmachineid"]],"attachIso":[["id","isAsync","virtualmachineid"],"Attaches an ISO to a virtual machine.\nRequired args: id virtualmachineid\nArgs: id isAsync virtualmachineid",["id","virtualmachineid"]],"createLoadBalancerRule":[["account","algorithm","cidrlist","description","domainid","isAsync","name","networkid","openfirewall","privateport","publicipid","publicport","zoneid"],"Creates a load balancer rule\nRequired args: algorithm name privateport publicport\nArgs: account algorithm cidrlist description domainid isAsync name networkid openfirewall privateport publicipid publicport zoneid",["algorithm","name","privateport","publicport"]],"createSecurityGroup":[["account","description","domainid","isAsync","name","projectid"],"Creates a security group\nRequired args: name\nArgs: account description domainid isAsync name projectid",["name"]],"createPod":[["allocationstate","endip","gateway","isAsync","name","netmask","startip","zoneid"],"Creates a new Pod.\nRequired args: gateway name netmask startip zoneid\nArgs: allocationstate endip gateway isAsync name netmask startip zoneid",["gateway","name","netmask","startip","zoneid"]],"createZone":[["allocationstate","dns1","dns2","domain","domainid","guestcidraddress","internaldns1","internaldns2","isAsync","localstorageenabled","name","networktype","securitygroupenabled"],"Creates a Zone.\nRequired args: dns1 internaldns1 name networktype\nArgs: allocationstate dns1 dns2 domain domainid guestcidraddress internaldns1 internaldns2 isAsync localstorageenabled name networktype securitygroupenabled",["dns1","internaldns1","name","networktype"]],"createStoragePool":[["clusterid","details","isAsync","name","podid","tags","url","zoneid"],"Creates a storage pool.\nRequired args: clusterid name podid url zoneid\nArgs: clusterid details isAsync name podid tags url zoneid",["clusterid","name","podid","url","zoneid"]],"createVpnGateway":[["isAsync","vpcid"],"Creates site to site vpn local gateway\nRequired args: vpcid\nArgs: isAsync vpcid",["vpcid"]],"createAutoScaleVmGroup":[["interval","isAsync","lbruleid","maxmembers","minmembers","scaledownpolicyids","scaleuppolicyids","vmprofileid"],"Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.\nRequired args: lbruleid maxmembers minmembers scaledownpolicyids scaleuppolicyids vmprofileid\nArgs: interval isAsync lbruleid maxmembers minmembers scaledownpolicyids scaleuppolicyids vmprofileid",["lbruleid","maxmembers","minmembers","scaledownpolicyids","scaleuppolicyids","vmprofileid"]],"createPrivateGateway":[["gateway","ipaddress","isAsync","netmask","physicalnetworkid","vlan","vpcid"],"Creates a private gateway\nRequired args: gateway ipaddress netmask vlan vpcid\nArgs: gateway ipaddress isAsync netmask physicalnetworkid vlan vpcid",["gateway","ipaddress","netmask","vlan","vpcid"]],"createVolume":[["account","diskofferingid","domainid","isAsync","name","projectid","size","snapshotid","zoneid"],"Creates a disk volume from a disk offering. This disk volume must still be attached to a virtual machine to make use of it.\nRequired args: name\nArgs: account diskofferingid domainid isAsync name projectid size snapshotid zoneid",["name"]],"createVPC":[["account","cidr","displaytext","domainid","isAsync","name","networkdomain","projectid","vpcofferingid","zoneid"],"Creates a VPC\nRequired args: cidr displaytext name vpcofferingid zoneid\nArgs: account cidr displaytext domainid isAsync name networkdomain projectid vpcofferingid zoneid",["cidr","displaytext","name","vpcofferingid","zoneid"]],"createCondition":[["account","counterid","domainid","isAsync","relationaloperator","threshold"],"Creates a condition\nRequired args: counterid relationaloperator threshold\nArgs: account counterid domainid isAsync relationaloperator threshold",["counterid","relationaloperator","threshold"]],"createAutoScaleVmProfile":[["autoscaleuserid","counterparam","destroyvmgraceperiod","isAsync","otherdeployparams","serviceofferingid","templateid","zoneid"],"Creates a profile that contains information about the virtual machine which will be provisioned automatically by autoscale feature.\nRequired args: serviceofferingid templateid zoneid\nArgs: autoscaleuserid counterparam destroyvmgraceperiod isAsync otherdeployparams serviceofferingid templateid zoneid",["serviceofferingid","templateid","zoneid"]],"createAccount":[["account","accountdetails","accounttype","domainid","email","firstname","isAsync","lastname","networkdomain","password","timezone","username"],"Creates an account\nRequired args: accounttype email firstname lastname password username\nArgs: account accountdetails accounttype domainid email firstname isAsync lastname networkdomain password timezone username",["accounttype","email","firstname","lastname","password","username"]],"createNetworkOffering":[["availability","conservemode","displaytext","guestiptype","isAsync","name","networkrate","servicecapabilitylist","serviceofferingid","serviceproviderlist","specifyipranges","specifyvlan","supportedservices","tags","traffictype"],"Creates a network offering.\nRequired args: displaytext guestiptype name supportedservices traffictype\nArgs: availability conservemode displaytext guestiptype isAsync name networkrate servicecapabilitylist serviceofferingid serviceproviderlist specifyipranges specifyvlan supportedservices tags traffictype",["displaytext","guestiptype","name","supportedservices","traffictype"]],"createVpnCustomerGateway":[["account","cidrlist","domainid","dpd","esplifetime","esppolicy","gateway","ikelifetime","ikepolicy","ipsecpsk","isAsync","name"],"Creates site to site vpn customer gateway\nRequired args: cidrlist esppolicy gateway ikepolicy ipsecpsk\nArgs: account cidrlist domainid dpd esplifetime esppolicy gateway ikelifetime ikepolicy ipsecpsk isAsync name",["cidrlist","esppolicy","gateway","ikepolicy","ipsecpsk"]],"createLunOnFiler":[["isAsync","name","size"],"Create a LUN from a pool\nRequired args: name size\nArgs: isAsync name size",["name","size"]],"createProject":[["account","displaytext","domainid","isAsync","name"],"Creates a project\nRequired args: displaytext name\nArgs: account displaytext domainid isAsync name",["displaytext","name"]],"createVlanIpRange":[["account","domainid","endip","forvirtualnetwork","gateway","isAsync","netmask","networkid","physicalnetworkid","podid","projectid","startip","vlan","zoneid"],"Creates a VLAN IP range.\nRequired args: startip\nArgs: account domainid endip forvirtualnetwork gateway isAsync netmask networkid physicalnetworkid podid projectid startip vlan zoneid",["startip"]],"createDomain":[["isAsync","name","networkdomain","parentdomainid"],"Creates a domain\nRequired args: name\nArgs: isAsync name networkdomain parentdomainid",["name"]],"createSnapshotPolicy":[["intervaltype","isAsync","maxsnaps","schedule","timezone","volumeid"],"Creates a snapshot policy for the account.\nRequired args: intervaltype maxsnaps schedule timezone volumeid\nArgs: intervaltype isAsync maxsnaps schedule timezone volumeid",["intervaltype","maxsnaps","schedule","timezone","volumeid"]],"createDiskOffering":[["customized","disksize","displaytext","domainid","isAsync","name","storagetype","tags"],"Creates a disk offering.\nRequired args: displaytext name\nArgs: customized disksize displaytext domainid isAsync name storagetype tags",["displaytext","name"]],"createPortForwardingRule":[["cidrlist","ipaddressid","isAsync","networkid","openfirewall","privateendport","privateport","protocol","publicendport","publicport","virtualmachineid"],"Creates a port forwarding rule\nRequired args: ipaddressid privateport protocol publicport virtualmachineid\nArgs: cidrlist ipaddressid isAsync networkid openfirewall privateendport privateport protocol publicendport publicport virtualmachineid",["ipaddressid","privateport","protocol","publicport","virtualmachineid"]],"createIpForwardingRule":[["cidrlist","endport","ipaddressid","isAsync","openfirewall","protocol","startport"],"Creates an ip forwarding rule\nRequired args: ipaddressid protocol startport\nArgs: cidrlist endport ipaddressid isAsync openfirewall protocol startport",["ipaddressid","protocol","startport"]],"createVpnConnection":[["isAsync","s2scustomergatewayid","s2svpngatewayid"],"Create site to site vpn connection\nRequired args: s2scustomergatewayid s2svpngatewayid\nArgs: isAsync s2scustomergatewayid s2svpngatewayid",["s2scustomergatewayid","s2svpngatewayid"]],"createLBStickinessPolicy":[["description","isAsync","lbruleid","methodname","name","param"],"Creates a Load Balancer stickiness policy\nRequired args: lbruleid methodname name\nArgs: description isAsync lbruleid methodname name param",["lbruleid","methodname","name"]],"createVPCOffering":[["displaytext","isAsync","name","supportedservices"],"Creates VPC offering\nRequired args: displaytext name supportedservices\nArgs: displaytext isAsync name supportedservices",["displaytext","name","supportedservices"]],"createNetwork":[["account","acltype","displaytext","domainid","endip","gateway","isAsync","name","netmask","networkdomain","networkofferingid","physicalnetworkid","projectid","startip","subdomainaccess","vlan","vpcid","zoneid"],"Creates a network\nRequired args: displaytext name networkofferingid zoneid\nArgs: account acltype displaytext domainid endip gateway isAsync name netmask networkdomain networkofferingid physicalnetworkid projectid startip subdomainaccess vlan vpcid zoneid",["displaytext","name","networkofferingid","zoneid"]],"createRemoteAccessVpn":[["account","domainid","iprange","isAsync","openfirewall","publicipid"],"Creates a l2tp/ipsec remote access vpn\nRequired args: publicipid\nArgs: account domainid iprange isAsync openfirewall publicipid",["publicipid"]],"createInstanceGroup":[["account","domainid","isAsync","name","projectid"],"Creates a vm group\nRequired args: name\nArgs: account domainid isAsync name projectid",["name"]],"createAutoScalePolicy":[["action","conditionids","duration","isAsync","quiettime"],"Creates an autoscale policy for a provision or deprovision action, the action is taken when the all the conditions evaluates to true for the specified duration. The policy is in effect once it is attached to a autscale vm group.\nRequired args: action conditionids duration\nArgs: action conditionids duration isAsync quiettime",["action","conditionids","duration"]],"createServiceOffering":[["cpunumber","cpuspeed","displaytext","domainid","hosttags","isAsync","issystem","limitcpuuse","memory","name","networkrate","offerha","storagetype","systemvmtype","tags"],"Creates a service offering.\nRequired args: cpunumber cpuspeed displaytext memory name\nArgs: cpunumber cpuspeed displaytext domainid hosttags isAsync issystem limitcpuuse memory name networkrate offerha storagetype systemvmtype tags",["cpunumber","cpuspeed","displaytext","memory","name"]],"createTemplate":[["bits","details","displaytext","isAsync","isfeatured","ispublic","name","ostypeid","passwordenabled","requireshvm","snapshotid","templatetag","url","virtualmachineid","volumeid"],"Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it.\nRequired args: displaytext name ostypeid\nArgs: bits details displaytext isAsync isfeatured ispublic name ostypeid passwordenabled requireshvm snapshotid templatetag url virtualmachineid volumeid",["displaytext","name","ostypeid"]],"createNetworkACL":[["cidrlist","endport","icmpcode","icmptype","isAsync","networkid","protocol","startport","traffictype"],"Creates a ACL rule the given network (the network has to belong to VPC)\nRequired args: networkid protocol\nArgs: cidrlist endport icmpcode icmptype isAsync networkid protocol startport traffictype",["networkid","protocol"]],"createTags":[["customer","isAsync","resourceids","resourcetype","tags"],"Creates resource tag(s)\nRequired args: resourceids resourcetype tags\nArgs: customer isAsync resourceids resourcetype tags",["resourceids","resourcetype","tags"]],"createVolumeOnFiler":[["aggregatename","ipaddress","isAsync","password","poolname","size","snapshotpolicy","snapshotreservation","username","volumename"],"Create a volume\nRequired args: aggregatename ipaddress password poolname size username volumename\nArgs: aggregatename ipaddress isAsync password poolname size snapshotpolicy snapshotreservation username volumename",["aggregatename","ipaddress","password","poolname","size","username","volumename"]],"createStaticRoute":[["cidr","gatewayid","isAsync"],"Creates a static route\nRequired args: cidr gatewayid\nArgs: cidr gatewayid isAsync",["cidr","gatewayid"]],"createUser":[["account","domainid","email","firstname","isAsync","lastname","password","timezone","username"],"Creates a user for an account that already exists\nRequired args: account email firstname lastname password username\nArgs: account domainid email firstname isAsync lastname password timezone username",["account","email","firstname","lastname","password","username"]],"createStorageNetworkIpRange":[["endip","gateway","isAsync","netmask","podid","startip","vlan"],"Creates a Storage network IP range.\nRequired args: gateway netmask podid startip\nArgs: endip gateway isAsync netmask podid startip vlan",["gateway","netmask","podid","startip"]],"createPool":[["algorithm","isAsync","name"],"Create a pool\nRequired args: algorithm name\nArgs: algorithm isAsync name",["algorithm","name"]],"createFirewallRule":[["cidrlist","endport","icmpcode","icmptype","ipaddressid","isAsync","protocol","startport","type"],"Creates a firewall rule for a given ip address\nRequired args: ipaddressid protocol\nArgs: cidrlist endport icmpcode icmptype ipaddressid isAsync protocol startport type",["ipaddressid","protocol"]],"createPhysicalNetwork":[["broadcastdomainrange","domainid","isAsync","isolationmethods","name","networkspeed","tags","vlan","zoneid"],"Creates a physical network\nRequired args: name zoneid\nArgs: broadcastdomainrange domainid isAsync isolationmethods name networkspeed tags vlan zoneid",["name","zoneid"]],"createCounter":[["isAsync","name","source","value"],"Adds metric counter\nRequired args: name source value\nArgs: isAsync name source value",["name","source","value"]],"createSnapshot":[["account","domainid","isAsync","policyid","volumeid"],"Creates an instant snapshot of a volume.\nRequired args: volumeid\nArgs: account domainid isAsync policyid volumeid",["volumeid"]],"createVirtualRouterElement":[["isAsync","nspid"],"Create a virtual router element.\nRequired args: nspid\nArgs: isAsync nspid",["nspid"]],"createSSHKeyPair":[["account","domainid","isAsync","name","projectid"],"Create a new keypair and returns the private key\nRequired args: name\nArgs: account domainid isAsync name projectid",["name"]],"markDefaultZoneForAccount":[["account","domainid","isAsync","zoneid"],"Marks a default zone for this account\nRequired args: account domainid zoneid\nArgs: account domainid isAsync zoneid",["account","domainid","zoneid"]],"startSystemVm":[["id","isAsync"],"Starts a system virtual machine.\nRequired args: id\nArgs: id isAsync",["id"]],"startRouter":[["id","isAsync"],"Starts a router.\nRequired args: id\nArgs: id isAsync",["id"]],"startVirtualMachine":[["hostid","id","isAsync"],"Starts a virtual machine.\nRequired args: id\nArgs: hostid id isAsync",["id"]],"addTrafficMonitor":[["excludezones","includezones","isAsync","url","zoneid"],"Adds Traffic Monitor Host for Direct Network Usage\nRequired args: url zoneid\nArgs: excludezones includezones isAsync url zoneid",["url","zoneid"]],"addNetscalerLoadBalancer":[["isAsync","networkdevicetype","password","physicalnetworkid","url","username"],"Adds a netscaler load balancer device\nRequired args: networkdevicetype password physicalnetworkid url username\nArgs: isAsync networkdevicetype password physicalnetworkid url username",["networkdevicetype","password","physicalnetworkid","url","username"]],"addCluster":[["allocationstate","clustername","clustertype","hypervisor","isAsync","password","podid","url","username","vsmipaddress","vsmpassword","vsmusername","zoneid"],"Adds a new cluster\nRequired args: clustername clustertype hypervisor podid zoneid\nArgs: allocationstate clustername clustertype hypervisor isAsync password podid url username vsmipaddress vsmpassword vsmusername zoneid",["clustername","clustertype","hypervisor","podid","zoneid"]],"addS3":[["accesskey","bucket","connectiontimeout","endpoint","isAsync","maxerrorretry","secretkey","sockettimeout","usehttps"],"Adds S3\nRequired args: accesskey bucket secretkey\nArgs: accesskey bucket connectiontimeout endpoint isAsync maxerrorretry secretkey sockettimeout usehttps",["accesskey","bucket","secretkey"]],"addAccountToProject":[["account","email","isAsync","projectid"],"Adds acoount to a project\nRequired args: projectid\nArgs: account email isAsync projectid",["projectid"]],"addExternalLoadBalancer":[["isAsync","password","url","username","zoneid"],"Adds F5 external load balancer appliance.\nRequired args: password url username zoneid\nArgs: isAsync password url username zoneid",["password","url","username","zoneid"]],"addVpnUser":[["account","domainid","isAsync","password","projectid","username"],"Adds vpn users\nRequired args: password username\nArgs: account domainid isAsync password projectid username",["password","username"]],"addSecondaryStorage":[["isAsync","url","zoneid"],"Adds secondary storage.\nRequired args: url\nArgs: isAsync url zoneid",["url"]],"addTrafficType":[["isAsync","kvmnetworklabel","physicalnetworkid","traffictype","vlan","vmwarenetworklabel","xennetworklabel"],"Adds traffic type to a physical network\nRequired args: physicalnetworkid traffictype\nArgs: isAsync kvmnetworklabel physicalnetworkid traffictype vlan vmwarenetworklabel xennetworklabel",["physicalnetworkid","traffictype"]],"addNiciraNvpDevice":[["hostname","isAsync","l3gatewayserviceuuid","password","physicalnetworkid","transportzoneuuid","username"],"Adds a Nicira NVP device\nRequired args: hostname password physicalnetworkid transportzoneuuid username\nArgs: hostname isAsync l3gatewayserviceuuid password physicalnetworkid transportzoneuuid username",["hostname","password","physicalnetworkid","transportzoneuuid","username"]],"addHost":[["allocationstate","clusterid","clustername","hosttags","hypervisor","isAsync","password","podid","url","username","zoneid"],"Adds a new host.\nRequired args: hypervisor password podid url username zoneid\nArgs: allocationstate clusterid clustername hosttags hypervisor isAsync password podid url username zoneid",["hypervisor","password","podid","url","username","zoneid"]],"addF5LoadBalancer":[["isAsync","networkdevicetype","password","physicalnetworkid","url","username"],"Adds a F5 BigIP load balancer device\nRequired args: networkdevicetype password physicalnetworkid url username\nArgs: isAsync networkdevicetype password physicalnetworkid url username",["networkdevicetype","password","physicalnetworkid","url","username"]],"addNetworkDevice":[["isAsync","networkdeviceparameterlist","networkdevicetype"],"Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer\nArgs: isAsync networkdeviceparameterlist networkdevicetype",[]],"addSrxFirewall":[["isAsync","networkdevicetype","password","physicalnetworkid","url","username"],"Adds a SRX firewall device\nRequired args: networkdevicetype password physicalnetworkid url username\nArgs: isAsync networkdevicetype password physicalnetworkid url username",["networkdevicetype","password","physicalnetworkid","url","username"]],"addSwift":[["account","isAsync","key","url","username"],"Adds Swift.\nRequired args: url\nArgs: account isAsync key url username",["url"]],"addExternalFirewall":[["isAsync","password","url","username","zoneid"],"Adds an external firewall appliance\nRequired args: password url username zoneid\nArgs: isAsync password url username zoneid",["password","url","username","zoneid"]],"addNetworkServiceProvider":[["destinationphysicalnetworkid","isAsync","name","physicalnetworkid","servicelist"],"Adds a network serviceProvider to a physical network\nRequired args: name physicalnetworkid\nArgs: destinationphysicalnetworkid isAsync name physicalnetworkid servicelist",["name","physicalnetworkid"]],"restartNetwork":[["cleanup","id","isAsync"],"Restarts the network; includes 1) restarting network elements - virtual routers, dhcp servers 2) reapplying all public ips 3) reapplying loadBalancing/portForwarding rules\nRequired args: id\nArgs: cleanup id isAsync",["id"]],"restartVPC":[["id","isAsync"],"Restarts a VPC\nArgs: id isAsync",[]],"ldapConfig":[["binddn","bindpass","hostname","isAsync","port","queryfilter","searchbase","ssl","truststore","truststorepass"],"Configure the LDAP context for this site.\nRequired args: hostname queryfilter searchbase\nArgs: binddn bindpass hostname isAsync port queryfilter searchbase ssl truststore truststorepass",["hostname","queryfilter","searchbase"]],"ldapRemove":[["isAsync"],"Remove the LDAP context for this site.\nArgs: isAsync",[]],"enableAccount":[["account","domainid","id","isAsync"],"Enables an account\nArgs: account domainid id isAsync",[]],"enableStorageMaintenance":[["id","isAsync"],"Puts storage pool into maintenance state\nRequired args: id\nArgs: id isAsync",["id"]],"enableCiscoNexusVSM":[["id","isAsync"],"Enable a Cisco Nexus VSM device\nRequired args: id\nArgs: id isAsync",["id"]],"enableStaticNat":[["ipaddressid","isAsync","networkid","virtualmachineid"],"Enables static nat for given ip address\nRequired args: ipaddressid virtualmachineid\nArgs: ipaddressid isAsync networkid virtualmachineid",["ipaddressid","virtualmachineid"]],"enableUser":[["id","isAsync"],"Enables a user account\nRequired args: id\nArgs: id isAsync",["id"]],"enableAutoScaleVmGroup":[["id","isAsync"],"Enables an AutoScale Vm Group\nRequired args: id\nArgs: id isAsync",["id"]],"configureSrxFirewall":[["fwdevicecapacity","fwdeviceid","isAsync"],"Configures a SRX firewall device\nRequired args: fwdeviceid\nArgs: fwdevicecapacity fwdeviceid isAsync",["fwdeviceid"]],"configureF5LoadBalancer":[["isAsync","lbdevicecapacity","lbdeviceid"],"configures a F5 load balancer device\nRequired args: lbdeviceid\nArgs: isAsync lbdevicecapacity lbdeviceid",["lbdeviceid"]],"configureVirtualRouterElement":[["enabled","id","isAsync"],"Configures a virtual router element.\nRequired args: id enabled\nArgs: enabled id isAsync",["id","enabled"]],"configureNetscalerLoadBalancer":[["inline","isAsync","lbdevicecapacity","lbdevicededicated","lbdeviceid","podids"],"configures a netscaler load balancer device\nRequired args: lbdeviceid\nArgs: inline isAsync lbdevicecapacity lbdevicededicated lbdeviceid podids",["lbdeviceid"]],"getCloudIdentifier":[["isAsync","userid"],"Retrieves a cloud identifier.\nRequired args: userid\nArgs: isAsync userid",["userid"]],"getVMPassword":[["id","isAsync"],"Returns an encrypted password for the VM\nRequired args: id\nArgs: id isAsync",["id"]],"getUser":[["isAsync","userapikey"],"Find user account by API key\nRequired args: userapikey\nArgs: isAsync userapikey",["userapikey"]],"getApiLimit":[["isAsync"],"Get API limit count for the caller\nArgs: isAsync",[]],"stopSystemVm":[["forced","id","isAsync"],"Stops a system VM.\nRequired args: id\nArgs: forced id isAsync",["id"]],"stopRouter":[["forced","id","isAsync"],"Stops a router.\nRequired args: id\nArgs: forced id isAsync",["id"]],"stopVirtualMachine":[["forced","id","isAsync"],"Stops a virtual machine.\nRequired args: id\nArgs: forced id isAsync",["id"]],"copyIso":[["destzoneid","id","isAsync","sourcezoneid"],"Copies an iso from one zone to another.\nRequired args: id destzoneid sourcezoneid\nArgs: destzoneid id isAsync sourcezoneid",["id","destzoneid","sourcezoneid"]],"copyTemplate":[["destzoneid","id","isAsync","sourcezoneid"],"Copies a template from one zone to another.\nRequired args: id destzoneid sourcezoneid\nArgs: destzoneid id isAsync sourcezoneid",["id","destzoneid","sourcezoneid"]],"resizeVolume":[["diskofferingid","id","isAsync","shrinkok","size"],"Resizes a volume\nArgs: diskofferingid id isAsync shrinkok size",[]],"resetApiLimit":[["account","isAsync"],"Reset api count\nArgs: account isAsync",[]],"resetPasswordForVirtualMachine":[["id","isAsync"],"Resets the password for virtual machine. The virtual machine must be in a \"Stopped\" state and the template must already support this feature for this command to take effect. [async]\nRequired args: id\nArgs: id isAsync",["id"]],"resetVpnConnection":[["account","domainid","id","isAsync"],"Reset site to site vpn connection\nRequired args: id\nArgs: account domainid id isAsync",["id"]],"listInstanceGroups":[["account","domainid","id","isAsync","isrecursive","keyword","listall","name","page","pagesize","projectid"],"Lists vm groups\nArgs: account domainid id isAsync isrecursive keyword listall name page pagesize projectid",[]],"listPhysicalNetworks":[["id","isAsync","keyword","name","page","pagesize","zoneid"],"Lists physical networks\nArgs: id isAsync keyword name page pagesize zoneid",[]],"listNetworks":[["account","acltype","canusefordeploy","domainid","forvpc","id","isAsync","isrecursive","issystem","keyword","listall","page","pagesize","physicalnetworkid","projectid","specifyipranges","supportedservices","tags","traffictype","type","vpcid","zoneid"],"Lists all available networks.\nArgs: account acltype canusefordeploy domainid forvpc id isAsync isrecursive issystem keyword listall page pagesize physicalnetworkid projectid specifyipranges supportedservices tags traffictype type vpcid zoneid",[]],"listCapabilities":[["isAsync"],"Lists capabilities\nArgs: isAsync",[]],"listClusters":[["allocationstate","clustertype","hypervisor","id","isAsync","keyword","managedstate","name","page","pagesize","podid","showcapacities","zoneid"],"Lists clusters.\nArgs: allocationstate clustertype hypervisor id isAsync keyword managedstate name page pagesize podid showcapacities zoneid",[]],"listResourceLimits":[["account","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","resourcetype"],"Lists resource limits.\nArgs: account domainid id isAsync isrecursive keyword listall page pagesize projectid resourcetype",[]],"listFirewallRules":[["account","domainid","id","ipaddressid","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","tags"],"Lists all firewall rules for an IP address.\nArgs: account domainid id ipaddressid isAsync isrecursive keyword listall page pagesize projectid tags",[]],"listSupportedNetworkServices":[["isAsync","keyword","page","pagesize","provider","service"],"Lists all network services provided by CloudStack or for the given Provider.\nArgs: isAsync keyword page pagesize provider service",[]],"listLoadBalancerRules":[["account","domainid","id","isAsync","isrecursive","keyword","listall","name","page","pagesize","projectid","publicipid","tags","virtualmachineid","zoneid"],"Lists load balancer rules.\nArgs: account domainid id isAsync isrecursive keyword listall name page pagesize projectid publicipid tags virtualmachineid zoneid",[]],"listAutoScalePolicies":[["account","action","conditionid","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","vmgroupid"],"Lists autoscale policies.\nArgs: account action conditionid domainid id isAsync isrecursive keyword listall page pagesize vmgroupid",[]],"listNiciraNvpDevices":[["isAsync","keyword","nvpdeviceid","page","pagesize","physicalnetworkid"],"Lists Nicira NVP devices\nArgs: isAsync keyword nvpdeviceid page pagesize physicalnetworkid",[]],"listF5LoadBalancerNetworks":[["isAsync","keyword","lbdeviceid","page","pagesize"],"lists network that are using a F5 load balancer device\nRequired args: lbdeviceid\nArgs: isAsync keyword lbdeviceid page pagesize",["lbdeviceid"]],"listTemplatePermissions":[["id","isAsync"],"List template visibility and all accounts that have permissions to view this template.\nRequired args: id\nArgs: id isAsync",["id"]],"listProjects":[["account","displaytext","domainid","id","isAsync","isrecursive","keyword","listall","name","page","pagesize","state","tags"],"Lists projects and provides detailed information for listed projects\nArgs: account displaytext domainid id isAsync isrecursive keyword listall name page pagesize state tags",[]],"listSystemVms":[["hostid","id","isAsync","keyword","name","page","pagesize","podid","state","storageid","systemvmtype","zoneid"],"List system virtual machines.\nArgs: hostid id isAsync keyword name page pagesize podid state storageid systemvmtype zoneid",[]],"listPortForwardingRules":[["account","domainid","id","ipaddressid","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","tags"],"Lists all port forwarding rules for an IP address.\nArgs: account domainid id ipaddressid isAsync isrecursive keyword listall page pagesize projectid tags",[]],"listExternalFirewalls":[["isAsync","keyword","page","pagesize","zoneid"],"List external firewall appliances.\nRequired args: zoneid\nArgs: isAsync keyword page pagesize zoneid",["zoneid"]],"listVpnGateways":[["account","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","vpcid"],"Lists site 2 site vpn gateways\nArgs: account domainid id isAsync isrecursive keyword listall page pagesize projectid vpcid",[]],"listLoadBalancerRuleInstances":[["applied","id","isAsync","keyword","page","pagesize"],"List all virtual machine instances that are assigned to a load balancer rule.\nRequired args: id\nArgs: applied id isAsync keyword page pagesize",["id"]],"listHosts":[["clusterid","details","hahost","id","isAsync","keyword","name","page","pagesize","podid","resourcestate","state","type","virtualmachineid","zoneid"],"Lists hosts.\nArgs: clusterid details hahost id isAsync keyword name page pagesize podid resourcestate state type virtualmachineid zoneid",[]],"listPools":[["isAsync"],"List Pool\nArgs: isAsync",[]],"listCounters":[["id","isAsync","keyword","name","page","pagesize","source"],"List the counters\nArgs: id isAsync keyword name page pagesize source",[]],"listConfigurations":[["category","isAsync","keyword","name","page","pagesize"],"Lists all configurations.\nArgs: category isAsync keyword name page pagesize",[]],"listUsageRecords":[["account","accountid","domainid","enddate","isAsync","keyword","page","pagesize","projectid","startdate","type"],"Lists usage records for accounts\nRequired args: enddate startdate\nArgs: account accountid domainid enddate isAsync keyword page pagesize projectid startdate type",["enddate","startdate"]],"listStoragePools":[["clusterid","id","ipaddress","isAsync","keyword","name","page","pagesize","path","podid","zoneid"],"Lists storage pools.\nArgs: clusterid id ipaddress isAsync keyword name page pagesize path podid zoneid",[]],"listSnapshots":[["account","domainid","id","intervaltype","isAsync","isrecursive","keyword","listall","name","page","pagesize","projectid","snapshottype","tags","volumeid"],"Lists all available snapshots for the account.\nArgs: account domainid id intervaltype isAsync isrecursive keyword listall name page pagesize projectid snapshottype tags volumeid",[]],"listZones":[["available","domainid","id","isAsync","keyword","page","pagesize","showcapacities"],"Lists zones\nArgs: available domainid id isAsync keyword page pagesize showcapacities",[]],"listServiceOfferings":[["domainid","id","isAsync","issystem","keyword","name","page","pagesize","systemvmtype","virtualmachineid"],"Lists all available service offerings.\nArgs: domainid id isAsync issystem keyword name page pagesize systemvmtype virtualmachineid",[]],"listCiscoNexusVSMs":[["clusterid","isAsync","keyword","page","pagesize","zoneid"],"Retrieves a Cisco Nexus 1000v Virtual Switch Manager device associated with a Cluster\nArgs: clusterid isAsync keyword page pagesize zoneid",[]],"listNetworkServiceProviders":[["isAsync","keyword","name","page","pagesize","physicalnetworkid","state"],"Lists network serviceproviders for a given physical network.\nArgs: isAsync keyword name page pagesize physicalnetworkid state",[]],"listCapacity":[["clusterid","fetchlatest","isAsync","keyword","page","pagesize","podid","sortby","type","zoneid"],"Lists all the system wide capacities.\nArgs: clusterid fetchlatest isAsync keyword page pagesize podid sortby type zoneid",[]],"listDiskOfferings":[["domainid","id","isAsync","keyword","name","page","pagesize"],"Lists all available disk offerings.\nArgs: domainid id isAsync keyword name page pagesize",[]],"listLBStickinessPolicies":[["isAsync","keyword","lbruleid","page","pagesize"],"Lists LBStickiness policies.\nRequired args: lbruleid\nArgs: isAsync keyword lbruleid page pagesize",["lbruleid"]],"listSrxFirewallNetworks":[["isAsync","keyword","lbdeviceid","page","pagesize"],"lists network that are using SRX firewall device\nRequired args: lbdeviceid\nArgs: isAsync keyword lbdeviceid page pagesize",["lbdeviceid"]],"listSecurityGroups":[["account","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","securitygroupname","tags","virtualmachineid"],"Lists security groups\nArgs: account domainid id isAsync isrecursive keyword listall page pagesize projectid securitygroupname tags virtualmachineid",[]],"listConditions":[["account","counterid","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","policyid"],"List Conditions for the specific user\nArgs: account counterid domainid id isAsync isrecursive keyword listall page pagesize policyid",[]],"listSwifts":[["id","isAsync","keyword","page","pagesize"],"List Swift.\nArgs: id isAsync keyword page pagesize",[]],"listHypervisorCapabilities":[["hypervisor","id","isAsync","keyword","page","pagesize"],"Lists all hypervisor capabilities.\nArgs: hypervisor id isAsync keyword page pagesize",[]],"listTags":[["account","customer","domainid","isAsync","isrecursive","key","keyword","listall","page","pagesize","projectid","resourceid","resourcetype","value"],"List resource tag(s)\nArgs: account customer domainid isAsync isrecursive key keyword listall page pagesize projectid resourceid resourcetype value",[]],"listRouters":[["account","domainid","forvpc","hostid","id","isAsync","isrecursive","keyword","listall","name","networkid","page","pagesize","podid","projectid","state","vpcid","zoneid"],"List routers.\nArgs: account domainid forvpc hostid id isAsync isrecursive keyword listall name networkid page pagesize podid projectid state vpcid zoneid",[]],"listTrafficTypes":[["isAsync","keyword","page","pagesize","physicalnetworkid"],"Lists traffic types of a given physical network.\nRequired args: physicalnetworkid\nArgs: isAsync keyword page pagesize physicalnetworkid",["physicalnetworkid"]],"listProjectInvitations":[["account","activeonly","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","state"],"Lists projects and provides detailed information for listed projects\nArgs: account activeonly domainid id isAsync isrecursive keyword listall page pagesize projectid state",[]],"listIsos":[["account","bootable","domainid","hypervisor","id","isAsync","isofilter","ispublic","isready","isrecursive","keyword","listall","name","page","pagesize","projectid","tags","zoneid"],"Lists all available ISO files.\nArgs: account bootable domainid hypervisor id isAsync isofilter ispublic isready isrecursive keyword listall name page pagesize projectid tags zoneid",[]],"listUsers":[["account","accounttype","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","state","username"],"Lists user accounts\nArgs: account accounttype domainid id isAsync isrecursive keyword listall page pagesize state username",[]],"listSSHKeyPairs":[["account","domainid","fingerprint","isAsync","isrecursive","keyword","listall","name","page","pagesize","projectid"],"List registered keypairs\nArgs: account domainid fingerprint isAsync isrecursive keyword listall name page pagesize projectid",[]],"listPrivateGateways":[["account","domainid","id","ipaddress","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","state","vlan","vpcid"],"List private gateways\nArgs: account domainid id ipaddress isAsync isrecursive keyword listall page pagesize projectid state vlan vpcid",[]],"listUsageTypes":[["isAsync"],"List Usage Types\nArgs: isAsync",[]],"listDomainChildren":[["id","isAsync","isrecursive","keyword","listall","name","page","pagesize"],"Lists all children domains belonging to a specified domain\nArgs: id isAsync isrecursive keyword listall name page pagesize",[]],"listDomains":[["id","isAsync","keyword","level","listall","name","page","pagesize"],"Lists domains and provides detailed information for listed domains\nArgs: id isAsync keyword level listall name page pagesize",[]],"listExternalLoadBalancers":[["isAsync","keyword","page","pagesize","zoneid"],"Lists F5 external load balancer appliances added in a zone.\nArgs: isAsync keyword page pagesize zoneid",[]],"listNetscalerLoadBalancers":[["isAsync","keyword","lbdeviceid","page","pagesize","physicalnetworkid"],"lists netscaler load balancer devices\nArgs: isAsync keyword lbdeviceid page pagesize physicalnetworkid",[]],"listS3s":[["isAsync","keyword","page","pagesize"],"Lists S3s\nArgs: isAsync keyword page pagesize",[]],"listHypervisors":[["isAsync","zoneid"],"List hypervisors\nArgs: isAsync zoneid",[]],"listAccounts":[["accounttype","domainid","id","isAsync","isrecursive","keyword","listall","name","page","pagesize","state"],"Lists accounts and provides detailed account information for listed accounts\nArgs: accounttype domainid id isAsync isrecursive keyword listall name page pagesize state",[]],"listNetworkDevice":[["isAsync","keyword","networkdeviceparameterlist","networkdevicetype","page","pagesize"],"List network devices\nArgs: isAsync keyword networkdeviceparameterlist networkdevicetype page pagesize",[]],"listVlanIpRanges":[["account","domainid","forvirtualnetwork","id","isAsync","keyword","networkid","page","pagesize","physicalnetworkid","podid","projectid","vlan","zoneid"],"Lists all VLAN IP ranges.\nArgs: account domainid forvirtualnetwork id isAsync keyword networkid page pagesize physicalnetworkid podid projectid vlan zoneid",[]],"listTrafficTypeImplementors":[["isAsync","keyword","page","pagesize","traffictype"],"Lists implementors of implementor of a network traffic type or implementors of all network traffic types\nArgs: isAsync keyword page pagesize traffictype",[]],"listStorageNetworkIpRange":[["id","isAsync","keyword","page","pagesize","podid","zoneid"],"List a storage network IP range.\nArgs: id isAsync keyword page pagesize podid zoneid",[]],"listIsoPermissions":[["id","isAsync"],"List iso visibility and all accounts that have permissions to view this iso.\nRequired args: id\nArgs: id isAsync",["id"]],"listSnapshotPolicies":[["isAsync","keyword","page","pagesize","volumeid"],"Lists snapshot policies.\nRequired args: volumeid\nArgs: isAsync keyword page pagesize volumeid",["volumeid"]],"listAutoScaleVmGroups":[["account","domainid","id","isAsync","isrecursive","keyword","lbruleid","listall","page","pagesize","policyid","projectid","vmprofileid","zoneid"],"Lists autoscale vm groups.\nArgs: account domainid id isAsync isrecursive keyword lbruleid listall page pagesize policyid projectid vmprofileid zoneid",[]],"listProjectAccounts":[["account","isAsync","keyword","page","pagesize","projectid","role"],"Lists project's accounts\nRequired args: projectid\nArgs: account isAsync keyword page pagesize projectid role",["projectid"]],"listAutoScaleVmProfiles":[["account","domainid","id","isAsync","isrecursive","keyword","listall","otherdeployparams","page","pagesize","projectid","templateid"],"Lists autoscale vm profiles.\nArgs: account domainid id isAsync isrecursive keyword listall otherdeployparams page pagesize projectid templateid",[]],"listApis":[["isAsync","name"],"lists all available apis on the server, provided by the Api Discovery plugin\nArgs: isAsync name",[]],"listVPCs":[["account","cidr","displaytext","domainid","id","isAsync","isrecursive","keyword","listall","name","page","pagesize","projectid","state","supportedservices","tags","vpcofferingid","zoneid"],"Lists VPCs\nArgs: account cidr displaytext domainid id isAsync isrecursive keyword listall name page pagesize projectid state supportedservices tags vpcofferingid zoneid",[]],"listF5LoadBalancers":[["isAsync","keyword","lbdeviceid","page","pagesize","physicalnetworkid"],"lists F5 load balancer devices\nArgs: isAsync keyword lbdeviceid page pagesize physicalnetworkid",[]],"listVpnCustomerGateways":[["account","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","projectid"],"Lists site to site vpn customer gateways\nArgs: account domainid id isAsync isrecursive keyword listall page pagesize projectid",[]],"listNetworkOfferings":[["availability","displaytext","forvpc","guestiptype","id","isAsync","isdefault","istagged","keyword","name","networkid","page","pagesize","sourcenatsupported","specifyipranges","specifyvlan","state","supportedservices","tags","traffictype","zoneid"],"Lists all available network offerings.\nArgs: availability displaytext forvpc guestiptype id isAsync isdefault istagged keyword name networkid page pagesize sourcenatsupported specifyipranges specifyvlan state supportedservices tags traffictype zoneid",[]],"listVirtualMachines":[["account","details","domainid","forvirtualnetwork","groupid","hostid","hypervisor","id","isAsync","isoid","isrecursive","keyword","listall","name","networkid","page","pagesize","podid","projectid","state","storageid","tags","templateid","vpcid","zoneid"],"List the virtual machines owned by the account.\nArgs: account details domainid forvirtualnetwork groupid hostid hypervisor id isAsync isoid isrecursive keyword listall name networkid page pagesize podid projectid state storageid tags templateid vpcid zoneid",[]],"listNetscalerLoadBalancerNetworks":[["isAsync","keyword","lbdeviceid","page","pagesize"],"lists network that are using a netscaler load balancer device\nRequired args: lbdeviceid\nArgs: isAsync keyword lbdeviceid page pagesize",["lbdeviceid"]],"listOsCategories":[["id","isAsync","keyword","name","page","pagesize"],"Lists all supported OS categories for this cloud.\nArgs: id isAsync keyword name page pagesize",[]],"listVirtualRouterElements":[["enabled","id","isAsync","keyword","nspid","page","pagesize"],"Lists all available virtual router elements.\nArgs: enabled id isAsync keyword nspid page pagesize",[]],"listLunsOnFiler":[["isAsync","poolname"],"List LUN\nRequired args: poolname\nArgs: isAsync poolname",["poolname"]],"listAsyncJobs":[["account","domainid","isAsync","isrecursive","keyword","listall","page","pagesize","startdate"],"Lists all pending asynchronous jobs for the account.\nArgs: account domainid isAsync isrecursive keyword listall page pagesize startdate",[]],"listOsTypes":[["description","id","isAsync","keyword","oscategoryid","page","pagesize"],"Lists all supported OS types for this cloud.\nArgs: description id isAsync keyword oscategoryid page pagesize",[]],"listNetworkACLs":[["account","domainid","id","isAsync","isrecursive","keyword","listall","networkid","page","pagesize","projectid","tags","traffictype"],"Lists all network ACLs\nArgs: account domainid id isAsync isrecursive keyword listall networkid page pagesize projectid tags traffictype",[]],"listVolumesOnFiler":[["isAsync","poolname"],"List Volumes\nRequired args: poolname\nArgs: isAsync poolname",["poolname"]],"listEventTypes":[["isAsync"],"List Event Types\nArgs: isAsync",[]],"listRemoteAccessVpns":[["account","domainid","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","publicipid"],"Lists remote access vpns\nRequired args: publicipid\nArgs: account domainid isAsync isrecursive keyword listall page pagesize projectid publicipid",["publicipid"]],"listAlerts":[["id","isAsync","keyword","page","pagesize","type"],"Lists all alerts.\nArgs: id isAsync keyword page pagesize type",[]],"listVPCOfferings":[["displaytext","id","isAsync","isdefault","keyword","name","page","pagesize","state","supportedservices"],"Lists VPC offerings\nArgs: displaytext id isAsync isdefault keyword name page pagesize state supportedservices",[]],"listNiciraNvpDeviceNetworks":[["isAsync","keyword","nvpdeviceid","page","pagesize"],"lists network that are using a nicira nvp device\nRequired args: nvpdeviceid\nArgs: isAsync keyword nvpdeviceid page pagesize",["nvpdeviceid"]],"listEvents":[["account","domainid","duration","enddate","entrytime","id","isAsync","isrecursive","keyword","level","listall","page","pagesize","projectid","startdate","type"],"A command to list events.\nArgs: account domainid duration enddate entrytime id isAsync isrecursive keyword level listall page pagesize projectid startdate type",[]],"listTemplates":[["account","domainid","hypervisor","id","isAsync","isrecursive","keyword","listall","name","page","pagesize","projectid","tags","templatefilter","zoneid"],"List all public, private, and privileged templates.\nRequired args: templatefilter\nArgs: account domainid hypervisor id isAsync isrecursive keyword listall name page pagesize projectid tags templatefilter zoneid",["templatefilter"]],"listPublicIpAddresses":[["account","allocatedonly","associatednetworkid","domainid","forloadbalancing","forvirtualnetwork","id","ipaddress","isAsync","isrecursive","issourcenat","isstaticnat","keyword","listall","page","pagesize","physicalnetworkid","projectid","tags","vlanid","vpcid","zoneid"],"Lists all public ip addresses\nArgs: account allocatedonly associatednetworkid domainid forloadbalancing forvirtualnetwork id ipaddress isAsync isrecursive issourcenat isstaticnat keyword listall page pagesize physicalnetworkid projectid tags vlanid vpcid zoneid",[]],"listIpForwardingRules":[["account","domainid","id","ipaddressid","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","virtualmachineid"],"List the ip forwarding rules\nArgs: account domainid id ipaddressid isAsync isrecursive keyword listall page pagesize projectid virtualmachineid",[]],"listSrxFirewalls":[["fwdeviceid","isAsync","keyword","page","pagesize","physicalnetworkid"],"lists SRX firewall devices in a physical network\nArgs: fwdeviceid isAsync keyword page pagesize physicalnetworkid",[]],"listVpnConnections":[["account","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","vpcid"],"Lists site to site vpn connection gateways\nArgs: account domainid id isAsync isrecursive keyword listall page pagesize projectid vpcid",[]],"listTrafficMonitors":[["isAsync","keyword","page","pagesize","zoneid"],"List traffic monitor Hosts.\nRequired args: zoneid\nArgs: isAsync keyword page pagesize zoneid",["zoneid"]],"listVpnUsers":[["account","domainid","id","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","username"],"Lists vpn users\nArgs: account domainid id isAsync isrecursive keyword listall page pagesize projectid username",[]],"listStaticRoutes":[["account","domainid","gatewayid","id","isAsync","isrecursive","keyword","listall","page","pagesize","projectid","tags","vpcid"],"Lists all static routes\nArgs: account domainid gatewayid id isAsync isrecursive keyword listall page pagesize projectid tags vpcid",[]],"listVolumes":[["account","domainid","hostid","id","isAsync","isrecursive","keyword","listall","name","page","pagesize","podid","projectid","tags","type","virtualmachineid","zoneid"],"Lists all volumes.\nArgs: account domainid hostid id isAsync isrecursive keyword listall name page pagesize podid projectid tags type virtualmachineid zoneid",[]],"listPods":[["allocationstate","id","isAsync","keyword","name","page","pagesize","showcapacities","zoneid"],"Lists all Pods.\nArgs: allocationstate id isAsync keyword name page pagesize showcapacities zoneid",[]],"uploadVolume":[["account","checksum","domainid","format","isAsync","name","url","zoneid"],"Uploads a data disk.\nRequired args: format name url zoneid\nArgs: account checksum domainid format isAsync name url zoneid",["format","name","url","zoneid"]],"uploadCustomCertificate":[["certificate","domainsuffix","id","isAsync","name","privatekey"],"Uploads a custom certificate for the console proxy VMs to use for SSL. Can be used to upload a single certificate signed by a known CA. Can also be used, through multiple calls, to upload a chain of certificates from CA to the custom certificate itself.\nRequired args: certificate domainsuffix\nArgs: certificate domainsuffix id isAsync name privatekey",["certificate","domainsuffix"]],"removeFromLoadBalancerRule":[["id","isAsync","virtualmachineids"],"Removes a virtual machine or a list of virtual machines from a load balancer rule.\nRequired args: id virtualmachineids\nArgs: id isAsync virtualmachineids",["id","virtualmachineids"]],"removeVpnUser":[["account","domainid","isAsync","projectid","username"],"Removes vpn user\nRequired args: username\nArgs: account domainid isAsync projectid username",["username"]],"deleteLoadBalancerRule":[["id","isAsync"],"Deletes a load balancer rule.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteProjectInvitation":[["id","isAsync"],"Accepts or declines project invitation\nRequired args: id\nArgs: id isAsync",["id"]],"deleteSecurityGroup":[["account","domainid","id","isAsync","name","projectid"],"Deletes security group\nArgs: account domainid id isAsync name projectid",[]],"deleteAccountFromProject":[["account","isAsync","projectid"],"Deletes account from the project\nRequired args: account projectid\nArgs: account isAsync projectid",["account","projectid"]],"deleteNetworkDevice":[["id","isAsync"],"Deletes network device.\nRequired args: id\nArgs: id isAsync",["id"]],"deletePod":[["id","isAsync"],"Deletes a Pod.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteSrxFirewall":[["fwdeviceid","isAsync"],"delete a SRX firewall device\nRequired args: fwdeviceid\nArgs: fwdeviceid isAsync",["fwdeviceid"]],"deleteSnapshotPolicies":[["id","ids","isAsync"],"Deletes snapshot policies for the account.\nArgs: id ids isAsync",[]],"deleteZone":[["id","isAsync"],"Deletes a Zone.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteNiciraNvpDevice":[["isAsync","nvpdeviceid"],"delete a nicira nvp device\nRequired args: nvpdeviceid\nArgs: isAsync nvpdeviceid",["nvpdeviceid"]],"deleteStoragePool":[["forced","id","isAsync"],"Deletes a storage pool.\nRequired args: id\nArgs: forced id isAsync",["id"]],"deleteVpnGateway":[["id","isAsync"],"Delete site to site vpn gateway\nRequired args: id\nArgs: id isAsync",["id"]],"deleteAutoScaleVmGroup":[["id","isAsync"],"Deletes a autoscale vm group.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteTrafficMonitor":[["id","isAsync"],"Deletes an traffic monitor host.\nRequired args: id\nArgs: id isAsync",["id"]],"deletePrivateGateway":[["id","isAsync"],"Deletes a Private gateway\nRequired args: id\nArgs: id isAsync",["id"]],"deleteVolume":[["id","isAsync"],"Deletes a detached disk volume.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteVPC":[["id","isAsync"],"Deletes a VPC\nRequired args: id\nArgs: id isAsync",["id"]],"deleteCondition":[["id","isAsync"],"Removes a condition\nRequired args: id\nArgs: id isAsync",["id"]],"deleteAutoScaleVmProfile":[["id","isAsync"],"Deletes a autoscale vm profile.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteAccount":[["id","isAsync"],"Deletes a account, and all users associated with this account\nRequired args: id\nArgs: id isAsync",["id"]],"deleteFirewallRule":[["id","isAsync"],"Deletes a firewall rule\nRequired args: id\nArgs: id isAsync",["id"]],"deleteNetworkOffering":[["id","isAsync"],"Deletes a network offering.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteVpnCustomerGateway":[["id","isAsync"],"Delete site to site vpn customer gateway\nRequired args: id\nArgs: id isAsync",["id"]],"deleteProject":[["id","isAsync"],"Deletes a project\nRequired args: id\nArgs: id isAsync",["id"]],"deletePhysicalNetwork":[["id","isAsync"],"Deletes a Physical Network.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteDomain":[["cleanup","id","isAsync"],"Deletes a specified domain\nRequired args: id\nArgs: cleanup id isAsync",["id"]],"deleteDiskOffering":[["id","isAsync"],"Updates a disk offering.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteExternalLoadBalancer":[["id","isAsync"],"Deletes a F5 external load balancer appliance added in a zone.\nRequired args: id\nArgs: id isAsync",["id"]],"deletePortForwardingRule":[["id","isAsync"],"Deletes a port forwarding rule\nRequired args: id\nArgs: id isAsync",["id"]],"deleteCluster":[["id","isAsync"],"Deletes a cluster.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteIpForwardingRule":[["id","isAsync"],"Deletes an ip forwarding rule\nRequired args: id\nArgs: id isAsync",["id"]],"deleteVpnConnection":[["id","isAsync"],"Delete site to site vpn connection\nRequired args: id\nArgs: id isAsync",["id"]],"deleteLBStickinessPolicy":[["id","isAsync"],"Deletes a LB stickiness policy.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteVPCOffering":[["id","isAsync"],"Deletes VPC offering\nRequired args: id\nArgs: id isAsync",["id"]],"deleteNetwork":[["id","isAsync"],"Deletes a network\nRequired args: id\nArgs: id isAsync",["id"]],"deleteRemoteAccessVpn":[["isAsync","publicipid"],"Destroys a l2tp/ipsec remote access vpn\nRequired args: publicipid\nArgs: isAsync publicipid",["publicipid"]],"deleteInstanceGroup":[["id","isAsync"],"Deletes a vm group\nRequired args: id\nArgs: id isAsync",["id"]],"deleteAutoScalePolicy":[["id","isAsync"],"Deletes a autoscale policy.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteServiceOffering":[["id","isAsync"],"Deletes a service offering.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteTemplate":[["id","isAsync","zoneid"],"Deletes a template from the system. All virtual machines using the deleted template will not be affected.\nRequired args: id\nArgs: id isAsync zoneid",["id"]],"deleteSnapshot":[["id","isAsync"],"Deletes a snapshot of a disk volume.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteNetworkACL":[["id","isAsync"],"Deletes a Network ACL\nRequired args: id\nArgs: id isAsync",["id"]],"deleteTags":[["isAsync","resourceids","resourcetype","tags"],"Deleting resource tag(s)\nRequired args: resourceids resourcetype\nArgs: isAsync resourceids resourcetype tags",["resourceids","resourcetype"]],"deleteStaticRoute":[["id","isAsync"],"Deletes a static route\nRequired args: id\nArgs: id isAsync",["id"]],"deleteTrafficType":[["id","isAsync"],"Deletes traffic type of a physical network\nRequired args: id\nArgs: id isAsync",["id"]],"deleteHost":[["forced","forcedestroylocalstorage","id","isAsync"],"Deletes a host.\nRequired args: id\nArgs: forced forcedestroylocalstorage id isAsync",["id"]],"deleteUser":[["id","isAsync"],"Creates a user for an account\nRequired args: id\nArgs: id isAsync",["id"]],"deleteStorageNetworkIpRange":[["id","isAsync"],"Deletes a storage network IP Range.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteExternalFirewall":[["id","isAsync"],"Deletes an external firewall appliance.\nRequired args: id\nArgs: id isAsync",["id"]],"deletePool":[["isAsync","poolname"],"Delete a pool\nRequired args: poolname\nArgs: isAsync poolname",["poolname"]],"deleteCiscoNexusVSM":[["id","isAsync"],"delete a Cisco Nexus VSM device\nRequired args: id\nArgs: id isAsync",["id"]],"deleteNetscalerLoadBalancer":[["isAsync","lbdeviceid"],"delete a netscaler load balancer device\nRequired args: lbdeviceid\nArgs: isAsync lbdeviceid",["lbdeviceid"]],"deleteVlanIpRange":[["id","isAsync"],"Creates a VLAN IP range.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteCounter":[["id","isAsync"],"Deletes a counter\nRequired args: id\nArgs: id isAsync",["id"]],"deleteF5LoadBalancer":[["isAsync","lbdeviceid"],"delete a F5 load balancer device\nRequired args: lbdeviceid\nArgs: isAsync lbdeviceid",["lbdeviceid"]],"deleteIso":[["id","isAsync","zoneid"],"Deletes an ISO file.\nRequired args: id\nArgs: id isAsync zoneid",["id"]],"deleteNetworkServiceProvider":[["id","isAsync"],"Deletes a Network Service Provider.\nRequired args: id\nArgs: id isAsync",["id"]],"deleteSSHKeyPair":[["account","domainid","isAsync","name","projectid"],"Deletes a keypair by name\nRequired args: name\nArgs: account domainid isAsync name projectid",["name"]],"activateProject":[["id","isAsync"],"Activates a project\nRequired args: id\nArgs: id isAsync",["id"]],"migrateSystemVm":[["hostid","isAsync","virtualmachineid"],"Attempts Migration of a system virtual machine to the host specified.\nRequired args: hostid virtualmachineid\nArgs: hostid isAsync virtualmachineid",["hostid","virtualmachineid"]],"migrateVolume":[["isAsync","storageid","volumeid"],"Migrate volume\nRequired args: storageid volumeid\nArgs: isAsync storageid volumeid",["storageid","volumeid"]],"migrateVirtualMachine":[["hostid","isAsync","storageid","virtualmachineid"],"Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool\nRequired args: virtualmachineid\nArgs: hostid isAsync storageid virtualmachineid",["virtualmachineid"]],"lockAccount":[["account","domainid","isAsync"],"Locks an account\nRequired args: account domainid\nArgs: account domainid isAsync",["account","domainid"]],"lockUser":[["id","isAsync"],"Locks a user account\nRequired args: id\nArgs: id isAsync",["id"]],"recoverVirtualMachine":[["id","isAsync"],"Recovers a virtual machine.\nRequired args: id\nArgs: id isAsync",["id"]],"extractVolume":[["id","isAsync","mode","url","zoneid"],"Extracts volume\nRequired args: id mode zoneid\nArgs: id isAsync mode url zoneid",["id","mode","zoneid"]],"extractIso":[["id","isAsync","mode","url","zoneid"],"Extracts an ISO\nRequired args: id mode\nArgs: id isAsync mode url zoneid",["id","mode"]],"extractTemplate":[["id","isAsync","mode","url","zoneid"],"Extracts a template\nRequired args: id mode\nArgs: id isAsync mode url zoneid",["id","mode"]],"deployVirtualMachine":[["account","diskofferingid","displayname","domainid","group","hostid","hypervisor","ipaddress","iptonetworklist","isAsync","keyboard","keypair","name","networkids","projectid","securitygroupids","securitygroupnames","serviceofferingid","size","startvm","templateid","userdata","zoneid"],"Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.\nRequired args: serviceofferingid templateid zoneid\nArgs: account diskofferingid displayname domainid group hostid hypervisor ipaddress iptonetworklist isAsync keyboard keypair name networkids projectid securitygroupids securitygroupnames serviceofferingid size startvm templateid userdata zoneid",["serviceofferingid","templateid","zoneid"]],"rebootSystemVm":[["id","isAsync"],"Reboots a system VM.\nRequired args: id\nArgs: id isAsync",["id"]],"rebootRouter":[["id","isAsync"],"Starts a router.\nRequired args: id\nArgs: id isAsync",["id"]],"rebootVirtualMachine":[["id","isAsync"],"Reboots a virtual machine.\nRequired args: id\nArgs: id isAsync",["id"]],"destroySystemVm":[["id","isAsync"],"Destroyes a system virtual machine.\nRequired args: id\nArgs: id isAsync",["id"]],"destroyRouter":[["id","isAsync"],"Destroys a router.\nRequired args: id\nArgs: id isAsync",["id"]],"destroyVolumeOnFiler":[["aggregatename","ipaddress","isAsync","volumename"],"Destroy a Volume\nRequired args: aggregatename ipaddress volumename\nArgs: aggregatename ipaddress isAsync volumename",["aggregatename","ipaddress","volumename"]],"destroyLunOnFiler":[["isAsync","path"],"Destroy a LUN\nRequired args: path\nArgs: isAsync path",["path"]],"destroyVirtualMachine":[["id","isAsync"],"Destroys a virtual machine. Once destroyed, only the administrator can recover it.\nRequired args: id\nArgs: id isAsync",["id"]],"associateIpAddress":[["account","domainid","isAsync","networkid","projectid","vpcid","zoneid"],"Acquires and associates a public IP to an account.\nArgs: account domainid isAsync networkid projectid vpcid zoneid",[]],"associateLun":[["iqn","isAsync","name"],"Associate a LUN with a guest IQN\nRequired args: iqn name\nArgs: iqn isAsync name",["iqn","name"]],"modifyPool":[["algorithm","isAsync","poolname"],"Modify pool\nRequired args: algorithm poolname\nArgs: algorithm isAsync poolname",["algorithm","poolname"]],"updateLoadBalancerRule":[["algorithm","description","id","isAsync","name"],"Updates load balancer\nRequired args: id\nArgs: algorithm description id isAsync name",["id"]],"updateDomain":[["id","isAsync","name","networkdomain"],"Updates a domain with a new name\nRequired args: id\nArgs: id isAsync name networkdomain",["id"]],"updateInstanceGroup":[["id","isAsync","name"],"Updates a vm group\nRequired args: id\nArgs: id isAsync name",["id"]],"updateDiskOffering":[["displaytext","id","isAsync","name","sortkey"],"Updates a disk offering.\nRequired args: id\nArgs: displaytext id isAsync name sortkey",["id"]],"updateVirtualMachine":[["displayname","group","haenable","id","isAsync","ostypeid","userdata"],"Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call.\nRequired args: id\nArgs: displayname group haenable id isAsync ostypeid userdata",["id"]],"updateVPCOffering":[["displaytext","id","isAsync","name","state"],"Updates VPC offering\nArgs: displaytext id isAsync name state",[]],"updatePortForwardingRule":[["ipaddressid","isAsync","privateip","privateport","protocol","publicport","virtualmachineid"],"Updates a port forwarding rule. Only the private port and the virtual machine can be updated.\nRequired args: ipaddressid privateport protocol publicport\nArgs: ipaddressid isAsync privateip privateport protocol publicport virtualmachineid",["ipaddressid","privateport","protocol","publicport"]],"updateCluster":[["allocationstate","clustername","clustertype","hypervisor","id","isAsync","managedstate"],"Updates an existing cluster\nRequired args: id\nArgs: allocationstate clustername clustertype hypervisor id isAsync managedstate",["id"]],"updateHost":[["allocationstate","hosttags","id","isAsync","oscategoryid","url"],"Updates a host.\nRequired args: id\nArgs: allocationstate hosttags id isAsync oscategoryid url",["id"]],"updateUser":[["email","firstname","id","isAsync","lastname","password","timezone","userapikey","username","usersecretkey"],"Updates a user account\nRequired args: id\nArgs: email firstname id isAsync lastname password timezone userapikey username usersecretkey",["id"]],"updateVPC":[["displaytext","id","isAsync","name"],"Updates a VPC\nArgs: displaytext id isAsync name",[]],"updateHostPassword":[["clusterid","hostid","isAsync","password","username"],"Update password of a host/pool on management server.\nRequired args: password username\nArgs: clusterid hostid isAsync password username",["password","username"]],"updatePod":[["allocationstate","endip","gateway","id","isAsync","name","netmask","startip"],"Updates a Pod.\nRequired args: id\nArgs: allocationstate endip gateway id isAsync name netmask startip",["id"]],"updateConfiguration":[["isAsync","name","value"],"Updates a configuration.\nRequired args: name\nArgs: isAsync name value",["name"]],"updateStorageNetworkIpRange":[["endip","id","isAsync","netmask","startip","vlan"],"Update a Storage network IP range, only allowed when no IPs in this range have been allocated.\nRequired args: id\nArgs: endip id isAsync netmask startip vlan",["id"]],"updateIsoPermissions":[["accounts","id","isAsync","isextractable","isfeatured","ispublic","op","projectids"],"Updates iso permissions\nRequired args: id\nArgs: accounts id isAsync isextractable isfeatured ispublic op projectids",["id"]],"updateResourceLimit":[["account","domainid","isAsync","max","projectid","resourcetype"],"Updates resource limits for an account or domain.\nRequired args: resourcetype\nArgs: account domainid isAsync max projectid resourcetype",["resourcetype"]],"updateTrafficType":[["id","isAsync","kvmnetworklabel","vmwarenetworklabel","xennetworklabel"],"Updates traffic type of a physical network\nRequired args: id\nArgs: id isAsync kvmnetworklabel vmwarenetworklabel xennetworklabel",["id"]],"updateAccount":[["account","accountdetails","domainid","id","isAsync","networkdomain","newname"],"Updates account information for the authenticated user\nRequired args: newname\nArgs: account accountdetails domainid id isAsync networkdomain newname",["newname"]],"updateStoragePool":[["id","isAsync","tags"],"Updates a storage pool.\nRequired args: id\nArgs: id isAsync tags",["id"]],"updateResourceCount":[["account","domainid","isAsync","projectid","resourcetype"],"Recalculate and update resource count for an account or domain.\nRequired args: domainid\nArgs: account domainid isAsync projectid resourcetype",["domainid"]],"updateNetwork":[["changecidr","displaytext","id","isAsync","name","networkdomain","networkofferingid"],"Updates a network\nRequired args: id\nArgs: changecidr displaytext id isAsync name networkdomain networkofferingid",["id"]],"updateZone":[["allocationstate","details","dhcpprovider","dns1","dns2","dnssearchorder","domain","guestcidraddress","id","internaldns1","internaldns2","isAsync","ispublic","localstorageenabled","name"],"Updates a Zone.\nRequired args: id\nArgs: allocationstate details dhcpprovider dns1 dns2 dnssearchorder domain guestcidraddress id internaldns1 internaldns2 isAsync ispublic localstorageenabled name",["id"]],"updateNetworkOffering":[["availability","displaytext","id","isAsync","name","sortkey","state"],"Updates a network offering.\nArgs: availability displaytext id isAsync name sortkey state",[]],"updatePhysicalNetwork":[["id","isAsync","networkspeed","state","tags","vlan"],"Updates a physical network\nRequired args: id\nArgs: id isAsync networkspeed state tags vlan",["id"]],"updateProjectInvitation":[["accept","account","isAsync","projectid","token"],"Accepts or declines project invitation\nRequired args: projectid\nArgs: accept account isAsync projectid token",["projectid"]],"updateAutoScalePolicy":[["conditionids","duration","id","isAsync","quiettime"],"Updates an existing autoscale policy.\nRequired args: id\nArgs: conditionids duration id isAsync quiettime",["id"]],"updateTemplatePermissions":[["accounts","id","isAsync","isextractable","isfeatured","ispublic","op","projectids"],"Updates a template visibility permissions. A public template is visible to all accounts within the same domain. A private template is visible only to the owner of the template. A priviledged template is a private template with account permissions added. Only accounts specified under the template permissions are visible to them.\nRequired args: id\nArgs: accounts id isAsync isextractable isfeatured ispublic op projectids",["id"]],"updateProject":[["account","displaytext","id","isAsync"],"Updates a project\nRequired args: id\nArgs: account displaytext id isAsync",["id"]],"updateVpnCustomerGateway":[["account","cidrlist","domainid","dpd","esplifetime","esppolicy","gateway","id","ikelifetime","ikepolicy","ipsecpsk","isAsync","name"],"Update site to site vpn customer gateway\nRequired args: id cidrlist esppolicy gateway ikepolicy ipsecpsk\nArgs: account cidrlist domainid dpd esplifetime esppolicy gateway id ikelifetime ikepolicy ipsecpsk isAsync name",["id","cidrlist","esppolicy","gateway","ikepolicy","ipsecpsk"]],"updateServiceOffering":[["displaytext","id","isAsync","name","sortkey"],"Updates a service offering.\nRequired args: id\nArgs: displaytext id isAsync name sortkey",["id"]],"updateTemplate":[["bootable","displaytext","format","id","isAsync","name","ostypeid","passwordenabled","sortkey"],"Updates attributes of a template.\nRequired args: id\nArgs: bootable displaytext format id isAsync name ostypeid passwordenabled sortkey",["id"]],"updateIso":[["bootable","displaytext","format","id","isAsync","name","ostypeid","passwordenabled","sortkey"],"Updates an ISO file.\nRequired args: id\nArgs: bootable displaytext format id isAsync name ostypeid passwordenabled sortkey",["id"]],"updateNetworkServiceProvider":[["id","isAsync","servicelist","state"],"Updates a network serviceProvider of a physical network\nRequired args: id\nArgs: id isAsync servicelist state",["id"]],"updateAutoScaleVmProfile":[["autoscaleuserid","counterparam","destroyvmgraceperiod","id","isAsync","templateid"],"Updates an existing autoscale vm profile.\nRequired args: id\nArgs: autoscaleuserid counterparam destroyvmgraceperiod id isAsync templateid",["id"]],"updateHypervisorCapabilities":[["id","isAsync","maxguestslimit","securitygroupenabled"],"Updates a hypervisor capabilities.\nArgs: id isAsync maxguestslimit securitygroupenabled",[]],"updateAutoScaleVmGroup":[["id","interval","isAsync","maxmembers","minmembers","scaledownpolicyids","scaleuppolicyids"],"Updates an existing autoscale vm group.\nRequired args: id\nArgs: id interval isAsync maxmembers minmembers scaledownpolicyids scaleuppolicyids",["id"]],"disableAccount":[["account","domainid","id","isAsync","lock"],"Disables an account\nRequired args: lock\nArgs: account domainid id isAsync lock",["lock"]],"disableAutoScaleVmGroup":[["id","isAsync"],"Disables an AutoScale Vm Group\nRequired args: id\nArgs: id isAsync",["id"]],"disableCiscoNexusVSM":[["id","isAsync"],"disable a Cisco Nexus VSM device\nRequired args: id\nArgs: id isAsync",["id"]],"disableStaticNat":[["ipaddressid","isAsync"],"Disables static rule for given ip address\nRequired args: ipaddressid\nArgs: ipaddressid isAsync",["ipaddressid"]],"disableUser":[["id","isAsync"],"Disables a user account\nRequired args: id\nArgs: id isAsync",["id"]],"generateUsageRecords":[["domainid","enddate","isAsync","startdate"],"Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed\nRequired args: enddate startdate\nArgs: domainid enddate isAsync startdate",["enddate","startdate"]],"changeServiceForVirtualMachine":[["id","isAsync","serviceofferingid"],"Changes the service offering for a virtual machine. The virtual machine must be in a \"Stopped\" state for this command to take effect.\nRequired args: id serviceofferingid\nArgs: id isAsync serviceofferingid",["id","serviceofferingid"]],"changeServiceForSystemVm":[["id","isAsync","serviceofferingid"],"Changes the service offering for a system vm (console proxy or secondary storage). The system vm must be in a \"Stopped\" state for this command to take effect.\nRequired args: id serviceofferingid\nArgs: id isAsync serviceofferingid",["id","serviceofferingid"]],"changeServiceForRouter":[["id","isAsync","serviceofferingid"],"Upgrades domain router to a new service offering\nRequired args: id serviceofferingid\nArgs: id isAsync serviceofferingid",["id","serviceofferingid"]],"registerUserKeys":[["id","isAsync"],"This command allows a user to register for the developer API, returning a secret key and an API key. This request is made through the integration API port, so it is a privileged command and must be made on behalf of a user. It is up to the implementer just how the username and password are entered, and then how that translates to an integration API request. Both secret key and API key should be returned to the user\nRequired args: id\nArgs: id isAsync",["id"]],"registerIso":[["account","bootable","checksum","displaytext","domainid","isAsync","isextractable","isfeatured","ispublic","name","ostypeid","projectid","url","zoneid"],"Registers an existing ISO into the CloudStack Cloud.\nRequired args: displaytext name url zoneid\nArgs: account bootable checksum displaytext domainid isAsync isextractable isfeatured ispublic name ostypeid projectid url zoneid",["displaytext","name","url","zoneid"]],"registerSSHKeyPair":[["account","domainid","isAsync","name","projectid","publickey"],"Register a public key in a keypair under a certain name\nRequired args: name publickey\nArgs: account domainid isAsync name projectid publickey",["name","publickey"]],"registerTemplate":[["account","bits","checksum","details","displaytext","domainid","format","hypervisor","isAsync","isextractable","isfeatured","ispublic","name","ostypeid","passwordenabled","projectid","requireshvm","sshkeyenabled","templatetag","url","zoneid"],"Registers an existing template into the CloudStack cloud.\nRequired args: displaytext format hypervisor name ostypeid url zoneid\nArgs: account bits checksum details displaytext domainid format hypervisor isAsync isextractable isfeatured ispublic name ostypeid passwordenabled projectid requireshvm sshkeyenabled templatetag url zoneid",["displaytext","format","hypervisor","name","ostypeid","url","zoneid"]],"assignToLoadBalancerRule":[["id","isAsync","virtualmachineids"],"Assigns virtual machine or a list of virtual machines to a load balancer rule.\nRequired args: id virtualmachineids\nArgs: id isAsync virtualmachineids",["id","virtualmachineids"]],"assignVirtualMachine":[["account","domainid","isAsync","networkids","securitygroupids","virtualmachineid"],"Move a user VM to another user under same domain.\nRequired args: account domainid virtualmachineid\nArgs: account domainid isAsync networkids securitygroupids virtualmachineid",["account","domainid","virtualmachineid"]]}
@@ -0,0 +1,103 @@
1
+ require "open-uri"
2
+ require "openssl"
3
+ require "base64"
4
+ require "json" #XXX: should i use Crack::JSON?
5
+ require "crack"
6
+
7
+ module Cloudn
8
+ class Client
9
+ def initialize(opt)
10
+ @api_key = opt[:api_key].freeze
11
+ @secret_key = opt[:secret_key].freeze
12
+ url = opt[:url]
13
+ @url = url.is_a?(URI::HTTP) ? url : URI.parse(url)
14
+ @url.freeze
15
+ @api_location = opt[:api_location].freeze
16
+ @json = opt[:json].freeze
17
+ end
18
+
19
+ attr_reader :json, :api_location
20
+
21
+ def get_raw(param_hash)
22
+ param_str = make_param_str(param_hash)
23
+ url = @url.dup
24
+ url.query = param_str
25
+ begin
26
+ response_text = OpenURI.open_uri(url,
27
+ :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
28
+ "User-Agent" => "Cloudn_cli/#{RUBY_VERSION}",
29
+ "X-api-location" => @api_location
30
+ ).read
31
+ rescue OpenURI::HTTPError => ex
32
+ raise ex.exception("status: #{ex.message} desc: #{ex.io.meta["x-description"]}") # update error message in detail
33
+ end
34
+ return response_text
35
+ end
36
+
37
+ def get(param_hash)
38
+ response_text = get_raw(param_hash)
39
+ response = @json ? JSON.parse(response_text) : Crack::XML.parse(response_text)
40
+ command = param_hash.fetch(:command).to_s
41
+ command.downcase!
42
+ key = command + "response"
43
+ begin
44
+ result = response.fetch(key)
45
+ rescue KeyError => ex
46
+ case key
47
+ when "restorevirtualmachineresponse"
48
+ key = "restorevmresponse"
49
+ else
50
+ raise ex
51
+ end
52
+ retry
53
+ end
54
+ return result
55
+ end
56
+
57
+ private
58
+
59
+ def hash_to_param_str(param_hash)
60
+ sorted_params = param_hash.sort_by(&:first) # sort by key
61
+ param_str = sorted_params.flat_map {|k, v| "#{k}=#{v}" }.join("&")
62
+ #return param_str
63
+ string = URI.encode(param_str)
64
+ #string = CGI::escape(param_str)
65
+ string = string.gsub("/","%2f")
66
+ string = string.gsub(":","%3a")
67
+ string = string.gsub("[","%5b")
68
+ string = string.gsub("]","%5d")
69
+ pp string
70
+ return string
71
+ end
72
+
73
+ def string_to_sign(param_hash)
74
+ param_hash = param_hash.merge(apikey: @api_key)
75
+ param_str = hash_to_param_str(param_hash)
76
+ param_str.downcase!
77
+ return param_str
78
+ end
79
+
80
+ def sign(param_hash)
81
+ param_str = string_to_sign(param_hash)
82
+ hmac = ::OpenSSL::HMAC::digest(::OpenSSL::Digest::SHA1.new, @secret_key, param_str)
83
+ base64 = Base64.encode64(hmac).chomp
84
+ return URI.encode(base64, "+=")
85
+ end
86
+
87
+ def make_param_str(param_hash)
88
+ param_hash.merge!(response: :json) if @json
89
+ signature = sign(param_hash)
90
+ param_str = hash_to_param_str(param_hash)
91
+ param_str.concat("&apiKey=#{@api_key}&signature=#{signature}")
92
+ return param_str
93
+ end
94
+ end
95
+ end
96
+
97
+ if $PROGRAM_NAME == __FILE__
98
+ require "pp"
99
+
100
+ config = YAML.load_file("config.yml")
101
+ cs = Cloudn::Client.new(config)
102
+ pp cs.get(command: :listServiceOfferings)
103
+ end
@@ -0,0 +1,296 @@
1
+ require "readline"
2
+ require "pp"
3
+ require "termcolor" # for simple colorize
4
+ require "coderay" # for syntax highlight
5
+ require "rexml/document"
6
+ require "erb"
7
+ require "open-uri"
8
+ require "cgi"
9
+ require_relative "client"
10
+
11
+ module Cloudn
12
+ class User
13
+ def initialize(name, opt)
14
+ @name = name.freeze
15
+ @api_key = opt[:api_key].freeze
16
+ @secret_key = opt[:secret_key].freeze
17
+ url = opt[:url]
18
+ @url = url.is_a?(URI::HTTP) ? url : URI.parse(url)
19
+ @url.freeze
20
+ @api_location = opt[:api_location].freeze
21
+ end
22
+
23
+ attr_reader :name, :api_key, :secret_key, :url, :api_location
24
+ end
25
+
26
+ class Shell
27
+ class SyntaxError < StandardError; end
28
+
29
+ def initialize(config_path)
30
+ @config_path = config_path.freeze
31
+ @xml_formatter = REXML::Formatters::Pretty.new(2)
32
+ @xml_formatter.compact = true
33
+ load_config
34
+ create_client
35
+ input_loop
36
+ end
37
+
38
+ attr_reader :config_path, :url, :json, :raw, :users, :current_user
39
+ alias user current_user
40
+
41
+ def json=(bool)
42
+ @json = bool
43
+ update_client
44
+ return @json
45
+ end
46
+
47
+ def raw=(bool)
48
+ @raw = bool
49
+ update_client
50
+ return @raw
51
+ end
52
+
53
+ def current_user=(user)
54
+ user = user.to_sym
55
+ @current_user = @users[user]
56
+ update_client
57
+ return @current_user
58
+ end
59
+ alias user= current_user=
60
+
61
+ private
62
+
63
+ def create_client
64
+ @client = Cloudn::Client.new(
65
+ url: @current_user.url,
66
+ api_key: @current_user.api_key,
67
+ secret_key: @current_user.secret_key,
68
+ api_location: @current_user.api_location,
69
+ json: @json
70
+ )
71
+ end
72
+ alias update_client create_client
73
+
74
+ def load_config
75
+ @config = YAML.load_file(@config_path)
76
+ @url = URI.parse(@config[:url])
77
+ @json = @config[:json]
78
+ @raw = @config[:raw_output]
79
+ users = @config[:users]
80
+ @users = {}
81
+ users.each do |name_sym, opt|
82
+ @users[name_sym] = User.new(name_sym.to_s, opt)
83
+ end
84
+ @current_user = @users.values.first
85
+ end
86
+
87
+ def make_param_hash(line)
88
+ command, *params = line.split
89
+ param_hash = { command: command }
90
+ unless params.empty?
91
+ opt_key_value = params.map do |param|
92
+ key, value = param.split("=", 2)
93
+ raise SyntaxError, "Invalid Parameter: #{param}" unless value
94
+ #[key.to_sym, CGI.escape(value)]
95
+ [key.to_sym, value]
96
+ #[key.to_sym, ERB::Util.u(value)]
97
+ end
98
+ opt_hash = Hash[opt_key_value]
99
+ param_hash.merge!(opt_hash)
100
+ end
101
+ return param_hash
102
+ end
103
+
104
+ def syntax_highlight(str, lang)
105
+ CodeRay.scan(str, lang).term
106
+ end
107
+
108
+ def raw_formatted_output(response_text)
109
+ if @json
110
+ response_hash = ::JSON.parse(response_text)
111
+ pretty_json = ::JSON.pretty_generate(response_hash)
112
+ puts syntax_highlight(pretty_json, :json)
113
+ else # XML
114
+ response_xml = ::REXML::Document.new(response_text)
115
+ @xml_formatter.write(response_xml, formatted = "")
116
+ puts syntax_highlight(formatted, :xml)
117
+ end
118
+ end
119
+
120
+ def process_command(line)
121
+ param_hash = make_param_hash(line)
122
+ if @raw
123
+ response_text = @client.get_raw(param_hash)
124
+ raw_formatted_output(response_text)
125
+ else
126
+ response_hash = @client.get(param_hash)
127
+ PP.pp(response_hash, pretty_printed = "")
128
+ puts syntax_highlight(pretty_printed, :ruby)
129
+ end
130
+ end
131
+
132
+ def info(str)
133
+ puts ::TermColor.colorize(str.to_s, :green)
134
+ end
135
+
136
+ def alert(str)
137
+ warn ::TermColor.colorize(str.to_s, :red)
138
+ end
139
+
140
+ def change_format(format)
141
+ case format
142
+ when /json/i
143
+ self.json = true
144
+ when /xml/i
145
+ self.json = false
146
+ else
147
+ raise ArgumentError, "undefined format: #{format}"
148
+ end
149
+ end
150
+
151
+ def show_list_users
152
+ @users.each do |name, user|
153
+ if user == @current_user
154
+ info "#{name} *"
155
+ else
156
+ info name
157
+ end
158
+ end
159
+ end
160
+
161
+ Usage = <<-EOS
162
+ Usage: command [parameter1=value2 parameter2=value2 ...]
163
+
164
+ Cloudn Cli Command:
165
+ exit|quit:
166
+ exit the shell
167
+ config:
168
+ show current config
169
+ doc ${api_name}:
170
+ show description for the API
171
+ format (xml|json)?:
172
+ show or change current format
173
+ raw (true|false)?:
174
+ enable/disable raw output
175
+ user ${user_name}:
176
+ switch user
177
+ users:
178
+ show users
179
+ eval { # ruby code }:
180
+ eval ruby code in Cloudn::Client instance context
181
+ EOS
182
+
183
+ NON_WHITESPACE_REGEXP = %r![^\s#{[0x3000].pack("U")}]!
184
+
185
+ def process_line(line)
186
+ return if line !~ NON_WHITESPACE_REGEXP # ignore bland line
187
+ case line
188
+ when "help"
189
+ info Usage
190
+ when "exit", "quit"
191
+ exit
192
+ when "config"
193
+ PP.pp(@config, pretty_printed = "")
194
+ puts syntax_highlight(pretty_printed, :ruby)
195
+ when /^doc (.+)$/
196
+ query = $1
197
+ raise ArgumentError, "command not specified" unless query
198
+ regexp = /^#{query}/i
199
+ commands = APIList.select {|command| regexp =~ command }
200
+ commands.each do |command|
201
+ info command
202
+ info APIParams[command][1]
203
+ puts
204
+ end
205
+ when /^format ?(.+)?$/
206
+ format_to_change = $1
207
+ change_format(format_to_change.to_s) if format_to_change
208
+ info "Current format is: #{@json ? "JSON" : "XML"}"
209
+ when /^raw ?(.+)?$/
210
+ raw = $1
211
+ self.raw = (raw == "true") if raw
212
+ info (@raw ? "Raw Output" : "Ruby's Hash Output")
213
+ when /^user (.+)?$/
214
+ user_to_change = $1
215
+ self.user = $1 if $1
216
+ info "Current user is: #{@current_user.name}"
217
+ when "users"
218
+ show_list_users
219
+ when /^eval \{(.+)\}$/
220
+ raise ArgumentError, "code is not specified" unless $1
221
+ code = $1
222
+ instance_eval(code)
223
+ else
224
+ process_command(line)
225
+ end
226
+ end
227
+
228
+ # API infomation for completion
229
+ APIParamsPath = File.expand_path("../api_list.json", __FILE__).freeze
230
+ APIParams = JSON.parse(File.read(APIParamsPath)).freeze
231
+ APIList = APIParams.keys.freeze
232
+
233
+ # libedit(editline) in Mac OS X is broken.
234
+ # its #line_buffer(rl_line_buffer) is not line buffer but a mere last line.
235
+ CompletionProc = lambda do |line|
236
+ words = line.split
237
+ word = words.last
238
+
239
+ case words.size
240
+ when 0, 1 # command completion
241
+ Readline.completion_append_character = " "
242
+ regexp = /^#{word}/i
243
+ return APIList.select {|key| regexp =~ key }
244
+ else # params completion
245
+ Readline.completion_append_character = "="
246
+ command = words.first
247
+ completing_param = words.pop
248
+ regexp = /^#{completing_param}/i
249
+ api_params = APIParams[command]
250
+ return nil unless api_params
251
+ no_required_params = api_params.first
252
+ completed_params = no_required_params.select {|param| regexp =~ param }
253
+ return completed_params.map {|param| (words + [param]).join(" ") }
254
+ end
255
+ end
256
+
257
+ def init_readline_completion
258
+ Readline.basic_word_break_characters = "" # disable readline's word break
259
+ Readline.completion_proc = CompletionProc
260
+ end
261
+
262
+ STTY = `stty -g`.chomp rescue nil
263
+ TrapINT = lambda do |signum|
264
+ trap(:INT) do
265
+ (system("stty", STTY) rescue nil) if STTY # reset stty
266
+ exit
267
+ end
268
+ puts "Interrupt again to exit"
269
+ end
270
+
271
+ def register_trap
272
+ trap(:INT, &TrapINT)
273
+ end
274
+
275
+ PaddingLen = 10
276
+ Padding = (" " * PaddingLen).freeze
277
+
278
+ def input_loop
279
+ init_readline_completion
280
+ register_trap
281
+ while line = Readline.readline("> ", true)
282
+ register_trap if trap(:INT, nil) != TrapINT
283
+ begin
284
+ process_line(line)
285
+ rescue => ex
286
+ alert "Exception #{ex.class}: #{ex.message}"
287
+ ex.backtrace.each {|trace| alert(Padding + trace) }
288
+ end
289
+ end
290
+ end
291
+ end
292
+ end
293
+
294
+ if $PROGRAM_NAME == __FILE__
295
+ p Cloudn::Shell.new("../../config.yml")
296
+ end