1414#
1515"""Google SecOps CLI integration commands"""
1616
17+ import json
1718import sys
1819
1920from secops .chronicle .models import (
@@ -127,6 +128,18 @@ def setup_integrations_command(subparsers):
127128 help = "Integration type" ,
128129 dest = "integration_type" ,
129130 )
131+ create_parser .add_argument (
132+ "--parameters" ,
133+ type = str ,
134+ help = "JSON string representing a list of integration parameters" ,
135+ dest = "parameters" ,
136+ )
137+ create_parser .add_argument (
138+ "--categories" ,
139+ type = str ,
140+ help = "Comma-separated list of categories for the integration" ,
141+ dest = "categories" ,
142+ )
130143 create_parser .set_defaults (func = handle_integration_create_command )
131144
132145 # download command
@@ -412,6 +425,18 @@ def setup_integrations_command(subparsers):
412425 help = "Integration type" ,
413426 dest = "integration_type" ,
414427 )
428+ update_parser .add_argument (
429+ "--parameters" ,
430+ type = str ,
431+ help = "JSON string representing a list of integration parameters" ,
432+ dest = "parameters" ,
433+ )
434+ update_parser .add_argument (
435+ "--categories" ,
436+ type = str ,
437+ help = "Comma-separated list of categories for the integration" ,
438+ dest = "categories" ,
439+ )
415440 update_parser .add_argument (
416441 "--staging" ,
417442 action = "store_true" ,
@@ -489,6 +514,18 @@ def setup_integrations_command(subparsers):
489514 help = "Integration type" ,
490515 dest = "integration_type" ,
491516 )
517+ update_custom_parser .add_argument (
518+ "--parameters" ,
519+ type = str ,
520+ help = "JSON string representing a list of integration parameters" ,
521+ dest = "parameters" ,
522+ )
523+ update_custom_parser .add_argument (
524+ "--categories" ,
525+ type = str ,
526+ help = "Comma-separated list of categories for the integration" ,
527+ dest = "categories" ,
528+ )
492529 update_custom_parser .add_argument (
493530 "--staging" ,
494531 action = "store_true" ,
@@ -580,6 +617,16 @@ def handle_integration_create_command(args, chronicle):
580617 if args .integration_type
581618 else None
582619 ),
620+ parameters = (
621+ json .loads (args .parameters )
622+ if getattr (args , "parameters" , None )
623+ else None
624+ ),
625+ categories = (
626+ [c .strip () for c in args .categories .split ("," )]
627+ if getattr (args , "categories" , None )
628+ else None
629+ ),
583630 )
584631 output_formatter (out , getattr (args , "output" , "json" ))
585632 except Exception as e : # pylint: disable=broad-exception-caught
@@ -590,7 +637,7 @@ def handle_integration_create_command(args, chronicle):
590637def handle_integration_download_command (args , chronicle ):
591638 """Handle download integration command"""
592639 try :
593- zip_bytes = chronicle .download_integration (
640+ zip_bytes = chronicle .soar . download_integration (
594641 integration_name = args .integration_id ,
595642 )
596643 with open (args .output_file , "wb" ) as f :
@@ -622,7 +669,7 @@ def handle_download_integration_dependency_command(args, chronicle):
622669def handle_export_integration_items_command (args , chronicle ):
623670 """Handle export integration items command"""
624671 try :
625- zip_bytes = chronicle .export_integration_items (
672+ zip_bytes = chronicle .soar . export_integration_items (
626673 integration_name = args .integration_id ,
627674 actions = args .actions ,
628675 jobs = args .jobs ,
@@ -736,7 +783,17 @@ def handle_update_integration_command(args, chronicle):
736783 if args .integration_type
737784 else None
738785 ),
739- staging = args .staging or None ,
786+ parameters = (
787+ json .loads (args .parameters )
788+ if getattr (args , "parameters" , None )
789+ else None
790+ ),
791+ categories = (
792+ [c .strip () for c in args .categories .split ("," )]
793+ if getattr (args , "categories" , None )
794+ else None
795+ ),
796+ staging = args .staging if "staging" in vars (args ) else None ,
740797 dependencies_to_remove = args .dependencies_to_remove ,
741798 update_mask = args .update_mask ,
742799 )
@@ -765,6 +822,16 @@ def handle_updated_custom_integration_command(args, chronicle):
765822 if args .integration_type
766823 else None
767824 ),
825+ parameters = (
826+ json .loads (args .parameters )
827+ if getattr (args , "parameters" , None )
828+ else None
829+ ),
830+ categories = (
831+ [c .strip () for c in args .categories .split ("," )]
832+ if getattr (args , "categories" , None )
833+ else None
834+ ),
768835 staging = args .staging or None ,
769836 dependencies_to_remove = args .dependencies_to_remove ,
770837 update_mask = args .update_mask ,
0 commit comments