Skip to content

Commit 0a16f6e

Browse files
authored
Merge pull request #1382 from caphrim007/feature.add-various-features-and-bugfixes
Fixes a number of problems and adds features (see issue fixes)
2 parents 7afc0ff + caa4897 commit 0a16f6e

37 files changed

Lines changed: 1993 additions & 1421 deletions

docs/_static/theme_overrides.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* override table width restrictions */
2+
@media screen and (min-width: 767px) {
3+
4+
.wy-table-responsive table td {
5+
/* !important prevents the common CSS stylesheets from
6+
overriding this as on RTD they are loaded after this stylesheet */
7+
white-space: normal !important;
8+
vertical-align: top !important;
9+
}
10+
11+
.wy-table-responsive {
12+
overflow: visible !important;
13+
}
14+
15+
}

docs/apidoc/f5.bigip.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,13 @@ f5.bigip module
6262
.. autosummary::
6363

6464
mixins.ToDictMixin
65-
mixins.LazyAttributesMixin
65+
mixins.LazyAttributeMixin
6666
mixins.ExclusiveAttributesMixin
6767
mixins.CheckExistenceMixin
6868
mixins.CommandExecutionMixin
6969
mixins.DeviceMixin
7070
mixins.FileDownloadMixin
7171
mixins.FileUploadMixin
72-
mixins.UnnamedResourceMixin
7372
mixins.AsmFileMixin
7473
mixins.LazyAttributesRequired
7574

docs/apidoc/f5.bigip.tm.gtm.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Module contents
1616
datacenter
1717
global_settings
1818
listener
19+
monitor
1920
pool
2021
region
2122
rule
@@ -45,6 +46,12 @@ listener
4546
.. automodule:: f5.bigip.tm.gtm.listener
4647
:members:
4748

49+
monitor
50+
~~~~~~~
51+
52+
.. automodule:: f5.bigip.tm.gtm.monitor
53+
:members:
54+
4855
pool
4956
~~~~
5057

docs/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@
197197
# so a file named "default.css" will overwrite the builtin "default.css".
198198
html_static_path = ['_static']
199199

200+
html_context = {
201+
'css_files': [
202+
'_static/theme_overrides.css', # overrides for wide tables in RTD theme
203+
],
204+
}
205+
200206
# Add any extra paths that contain custom files (such as robots.txt or
201207
# .htaccess) here, relative to this directory. These files are copied
202208
# directly to the root of the documentation.

docs/userguide/SDK_plural_note.rst

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
.. important::
22

3-
In the SDK, :ref:`collection <collection_section>` objects are usually plural, while |Resource| objects are singular.
3+
In the SDK, :ref:`collection <collection_section>` objects are usually plural,
4+
while |Resource| objects are singular.
45

5-
When the |Resource| object's corresponding URI is already plural, we append the name of the :ref:`collection <collection_section>` with ``_s``.
6+
When the |Resource| object's corresponding URI is already plural, we append the name
7+
of the :ref:`collection <collection_section>` with ``_s``.
68

7-
**Example:**
9+
**Example:**
810

9-
=========================== ===================== ===============================
10-
URI Collection Resource
11-
=========================== ===================== ===============================
12-
/mgmt/tm/net/tunnels/ tm.net.tunnels tm.net.tunnels.tunnel
13-
/mgmt/tm/ltm/pool/ tm.ltm.pools tm.ltm.pools.pool
14-
/mgmt/tm/ltm/pool/members/ tm.ltm.pool.members_s tm.ltm.pool.members_s.members
15-
=========================== ===================== ===============================
11+
.. table::
1612

13+
+---------------------------------+---------------------------+---------------------------------+
14+
| URI | Collection | Resource |
15+
+=================================+===========================+=================================+
16+
| ``/mgmt/tm/net/tunnels/ | tm.net.tunnels | tm.net.tunnels.tunnel |
17+
+---------------------------------+---------------------------+---------------------------------+
18+
| ``/mgmt/tm/ltm/pool | tm.ltm.pools | tm.ltm.pools.pool |
19+
+---------------------------------+---------------------------+---------------------------------+
20+
| ``/mgmt/tm/ltm/pool/members`` | tm.ltm.pool.members_s | tm.ltm.pool.members_s.members |
21+
+---------------------------------+---------------------------+---------------------------------+

