[Python-modules-commits] [python-softlayer] 01/05: Import python-softlayer_5.0.1.orig.tar.gz

Scott Kitterman kitterman at moszumanska.debian.org
Sun Apr 3 02:44:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

kitterman pushed a commit to branch master
in repository python-softlayer.

commit 95f41aad64d8adce60e74b5a36c5e0e134007320
Author: Scott Kitterman <scott at kitterman.com>
Date:   Sat Apr 2 22:39:49 2016 -0400

    Import python-softlayer_5.0.1.orig.tar.gz
---
 .gitignore                                         |   1 +
 .travis.yml                                        |   5 +-
 CHANGELOG                                          |  26 +-
 ISSUE_TEMPLATE                                     |   7 +
 LICENSE                                            |   4 +-
 README.rst                                         |  45 ++-
 SoftLayer/API.py                                   |  36 +-
 SoftLayer/CLI/call_api.py                          |  74 +++-
 SoftLayer/CLI/cdn/detail.py                        |  10 +-
 SoftLayer/CLI/cdn/list.py                          |   4 +-
 SoftLayer/CLI/cdn/load.py                          |   4 +-
 SoftLayer/CLI/cdn/origin_add.py                    |   6 +-
 SoftLayer/CLI/cdn/origin_list.py                   |   4 +-
 SoftLayer/CLI/cdn/origin_remove.py                 |   4 +-
 SoftLayer/CLI/cdn/purge.py                         |   4 +-
 SoftLayer/CLI/columns.py                           |  54 ++-
 SoftLayer/CLI/config/__init__.py                   |   6 +-
 SoftLayer/CLI/config/setup.py                      |   4 +-
 SoftLayer/CLI/config/show.py                       |   4 +-
 SoftLayer/CLI/core.py                              |  92 ++---
 SoftLayer/CLI/dns/record_add.py                    |   5 +-
 SoftLayer/CLI/dns/record_edit.py                   |   4 +-
 SoftLayer/CLI/dns/record_list.py                   |   4 +-
 SoftLayer/CLI/dns/record_remove.py                 |   4 +-
 SoftLayer/CLI/dns/zone_create.py                   |   4 +-
 SoftLayer/CLI/dns/zone_delete.py                   |   4 +-
 SoftLayer/CLI/dns/zone_import.py                   |   4 +-
 SoftLayer/CLI/dns/zone_list.py                     |   4 +-
 SoftLayer/CLI/dns/zone_print.py                    |   4 +-
 SoftLayer/CLI/environment.py                       |  29 +-
 SoftLayer/CLI/firewall/add.py                      |   4 +-
 SoftLayer/CLI/firewall/cancel.py                   |   4 +-
 SoftLayer/CLI/firewall/detail.py                   |   4 +-
 SoftLayer/CLI/firewall/edit.py                     |   4 +-
 SoftLayer/CLI/firewall/list.py                     |   4 +-
 SoftLayer/CLI/formatting.py                        |  24 +-
 SoftLayer/CLI/globalip/assign.py                   |   4 +-
 SoftLayer/CLI/globalip/cancel.py                   |   4 +-
 SoftLayer/CLI/globalip/create.py                   |   6 +-
 SoftLayer/CLI/globalip/list.py                     |   4 +-
 SoftLayer/CLI/globalip/unassign.py                 |   4 +-
 SoftLayer/CLI/{server => hardware}/__init__.py     |   0
 SoftLayer/CLI/{server => hardware}/cancel.py       |   4 +-
 .../CLI/{server => hardware}/cancel_reasons.py     |   4 +-
 SoftLayer/CLI/{server => hardware}/create.py       |   5 +-
 .../CLI/{server => hardware}/create_options.py     |   5 +-
 SoftLayer/CLI/{server => hardware}/credentials.py  |   5 +-
 SoftLayer/CLI/{server => hardware}/detail.py       |  19 +-
 SoftLayer/CLI/{server => hardware}/edit.py         |  21 +-
 SoftLayer/CLI/{server => hardware}/list.py         |  57 ++-
 SoftLayer/CLI/{server => hardware}/power.py        |   4 +-
 SoftLayer/CLI/{server => hardware}/reload.py       |  12 +-
 SoftLayer/CLI/{server => hardware}/rescue.py       |   4 +-
 .../CLI/{server => hardware}/update_firmware.py    |   4 +-
 SoftLayer/CLI/helpers.py                           |   4 +-
 SoftLayer/CLI/image/__init__.py                    |   2 +-
 SoftLayer/CLI/image/delete.py                      |   4 +-
 SoftLayer/CLI/image/detail.py                      |  14 +-
 SoftLayer/CLI/image/edit.py                        |   4 +-
 SoftLayer/CLI/image/export.py                      |  28 ++
 SoftLayer/CLI/image/import.py                      |  44 +--
 SoftLayer/CLI/image/list.py                        |  17 +-
 SoftLayer/CLI/iscsi/cancel.py                      |   4 +-
 SoftLayer/CLI/iscsi/create.py                      |   4 +-
 SoftLayer/CLI/iscsi/detail.py                      |  10 +-
 SoftLayer/CLI/iscsi/list.py                        |  10 +-
 SoftLayer/CLI/loadbal/cancel.py                    |   4 +-
 SoftLayer/CLI/loadbal/create.py                    |   4 +-
 SoftLayer/CLI/loadbal/create_options.py            |   6 +-
 SoftLayer/CLI/loadbal/detail.py                    |  10 +-
 SoftLayer/CLI/loadbal/group_add.py                 |   4 +-
 SoftLayer/CLI/loadbal/group_delete.py              |   4 +-
 SoftLayer/CLI/loadbal/group_edit.py                |   4 +-
 SoftLayer/CLI/loadbal/group_reset.py               |   4 +-
 SoftLayer/CLI/loadbal/health_checks.py             |   4 +-
 SoftLayer/CLI/loadbal/list.py                      |   4 +-
 SoftLayer/CLI/loadbal/routing_methods.py           |   4 +-
 SoftLayer/CLI/loadbal/routing_types.py             |  10 +-
 SoftLayer/CLI/loadbal/service_add.py               |   6 +-
 SoftLayer/CLI/loadbal/service_delete.py            |   4 +-
 SoftLayer/CLI/loadbal/service_edit.py              |   9 +-
 SoftLayer/CLI/loadbal/service_toggle.py            |   4 +-
 SoftLayer/CLI/metadata.py                          |   8 +-
 SoftLayer/CLI/mq/accounts_list.py                  |   4 +-
 SoftLayer/CLI/mq/endpoints_list.py                 |   4 +-
 SoftLayer/CLI/mq/ping.py                           |   4 +-
 SoftLayer/CLI/mq/queue_add.py                      |   7 +-
 SoftLayer/CLI/mq/queue_detail.py                   |   4 +-
 SoftLayer/CLI/mq/queue_edit.py                     |   7 +-
 SoftLayer/CLI/mq/queue_list.py                     |   4 +-
 SoftLayer/CLI/mq/queue_pop.py                      |   5 +-
 SoftLayer/CLI/mq/queue_push.py                     |   4 +-
 SoftLayer/CLI/mq/queue_remove.py                   |   4 +-
 SoftLayer/CLI/mq/topic_add.py                      |   7 +-
 SoftLayer/CLI/mq/topic_detail.py                   |   4 +-
 SoftLayer/CLI/mq/topic_list.py                     |   4 +-
 SoftLayer/CLI/mq/topic_push.py                     |   4 +-
 SoftLayer/CLI/mq/topic_remove.py                   |   4 +-
 SoftLayer/CLI/mq/topic_subscribe.py                |   4 +-
 SoftLayer/CLI/mq/topic_unsubscribe.py              |   4 +-
 SoftLayer/CLI/nas/credentials.py                   |   5 +-
 SoftLayer/CLI/nas/list.py                          |   4 +-
 SoftLayer/CLI/object_storage/__init__.py           |   1 +
 SoftLayer/CLI/object_storage/list_accounts.py      |  26 ++
 SoftLayer/CLI/object_storage/list_endpoints.py     |  27 ++
 SoftLayer/CLI/routes.py                            |  88 +++--
 SoftLayer/CLI/rwhois/edit.py                       |   4 +-
 SoftLayer/CLI/rwhois/show.py                       |  10 +-
 SoftLayer/CLI/server/nic_edit.py                   |  24 --
 SoftLayer/CLI/snapshot/cancel.py                   |   5 +-
 SoftLayer/CLI/snapshot/create.py                   |   5 +-
 SoftLayer/CLI/snapshot/create_space.py             |   5 +-
 SoftLayer/CLI/snapshot/list.py                     |   4 +-
 SoftLayer/CLI/snapshot/restore_volume.py           |   5 +-
 SoftLayer/CLI/sshkey/add.py                        |   4 +-
 SoftLayer/CLI/sshkey/edit.py                       |   4 +-
 SoftLayer/CLI/sshkey/list.py                       |   4 +-
 SoftLayer/CLI/sshkey/print.py                      |   6 +-
 SoftLayer/CLI/sshkey/remove.py                     |   4 +-
 SoftLayer/CLI/ssl/add.py                           |   4 +-
 SoftLayer/CLI/ssl/download.py                      |   4 +-
 SoftLayer/CLI/ssl/edit.py                          |   4 +-
 SoftLayer/CLI/ssl/list.py                          |   5 +-
 SoftLayer/CLI/ssl/remove.py                        |   4 +-
 SoftLayer/CLI/subnet/cancel.py                     |   4 +-
 SoftLayer/CLI/subnet/create.py                     |   5 +-
 SoftLayer/CLI/subnet/detail.py                     |  10 +-
 SoftLayer/CLI/subnet/list.py                       |   5 +-
 SoftLayer/CLI/subnet/lookup.py                     |  23 +-
 SoftLayer/CLI/summary.py                           |  33 +-
 SoftLayer/CLI/ticket/__init__.py                   |  10 +-
 SoftLayer/CLI/ticket/create.py                     |   4 +-
 SoftLayer/CLI/ticket/detail.py                     |  10 +-
 SoftLayer/CLI/ticket/list.py                       |   5 +-
 SoftLayer/CLI/ticket/subjects.py                   |   5 +-
 SoftLayer/CLI/ticket/summary.py                    |   4 +-
 SoftLayer/CLI/ticket/update.py                     |   4 +-
 SoftLayer/CLI/virt/cancel.py                       |   3 +-
 SoftLayer/CLI/virt/capture.py                      |  11 +-
 SoftLayer/CLI/virt/create.py                       |  15 +-
 SoftLayer/CLI/virt/create_options.py               |  13 +-
 SoftLayer/CLI/virt/credentials.py                  |   5 +-
 SoftLayer/CLI/virt/detail.py                       |  19 +-
 SoftLayer/CLI/virt/dns.py                          |  71 +++-
 SoftLayer/CLI/virt/edit.py                         |  25 +-
 SoftLayer/CLI/virt/list.py                         |  56 ++-
 SoftLayer/CLI/virt/network.py                      |  27 --
 SoftLayer/CLI/virt/power.py                        |   4 +-
 SoftLayer/CLI/virt/ready.py                        |  10 +-
 SoftLayer/CLI/virt/reload.py                       |  15 +-
 SoftLayer/CLI/virt/upgrade.py                      |  15 +-
 SoftLayer/CLI/vlan/detail.py                       |  37 +-
 SoftLayer/CLI/vlan/list.py                         |  35 +-
 SoftLayer/__init__.py                              |  18 +-
 SoftLayer/config.py                                |   1 +
 SoftLayer/consts.py                                |   2 +-
 SoftLayer/fixtures/SoftLayer_Account.py            |  15 +
 SoftLayer/fixtures/SoftLayer_Hardware_Server.py    |   1 +
 .../SoftLayer_Network_ContentDelivery_Account.py   |   2 +
 SoftLayer/fixtures/SoftLayer_Product_Package.py    |  32 +-
 ...er_Virtual_Guest_Block_Device_Template_Group.py |   2 +
 SoftLayer/managers/__init__.py                     |  33 +-
 SoftLayer/managers/cdn.py                          |   8 +-
 SoftLayer/managers/dns.py                          |   2 +-
 SoftLayer/managers/firewall.py                     |   4 +-
 SoftLayer/managers/hardware.py                     |  57 ++-
 SoftLayer/managers/image.py                        |  39 +-
 SoftLayer/managers/load_balancer.py                |  15 +-
 SoftLayer/managers/network.py                      |  71 ++--
 SoftLayer/managers/object_storage.py               |  49 +++
 SoftLayer/managers/ssl.py                          |   3 +-
 SoftLayer/managers/vs.py                           | 120 +++---
 SoftLayer/shell/cmd_env.py                         |   5 +-
 SoftLayer/shell/completer.py                       |  35 +-
 SoftLayer/shell/core.py                            |  64 +++-
 SoftLayer/testing/__init__.py                      |   9 +-
 SoftLayer/tests/CLI/modules/vs_tests.py            | 134 -------
 SoftLayer/transports.py                            | 149 ++++++--
 SoftLayer/utils.py                                 |   4 +-
 docs/api/client.rst                                |  32 +-
 docs/conf.py                                       |   6 +-
 docs/dev/index.rst                                 |   6 +-
 docs/index.rst                                     |  19 +-
 setup.cfg                                          |   5 +-
 setup.py                                           |  10 +-
 {SoftLayer/tests => tests}/CLI/__init__.py         |   0
 {SoftLayer/tests => tests}/CLI/core_tests.py       |  24 +-
 {SoftLayer/tests => tests}/CLI/deprecated_tests.py |   0
 .../tests => tests}/CLI/environment_tests.py       |   8 +-
 {SoftLayer/tests => tests}/CLI/helper_tests.py     |   4 +-
 {SoftLayer/tests => tests}/CLI/modules/__init__.py |   0
 .../tests => tests}/CLI/modules/call_api_tests.py  |  63 ++-
 .../tests => tests}/CLI/modules/cdn_tests.py       |   0
 .../tests => tests}/CLI/modules/config_tests.py    |   0
 .../tests => tests}/CLI/modules/dns_tests.py       |   0
 .../tests => tests}/CLI/modules/firewall_tests.py  |   0
 .../tests => tests}/CLI/modules/globalip_tests.py  |   0
 .../tests => tests}/CLI/modules/nas_tests.py       |   0
 tests/CLI/modules/object_storage_tests.py          |  38 ++
 .../tests => tests}/CLI/modules/rwhois_tests.py    |   0
 .../tests => tests}/CLI/modules/server_tests.py    |  45 ++-
 .../tests => tests}/CLI/modules/sshkey_tests.py    |   0
 .../tests => tests}/CLI/modules/summary_tests.py   |   5 +-
 .../tests => tests}/CLI/modules/ticket_tests.py    |   0
 tests/CLI/modules/vs_tests.py                      | 424 +++++++++++++++++++++
 {SoftLayer/tests => tests}/__init__.py             |   0
 {SoftLayer/tests => tests}/api_tests.py            |   0
 {SoftLayer/tests => tests}/auth_tests.py           |   0
 {SoftLayer/tests => tests}/basic_tests.py          |   0
 {SoftLayer/tests => tests}/config_tests.py         |   0
 tests/conftest.py                                  |   3 +
 {SoftLayer/tests => tests}/functional_tests.py     |   0
 {SoftLayer/tests => tests}/managers/__init__.py    |   0
 {SoftLayer/tests => tests}/managers/cdn_tests.py   |   8 +-
 {SoftLayer/tests => tests}/managers/dns_tests.py   |   4 +-
 .../tests => tests}/managers/firewall_tests.py     |   0
 .../tests => tests}/managers/hardware_tests.py     |   0
 {SoftLayer/tests => tests}/managers/image_tests.py |  30 +-
 {SoftLayer/tests => tests}/managers/iscsi_tests.py |   0
 .../tests => tests}/managers/loadbal_tests.py      |   2 +-
 .../tests => tests}/managers/metadata_tests.py     |   0
 .../tests => tests}/managers/network_tests.py      |  11 +-
 tests/managers/object_storage_tests.py             |  35 ++
 .../tests => tests}/managers/ordering_tests.py     |   0
 {SoftLayer/tests => tests}/managers/queue_tests.py |   0
 .../tests => tests}/managers/sshkey_tests.py       |   0
 {SoftLayer/tests => tests}/managers/ssl_tests.py   |   0
 .../tests => tests}/managers/ticket_tests.py       |   0
 {SoftLayer/tests => tests}/managers/vs_tests.py    |  28 +-
 {SoftLayer/tests => tests}/transport_tests.py      | 114 +++++-
 tools/test-requirements.txt                        |   4 +-
 tox.ini                                            |  31 +-
 232 files changed, 2377 insertions(+), 1181 deletions(-)

