Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Doc updates #1219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions SoftLayer/CLI/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@
'ip': 'primary_ip',
}

HELP = """Find details about this machine

\b
PROP Choices
%s
\b
Examples :
%s
""" % ('*' + '\n*'.join(META_CHOICES),
'slcli metadata ' + '\nslcli metadata '.join(META_CHOICES))
HELP = """Find details about the machine making these API calls.

.. csv-table:: Choices

{choices}

""".format(choices="\n ".join(META_CHOICES))


@click.command(help=HELP,
Expand Down
9 changes: 6 additions & 3 deletions SoftLayer/CLI/user/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@
def cli(env, username, email, password, from_user, template, api_key):
"""Creates a user Users.

:Example: slcli user create [email protected] -e [email protected] -p generate -a
-t '{"firstName": "Test", "lastName": "Testerson"}'

Remember to set the permissions and access for this new user.

Example::

slcli user create [email protected] -e [email protected] -p generate -a
-t '{"firstName": "Test", "lastName": "Testerson"}'

"""

mgr = SoftLayer.UserManager(env.client)
Expand Down
1 change: 1 addition & 0 deletions SoftLayer/CLI/user/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def cli(env, identifier):
and will eventually be fully removed from the account by an automated internal process.

Example: slcli user delete userId

"""

mgr = SoftLayer.UserManager(env.client)
Expand Down
5 changes: 4 additions & 1 deletion SoftLayer/CLI/user/edit_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def cli(env, user, template):

JSON strings should be enclosed in '' and each item should be enclosed in ""

:Example: slcli user edit-details testUser -t '{"firstName": "Test", "lastName": "Testerson"}'
Example::

slcli user edit-details testUser -t '{"firstName": "Test", "lastName": "Testerson"}'

"""
mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolve_id(mgr.resolve_ids, user, 'username')
Expand Down
1 change: 1 addition & 0 deletions SoftLayer/CLI/user/edit_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@environment.pass_env
def cli(env, identifier, enable, permission, from_user):
"""Enable or Disable specific permissions."""

mgr = SoftLayer.UserManager(env.client)
user_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'username')
result = False
Expand Down
2 changes: 2 additions & 0 deletions SoftLayer/managers/autoscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def get_virtual_guests(self, identifier, mask=None):

:param identifier: SoftLayer_Scale_Group Id
:param mask: optional SoftLayer_Scale_Member objectMask

