77# Changes may cause incorrect behavior and will be lost if the code is
88# regenerated.
99# --------------------------------------------------------------------------
10-
11-
1210# pylint: disable=protected-access
1311
14- # pylint: disable=no-self-use
15-
16-
1712import argparse
1813from collections import defaultdict
1914from knack .util import CLIError
2015
2116
22- class AddDiskPoolUpdateDisks (argparse ._AppendAction ):
23- def __call__ (self , parser , namespace , values , option_string = None ):
24- action = self .get_action (values , option_string )
25-
26- for item in action :
27- super (AddDiskPoolUpdateDisks , self ).__call__ (parser , namespace , item , option_string )
28-
29- def get_action (self , values , option_string = None ):
30- try :
31- value_chunk_list = [values [x : x + 1 ] for x in range (0 , len (values ), 1 )]
32- value_list = []
33- for chunk in value_chunk_list :
34- id = chunk
35- value_list .append (
36- {
37- 'id' : id ,
38- }
39- )
40- return value_list
41- except ValueError :
42- raise CLIError ('usage error: {} NAME METRIC OPERATION VALUE' .format (option_string ))
43-
44-
4517class AddSku (argparse .Action ):
4618 def __call__ (self , parser , namespace , values , option_string = None ):
4719 action = self .get_action (values , option_string )
4820 namespace .sku = action
4921
50- def get_action (self , values , option_string ):
22+ def get_action (self , values , option_string ): # pylint: disable=no-self-use
5123 try :
5224 properties = defaultdict (list )
5325 for (k , v ) in (x .split ('=' , 1 ) for x in values ):
@@ -57,56 +29,68 @@ def get_action(self, values, option_string):
5729 raise CLIError ('usage error: {} [KEY=VALUE ...]' .format (option_string ))
5830 d = {}
5931 for k in properties :
60-
6132 kl = k .lower ()
62-
6333 v = properties [k ]
64-
6534 if kl == 'name' :
66-
6735 d ['name' ] = v [0 ]
68-
6936 elif kl == 'tier' :
70-
7137 d ['tier' ] = v [0 ]
72-
7338 else :
74- raise CLIError (
75- 'Unsupported Key {} is provided for parameter sku. All possible keys are: name, tier' .format (k )
76- )
77-
39+ raise CLIError ('Unsupported Key {} is provided for parameter sku. All possible keys are: name, tier' .
40+ format (k ))
7841 return d
7942
8043
8144class AddDiskPoolCreateDisks (argparse ._AppendAction ):
8245 def __call__ (self , parser , namespace , values , option_string = None ):
8346 action = self .get_action (values , option_string )
84-
8547 for item in action :
8648 super (AddDiskPoolCreateDisks , self ).__call__ (parser , namespace , item , option_string )
8749
8850 def get_action (self , values , option_string = None ):
8951 try :
90- value_chunk_list = [values [x : x + 1 ] for x in range (0 , len (values ), 1 )]
52+ value_chunk_list = [values [x :x + 1 ] for x in range (0 , len (values ), 1 )]
9153 value_list = []
9254 for chunk in value_chunk_list :
93- id = chunk
55+ id , = chunk
9456 value_list .append (
9557 {
96- 'id' : id ,
58+ 'id' : id
9759 }
9860 )
9961 return value_list
10062 except ValueError :
10163 raise CLIError ('usage error: {} NAME METRIC OPERATION VALUE' .format (option_string ))
10264
10365
104- class AddDiskPoolIscsiTargetUpdateStaticAcls (argparse ._AppendAction ):
66+ class AddDiskPoolUpdateDisks (argparse ._AppendAction ):
10567 def __call__ (self , parser , namespace , values , option_string = None ):
10668 action = self .get_action (values , option_string )
107- super (AddDiskPoolIscsiTargetUpdateStaticAcls , self ).__call__ (parser , namespace , action , option_string )
69+ for item in action :
70+ super (AddDiskPoolUpdateDisks , self ).__call__ (parser , namespace , item , option_string )
10871
109- def get_action (self , values , option_string ):
72+ def get_action (self , values , option_string = None ):
73+ try :
74+ value_chunk_list = [values [x :x + 1 ] for x in range (0 , len (values ), 1 )]
75+ value_list = []
76+ for chunk in value_chunk_list :
77+ id , = chunk
78+ value_list .append (
79+ {
80+ 'id' : id
81+ }
82+ )
83+ return value_list
84+ except ValueError :
85+ raise CLIError ('usage error: {} NAME METRIC OPERATION VALUE' .format (option_string ))
86+
87+
88+ class AddDiskPoolIscsiTargetCreateStaticAcls (argparse ._AppendAction ):
89+ def __call__ (self , parser , namespace , values , option_string = None ):
90+ action = self .get_action (values , option_string )
91+ super (AddDiskPoolIscsiTargetCreateStaticAcls , self ).__call__ (parser , namespace , action , option_string )
92+
93+ def get_action (self , values , option_string ): # pylint: disable=no-self-use
11094 try :
11195 properties = defaultdict (list )
11296 for (k , v ) in (x .split ('=' , 1 ) for x in values ):
@@ -116,34 +100,24 @@ def get_action(self, values, option_string):
116100 raise CLIError ('usage error: {} [KEY=VALUE ...]' .format (option_string ))
117101 d = {}
118102 for k in properties :
119-
120103 kl = k .lower ()
121-
122104 v = properties [k ]
123-
124105 if kl == 'initiator-iqn' :
125-
126106 d ['initiator_iqn' ] = v [0 ]
127-
128107 elif kl == 'mapped-luns' :
129-
130108 d ['mapped_luns' ] = v
131-
132109 else :
133- raise CLIError (
134- 'Unsupported Key {} is provided for parameter static-acls. All possible keys are: initiator-iqn,'
135- ' mapped-luns' .format (k )
136- )
137-
110+ raise CLIError ('Unsupported Key {} is provided for parameter static_acls. All possible keys are: '
111+ 'initiator-iqn, mapped-luns' .format (k ))
138112 return d
139113
140114
141- class AddDiskPoolIscsiTargetUpdateLuns (argparse ._AppendAction ):
115+ class AddDiskPoolIscsiTargetCreateLuns (argparse ._AppendAction ):
142116 def __call__ (self , parser , namespace , values , option_string = None ):
143117 action = self .get_action (values , option_string )
144- super (AddDiskPoolIscsiTargetUpdateLuns , self ).__call__ (parser , namespace , action , option_string )
118+ super (AddDiskPoolIscsiTargetCreateLuns , self ).__call__ (parser , namespace , action , option_string )
145119
146- def get_action (self , values , option_string ):
120+ def get_action (self , values , option_string ): # pylint: disable=no-self-use
147121 try :
148122 properties = defaultdict (list )
149123 for (k , v ) in (x .split ('=' , 1 ) for x in values ):
@@ -153,34 +127,24 @@ def get_action(self, values, option_string):
153127 raise CLIError ('usage error: {} [KEY=VALUE ...]' .format (option_string ))
154128 d = {}
155129 for k in properties :
156-
157130 kl = k .lower ()
158-
159131 v = properties [k ]
160-
161132 if kl == 'name' :
162-
163133 d ['name' ] = v [0 ]
164-
165134 elif kl == 'managed-disk-azure-resource-id' :
166-
167135 d ['managed_disk_azure_resource_id' ] = v [0 ]
168-
169136 else :
170- raise CLIError (
171- 'Unsupported Key {} is provided for parameter luns. All possible keys are: name,'
172- ' managed-disk-azure-resource-id' .format (k )
173- )
174-
137+ raise CLIError ('Unsupported Key {} is provided for parameter luns. All possible keys are: name, '
138+ 'managed-disk-azure-resource-id' .format (k ))
175139 return d
176140
177141
178- class AddDiskPoolIscsiTargetCreateStaticAcls (argparse ._AppendAction ):
142+ class AddDiskPoolIscsiTargetUpdateStaticAcls (argparse ._AppendAction ):
179143 def __call__ (self , parser , namespace , values , option_string = None ):
180144 action = self .get_action (values , option_string )
181- super (AddDiskPoolIscsiTargetCreateStaticAcls , self ).__call__ (parser , namespace , action , option_string )
145+ super (AddDiskPoolIscsiTargetUpdateStaticAcls , self ).__call__ (parser , namespace , action , option_string )
182146
183- def get_action (self , values , option_string ):
147+ def get_action (self , values , option_string ): # pylint: disable=no-self-use
184148 try :
185149 properties = defaultdict (list )
186150 for (k , v ) in (x .split ('=' , 1 ) for x in values ):
@@ -190,34 +154,24 @@ def get_action(self, values, option_string):
190154 raise CLIError ('usage error: {} [KEY=VALUE ...]' .format (option_string ))
191155 d = {}
192156 for k in properties :
193-
194157 kl = k .lower ()
195-
196158 v = properties [k ]
197-
198159 if kl == 'initiator-iqn' :
199-
200160 d ['initiator_iqn' ] = v [0 ]
201-
202161 elif kl == 'mapped-luns' :
203-
204162 d ['mapped_luns' ] = v
205-
206163 else :
207- raise CLIError (
208- 'Unsupported Key {} is provided for parameter static-acls. All possible keys are: initiator-iqn,'
209- ' mapped-luns' .format (k )
210- )
211-
164+ raise CLIError ('Unsupported Key {} is provided for parameter static_acls. All possible keys are: '
165+ 'initiator-iqn, mapped-luns' .format (k ))
212166 return d
213167
214168
215- class AddDiskPoolIscsiTargetCreateLuns (argparse ._AppendAction ):
169+ class AddDiskPoolIscsiTargetUpdateLuns (argparse ._AppendAction ):
216170 def __call__ (self , parser , namespace , values , option_string = None ):
217171 action = self .get_action (values , option_string )
218- super (AddDiskPoolIscsiTargetCreateLuns , self ).__call__ (parser , namespace , action , option_string )
172+ super (AddDiskPoolIscsiTargetUpdateLuns , self ).__call__ (parser , namespace , action , option_string )
219173
220- def get_action (self , values , option_string ):
174+ def get_action (self , values , option_string ): # pylint: disable=no-self-use
221175 try :
222176 properties = defaultdict (list )
223177 for (k , v ) in (x .split ('=' , 1 ) for x in values ):
@@ -227,23 +181,13 @@ def get_action(self, values, option_string):
227181 raise CLIError ('usage error: {} [KEY=VALUE ...]' .format (option_string ))
228182 d = {}
229183 for k in properties :
230-
231184 kl = k .lower ()
232-
233185 v = properties [k ]
234-
235186 if kl == 'name' :
236-
237187 d ['name' ] = v [0 ]
238-
239188 elif kl == 'managed-disk-azure-resource-id' :
240-
241189 d ['managed_disk_azure_resource_id' ] = v [0 ]
242-
243190 else :
244- raise CLIError (
245- 'Unsupported Key {} is provided for parameter luns. All possible keys are: name,'
246- ' managed-disk-azure-resource-id' .format (k )
247- )
248-
191+ raise CLIError ('Unsupported Key {} is provided for parameter luns. All possible keys are: name, '
192+ 'managed-disk-azure-resource-id' .format (k ))
249193 return d
0 commit comments