@@ -40,7 +40,7 @@ def terraform_output(terraform_path=TERRAFORM_OUTPUT):
4040
4141
4242def create_deployment_space (
43- cos_crn , wml_name , wml_crn , space_name = "default" , description = ""
43+ client , cos_crn , wml_name , wml_crn , space_name = "default" , description = ""
4444):
4545
4646 metadata = {
@@ -60,25 +60,25 @@ def create_deployment_space(
6060 return space_details
6161
6262
63- def update_deployment_space (new_name , space_id ):
63+ def update_deployment_space (client , new_name , space_id ):
6464
6565 metadata = {client .spaces .ConfigurationMetaNames .NAME : new_name }
6666
6767 space_details = client .spaces .update (space_id , changes = metadata )
6868 return space_details
6969
7070
71- def delete_deployment_space (space_id ):
71+ def delete_deployment_space (client , space_id ):
7272
7373 client .spaces .delete (space_id )
7474
7575
76- def list_deployment_space ():
76+ def list_deployment_space (client ):
7777 spaces = client .spaces .list ()
7878 print (spaces )
7979
8080
81- def describe_deployment_space (space_id ):
81+ def describe_deployment_space (client , space_id ):
8282 info = client .spaces .get_details (space_id )
8383 pprint (info )
8484
@@ -113,13 +113,18 @@ def help():
113113 if len (args ) == 2 :
114114 space_name = args [1 ]
115115 space = create_deployment_space (
116- infos ["cos_crn" ], infos ["wml_name" ], infos ["wml_crn" ], space_name
116+ client ,
117+ infos ["cos_crn" ],
118+ infos ["wml_name" ],
119+ infos ["wml_crn" ],
120+ space_name ,
117121 )
118122
119123 elif len (args ) > 2 :
120124 space_name = args [1 ]
121125 description = args [2 ]
122126 space = create_deployment_space (
127+ client ,
123128 infos ["cos_crn" ],
124129 infos ["wml_name" ],
125130 infos ["wml_crn" ],
@@ -137,7 +142,7 @@ def help():
137142 except :
138143 raise Exception ("Missing arguments" )
139144
140- space = update_deployment_space (new_name , space_id )
145+ space = update_deployment_space (client , new_name , space_id )
141146 pprint (space )
142147
143148 elif action == "delete" :
@@ -146,10 +151,10 @@ def help():
146151 except :
147152 raise Exception ("Missing space_id" )
148153
149- delete_deployment_space (space_id )
154+ delete_deployment_space (client , space_id )
150155
151156 elif action == "list" :
152- list_deployment_space ()
157+ list_deployment_space (client )
153158
154159 elif action == "describe" :
155160
@@ -158,7 +163,7 @@ def help():
158163 except :
159164 raise Exception ("Missing space_id" )
160165
161- describe_deployment_space (space_id )
166+ describe_deployment_space (client , space_id )
162167
163168 else :
164169 help ()
0 commit comments