Skip to content
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
10 changes: 8 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
# Required
version: 2

build:
os: ubuntu-23.04
tools:
python: "3.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: htmldir
Expand All @@ -15,10 +20,11 @@ sphinx:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF and ePub
formats: all
# formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: 3.11
install:
- requirements: docs/requirements.txt
- method: pip
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ sphinx-build -b html -d _build/doctrees . _build/html
```


### Note

If you get this error, or similar... you might just need to remove the `_build/html/*` directory and try again, that seems to generally work.
```
docs\cli\hardware.rst:15: ERROR: Failed to import "cli" from "SoftLayer.CLI.hardware.cancel". The following exception was raised:
Traceback (most recent call last):
File "py311\Lib\site-packages\sphinx_click\ext.py", line 403, in _load_module
mod = __import__(module_name, globals(), locals(), [attr_name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "SoftLayer\CLI\hardware\cancel.py", line 13, in <module>
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'SoftLayer.CLI' has no attribute 'command'
```

## Unit Tests

All new features should be 100% code covered, and your pull request should at the very least increase total code overage.
Expand Down
3 changes: 2 additions & 1 deletion SoftLayer/CLI/event_log/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
def cli(env, date_min, date_max, obj_event, obj_id, obj_type, utc_offset, metadata, limit):
"""Get Event Logs

Example:
Example::

slcli event-log get -d 01/01/2019 -D 02/01/2019 -t User -l 10
"""
columns = ['Event', 'Object', 'Type', 'Date', 'Username']
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/CLI/licenses/create_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from SoftLayer.CLI.command import SLCommand as SLCommand
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.managers.licenses import LicensesManager
from SoftLayer.managers.license import LicensesManager
from SoftLayer import utils


Expand Down
8 changes: 7 additions & 1 deletion SoftLayer/managers/license.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
SoftLayer.license
~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~
License Manager

:license: MIT, see LICENSE for more details.
Expand All @@ -11,6 +11,8 @@
from SoftLayer.managers import ordering
from SoftLayer import utils

LICENSE_PACKAGE_ID = 301


class LicensesManager(object):
"""Manages account license."""
Expand Down Expand Up @@ -63,3 +65,7 @@ def create(self, datacenter, item_package):
item_keynames=item_package,
complex_type=complex_type,
hourly=False)

def get_create_options(self):
"""Returns valid options for ordering Licenses."""
return self.client.call('SoftLayer_Product_Package', 'getItems', id=LICENSE_PACKAGE_ID)
25 changes: 0 additions & 25 deletions SoftLayer/managers/licenses.py

This file was deleted.

2 changes: 1 addition & 1 deletion SoftLayer/managers/storage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
SoftLayer.storage
~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~
Network Storage Manager

:license: MIT, see LICENSE for more details.
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/managers/storage_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
SoftLayer.storage_utils
~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
Utility functions used by File and Block Storage Managers

:license: MIT, see LICENSE for more details.
Expand Down
28 changes: 15 additions & 13 deletions SoftLayer/managers/tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
SoftLayer.tags
~~~~~~~~~~~~
~~~~~~~~~~~~~~
Tag Manager

:license: MIT, see LICENSE for more details.
Expand Down Expand Up @@ -83,18 +83,20 @@ def reference_lookup(self, resource_table_id, tag_type):

From SoftLayer_Tag::getAllTagTypes()

|Type |Service |
| ----------------------------- | ------ |
|Hardware |HARDWARE|
|CCI |GUEST|
|Account Document |ACCOUNT_DOCUMENT|
|Ticket |TICKET|
|Vlan Firewall |NETWORK_VLAN_FIREWALL|
|Contract |CONTRACT|
|Image Template |IMAGE_TEMPLATE|
|Application Delivery Controller |APPLICATION_DELIVERY_CONTROLLER|
|Vlan |NETWORK_VLAN|
|Dedicated Host |DEDICATED_HOST|
::

|Type |Service |
| ----------------------------- | ------ |
|Hardware |HARDWARE|
|CCI |GUEST|
|Account Document |ACCOUNT_DOCUMENT|
|Ticket |TICKET|
|Vlan Firewall |NETWORK_VLAN_FIREWALL|
|Contract |CONTRACT|
|Image Template |IMAGE_TEMPLATE|
|Application Delivery Controller |APPLICATION_DELIVERY_CONTROLLER|
|Vlan |NETWORK_VLAN|
|Dedicated Host |DEDICATED_HOST|
"""
service = self.type_to_service(tag_type)
if service is None:
Expand Down
48 changes: 23 additions & 25 deletions SoftLayer/managers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def enable_notifications(self, notifications_names):
:returns: True on success

Example::

enable_notifications(['Order Approved','Reload Complete'])
"""

Expand All @@ -120,6 +121,7 @@ def disable_notifications(self, notifications_names):
:returns: True on success

Example::

disable_notifications(['Order Approved','Reload Complete'])
"""

Expand All @@ -140,6 +142,7 @@ def add_permissions(self, user_id, permissions):
:returns: True on success, Exception otherwise

Example::

add_permissions(123, ['BANDWIDTH_MANAGE'])
"""
pretty_permissions = self.format_permission_object(permissions)
Expand All @@ -154,6 +157,7 @@ def remove_permissions(self, user_id, permissions):
:returns: True on success, Exception otherwise

Example::

remove_permissions(123, ['BANDWIDTH_MANAGE'])
"""
pretty_permissions = self.format_permission_object(permissions)
Expand Down Expand Up @@ -196,7 +200,9 @@ def get_logins(self, user_id, start_date=None):
:param int id: User id to get
:param string start_date: "%m/%d/%Y %H:%M:%s" formatted string.
:returns: list https://softlayer.github.io/reference/datatypes/SoftLayer_User_Customer_Access_Authentication/

Example::

get_logins(123, '04/08/2018 0:0:0')
"""

Expand Down Expand Up @@ -366,7 +372,6 @@ def vpn_enable_or_disable(self, user_id, value):

:param int user_id: User to edit.
:param bool value: Value for vpn enable flag.
or
:param bool value: Value for vpn disable flag.
"""
user_object = {'sslVpnAllowedFlag': value}
Expand Down Expand Up @@ -426,93 +431,86 @@ def get_overrides_list(self, user_id, subnet_ids):
def grant_hardware_access(self, user_id, hardware_id):
"""Grants the user access to a single hardware device.

:param int user_id:
:param int hardware_id

:param int user_id: User Id
:param int hardware_id: Hardware Id
:returns: true
"""
return self.user_service.addHardwareAccess(hardware_id, id=user_id)

def grant_virtual_access(self, user_id, virtual_id):
"""Grants the user access to a single VS device.

:param int user_id:
:param int virtual_id

:param int user_id: User Id
:param int virtual_id: Hardware Id
:returns: true
"""
return self.user_service.addVirtualGuestAccess(virtual_id, id=user_id)

def grant_dedicated_access(self, user_id, dedicated_id):
"""Grants the user access to a single dedicated host device.

:param int user_id:
:param int dedicated_id

:param int user_id: User Id
:param int dedicated_id: Dedicatd Host Id
:returns: true
"""
return self.user_service.addDedicatedHostAccess(dedicated_id, id=user_id)

def remove_hardware_access(self, user_id, hardware_id):
"""Remove hardware from a portal user’s hardware access list.

:param int user_id:
:param int hardware_id

:param int user_id: User Id
:param int hardware_id: Hardware Id
:returns: true
"""
return self.user_service.removeHardwareAccess(hardware_id, id=user_id)

def remove_virtual_access(self, user_id, virtual_id):
"""Remove hardware from a portal user’s virtual guests access list.

:param int user_id:
:param int hardware_id

:param int user_id: User Id
:param int hardware_id: Hardware Id
:returns: true
"""
return self.user_service.removeVirtualGuestAccess(virtual_id, id=user_id)

def remove_dedicated_access(self, user_id, dedicated_id):
"""Remove hardware from a portal user’s dedicated host access list.

:param int user_id:
:param int dedicated_id

:param int user_id: User Id
:param int dedicated_id: Dedicated Host Id
:returns: true
"""
return self.user_service.removeDedicatedHostAccess(dedicated_id, id=user_id)

def get_user_hardware(self, user_id):
"""User Hardware list.

:param int user_id:
:param int user_id: User Id
:return: List hardware relate to user
"""
return self.user_service.getHardware(id=user_id)

def get_user_dedicated_host(self, user_id):
"""User dedicate host list.

:param int user_id:
:param int user_id: User Id
:return: List dedicated host relate to user
"""
return self.user_service.getDedicatedHosts(id=user_id)

def get_user_virtuals(self, user_id):
"""User virtual guest list.

:param int user_id:
:param int user_id: User Id
:return: List virtual guest relate to user
"""
return self.user_service.getVirtualGuests(id=user_id)

def update_vpn_password(self, user_id, password):
"""Update a user's VPN password.

:param int user_id:
:param string password:

:param int user_id: User Id
:param string password: Password
:returns: true
"""
return self.user_service.updateVpnPassword(password, id=user_id)
Expand Down
32 changes: 32 additions & 0 deletions docs/_templates/manager_template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{ objname }}
{{ underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:inherited-members:

{% block methods %}
.. automethod:: __init__

{% if methods %}
.. rubric:: Methods

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: Attributes

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
Loading