13
13
# License for the specific language governing permissions and limitations
14
14
# under the License.
15
15
16
+ """This module is used for the initialization of PowerFlex Client."""
17
+
18
+ # pylint: disable=invalid-name,too-many-arguments,too-many-positional-arguments
19
+
16
20
from packaging import version
17
21
18
22
from PyPowerFlex import configuration
28
32
29
33
30
34
class PowerFlexClient :
35
+ """
36
+ Client class for interacting with PowerFlex API.
37
+
38
+ This class initializes the client with the provided configuration and provides
39
+ access to the various storage entities available in the PowerFlex system.
40
+ """
31
41
__slots__ = (
32
42
'__is_initialized' ,
33
43
'configuration' ,
@@ -76,12 +86,18 @@ def __init__(self,
76
86
def __getattr__ (self , item ):
77
87
if not self .__is_initialized and item in self .__slots__ :
78
88
raise exceptions .ClientNotInitialized
79
- return super (PowerFlexClient , self ).__getattribute__ (item )
89
+ return super ().__getattribute__ (item )
80
90
81
91
def __add_storage_entity (self , attr_name , entity_class ):
82
92
setattr (self , attr_name , entity_class (self .token , self .configuration ))
83
93
84
94
def initialize (self ):
95
+ """
96
+ Initializes the client.
97
+
98
+ Raises:
99
+ PowerFlexClientException: If the PowerFlex API version is lower than 3.0.
100
+ """
85
101
self .configuration .validate ()
86
102
self .__add_storage_entity ('device' , objects .Device )
87
103
self .__add_storage_entity ('fault_set' , objects .FaultSet )
@@ -97,12 +113,16 @@ def initialize(self):
97
113
self .__add_storage_entity ('system' , objects .System )
98
114
self .__add_storage_entity ('volume' , objects .Volume )
99
115
self .__add_storage_entity ('utility' , objects .PowerFlexUtility )
100
- self .__add_storage_entity ('replication_consistency_group' , objects .ReplicationConsistencyGroup )
116
+ self .__add_storage_entity (
117
+ 'replication_consistency_group' ,
118
+ objects .ReplicationConsistencyGroup )
101
119
self .__add_storage_entity ('replication_pair' , objects .ReplicationPair )
102
120
self .__add_storage_entity ('service_template' , objects .ServiceTemplate )
103
121
self .__add_storage_entity ('managed_device' , objects .ManagedDevice )
104
122
self .__add_storage_entity ('deployment' , objects .Deployment )
105
- self .__add_storage_entity ('firmware_repository' , objects .FirmwareRepository )
123
+ self .__add_storage_entity (
124
+ 'firmware_repository' ,
125
+ objects .FirmwareRepository )
106
126
self .__add_storage_entity ('host' , objects .Host )
107
127
utils .init_logger (self .configuration .log_level )
108
128
if version .parse (self .system .api_version ()) < version .Version ('3.0' ):
0 commit comments