docs/userguide/basics.rst

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Basic Concepts
22
==============
33

4-
Familiarizing yourself with the following underlying basic concepts will help you get up and running with the SDK.
4+
Familiarizing yourself with the following underlying basic concepts will help you get up
5+
and running with the SDK.
56

67
.. include:: SDK_plural_note.rst
78

@@ -61,63 +62,78 @@ A set of basic REST endpoints can be derived from the object's URI and ``kind``
6162
Dynamic Attributes
6263
------------------
6364

64-
The python object's attribute can be created dynamically based on the JSON returned when querying the REST API.
65+
The python object's attribute can be created dynamically based on the JSON returned when
66+
querying the REST API.
6567

6668
.. _kind_params_section:
6769

6870
iControl® REST ``kind`` Parameters
6971
----------------------------------
7072

71-
Almost all iControl® REST API entries contain a parameter named ``kind``. This parameter provides information about the object that lets you know what you should expect to follow it. The iControl® REST API uses three types of ``kind``: ``collectionstate``, ``state``, and ``stats``.
73+
Almost all iControl® REST API entries contain a parameter named ``kind``. This parameter
74+
provides information about the object that lets you know what you should expect to follow
75+
it. The iControl® REST API uses three types of ``kind``: ``collectionstate``, ``state``,
76+
and ``stats``.
7277

7378
.. table::
7479

75-
+---------------------+--------------------------+-------------------------------------------------+
76-
| ``kind`` | Associated Objects | Methods |
77-
+=====================+==========================+=================================================+
78-
| ``collectionstate`` | |Organizing Collection|, | |exists| |
79-
| | |Collection| | |
80-
+---------------------+--------------------------+-------------------------------------------------+
81-
| ``state`` | |Resource| | |create|, |update|, |refresh|, |delete|, |
82-
| | | |load|, |exists| |
83-
+---------------------+--------------------------+-------------------------------------------------|
84-
| ``state`` | |Unnamed Resource| | |update|, |refresh|, |load|, |exists|
85-
+---------------------+--------------------------+-------------------------------------------------+
86-
| ``stats`` | |Resource| | |refresh|, |load|, |exists| |
87-
+---------------------+--------------------------+-------------------------------------------------+
80+
+---------------------+---------------------------+------------------------------------------+
81+
| Kind | Associated Objects | Methods |
82+
+=====================+===========================+==========================================+
83+
| ``collectionstate`` | * |Organizing Collection| | |exists| |
84+
| | * |Collection| | |
85+
+---------------------+---------------------------+------------------------------------------+
86+
| ``state`` | |Resource| | * |create| |
87+
| | | * |update| |
88+
| | | * |refresh| |
89+
| | | * |delete| |
90+
| | | * |load| |
91+
| | | * |exists| |
92+
+---------------------+---------------------------+------------------------------------------+
93+
| ``state`` | |Unnamed Resource| | * |update| |
94+
| | | * |refresh| |
95+
| | | * |load| |
96+
| | | * |exists| |
97+
+---------------------+---------------------------+------------------------------------------+
98+
| ``stats`` | |Resource| | * |refresh| |
99+
| | | * |load| |
100+
| | | * |exists| |
101+
+---------------------+---------------------------+------------------------------------------+
88102

89103

90104
.. _methods_section:
91105

92106
Methods
93107
-------
94108

