I welcome our new overlords! :p On 10/31/12 11:10 AM, "Rohit Yadav" <rohit.ya...@citrix.com> wrote:
>Hi, > >I was working on a CLI for cloudstack, it's based on Marvin (the >neglected robot) and called cloudmonkey after our beloved mascot :D > >I've committed that on master, please review: >https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=commi >t;h=2ceaa3911e792dbeb6c40dfb70961008a01f7e3c > >Features: >- it's a shell and also a terminal tool, accepts file redirection and >pipes >- scalable to find and run old and new APIs >- intuitive grammar and verbs >- autocompletion (functional hack) >- shell execution using ! or shell >- cfg support: user defined variables, like prompt, ruler, host, port etc. >- history >- colors (disable using set color false) >- dynamic API loading and rule generation >- leverages Marvin to get latest autogenerated APIs >- emacs like shortcuts on prompt >- uses apiKey and secretKey to interact with mgmt server >- logs all client commands >- PEP-8 compliant code > >FIXMEs: >- Reverse search over history >- Fix input and output processing > >It requires python and clint; >pip install clint (or if you have to easy_install clint) >mvn clean install -P developer >cd tools/cli/cloudmonkey >python cloudmonkey.py > >If you want to have the terminal tool installed; >cd tools/cli >python setup.py sdist >cd dist >pip install cloudmonkey-0.0.4.tar.gz (or easy_install etc.) > >You can do stuff like; >cloudmonkey < file-with-commands, or >cloudmonkey list Users, or as shell; > >(If you see unicode chars cloud and monkey below, yes they were put >intentionally :) > >$ cloudmonkey >☁ Apache CloudStack CLI. Type help or ? to list commands. >🙉 cloudmonkey> set apiKey <your key here> >🙉 cloudmonkey> set secretKey <your key here> >🙉 cloudmonkey> <tab><tab> >add api create delete disable enable help list >quit remove set shell update >🙉 cloudmonkey> list <tab><tab> >Accounts Alerts AsyncJobs > Capabilities Capacity Clusters > Configurations >DiskOfferings DomainChildren Domains > Events EventTypes >FirewallRules Hosts >HypervisorCapabilities Hypervisors InstanceGroups > IpForwardingRules IsoPermissions Isos > LBStickinessPolicies >LoadBalancerRuleInstances LoadBalancerRules NetworkACLs > NetworkDevice NetworkOfferings Networks > NetworkServiceProviders >OsCategories OsTypes PhysicalNetworks > Pods PortForwardingRules >PrivateGateways ProjectAccounts >ProjectInvitations Projects PublicIpAddresses > RemoteAccessVpns ResourceLimits Routers > SecurityGroups >ServiceOfferings SnapshotPolicies Snapshots > SSHKeyPairs StaticRoutes >StorageNetworkIpRange StoragePools >SupportedNetworkServices Swifts SystemVms > Tags TemplatePermissions Templates > TrafficTypeImplementors >TrafficTypes Users VirtualMachines > VirtualRouterElements VlanIpRanges Volumes > VPCOfferings >VPCs VpnConnections VpnCustomerGateways > VpnGateways VpnUsers Zones > >🙉 cloudmonkey> list Users >… >🙉 cloudmonkey> !ls ># this give you a shell too and one can do things like >🙉 cloudmonkey> !for i in Users Account; do echo `cloudmonkey list $i | >grep id`; done; > >Example commands to deploy a datacenter; (fill in dynamic ids etc.) >create Zone dns1=8.8.8.8 internaldns1=10.147.28.6 name=Zone1 >networktype=Basic >create PhysicalNetwork name=test-network zoneid= > >add TrafficType traffictype=Guest physicalnetworkid= > >add TrafficType traffictype=Management physicalnetworkid= > >update PhysicalNetwork state=Enabled id= > >list NetworkServiceProviders name=VirtualRouter physicalNetworkId= > >list VirtualRouterElements nspid= > >api configureVirtualRouterElement enabled=true id= > >update NetworkServiceProvider state=Enabled id= > >list NetworkServiceProviders name=SecurityGroupProvider >physicalNetworkId= >update NetworkServiceProvider state=Enabled id= > >create Network zoneid= name=guestNetworkForBasicZone >displaytext=guestNetworkForBasicZone networkofferingid= >create Pod zoneid= name=Pod1 gateway=10.147.28.1 netmask=255.255.255.0 >startip=10.147.28.220 endip=10.147.28.235 >create VlanIpRange podid= networkid= gateway=10.147.28.1 >netmask=255.255.255.0 startip=10.147.28.236 endip=10.147.28.250 >forVirtualNetwork=false >add Cluster zoneid= hypervisor=XenServer clustertype=CloudManaged podid= >clustername=Cluster1 >add Host zoneid= podid= clusterid= hypervisor=XenServer >clustertype=CloudManaged username=root password=password >url=http://10.147.28.60 >create StoragePool zoneid= clusterid= name=NFS1 >url=nfs://10.147.28.7/export/home/rohit/primary >add SecondaryStorage zoneId= >url=nfs://10.147.28.7/export/home/rohit/secondary >update Zone allocationstate=Enabled id= > >After some stabilisation, I can put it on pypi so any user can just do >pip install cloudmonkey to get the CLI. > >Regards. >PS. Marvin the neglected robot and hipster cloudmonkey should rule the >world :D -- Æ