Skip to content

Commit d250bdd

Browse files
allmightyspiffGitHub Enterprise
authored andcommitted
Merge pull request #1 from SoftLayer/v1
V1 EmployeeClient
2 parents 016471d + ac3b1e0 commit d250bdd

File tree

18 files changed

+559
-81
lines changed

18 files changed

+559
-81
lines changed

README.rst

Lines changed: 46 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,53 @@
11
SoftLayer API Python Client
22
===========================
3-
.. image:: https://github.com/softlayer/softlayer-python/workflows/Tests/badge.svg
4-
:target: https://github.com/softlayer/softlayer-python/actions?query=workflow%3ATests
53

6-
.. image:: https://github.com/softlayer/softlayer-python/workflows/documentation/badge.svg
7-
:target: https://github.com/softlayer/softlayer-python/actions?query=workflow%3Adocumentation
4+
This library is provided `as is` to make internal IMS API calls. You are responsible for your API usage, and any abuse, intentional or accidental, will result in your employee account being locked or limited.
85

9-
.. image:: https://landscape.io/github/softlayer/softlayer-python/master/landscape.svg
10-
:target: https://landscape.io/github/softlayer/softlayer-python/master
11-
12-
.. image:: https://badge.fury.io/py/SoftLayer.svg
13-
:target: http://badge.fury.io/py/SoftLayer
14-
15-
.. image:: https://coveralls.io/repos/github/softlayer/softlayer-python/badge.svg?branch=master
16-
:target: https://coveralls.io/github/softlayer/softlayer-python?branch=master
17-
18-
.. image:: https://snapcraft.io//slcli/badge.svg
19-
:target: https://snapcraft.io/slcli
20-
21-
22-
This library provides a simple Python client to interact with `SoftLayer's
23-
XML-RPC API <https://softlayer.github.io/reference/softlayerapi>`_.
24-
25-
A command-line interface is also included and can be used to manage various
26-
SoftLayer products and services.
276

7+
Make sure you use the HTTPS url `https://internal.app0lb.dal10.softlayer.local/v3/internal/xmlrpc/`
288

299
Documentation
3010
-------------
31-
Documentation for the Python client is available at `Read the Docs <https://softlayer-python.readthedocs.io/en/latest/index.html>`_ .
11+
DThis project is based off the `SLCLI <https://github.com/softlayer/softlayer-python>`_ , and most things that work there will work here.
3212

33-
Additional API documentation can be found on the SoftLayer Development Network:
34-
35-
* `SoftLayer API reference
36-
<https://sldn.softlayer.com/reference/softlayerapi>`_
37-
* `Object mask information and examples
38-
<https://sldn.softlayer.com/article/object-masks>`_
39-
* `Code Examples
40-
<https://sldn.softlayer.com/python/>`_
13+
There is no internal API documentation like SLDN.
4114

4215
Installation
4316
------------
4417
Install via pip:
4518

4619
.. code-block:: bash
4720
48-
$ pip install softlayer
49-
50-
51-
Or you can install from source. Download source and run:
21+
$ git clone https://github.ibm.com/SoftLayer/internal-softlayer-cli
22+
$ cd internal-softlayer-cli
23+
$ python setup.py install
24+
$ ./islcli login
5225
53-
.. code-block:: bash
5426
55-
$ python setup.py install
27+
Configuration
28+
-------------
5629

57-
Another (safer) method of installation is to use the published snap. Snaps are available for any Linux OS running snapd, the service that runs and manage snaps. Snaps are "auto-updating" packages and will not disrupt the current versions of libraries and software packages on your Linux-based system. To learn more, please visit: https://snapcraft.io/
30+
The config file is located at `~/.softlayer` or `~/AppData/Roaming/softlayer` for Windows systems.
5831

59-
To install the slcli snap:
32+
Your config file should look something like this for using the islcli. Beware the `islcli` and `slcli` use the same config for the moment. You need to set `verify = False` in the config because the internal endpoint uses a self-signed SSL certificate.
6033

