@@ -219,9 +219,16 @@ if __name__ == "__main__":
219219 action = 'store_true' , help = "Update an configuration using paramemeters provided by --params" )
220220 parser .add_argument ("--delete-configuration" , dest = "delete_configuration" ,
221221 help = "Delete a configuration" , metavar = "CONFIGURATION_ID" )
222+ parser .add_argument ("--apply-configuration" , dest = "apply_configuration" ,
223+ help = "Load an configuration with path to file" , metavar = "UUID" )
224+ parser .add_argument ("--remove-configuration" , dest = "remove_configuration" ,
225+ help = "Remove a configuration" , metavar = "UUID" )
222226 parser .add_argument ("--type-id" , dest = "type_id" , help = "id of configuration source type" )
223227 parser .add_argument ("--config-id" , dest = "config_id" , help = "id of configuration" )
224228 parser .add_argument ("--params" , dest = "params" , help = "comma separated key value pairs (key1=val1,key2=val2)" )
229+ parser .add_argument ("--is-trace" , dest = "is-trace" ,
230+ action = 'store_true' , help = "specify if UUID is for trace if ommitted the by defaut it's for an experiment." )
231+
225232
226233 argcomplete .autocomplete (parser )
227234 options = parser .parse_args ()
@@ -495,6 +502,35 @@ if __name__ == "__main__":
495502 else :
496503 print ("No source typeId provided to delete this configuration" )
497504
505+ if options .apply_configuration :
506+ if options .type_id is not None :
507+ if options .config_id is not None :
508+ response = tsp_client .apply_configuration (options .apply_configuration , options .type_id , options .config_id , False )
509+ if response .status_code == 200 :
510+ sys .exit (0 )
511+ else :
512+ print ("apply configuration failed" )
513+ sys .exit (1 )
514+ else :
515+ print ("No config id to configuration file provided" )
516+ sys .exit (1 )
517+ else :
518+ print ("No typeId provided" )
519+
520+ if options .remove_configuration :
521+ if options .type_id is not None :
522+ if options .config_id is not None :
523+ response = tsp_client .remove_configuration (options .remove_configuration , options .type_id , options .config_id )
524+ if response .status_code == 200 :
525+ sys .exit (0 )
526+ else :
527+ print ("Remove configuration failed" )
528+ sys .exit (1 )
529+ else :
530+ print ("No config id to configuration file provided" )
531+ sys .exit (1 )
532+ else :
533+ print ("No source typeId provided to delete this configuration" )
498534
499535 except requests .exceptions .ConnectionError as e :
500536 print ('Unexpected error: {0}' .format (e ))
0 commit comments