|
| 1 | +.. _cli: |
| 2 | + |
| 3 | +Command-line Interface |
| 4 | +====================== |
| 5 | + |
| 6 | +The SoftLayer command line interface is available via the `sl` command available in your `PATH`. The `sl` command is a reference implementation of SoftLayer API bindings for python and how to efficiently make API calls. |
| 7 | + |
| 8 | + |
| 9 | +Configuration Setup |
| 10 | +------------------- |
| 11 | +To check the configuration, you can use `sl config show`. |
| 12 | +:: |
| 13 | + |
| 14 | + $ sl config setup |
| 15 | + Username: username |
| 16 | + API Key: oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha |
| 17 | + Endpoint URL [https://api.softlayer.com/xmlrpc/v3/]: |
| 18 | + Are you sure you want to write settings to "/path/to/home/.softlayer"? [y/N]: y |
| 19 | + |
| 20 | +To check the configuration, you can use `sl config show`. |
| 21 | +:: |
| 22 | + |
| 23 | + $ sl config show |
| 24 | + :..............:..................................................................: |
| 25 | + : Name : Value : |
| 26 | + :..............:..................................................................: |
| 27 | + : Username : username : |
| 28 | + : API Key : oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha : |
| 29 | + : Endpoint URL : https://api.softlayer.com/xmlrpc/v3/ : |
| 30 | + :..............:..................................................................: |
| 31 | + |
| 32 | + |
| 33 | +Configuration File Details |
| 34 | +-------------------------- |
| 35 | +The CLI loads your settings from a number of different locations. |
| 36 | + |
| 37 | +* Enviorment variables (SL_USERNAME, SL_API_KEY) |
| 38 | +* Config file (~/.softlayer) |
| 39 | +* Or argument (-C/path/to/config or --config=/path/to/config) |
| 40 | + |
| 41 | +The configuration file is INI based and requires the `softlayer` section to be present. |
| 42 | +The only required fields are `username` and `api_key`. You can optionally also/exclusively supply the `endpoint_url` as well. |
| 43 | + |
| 44 | +*Full config* |
| 45 | +:: |
| 46 | + |
| 47 | + [softlayer] |
| 48 | + username = username |
| 49 | + api_key = oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha |
| 50 | + endpoint_url = http://api.softlayer.com/xmlrpc/v3/ |
| 51 | + |
| 52 | +*exclusive url* |
| 53 | +:: |
| 54 | + |
| 55 | + [softlayer] |
| 56 | + endpoint_url = http://api.softlayer.com/xmlrpc/v3/ |
| 57 | + |
| 58 | + |
| 59 | +Usage Examples |
| 60 | +-------------- |
| 61 | +To discover the available commands, simply type `sl`. |
| 62 | +:: |
| 63 | + |
| 64 | + $ sl |
| 65 | + usage: sl <command> [<args>...] |
| 66 | + sl help <command> |
| 67 | + sl [-h | --help] |
| 68 | + |
| 69 | + SoftLayer Command-line Client |
| 70 | + |
| 71 | + The available commands are: |
| 72 | + firewall Firewall rule and security management |
| 73 | + image Manages compute and flex images |
| 74 | + ssl Manages SSL |
| 75 | + cci Manage, delete, order compute instances |
| 76 | + dns Manage DNS |
| 77 | + config View and edit configuration for this tool |
| 78 | + metadata Get details about this machine. Also available with 'my' and 'meta' |
| 79 | + nas View NAS details |
| 80 | + iscsi View iSCSI details |
| 81 | + |
| 82 | + See 'sl help <command>' for more information on a specific command. |
| 83 | + |
| 84 | + To use most commands your SoftLayer username and api_key need to be configured. |
| 85 | + The easiest way to do that is to use: 'sl config setup' |
| 86 | + |
| 87 | +As you can see, there are a number of commands. To look at the list of subcommands for Cloud Compute Instances, type `sl <command>`. For example: |
| 88 | +:: |
| 89 | + |
| 90 | + $ sl cci |
| 91 | + usage: sl cci [<command>] [<args>...] [options] |
| 92 | + |
| 93 | + Manage, delete, order compute instances |
| 94 | + |
| 95 | + The available commands are: |
| 96 | + network Manage network settings |
| 97 | + create Order and create a CCI |
| 98 | + (see `sl cci create-options` for choices) |
| 99 | + manage Manage active CCI |
| 100 | + list List CCI's on the account |
| 101 | + detail Output details about a CCI |
| 102 | + dns DNS related actions to a CCI |
| 103 | + cancel Cancel a running CCI |
| 104 | + create-options Output available available options when creating a CCI |
| 105 | + reload Reload the OS on a CCI based on its current configuration |
| 106 | + |
| 107 | + Standard Options: |
| 108 | + -h --help Show this screen |
| 109 | + |
| 110 | +Finally, we can make an actual call. Let's list out the CCIs on our account using `sl cci list`. |
| 111 | + |
| 112 | +:: |
| 113 | + |
| 114 | + $ sl cci list |
| 115 | + :.........:............:....................:.......:........:................:..............:....................: |
| 116 | + : id : datacenter : host : cores : memory : primary_ip : backend_ip : active_transaction : |
| 117 | + :.........:............:....................:.......:........:................:..............:....................: |
| 118 | + : 1234567 : dal05 : test.example.com : 4 : 4G : 12.34.56 : 65.43.21 : - : |
| 119 | + :.........:............:....................:.......:........:................:..............:....................: |
| 120 | + |
| 121 | +Most commands will take in additional options/arguments. To see all available actions, use `--help`. |
| 122 | +:: |
| 123 | + |
| 124 | + $ sl cci list --help |
| 125 | + usage: sl cci list [--hourly | --monthly] [--sortby=SORT_COLUMN] [--tags=TAGS] |
| 126 | + [options] |
| 127 | + |
| 128 | + List CCIs |
| 129 | + |
| 130 | + Examples: |
| 131 | + sl cci list --datacenter=dal05 |
| 132 | + sl cci list --network=100 --cpu=2 |
| 133 | + sl cci list --memory='>= 2048' |
| 134 | + sl cci list --tags=production,db |
| 135 | + |
| 136 | + Options: |
| 137 | + --sortby=ARG Column to sort by. options: id, datacenter, host, |
| 138 | + Cores, memory, primary_ip, backend_ip |
| 139 | + |
| 140 | + Filters: |
| 141 | + --hourly Show hourly instances |
| 142 | + --monthly Show monthly instances |
| 143 | + -H --hostname=HOST Host portion of the FQDN. example: server |
| 144 | + -D --domain=DOMAIN Domain portion of the FQDN example: example.com |
| 145 | + -c --cpu=CPU Number of CPU cores |
| 146 | + -m --memory=MEMORY Memory in mebibytes (n * 1024) |
| 147 | + -d DC, --datacenter=DC datacenter shortname (sng01, dal05, ...) |
| 148 | + -n MBPS, --network=MBPS Network port speed in Mbps |
| 149 | + --tags=ARG Only show instances that have one of these tags. |
| 150 | + Comma-separated. (production,db) |
| 151 | + |
| 152 | + For more on filters see 'sl help filters' |
| 153 | + |
| 154 | + Standard Options: |
| 155 | + --format=ARG Output format. [Options: table, raw] [Default: table] |
| 156 | + -C FILE --config=FILE Config file location. [Default: ~/.softlayer] |
| 157 | + -h --help Show this screen |
0 commit comments