6134
.. code-block:: bash
62-
63-
$ sudo snap install slcli
64-
65-
(or to get the latest release)
66-
67-
$ sudo snap install slcli --edge
68-
69-
35+
36+
[softlayer]
37+
username = imsUsername
38+
verify = False
39+
endpoint_url = https://internal.app0lb.dal10.softlayer.local/v3/internal/xmlrpc/
7040
7141
72-
The most up-to-date version of this library can be found on the SoftLayer
73-
GitHub public repositories at http://github.com/softlayer. For questions regarding the use of this library please post to Stack Overflow at https://stackoverflow.com/ and your posts with “SoftLayer” so our team can easily find your post. To report a bug with this library please create an Issue on github.
74-
75-
InsecurePlatformWarning Notice
76-
------------------------------
77-
This library relies on the `requests <http://docs.python-requests.org/>`_ library to make HTTP requests. On Python versions below Python 2.7.9, requests has started emitting a security warning (InsecurePlatformWarning) due to insecurities with creating SSL connections. To resolve this, upgrade to Python 2.7.9+ or follow the instructions here: http://stackoverflow.com/a/29099439.
7842
7943
Basic Usage
8044
-----------
8145

82-
- `The Complete Command Directory <https://softlayer-python.readthedocs.io/en/latest/cli_directory/>`_
46+
.. code-block:: bash
47+
48+
$ islcli login
49+
$ islcli -a <account_id> vs list
50+
8351
8452
Advanced Usage
8553
--------------
@@ -90,26 +58,40 @@ You can automatically set some parameters via environment variables with by usin
9058
9159
$ export SLCLI_VERBOSE=3
9260
$ export SLCLI_FORMAT=json
93-
$ slcli vs list
61+
$ slcli -a <account_id> vs list
9462
9563
is equivalent to
9664

9765
.. code-block:: bash
9866
99-
$ slcli -vvv --format=json vs list
67+
$ slcli -vvv --format=json -a <account_id> vs list
10068
10169
Getting Help
10270
------------
103-
Bugs and feature requests about this library should have a `GitHub issue <https://github.com/softlayer/softlayer-python/issues>`_ opened about them.
10471

105-
Issues with the Softlayer API itself should be addressed by opening a ticket.
72+
Feel free to open an issue if you think there is a bug, or a feature you want. Or asking in #sl-api on IBM slack. This is considered an unofficial project however, so questions might take some time to get answered.
10673

10774

10875
Examples
10976
--------
11077

11178
A curated list of examples on how to use this library can be found at `SLDN <https://softlayer.github.io/python/>`_
11279

80+
81+
.. code-block:: python
82+
83+
import SoftLayer
84+
client = SoftLayer.employee_client()
85+
username = input("Username:")
86+
password = input("Password:")
87+
yubikey = input("Yubi key:")
88+
client.authenticate_with_password(username, password, yubikey)
89+
result = client.call('SoftLayer_Account', 'getObject', id="12345", mask="mask[id]")
90+
91+
92+
After logging in with `authenticate_with_password` the EmployeeClient will try to automatically refresh the login token when it gets a TokenExpired exception. It will also record the token in the config file for future use in the CLI.
93+
94+
11395
Debugging
11496
---------
11597
To get the exact API call that this library makes, you can do the following.
@@ -131,7 +113,7 @@ If you are using the library directly in python, you can do something like this.
131113
class invoices():
132114
133115
def __init__(self):
134-
self.client = SoftLayer.Client()
116+
self.client = SoftLayer.EmployeeClient()
135117
debugger = SoftLayer.DebugTransport(self.client.transport)
136118
self.client.transport = debugger
137119
@@ -153,16 +135,13 @@ If you are using the library directly in python, you can do something like this.
153135
154136
System Requirements
155137
-------------------
156-
* Python 3.5, 3.6, 3.7, 3.8, or 3.9.
157-
* A valid SoftLayer API username and key.
158-
* A connection to SoftLayer's private network is required to use
159-
our private network API endpoints.
138+
* Python 3.7, 3.8, or 3.9.
139+
* A valid SoftLayer Employee API username, password, Yubi Key
140+
* A connection to SoftLayer's Employee VPN
160141

161142
Python 2.7 Support
162143
------------------
163-
As of version 5.8.0 SoftLayer-Python will no longer support python2.7, which is `End Of Life as of 2020 <https://www.python.org/dev/peps/pep-0373/>`_ .
164-
If you cannot install python 3.6+ for some reason, you will need to use a version of softlayer-python <= 5.7.2
165-
144+
Python 2.7 is `End Of Life as of 2020 <https://www.python.org/dev/peps/pep-0373/>`_ . Its not supported, you will need to upgrade to python 3.7 at least.
166145

167146

168147
Python Packages
@@ -173,6 +152,7 @@ Python Packages
173152
* prompt_toolkit >= 2
174153
* pygments >= 2.0.0
175154
* urllib3 >= 1.24
155+
* Rich
176156

177157
Copyright
178158
---------

0 commit comments

Comments
 (0)