[cloudstack-cloudmonkey.wiki] branch master updated: Updated Usage (markdown)
This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.wiki.git The following commit(s) were added to refs/heads/master by this push: new f7e6600 Updated Usage (markdown) f7e6600 is described below commit f7e66009908566d6a3f131af50676ec06e38cfb2 Author: Rohit Yadav AuthorDate: Thu Mar 14 13:21:47 2019 +0530 Updated Usage (markdown) --- Usage.md | 5 + 1 file changed, 5 insertions(+) diff --git a/Usage.md b/Usage.md index 63445fb..abfe387 100644 --- a/Usage.md +++ b/Usage.md @@ -73,6 +73,11 @@ Some APIs accept array or maps as their arguments, in that case use `arg0.key=va > create networkoffering supportedservices=Dhcp,Dns > serviceproviderlist[0].service=Dhcp > serviceproviderlist[0].provider=VirtualRouter > serviceproviderlist[1].service=Dns > serviceproviderlist[1].provider=VirtualRouter ``` +Content of a file can be passed using a special syntax of `@/path/to/file` passed to the API request. For example: +``` +> upload customcertificate certificate=@/tmp/c.crt privatekey=@/tmp/c.key domainsuffix=some.domain.com +``` + ## Text processing using pipes Text processing is very easy, one can pipe the output to other terminal tools such as awk, sed, grep, jq etc. Examples:
[cloudstack-cloudmonkey.wiki] branch master updated: Updated Usage (markdown)
This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.wiki.git The following commit(s) were added to refs/heads/master by this push: new c974335 Updated Usage (markdown) c974335 is described below commit c9743356af5cb19d5b173e9ab94ca88294c81b07 Author: Rohit Yadav AuthorDate: Thu Mar 14 13:19:41 2019 +0530 Updated Usage (markdown) --- Usage.md | 233 ++- 1 file changed, 231 insertions(+), 2 deletions(-) diff --git a/Usage.md b/Usage.md index ece53c7..63445fb 100644 --- a/Usage.md +++ b/Usage.md @@ -1,3 +1,232 @@ -Refer to old docs: https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI +Link to old docs: https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI -Updates usage docs will be added soon. \ No newline at end of file +## Server profiles + +CloudMonkey supports multiple (management) server profiles, using which one can use to make API requests to different CloudStack servers. If cloudmonkey starts for the first time, it will create a default server profile by the name `[localcloud]` and use the following default values which one can then override using the `set` command. The default `cmk` config file at `~/.cmk/config` looks as follows: + +``` +prompt = 🐱 +asyncblock = true +timeout = 1800 +output = json +paramcompletion = true +verifycert = true +profile = localcloud + +[localcloud] +url = http://localhost:8080/client/api +username = admin +password = password +domain= / +apikey= +secretkey = +``` + +To create a new server profile, one can use `set profile ` and this will create a new server profile config section in `~/.cmk/config` and use the above default values. You can `set` parameters of a server profile such as the url, username, password and it will set the passed values for the current server profile. + +These are the various options you can configure in `cmk` using `set`: + +Option | Description | Default +---|---|--- +prompt | The CLI prompt | 🐱 +asyncblock | Whether to block and poll for async API job result, valid options: true and false | true +timeout | The API timeout in seconds | 1800 +output | The API response output format, valid options: json, table, text, column, csv | json +verifycert | Whether to verify X509/TLS certificate if URL is https enabled | true +profile | The server profile name, `set` will switch to an existing profile or create a new profile with default if it does not exist | localcloud +url* | The CloudStack server API url | http://localhost:8080/client/api +username* | The user's username | admin +password* | The user's password | password +domain* | The user's domain | / +apikey* | The user's API key | +secretkey* | The user's secret key | + +Notes: +- Options marked with `*` are settings server profile settings, other settings are core/global settings. +- When both api/secret key and username/passwords are provided, the api/secret keys take precedence for API authentication over username/password. +- An additional setting `debug` exists when can be turned on to enable console based debugging. + +## Shell and Interactive Usage + +`cmk` implements readline compliant shell and most of the emacs/readline bindings are honoured. For example: +Ctrl+r (reverse search), Ctrl+a (start of the line), Ctrl+e (end of the line), Ctlr+w (remove one word from back), Ctrl+u (remove whole line) etc. + +The command history can be accessed by using up/down arrow keys as well and it is saved at `~/.cmk/history`. + +## Debugging + +Debugging in log is disabled, but you can enable debugging on console by starting CloudMonkey with `cmk -d` or use `set debug [true|false]`. + +## Argument passing + +Arguments can be passed to an api command using the syntax ` key1=value1 ...`. CloudMonkey's shell input parsing is similar to `shlex` and arguments are split by spaces. Arguments/values with space in them can be wrapped instead double/single quotes such as `list api arg1="some value with spaces" arg2='example input'`. + +If values have spaces, one can put them under quotes, like: + +``` +> create project name="my unique name" displaytext="my lengthy description" +``` + +Some APIs accept array or maps as their arguments, in that case use `arg0.key=value` syntax. For example, while creating network offering: + +``` +> create networkoffering supportedservices=Dhcp,Dns serviceproviderlist[0].service=Dhcp serviceproviderlist[0].provider=VirtualRouter serviceproviderlist[1].service=Dns serviceproviderlist[1].provider=VirtualRouter +``` + +## Text processing using pipes + +Text processing is very easy, one can pipe the output to other terminal tools such as awk, sed, grep, jq etc. Examples: + +``` +$ cmk list users | jq -r '.user[].id' +$ cmk ...
[cloudstack-cloudmonkey.wiki] branch master updated: Updated Usage (markdown)
This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.wiki.git The following commit(s) were added to refs/heads/master by this push: new 1f068af Updated Usage (markdown) 1f068af is described below commit 1f068af8a97de69fd8fa5be2b409b4a5b5e702ac Author: Rohit Yadav AuthorDate: Thu Mar 14 12:35:38 2019 +0530 Updated Usage (markdown) --- Usage.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Usage.md b/Usage.md index 01fc683..ece53c7 100644 --- a/Usage.md +++ b/Usage.md @@ -1 +1,3 @@ -List various feature and docs on how to use them, write bash etc. \ No newline at end of file +Refer to old docs: https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI + +Updates usage docs will be added soon. \ No newline at end of file
[cloudstack-cloudmonkey.wiki] branch master updated: Updated Usage (markdown)
This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.wiki.git The following commit(s) were added to refs/heads/master by this push: new b578230 Updated Usage (markdown) b578230 is described below commit b578230936ed5ba490e8e59d2cd026ded31040d1 Author: Rohit Yadav AuthorDate: Tue Jun 26 13:08:14 2018 +0530 Updated Usage (markdown) --- Usage.md => Getting-Started.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Usage.md b/Getting-Started.md similarity index 100% rename from Usage.md rename to Getting-Started.md
[cloudstack-cloudmonkey.wiki] branch master updated: Updated Usage (markdown)
This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.wiki.git The following commit(s) were added to refs/heads/master by this push: new 016f513 Updated Usage (markdown) 016f513 is described below commit 016f5131c45548c924bdb7e3b8784501c5324daf Author: Rohit Yadav AuthorDate: Tue Jun 26 13:07:59 2018 +0530 Updated Usage (markdown) --- Usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Usage.md b/Usage.md index 7c0aa37..23ef9d2 100644 --- a/Usage.md +++ b/Usage.md @@ -25,4 +25,4 @@ Successfully logged in and saved credentials to the server profile. (mycloud) 🐱 > sync ⣟ 😺 discovering APIs, please wait... ``` -You can also use the `set` command to set the various server profile specific options. \ No newline at end of file +You can also use the `set` command to set the various server profile specific options. The cloudmonkey configuration is stored at `~/.cmk/config` file, the `~/.cmk` directory also contains the API cache and history files. \ No newline at end of file
[cloudstack-cloudmonkey.wiki] branch master updated: Updated Usage (markdown)
This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.wiki.git The following commit(s) were added to refs/heads/master by this push: new 5f76a8c Updated Usage (markdown) 5f76a8c is described below commit 5f76a8c692ba9d3b393641477f5cbf4c8791f9ee Author: Rohit Yadav AuthorDate: Tue Jun 26 13:06:34 2018 +0530 Updated Usage (markdown) --- Usage.md | 29 +++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/Usage.md b/Usage.md index 6d99c50..7c0aa37 100644 --- a/Usage.md +++ b/Usage.md @@ -1,3 +1,28 @@ -For legacy cloudmonkey (Python based) until version 5.3.3, please refer the [old cwiki doc](https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI) for usage. +# First steps -This page is under progress, the usage will be more or less same as the legacy cloudmonkey (python based). \ No newline at end of file +The default server profile has the name `localcloud` with defaults (such as url and credentials) set to a locally running CloudStack server. Start `cmk`, create a new server profile, configure your CloudStack server's API endpoint and run `sync`, for example: + +``` +$ cmk +Loaded in-built API cache. Failed to read API cache, please run 'sync'. +Apache CloudStack 🐵 cloudmonkey 6.x.y +Type "help" for details, "sync" to update API cache or press tab to list options +Report issues here: https://github.com/apache/cloudstack-cloudmonkey/issues + +(localcloud) 🐱 > set profile mycloud +Loaded server profile: mycloud +Url: http://localhost:8080/client/api +Username:admin +Domain: / +API Key: + +(mycloud) 🐱 > set url http://myprovider.cloud/client/api +(mycloud) 🐱 > login +✔ Username: myusername +✔ Password: ** +✔ Domain: mydomain +Successfully logged in and saved credentials to the server profile. +(mycloud) 🐱 > sync +⣟ 😺 discovering APIs, please wait... +``` +You can also use the `set` command to set the various server profile specific options. \ No newline at end of file
[cloudstack-cloudmonkey.wiki] branch master updated: Updated Usage (markdown)
This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.wiki.git The following commit(s) were added to refs/heads/master by this push: new b30234d Updated Usage (markdown) b30234d is described below commit b30234dc0c4f696e50156ab5130fa0c9bdf351ab Author: Rohit Yadav AuthorDate: Wed Apr 11 01:54:34 2018 +0530 Updated Usage (markdown) --- Usage.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Usage.md b/Usage.md index 3e0f590..6d99c50 100644 --- a/Usage.md +++ b/Usage.md @@ -1 +1,3 @@ -For legacy cloudmonkey (Python based) until version 5.3.3, please refer the [old cwiki doc](https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI) for usage. \ No newline at end of file +For legacy cloudmonkey (Python based) until version 5.3.3, please refer the [old cwiki doc](https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+cloudmonkey+CLI) for usage. + +This page is under progress, the usage will be more or less same as the legacy cloudmonkey (python based). \ No newline at end of file -- To stop receiving notification emails like this one, please contact ro...@apache.org.