> -----Original Message----- > From: Rohit Yadav [mailto:rohit.ya...@citrix.com] > Sent: Thursday, November 01, 2012 2:23 PM > To: cloudstack-dev@incubator.apache.org > Subject: RE: CLI for CloudStack: cloudmonkey > > After you install the tool, so that cloudmonkey is in your /usr/local/bin or > in > $PATH... > > Two ways; > 1. As command line tool, on bash/zsh, use the BNF grammar; <command line > tool > name>:<separator>:<verb>:<separator>:<action>:<separator>:<params> > <command line tool name>={'cloudmonkey'} <separator>={' '} <verb>={'list', > 'create', 'delete', 'update'.... etc.} <action>={'Users'... etc.} > <params>={'listall=#'... etc.} So; $ cloudmonkey list Users
Got it, thanks! > > 2. file redirector: > > $ cat test-file: > list Users > list <some other action> > <some verb> <some action> > > $ cloudmonkey < test-file > > Note, I'll change the actions (Users, VirtualMachine etc.) to lowercase > (users, > virtualmachine etc.) if that's okay? Please do, nobody wants to type extra keystroke, if it's not necessary. > > Regards. > > ________________________________________ > From: Edison Su [edison...@citrix.com] > Sent: Friday, November 02, 2012 1:55 AM > To: cloudstack-dev@incubator.apache.org > Subject: RE: CLI for CloudStack: cloudmonkey > > Oh, it reminds me that how to use the CLI on the bash command line? > I think admin may want to call cloudstack API in a bash script, how can I do > that? > > > -----Original Message----- > > From: Marcus Sorensen [mailto:shadow...@gmail.com] > > Sent: Thursday, November 01, 2012 1:11 PM > > To: cloudstack-dev@incubator.apache.org > > Subject: Re: CLI for CloudStack: cloudmonkey > > > > Yes, I look forward to using it instead of local curl calls on the > > command line :-) > > > > On Thu, Nov 1, 2012 at 2:02 PM, Edison Su <edison...@citrix.com> wrote: > > > > > > > > >> -----Original Message----- > > >> From: Rohit Yadav [mailto:rohit.ya...@citrix.com] > > >> Sent: Thursday, November 01, 2012 11:45 AM > > >> To: cloudstack-dev@incubator.apache.org > > >> Subject: RE: CLI for CloudStack: cloudmonkey > > >> > > >> Hi Chip, please go ahead if we can fix the http/s issue. The > > >> connection is based on marvin, I'm sure using CLI we'll find out > > >> more bugs and fix anything in marvin thereby help maintain > > >> marvin->tests and > > CLI. > > >> Please hack that up on tools/marvin/marvin/cloudstackConnection.py > > >> > > >> Edison, yes I'm working on the completedefault, I've figured a > > >> solution to the parsing and tabbing issue to show params for any > > >> api and added more verbs to the grammar like deploy, start etc. > > >> In the new approach doc strings and params needed for an api are > > >> fetched and cached in the class locally to speed up the loading process. > > >> Till it gets committed, cloudmonkey (now) will keep telling the > > >> user what params they are missing until it gets all the required ones. > > > > > > Great! Thanks for your awesome CLI, people will like it. > > > > > >> > > >> One more thing, for people who may not have unicode support the > > >> prompt may appear weird and history search (up, down ) can mess up > > >> the visuals. For example on Mac it appears as a colorful emoji, but > > >> I found that it looks weird on other platforms. Will probably > > >> remove it, or the user can custom set their prompt, using: set > > >> prompt > > >> myprompt> > > >> > > >> Regards. > > >> PS. the set command is full of (fun :) hacks because of > > >> funtional/generic programming, it basically can set any attribute > > >> on the class, so one can do something like creating something (var, > > >> func). For example set ruler # (so instead of - you will have a # > > >> separator) > > >> > > >> ________________________________________ > > >> From: Chip Childers [chip.child...@sungard.com] > > >> Sent: Thursday, November 01, 2012 11:15 PM > > >> To: cloudstack-dev@incubator.apache.org > > >> Subject: Re: CLI for CloudStack: cloudmonkey > > >> > > >> On Wed, Oct 31, 2012 at 2:10 PM, 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.gi > > >> > t; a=c ommit;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 > > >> > > >> Rohit, > > >> > > >> This is really really cool. It puts the "fun" in managing > > >> instances from a command line. I've been testing it against a > > >> production CloudStack environment, and it's working pretty well. > > >> > > >> If you don't mind, I might hack at the code a bit to fill in some > > >> gaps that I'm seeing. First example is that it assumes http, which > > >> doesn't work in a public deployment where the endpoint is over https. > > >> > > >> -chip