18
18
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19
19
# OTHER DEALINGS IN THE SOFTWARE.
20
20
21
+ """HPE Container Platform Client."""
22
+
21
23
from __future__ import absolute_import
22
24
23
25
import configparser
52
54
53
55
54
56
class ContainerPlatformClient (object ):
55
- """Client object for HPE Container Platform. This is the central object
56
- that users of this library work with.
57
+ """Client object for HPE Container Platform.
58
+
59
+ This is the central object that users of this library work with.
57
60
58
61
Parameters
59
62
----------
@@ -126,7 +129,6 @@ def create_from_config_file(
126
129
username = admin
127
130
password = admin123
128
131
"""
129
-
130
132
if profile is None :
131
133
profile = "default"
132
134
@@ -230,23 +232,24 @@ def get_config_value(key, profile):
230
232
231
233
@classmethod
232
234
def create_from_env (cls ):
233
- """Create an instance of ContainerPlatformClient from environment variables:
234
-
235
- Variables::
236
-
237
- HPECP_USERNAME
238
- HPECP_PASSWORD
239
- HPECP_API_HOST
240
- HPECP_API_PORT
241
- HPECP_USE_SSL
242
- HPECP_VERIFY_SSL
243
- HPECP_warn_ssl
244
-
235
+ """Create an instance of ContainerPlatformClient from environment variables.
236
+
237
+ Variables
238
+ ---------
239
+ HPECP_USERNAME
240
+ HPECP_PASSWORD
241
+ HPECP_API_HOST
242
+ HPECP_API_PORT
243
+ HPECP_USE_SSL
244
+ HPECP_VERIFY_SSL
245
+ HPECP_WARN_SSL
246
+
247
+ See Also
248
+ --------
245
249
See ContainerPlatformClient
246
250
:py:class:`constructor <ContainerPlatformClient>` for the paramaeter
247
251
definitions.
248
252
"""
249
-
250
253
if "HPECP_USERNAME" in os .environ :
251
254
HPECP_USERNAME = os .environ ["HPECP_USERNAME" ]
252
255
@@ -288,7 +291,6 @@ def __init__(
288
291
verify_ssl = True ,
289
292
warn_ssl = False ,
290
293
):
291
- """Doc string is defined at the top of the class"""
292
294
self ._log = Logger ().get_logger (self .__class__ .__name__ )
293
295
294
296
if verify_ssl == "True" :
@@ -361,13 +363,11 @@ def __init__(
361
363
self ._role = RoleController (self )
362
364
363
365
def create_session (self ):
364
- """Create a session with the HPE CP controller defined in the object
365
-
366
- :py:class:`ContainerPlatformClient`.
366
+ """Create a session with the HPE CP controller.
367
367
368
368
Returns
369
369
-------
370
- ContainerPlatformClient:
370
+ ContainerPlatformClient
371
371
An instance of ContainerPlatformClient is returned.
372
372
373
373
Raises
@@ -377,7 +377,6 @@ def create_session(self):
377
377
requests.exceptions.RequestException
378
378
for exceptions that are not a connection error
379
379
"""
380
-
381
380
url = self .base_url + "/api/v1/login"
382
381
auth = {"name" : self .username , "password" : self .password }
383
382
@@ -569,8 +568,9 @@ def _request(
569
568
570
569
@property
571
570
def tenant (self ):
572
- """Reference to an object of type `.tenant.TenantController`. See
573
- the class :py:class:`.tenant.TenantController` for the methods
571
+ """Retrieve a reference to `.tenant.TenantController` object.
572
+
573
+ See the class :py:class:`.tenant.TenantController` for the methods
574
574
available.
575
575
576
576
Example
@@ -587,8 +587,9 @@ def tenant(self):
587
587
588
588
@property
589
589
def config (self ):
590
- """Reference to an object of type `.config.ConfigController`. See
591
- the class :py:class:`.config.ConfigController` for the methods
590
+ """Retrieve a reference to `.config.ConfigController` object.
591
+
592
+ See the class :py:class:`.config.ConfigController` for the methods
592
593
available.
593
594
594
595
Example
@@ -619,12 +620,12 @@ def config(self):
619
620
... }
620
621
... )
621
622
""" # noqa: E501
622
-
623
623
return self ._config
624
624
625
625
@property
626
626
def k8s_cluster (self ):
627
- """Reference to an object of type `.k8s_cluster.K8sClusterController`.
627
+ """Retrieve a reference to `.k8s_cluster.K8sClusterController` object.
628
+
628
629
See the class :py:class:`.k8s_cluster.K8sClusterController` for the
629
630
methods available.
630
631
@@ -642,7 +643,8 @@ def k8s_cluster(self):
642
643
643
644
@property
644
645
def k8s_worker (self ):
645
- """Reference to an object of type `.k8s_worker.K8sWorkerController`.
646
+ """Retrieve a reference to `.k8s_worker.K8sWorkerController` object.
647
+
646
648
See the class :py:class:`.k8s_worker.K8sWorkerController` for the
647
649
methods available.
648
650
@@ -660,8 +662,9 @@ def k8s_worker(self):
660
662
661
663
@property
662
664
def gateway (self ):
663
- """Reference to an object of type `.gateway.GatewayController`. See
664
- the class :py:class:`.gateway.GatewayController` for the methods
665
+ """Retrieve a reference to `.gateway.GatewayController` object.
666
+
667
+ See the class :py:class:`.gateway.GatewayController` for the methods
665
668
available.
666
669
667
670
Example
@@ -678,8 +681,9 @@ def gateway(self):
678
681
679
682
@property
680
683
def license (self ):
681
- """Reference to an object of type `.license.LicenseController`. See
682
- the class :py:class:`.license.LicenseController` for the methods
684
+ """Retrieve a reference to a `.license.LicenseController` object.
685
+
686
+ See the class :py:class:`.license.LicenseController` for the methods
683
687
available.
684
688
685
689
Example
@@ -696,8 +700,10 @@ def license(self):
696
700
697
701
@property
698
702
def lock (self ):
699
- """Reference to an object of type `.lock.LockController`. See the
700
- class :py:class:`.lock.LockController` for the methods available.
703
+ """Retrieve a reference to a `.lock.LockController` object.
704
+
705
+ See the class :py:class:`.lock.LockController` for the methods
706
+ available.
701
707
702
708
Example
703
709
-------
@@ -713,7 +719,9 @@ class :py:class:`.lock.LockController` for the methods available.
713
719
714
720
@property
715
721
def log (self ):
716
- """Reference to :py:class:`.logger.Logger`. The log function can be
722
+ """Retrieve a reference to a `:py:class:`.logger.Logger`.
723
+
724
+ The log function can be
717
725
called from controller objects via the `client` parameter passed in
718
726
during instantiation of the controller.
719
727
@@ -729,13 +737,14 @@ def some_method(self):
729
737
...
730
738
self.client.log.error("Some Error")
731
739
"""
732
-
733
740
return self ._log
734
741
735
742
@property
736
743
def user (self ):
737
- """Reference to an object of type `.user.UserController`. See the
738
- class :py:class:`.lock.UserController` for the methods available.
744
+ """Retrieve a reference to a `.lock.LockController` object.
745
+
746
+ See the class :py:class:`.lock.UserController` for the methods
747
+ available.
739
748
740
749
Example
741
750
-------
@@ -751,8 +760,9 @@ class :py:class:`.lock.UserController` for the methods available.
751
760
752
761
@property
753
762
def catalog (self ):
754
- """Reference to an object of type `.catalog.CatalogController`. See
755
- the class :py:class:`.catalog.CatalogController` for the methods
763
+ """Retrieve a reference to a `.catalog.CatalogController` object.
764
+
765
+ See the class :py:class:`.catalog.CatalogController` for the methods
756
766
available.
757
767
758
768
Example
@@ -769,8 +779,10 @@ def catalog(self):
769
779
770
780
@property
771
781
def role (self ):
772
- """Reference to an object of type `.role.RoleController`. See the
773
- class :py:class:`.role.RoleController` for the methods available.
782
+ """Retrieve a reference to a `.role.RoleController` object.
783
+
784
+ See the class :py:class:`.role.RoleController` for the methods
785
+ available.
774
786
775
787
Example
776
788
-------
0 commit comments