95-
+-----------+---------------+-------------------------------------------------------------------+
96-
| Method | HTTP Command | Action(s) |
97-
+===========+===============+===================================================================+
98-
| |create| | POST | | creates a new resource on the device with its own URI |
99-
+-----------+---------------+-------------------------------------------------------------------+
100-
| |exec_cmd|| POST | | executes commands on applicable unnamed resources |
101-
+-----------+---------------+-------------------------------------------------------------------+
102-
| |update| | PUT | | submits a new configuration to the device resource; sets the |
103-
| | | | Resource attributes to the state reported by the device |
104-
+-----------+---------------+-------------------------------------------------------------------+
105-
| |modify| | PATCH | | submits a new configuration to the device resource; sets only |
106-
| | | | the attributes specified in `modify` method. This is different |
107-
| | | | from `update` because update will change all the attributes, not|
108-
| | | | only the ones that you specify. |
109-
+-----------+---------------+-------------------------------------------------------------------+
110-
| |refresh| | GET | | obtains the state of a device resource; sets the representing |
111-
| | | | Python Resource Object; tracks device state via its attributes |
112-
+-----------+---------------+-------------------------------------------------------------------+
113-
| |delete| | DELETE | | removes the resource from the device, sets ``self.__dict__`` |
114-
| | | | to ``{'deleted': True}`` |
115-
+-----------+---------------+-------------------------------------------------------------------+
116-
| |load| | GET | | obtains the state of an existing resource on the device; sets |
117-
| | | | the Resource attributes to match that state |
118-
+-----------+---------------+-------------------------------------------------------------------+
119-
| |exists| | GET | | checks for the existence of an object on the BIG-IP® |
120-
+-----------+---------------+-------------------------------------------------------------------+
109+
.. table::
110+
111+
+-----------+---------------+-------------------------------------------------------------------+
112+
| Method | HTTP Command | Action(s) |
113+
+===========+===============+===================================================================+
114+
| |create| | POST | | creates a new resource on the device with its own URI |
115+
+-----------+---------------+-------------------------------------------------------------------+
116+
| |exec_cmd|| POST | | executes commands on applicable unnamed resources |
117+
+-----------+---------------+-------------------------------------------------------------------+
118+
| |update| | PUT | | submits a new configuration to the device resource; sets the |
119+
| | | | Resource attributes to the state reported by the device |
120+
+-----------+---------------+-------------------------------------------------------------------+
121+
| |modify| | PATCH | | submits a new configuration to the device resource; sets only |
122+
| | | | the attributes specified in `modify` method. This is different |
123+
| | | | from `update` because update will change all the attributes, not|
124+
| | | | only the ones that you specify. |
125+
+-----------+---------------+-------------------------------------------------------------------+
126+
| |refresh| | GET | | obtains the state of a device resource; sets the representing |
127+
| | | | Python Resource Object; tracks device state via its attributes |
128+
+-----------+---------------+-------------------------------------------------------------------+
129+
| |delete| | DELETE | | removes the resource from the device, sets ``self.__dict__`` |
130+
| | | | to ``{'deleted': True}`` |
131+
+-----------+---------------+-------------------------------------------------------------------+
132+
| |load| | GET | | obtains the state of an existing resource on the device; sets |
133+
| | | | the Resource attributes to match that state |
134+
+-----------+---------------+-------------------------------------------------------------------+
135+
| |exists| | GET | | checks for the existence of an object on the BIG-IP® |
136+
+-----------+---------------+-------------------------------------------------------------------+
121137

122138
.. note::
123139

f5/bigip/mixins.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,7 @@ def _upload(self, fileinterface, **kwargs):
286286
else:
287287
end = start + current_bytes
288288
headers = {
289-
'Content-Range': '%s-%s/%s' % (start,
290-
end - 1,
291-
size),
289+
'Content-Range': '%s-%s/%s' % (start, end - 1, size),
292290
'Content-Type': 'application/octet-stream'}
293291
data = {
294292
'data': file_slice,
@@ -418,9 +416,7 @@ def _upload(self, fileinterface, **kwargs):
418416
else:
419417
end = start + current_bytes
420418
headers = {
421-
'Content-Range': '%s-%s/%s' % (start,
422-
end - 1,
423-
size),
419+
'Content-Range': '%s-%s/%s' % (start, end - 1, size),
424420
'Content-Type': 'application/octet-stream'}
425421
data = {'data': file_slice,
426422
'headers': headers,
@@ -470,3 +466,23 @@ def _return_object(self, container, item_name):
470466
for item in coll:
471467
if item.name == item_name:
472468
return item
469+
470+
471+
class UpdateMonitorMixin(object):
472+
def update(self, **kwargs):
473+
"""Change the configuration of the resource on the device.
474+
475+
This method uses Http PUT alter the service state on the device.
476+
477+
The attributes of the instance will be packaged as a dictionary. That
478+
dictionary will be updated with kwargs. It is then submitted as JSON
479+
to the device. Various edge cases are handled:
480+
481+
* read-only attributes that are unchangeable are removed
482+
* ``defaultsFrom`` attribute is removed from JSON before the PUT
483+
484+
:param kwargs: keys and associated values to alter on the device
485+
486+
"""
487+
self.__dict__.pop('defaultsFrom', '')
488+
self._update(**kwargs)

0 commit comments

Comments
 (0)