diff --git a/.gitignore b/.gitignore
index f36cbec..4117093 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ Thumbs.db
 ._*
 *.pyc
 .coverage
+htmlcov
 cover/*
 .tox
 docs/_build/*
diff --git a/.travis.yml b/.travis.yml
index 9abe381..6a26a77 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,15 +8,14 @@ matrix:
       env: TOX_ENV=py33
     - python: "3.4"
       env: TOX_ENV=py34
+    - python: "3.5"
+      env: TOX_ENV=py35
     - python: "pypy"
       env: TOX_ENV=pypy
     - python: "2.7"
       env: TOX_ENV=analysis
     - python: "2.7"
       env: TOX_ENV=coverage
-  allow_failures:
-    - python: "nightly"
-      env: TOX_ENV=py35
 install:
  - pip install tox
  - pip install coveralls
diff --git a/CHANGELOG b/CHANGELOG
index f9a3713..39c1ee4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,27 @@
+5.0.1
+
+    * Adds missing depdendency that was previously pulled in by prompt_toolkit
+
+    * Fix a bug by updating the CDN manager to use the new purge method
+
+    * Fixes bug that occured when iscsi listings with resources have no datacenter
+
+5.0.0
+
+    * Adds a shell (accessable with `slcli shell`) which provides autocomplete for slcli commands and options
+
+    * Move modifying nic speed to `slcli virtual edit` and `slcli hardware edit` instead of having its own command
+
+    * How filters work with `slcli call-api` has changed significantly. Instead of accepting JSON, it now accepts an easier-to-use format. See `slcli call-api -h` for examples
+
+    * Adds manager for object storage
+
+    * 'virtual' and 'hardware' are preferred over 'vs' and 'server' in the CLI
+
+    * Improved REST transport support
+
+    * Many bug fixes
+
 4.1.1
 
     * Fixes to work with Click v5
@@ -86,7 +110,7 @@
 
     * API: Adds virtual server rescue command to SoftLayer.VSManager
 
-    * API+CLI: Adds ability to import virtual images from a given URI. The API only supports importing from a swift account using 'swift://'. For more details, see http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/createFromExternalSource.
+    * API+CLI: Adds ability to import virtual images from a given URI. The API only supports importing from a swift account using 'swift://'. For more details, see http://developer.softlayer.com/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/createFromExternalSource.
 
     * CLI: A `--fixtures` global flag was added to pull from fixture data instead of the API. This is useful for discovery, demonstration and testing purposes.
 
diff --git a/ISSUE_TEMPLATE b/ISSUE_TEMPLATE
new file mode 100644
index 0000000..97df853
--- /dev/null
+++ b/ISSUE_TEMPLATE
@@ -0,0 +1,7 @@
+### Expected Behavior
+
+### Actual Behavior
+
+### Environment Information
+Operating System:
+softlayer-python version (`slcli --version`):
diff --git a/LICENSE b/LICENSE
index e606a22..e6da618 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved.
+Copyright (c) 2016 SoftLayer Technologies, Inc. All rights reserved.
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
@@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
\ No newline at end of file
+THE SOFTWARE.
diff --git a/README.rst b/README.rst
index 0f3d8fb..d8949f2 100644
--- a/README.rst
+++ b/README.rst
@@ -3,29 +3,34 @@ SoftLayer API Python Client
 .. image:: https://travis-ci.org/softlayer/softlayer-python.svg?branch=master
     :target: https://travis-ci.org/softlayer/softlayer-python
 
-.. image:: https://landscape.io/github/softlayer/softlayer-python/master/landscape.png
+.. image:: https://landscape.io/github/softlayer/softlayer-python/master/landscape.svg
     :target: https://landscape.io/github/softlayer/softlayer-python/master
 
-.. image:: https://badge.fury.io/py/SoftLayer.png
+.. image:: https://badge.fury.io/py/SoftLayer.svg
     :target: http://badge.fury.io/py/SoftLayer
 
 .. image:: https://coveralls.io/repos/softlayer/softlayer-python/badge.svg
     :target: https://coveralls.io/r/softlayer/softlayer-python
 
-SoftLayer API bindings for Python. For use with
-`SoftLayer's API <http://sldn.softlayer.com/reference/softlayerapi>`_.
 
-This library provides a simple interface to interact with SoftLayer's XML-RPC
-API and provides support for many of SoftLayer API's features like
-`object masks <http://sldn.softlayer.com/article/Using-Object-Masks-SoftLayerAPI>`_
-and includes a command-line interface that can be used to manage various
-SoftLayer services.
+This library provides a simple Python client to interact with `SoftLayer's
+XML-RPC API <http://developer.softlayer.com/reference/softlayerapi>`_.
+
+A command-line interface is also included and can be used to manage various
+SoftLayer products and services.
 
 
 Documentation
 -------------
-Documentation is available at http://softlayer.github.io/softlayer-python/
+Documentation for the Python client is available at
+http://softlayer.github.io/softlayer-python/.
+
+Additional API documentation can be found on the SoftLayer Development Network:
 
+* `SoftLayer API reference
+  <http://developer.softlayer.com/reference/softlayerapi>`_
+* `Object mask information and examples
+  <http://developer.softlayer.com/article/Object-Masks>`_
 
 Installation
 ------------
@@ -43,23 +48,23 @@ Or you can install from source. Download source and run:
 	$ python setup.py install
 
 
-The most up to date version of this library can be found on the SoftLayer
-GitHub public repositories at http://github.com/softlayer. Please post to the
-SoftLayer forums at http://forums.softlayer.com/ or open a support ticket in
-the SoftLayer customer portal if you have any questions regarding use of this
-library.
+The most up-to-date version of this library can be found on the SoftLayer
+GitHub public repositories at http://github.com/softlayer. Please post to Stack Overflow at https://stackoverflow.com/ or open a support ticket in the customer portal if you have any questions regarding use of this library. If you use Stack Overflow please tag your posts with “SoftLayer” so our team can easily find your post. 
 
+InsecurePlatformWarning Notice
+------------------------------
+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.
 
 System Requirements
 -------------------
-* This library has been tested on Python 2.7, 3.3 and 3.4.
-* A valid SoftLayer API username and key are required to call SoftLayer's API.
-* A connection to SoftLayer's private network is required to connect to
-  SoftLayer’s private network API endpoints.
+* Python 2.7, 3.3, or 3.4.
+* A valid SoftLayer API username and key.
+* A connection to SoftLayer's private network is required to use
+  our private network API endpoints.
 
 
 Copyright
 ---------
-This software is Copyright (c) 2015 SoftLayer Technologies, Inc.
+This software is Copyright (c) 2016 SoftLayer Technologies, Inc.
 
 See the bundled LICENSE file for more information.
diff --git a/SoftLayer/API.py b/SoftLayer/API.py
index 2612d41..dc887d4 100644
--- a/SoftLayer/API.py
+++ b/SoftLayer/API.py
@@ -72,7 +72,7 @@ def create_client_from_env(username=None,
 
         >>> import SoftLayer
         >>> client = SoftLayer.create_client_from_env()
-        >>> resp = client['Account'].getObject()
+        >>> resp = client.call('Account', 'getObject')
         >>> resp['companyName']
         'Your Company'
 
@@ -95,11 +95,21 @@ def create_client_from_env(username=None,
 
     # If we have enough information to make an auth driver, let's do it
     if auth is None and settings.get('username') and settings.get('api_key'):
-
-        auth = slauth.BasicAuthentication(
-            settings.get('username'),
-            settings.get('api_key'),
-        )
+        # NOTE(kmcdonald): some transports mask other transports, so this is
+        # a way to find the 'real' one
+        real_transport = getattr(transport, 'transport', transport)
+
+        if isinstance(real_transport, transports.XmlRpcTransport):
+            auth = slauth.BasicAuthentication(
+                settings.get('username'),
+                settings.get('api_key'),
+            )
+
+        elif isinstance(real_transport, transports.RestTransport):
+            auth = slauth.BasicHTTPAuthentication(
+                settings.get('username'),
+                settings.get('api_key'),
+            )
 
     return BaseClient(auth=auth, transport=transport)
 
@@ -141,11 +151,11 @@ class BaseClient(object):
 
         """
         self.auth = None
-        res = self['User_Customer'].getPortalLoginToken(
-            username,
-            password,
-            security_question_id,
-            security_question_answer)
+        res = self.call('User_Customer', 'getPortalLoginToken',
+                        username,
+                        password,
+                        security_question_id,
+                        security_question_answer)
         self.auth = slauth.TokenAuthentication(res['userId'], res['hash'])
         return res['userId'], res['hash']
 
@@ -177,7 +187,7 @@ class BaseClient(object):
         Usage:
             >>> import SoftLayer
             >>> client = SoftLayer.create_client_from_env()
-            >>> client['Account'].getVirtualGuests(mask="id", limit=10)
+            >>> client.call('Account', 'getVirtualGuests', mask="id", limit=10)
             [...]
 
         """
@@ -344,7 +354,7 @@ class Service(object):
         Usage:
             >>> import SoftLayer
             >>> client = SoftLayer.create_client_from_env()
-            >>> gen = client['Account'].getVirtualGuests(iter=True)
+            >>> gen = client.call('Account', 'getVirtualGuests', iter=True)
             >>> for virtual_guest in gen:
             ...     virtual_guest['id']
             ...
diff --git a/SoftLayer/CLI/call_api.py b/SoftLayer/CLI/call_api.py
index cac9d8e..31b0a76 100644
--- a/SoftLayer/CLI/call_api.py
+++ b/SoftLayer/CLI/call_api.py
@@ -1,9 +1,47 @@
 """Call arbitrary API endpoints."""
-
 import click
 
 from SoftLayer.CLI import environment
 from SoftLayer.CLI import formatting
+from SoftLayer.CLI import helpers
+from SoftLayer import utils
+
+
+def _build_filters(_filters):
+    """Builds filters using the filter options passed into the CLI.
+
+    This only supports the equals keyword at the moment.
+    """
+    root = utils.NestedDict({})
+    for _filter in _filters:
+        # split "some.key=value" into ["some.key", "value"]
+        key, value = _filter.split('=', 1)
+
+        current = root
+        # split "some.key" into ["some", "key"]
+        parts = [part.strip() for part in key.split('.')]
+
+        # Actually drill down and add the filter
+        for part in parts[:-1]:
+            current = current[part]
+        current[parts[-1]] = utils.query_filter(value.strip())
+
+    return root.to_dict()
+
+
+def _build_python_example(args, kwargs):
+    sorted_kwargs = sorted(kwargs.items())
+
+    call_str = 'import SoftLayer\n\n'
+    call_str += 'client = SoftLayer.create_client_from_env()\n'
+    call_str += 'result = client.call('
+    arg_list = [repr(arg) for arg in args]
+    arg_list += [key + '=' + repr(value)
+                 for key, value in sorted_kwargs if value]
+    call_str += ',\n                     '.join(arg_list)
+    call_str += ')'
+
+    return call_str
 
 
 @click.command('call', short_help="Call arbitrary API endpoints.")
@@ -11,11 +49,18 @@ from SoftLayer.CLI import formatting
 @click.argument('method')
 @click.argument('parameters', nargs=-1)
 @click.option('--id', '_id', help="Init parameter")
+ at helpers.multi_option('--filter', '-f', '_filters',
+                      help="Object filters. This should be of the form: "
+                      "'property=value' or 'nested.property=value'. Complex "
+                      "filters like betweenDate are not currently supported.")
 @click.option('--mask', help="String-based object mask")
 @click.option('--limit', type=click.INT, help="Result limit")
 @click.option('--offset', type=click.INT, help="Result offset")
+ at click.option('--output-python / --no-output-python',
+              help="Show python example code instead of executing the call")
 @environment.pass_env
-def cli(env, service, method, parameters, _id, mask, limit, offset):
+def cli(env, service, method, parameters, _id, _filters, mask, limit, offset,
+        output_python=False):
     """Call arbitrary API endpoints with the given SERVICE and METHOD.
 
     \b
@@ -25,10 +70,23 @@ def cli(env, service, method, parameters, _id, mask, limit, offset):
     slcli call-api Virtual_Guest getObject --id=12345
     slcli call-api Metric_Tracking_Object getBandwidthData --id=1234 \\
         "2015-01-01 00:00:00" "2015-01-1 12:00:00" public
+    slcli call-api Account getVirtualGuests \\
+        -f 'virtualGuests.datacenter.name=dal05' \\
+        -f 'virtualGuests.maxCpu=4' \\
+        --mask=id,hostname,datacenter.name,maxCpu
     """
-    result = env.client.call(service, method, *parameters,
-                             id=_id,
-                             mask=mask,
-                             limit=limit,
-                             offset=offset)
-    env.fout(formatting.iter_to_table(result))
+
+    args = [service, method] + list(parameters)
+    kwargs = {
+        'id': _id,
+        'filter': _build_filters(_filters),
+        'mask': mask,
+        'limit': limit,
+        'offset': offset,
+    }
+
+    if output_python:
+        env.out(_build_python_example(args, kwargs))
+    else:
+        result = env.client.call(*args, **kwargs)
+        env.fout(formatting.iter_to_table(result))
diff --git a/SoftLayer/CLI/cdn/detail.py b/SoftLayer/CLI/cdn/detail.py
index de74e91..509db53 100644
--- a/SoftLayer/CLI/cdn/detail.py
+++ b/SoftLayer/CLI/cdn/detail.py
@@ -1,12 +1,12 @@
 """Detail a CDN Account."""
 # :license: MIT, see LICENSE for more details.
 
+import click
+
 import SoftLayer
 from SoftLayer.CLI import environment
 from SoftLayer.CLI import formatting
 
-import click
-
 
 @click.command()
 @click.argument('account_id')
@@ -17,9 +17,9 @@ def cli(env, account_id):
     manager = SoftLayer.CDNManager(env.client)
     account = manager.get_account(account_id)
 
-    table = formatting.KeyValueTable(['Name', 'Value'])
-    table.align['Name'] = 'r'
-    table.align['Value'] = 'l'
+    table = formatting.KeyValueTable(['name', 'value'])
+    table.align['name'] = 'r'
+    table.align['value'] = 'l'
 
     table.add_row(['id', account['id']])
     table.add_row(['account_name', account['cdnAccountName']])
diff --git a/SoftLayer/CLI/cdn/list.py b/SoftLayer/CLI/cdn/list.py
index 71deb4d..2e1b077 100644
--- a/SoftLayer/CLI/cdn/list.py
+++ b/SoftLayer/CLI/cdn/list.py
@@ -1,12 +1,12 @@
 """List CDN Accounts."""
 # :license: MIT, see LICENSE for more details.
 
+import click
+
 import SoftLayer
 from SoftLayer.CLI import environment
 from SoftLayer.CLI import formatting
 
-import click
-
 
 @click.command()
 @click.option('--sortby',
diff --git a/SoftLayer/CLI/cdn/load.py b/SoftLayer/CLI/cdn/load.py
index 5dc53ca..648f4f3 100644
--- a/SoftLayer/CLI/cdn/load.py
+++ b/SoftLayer/CLI/cdn/load.py
@@ -1,11 +1,11 @@
 """Cache one or more files on all edge nodes."""
 # :license: MIT, see LICENSE for more details.
 
+import click
+
 import SoftLayer
 from SoftLayer.CLI import environment
 
-import click
-
 
 @click.command()
 @click.argument('account_id')
diff --git a/SoftLayer/CLI/cdn/origin_add.py b/SoftLayer/CLI/cdn/origin_add.py
index c8f5635..51d789d 100644
--- a/SoftLayer/CLI/cdn/origin_add.py
+++ b/SoftLayer/CLI/cdn/origin_add.py
@@ -1,10 +1,11 @@
 """Create an origin pull mapping."""
 # :license: MIT, see LICENSE for more details.
 
+import click
+
 import SoftLayer
 from SoftLayer.CLI import environment
 
-import click
 # pylint: disable=redefined-builtin
 
 
@@ -13,7 +14,8 @@ import click
 @click.argument('content_url')
 @click.option('--type',
               help='The media type for this mapping (http, flash, wm, ...)',
-              default='http')
+              default='http',
+              show_default=True)
 @click.option('--cname',
               help='An optional CNAME to attach to the mapping')
 @environment.pass_env
diff --git a/SoftLayer/CLI/cdn/origin_list.py b/SoftLayer/CLI/cdn/origin_list.py
index 613dfb3..1867a9c 100644
--- a/SoftLayer/CLI/cdn/origin_list.py
+++ b/SoftLayer/CLI/cdn/origin_list.py
@@ -1,12 +1,12 @@
 """List origin pull mappings."""
 # :license: MIT, see LICENSE for more details.
 
+import click
+
 import SoftLayer
 from SoftLayer.CLI import environment
 from SoftLayer.CLI import formatting
 
-import click
-
 
 @click.command()
 @click.argument('account_id')
diff --git a/SoftLayer/CLI/cdn/origin_remove.py b/SoftLayer/CLI/cdn/origin_remove.py
index 055a93b..2b8855e 100644
--- a/SoftLayer/CLI/cdn/origin_remove.py
+++ b/SoftLayer/CLI/cdn/origin_remove.py
@@ -1,11 +1,11 @@
 """Remove an origin pull mapping."""
 # :license: MIT, see LICENSE for more details.
 
+import click
+
 import SoftLayer
 from SoftLayer.CLI import environment
 
-import click
-
 
 @click.command()
 @click.argument('account_id')
diff --git a/SoftLayer/CLI/cdn/purge.py b/SoftLayer/CLI/cdn/purge.py
index 09d0810..7738600 100644
--- a/SoftLayer/CLI/cdn/purge.py
+++ b/SoftLayer/CLI/cdn/purge.py
@@ -1,11 +1,11 @@
 """Purge cached files from all edge nodes."""
 # :license: MIT, see LICENSE for more details.
 
+import click
+
 import SoftLayer
 from SoftLayer.CLI import environment
 
-import click
-
 
 @click.command()
 @click.argument('account_id')
diff --git a/SoftLayer/CLI/columns.py b/SoftLayer/CLI/columns.py
index 7c967d5..18a9cea 100644
--- a/SoftLayer/CLI/columns.py
+++ b/SoftLayer/CLI/columns.py
@@ -12,16 +12,32 @@ from SoftLayer import utils
 # pylint: disable=unused-argument
 
 
+class Column(object):
+    """Column desctribes an attribute and how to fetch/display it."""
+    def __init__(self, name, path, mask=None):
+        self.name = name
+        self.path = path
+        self.mask = mask
+
+        # If the mask is not set explicitly, infer it from the path
+        if self.mask is None and isinstance(path, (tuple, list)):
+            self.mask = '.'.join(path)
+
+
 class ColumnFormatter(object):
     """Maps each column using a function"""
     def __init__(self):
         self.columns = []
         self.column_funcs = []
+        self.mask_parts = set()
 
-    def add_column(self, name, func):
+    def add_column(self, column):
         """Add a new column along with a formatting function."""
-        self.columns.append(name)
-        self.column_funcs.append(func)
+        self.columns.append(column.name)
+        self.column_funcs.append(column.path)
+
+        if column.mask is not None:
+            self.mask_parts.add(column.mask)
 
     def row(self, data):
         """Return a formatted row for the given data."""
@@ -31,28 +47,34 @@ class ColumnFormatter(object):
             else:
                 yield utils.lookup(data, *column)
 
+    def mask(self):
+        """Returns a SoftLayer mask to fetch data needed for each column."""
+        return ','.join(self.mask_parts)
+
 
-def get_formatter(column_map):
+def get_formatter(columns):
     """This function returns a callback to use with click options.
 
     The retuend function parses a comma-separated value and returns a new
     ColumnFormatter.
 
-    :param column_map: a dictionary of the form: {col_name: function}.
+    :param columns: a list of Column instances
     """
 
+    column_map = dict((column.name, column) for column in columns)
+
     def validate(ctx, param, value):
         """Click validation function."""
-        try:
-            formatter = ColumnFormatter()
-            for column in [col.strip() for col in value.split(',')]:
-                if column in column_map:
-                    formatter.add_column(column, column_map[column])
-                else:
-                    formatter.add_column(column, (column,))
-
-            return formatter
-        except ValueError:
-            raise click.BadParameter('rolls need to be in format NdM')
+        if value == '':
+            raise click.BadParameter('At least one column is required.')
+
+        formatter = ColumnFormatter()
+        for column in [col.strip() for col in value.split(',')]:
+            if column in column_map:
+                formatter.add_column(column_map[column])
+            else:
+                formatter.add_column(Column(column, column.split('.')))
+
+        return formatter
 
     return validate
diff --git a/SoftLayer/CLI/config/__init__.py b/SoftLayer/CLI/config/__init__.py
index c6b6b31..fc1cca2 100644
--- a/SoftLayer/CLI/config/__init__.py
+++ b/SoftLayer/CLI/config/__init__.py
@@ -42,9 +42,9 @@ def get_settings_from_client(client):
 
 def config_table(settings):
     """Returns a config table."""
-    table = formatting.KeyValueTable(['Name', 'Value'])
-    table.align['Name'] = 'r'
-    table.align['Value'] = 'l'
+    table = formatting.KeyValueTable(['name', 'value'])
+    table.align['name'] = 'r'
+    table.align['value'] = 'l'
     table.add_row(['Username', settings['username'] or 'not set'])
     table.add_row(['API Key', settings['api_key'] or 'not set'])
     table.add_row(['Endpoint URL', settings['endpoint_url'] or 'not set'])
diff --git a/SoftLayer/CLI/config/setup.py b/SoftLayer/CLI/config/setup.py
index 2a16787..de3399a 100644
--- a/SoftLayer/CLI/config/setup.py
+++ b/SoftLayer/CLI/config/setup.py
@@ -2,6 +2,8 @@
 # :license: MIT, see LICENSE for more details.
 import os.path
 
+import click
+
 import SoftLayer
 from SoftLayer import auth
 from SoftLayer.CLI import config
@@ -10,8 +12,6 @@ from SoftLayer.CLI import exceptions
 from SoftLayer.CLI import formatting
 from SoftLayer import utils
 
-import click
-
 
 def get_api_key(client, username, secret):
     """Attempts API-Key and password auth to get an API key.
diff --git a/SoftLayer/CLI/config/show.py b/SoftLayer/CLI/config/show.py
index 5ddd6ca..0e195c4 100644
--- a/SoftLayer/CLI/config/show.py
+++ b/SoftLayer/CLI/config/show.py
@@ -1,11 +1,11 @@
 """Show current CLI configuration."""
 # :license: MIT, see LICENSE for more details.
 
+import click
+
 from SoftLayer.CLI import config
 from SoftLayer.CLI import environment
 
-import click
-
 
 @click.command()
 @environment.pass_env
diff --git a/SoftLayer/CLI/core.py b/SoftLayer/CLI/core.py
index 6931f78..aa38430 100644
--- a/SoftLayer/CLI/core.py
+++ b/SoftLayer/CLI/core.py
@@ -7,18 +7,23 @@
 """
 from __future__ import print_function
 import logging
+import os
 import sys
+import time
 import types
 
+import click
+
 import SoftLayer
 from SoftLayer.CLI import environment
 from SoftLayer.CLI import exceptions
 from SoftLayer.CLI import formatting
+from SoftLayer import consts
 
-import click
 # pylint: disable=too-many-public-methods, broad-except, unused-argument
 # pylint: disable=redefined-builtin, super-init-not-called
 
+START_TIME = time.time()
 DEBUG_LOGGING_MAP = {
     0: logging.CRITICAL,
     1: logging.WARNING,
@@ -40,9 +45,10 @@ class CommandLoader(click.MultiCommand):
         self.path = path
 
     def list_commands(self, ctx):
-        """Get module for click."""
+        """List all sub-commands."""
         env = ctx.ensure_object(environment.Environment)
         env.load()
+
         return sorted(env.list_commands(*self.path))
 
     def get_command(self, ctx, name):
@@ -58,7 +64,7 @@ class CommandLoader(click.MultiCommand):
         new_path.append(name)
         module = env.get_command(*new_path)
         if isinstance(module, types.ModuleType):
-            return CommandLoader(*new_path, help=module.__doc__)
+            return CommandLoader(*new_path, help=module.__doc__ or '')
         else:
             return module
 
@@ -72,27 +78,20 @@ use: 'slcli setup'""",
                                'auto_envvar_prefix': 'SLCLI'})
 @click.option('--format',
               default=DEFAULT_FORMAT,
+              show_default=True,
               help="Output format",
               type=click.Choice(VALID_FORMATS))
 @click.option('--config', '-C',
               required=False,
               default=click.get_app_dir('softlayer', force_posix=True),
+              show_default=True,
               help="Config file location",
               type=click.Path(resolve_path=True))
- at click.option('--debug',
-              required=False,
-              default=None,
-              help="Sets the debug noise level",
-              type=click.Choice(sorted([str(key) for key
-                                        in DEBUG_LOGGING_MAP.keys()])))
 @click.option('--verbose', '-v',
-              help="Sets the debug noise level",
+              help="Sets the debug noise level, specify multiple times "
+                   "for more verbosity.",
               type=click.IntRange(0, 3, clamp=True),
               count=True)
- at click.option('--timings',
-              required=False,
-              is_flag=True,
-              help="Time each API call and display after results")
 @click.option('--proxy',
               required=False,
               help="HTTP[S] proxy to be use to make API calls")
@@ -100,29 +99,23 @@ use: 'slcli setup'""",
               is_flag=True,
               required=False,
               help="Confirm all prompt actions")
- at click.option('--fixtures / --no-fixtures',
-              envvar='SL_FIXTURES',
+ at click.option('--demo / --no-demo',
               is_flag=True,
               required=False,
-              help="Use fixtures instead of actually making API calls")
+              help="Use demo data instead of actually making API calls")
 @click.version_option(prog_name="slcli (SoftLayer Command-line)")
 @environment.pass_env
 def cli(env,
         format='table',
         config=None,
... 7248 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-softlayer.git



More information about the Python-modules-commits mailing list