.. _SoftLayer_Scale_Group::getVirtualGuestMembers():
https://sldn.softlayer.com/reference/services/SoftLayer_Scale_Group/getVirtualGuestMembers/
"""
Expand All @@ -109,6 +110,7 @@ def edit(self, identifier, template):

:param identifier: SoftLayer_Scale_Group id
:param template: `SoftLayer_Scale_Group`_

.. _SoftLayer_Scale_Group::editObject():
https://sldn.softlayer.com/reference/services/SoftLayer_Scale_Group/editObject/
.. _SoftLayer_Scale_Group: https://sldn.softlayer.com/reference/datatypes/SoftLayer_Scale_Group/
Expand Down
169 changes: 86 additions & 83 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,39 @@ SoftLayer API bindings for python and how to efficiently make API calls. See
the :ref:`usage-examples` section to see how to discover all of the
functionality not fully documented here.

.. toctree::
:maxdepth: 2
:glob:

cli/*

.. _config_setup:

Configuration Setup
-------------------
To update the configuration, you can use `slcli setup`.

::

$ slcli setup
Username []: username
API Key or Password []:
Endpoint (public|private|custom): public
:..............:..................................................................:
: Name : Value :
:..............:..................................................................:
: Username : username :
: API Key : oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3.1/ :
:..............:..................................................................:
Are you sure you want to write settings to "/home/me/.softlayer"? [y/N]: y
$ slcli setup
Username []: username
API Key or Password []:
Endpoint (public|private|custom): public
:..............:..................................................................:
: Name : Value :
:..............:..................................................................:
: Username : username :
: API Key : oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3.1/ :
:..............:..................................................................:
Are you sure you want to write settings to "/home/me/.softlayer"? [y/N]: y

To check the configuration, you can use `slcli config show`.

::

$ slcli config show
:..............:..................................................................:
: Name : Value :
:..............:..................................................................:
: Username : username :
: API Key : oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3.1/ :
:..............:..................................................................:
$ slcli config show
:..............:..................................................................:
: Name : Value :
:..............:..................................................................:
: Username : username :
: API Key : oyVmeipYQCNrjVS4rF9bHWV7D75S6pa1fghFl384v7mwRCbHTfuJ8qRORIqoVnha :
: Endpoint URL : https://api.softlayer.com/xmlrpc/v3.1/ :
:..............:..................................................................:


If you are using an account created from the https://cloud.ibm.com portal, your username will be literally `apikey`, and use the key provided. `How to create an IBM apikey <https://cloud.ibm.com/docs/iam?topic=iam-userapikey#create_user_key>`_
Expand All @@ -57,6 +53,8 @@ To see more about the config file format, see :ref:`config_file`.
Usage Examples
--------------
To discover the available commands, simply type `slcli`.


::

$ slcli
Expand Down Expand Up @@ -112,71 +110,76 @@ To discover the available commands, simply type `slcli`.

As you can see, there are a number of commands/sections. To look at the list of
subcommands for virtual servers type `slcli vs`. For example:
::

$ slcli vs
Usage: slcli vs [OPTIONS] COMMAND [ARGS]...

Virtual Servers.

Options:
--help Show this message and exit.

Commands:
cancel Cancel virtual servers.
capture Capture SoftLayer image.
create Order/create virtual servers.
create-options Virtual server order options.
credentials List virtual server credentials.
detail Get details for a virtual server.
dns-sync Sync DNS records.
edit Edit a virtual server's details.
list List virtual servers.
network Manage network settings.
pause Pauses an active virtual server.
power_off Power off an active virtual server.
power_on Power on a virtual server.
ready Check if a virtual server is ready.
reboot Reboot an active virtual server.
reload Reload operating system on a virtual server.
rescue Reboot into a rescue image.
resume Resumes a paused virtual server.
upgrade Upgrade a virtual server.

Finally, we can make an actual call. Let's list out the virtual servers on our
account by using `slcli vs list`.

::

$ slcli vs list
:.........:............:....................:.......:........:................:..............:....................:
: id : datacenter : host : cores : memory : primary_ip : backend_ip : active_transaction :
:.........:............:....................:.......:........:................:..............:....................:
: 1234567 : sjc01 : test.example.com : 4 : 4G : 12.34.56 : 65.43.21 : - :
:.........:............:....................:.......:........:................:..............:....................:
$ slcli vs
Usage: slcli vs [OPTIONS] COMMAND [ARGS]...

Virtual Servers.

Options:
--help Show this message and exit.

Commands:
cancel Cancel virtual servers.
capture Capture SoftLayer image.
create Order/create virtual servers.
create-options Virtual server order options.
credentials List virtual server credentials.
detail Get details for a virtual server.
dns-sync Sync DNS records.
edit Edit a virtual server's details.
list List virtual servers.
network Manage network settings.
pause Pauses an active virtual server.
power_off Power off an active virtual server.
power_on Power on a virtual server.
ready Check if a virtual server is ready.
reboot Reboot an active virtual server.
reload Reload operating system on a virtual server.
rescue Reboot into a rescue image.
resume Resumes a paused virtual server.
upgrade Upgrade a virtual server.


Finally, we can make an actual call. Let's list out the virtual servers on our account by using `slcli vs list`.


Example::

$ slcli vs list
:.........:............:....................:.......:........:................:..............:....................:
: id : datacenter : host : cores : memory : primary_ip : backend_ip : active_transaction :
:.........:............:....................:.......:........:................:..............:....................:
: 1234567 : sjc01 : test.example.com : 4 : 4G : 12.34.56 : 65.43.21 : - :
:.........:............:....................:.......:........:................:..............:....................:

Most commands will take in additional options/arguments. To see all available actions, use `--help`.


::

$ slcli vs list --help
Usage: slcli vs list [OPTIONS]

List virtual servers.

Options:
--sortby [guid|hostname|primary_ip|backend_ip|datacenter]
Column to sort by
-c, --cpu INTEGER Number of CPU cores
-D, --domain TEXT Domain portion of the FQDN
-d, --datacenter TEXT Datacenter shortname
-H, --hostname TEXT Host portion of the FQDN
-m, --memory INTEGER Memory in mebibytes
-n, --network TEXT Network port speed in Mbps
--hourly Show only hourly instances
--monthly Show only monthly instances
--tags TEXT Show instances that have one of these comma-
separated tags
--help Show this message and exit.
$ slcli vs list --help
Usage: slcli vs list [OPTIONS]

List virtual servers.

Options:
--sortby [guid|hostname|primary_ip|backend_ip|datacenter]
Column to sort by
-c, --cpu INTEGER Number of CPU cores
-D, --domain TEXT Domain portion of the FQDN
-d, --datacenter TEXT Datacenter shortname
-H, --hostname TEXT Host portion of the FQDN
-m, --memory INTEGER Memory in mebibytes
-n, --network TEXT Network port speed in Mbps
--hourly Show only hourly instances
--monthly Show only monthly instances
--tags TEXT Show instances that have one of these comma-
separated tags
--help Show this message and exit.



Expand Down
Loading