5353 PARAMETER ,
5454 PARAMETER_LIST ,
5555 UPSERT_PARAMETER ,
56+ UPDATE_ENTITYV2 ,
5657)
5758
5859class JupiterOneClient :
@@ -1070,7 +1071,9 @@ def create_alert_rule(
10701071
10711072 def delete_alert_rule (self , rule_id : str = None ):
10721073 """Delete a single Alert Rule configured in J1 account"""
1073- variables = {"id" : rule_id }
1074+ variables = {
1075+ "id" : rule_id
1076+ }
10741077
10751078 response = self ._execute_query (DELETE_RULE_INSTANCE , variables = variables )
10761079
@@ -1195,7 +1198,9 @@ def update_alert_rule(
11951198
11961199 def evaluate_alert_rule (self , rule_id : str = None ):
11971200 """Run an Evaluation for a defined Alert Rule configured in J1 account"""
1198- variables = {"id" : rule_id }
1201+ variables = {
1202+ "id" : rule_id
1203+ }
11991204
12001205 response = self ._execute_query (EVALUATE_RULE_INSTANCE , variables = variables )
12011206 return response
@@ -1215,7 +1220,9 @@ def list_alert_rule_evaluation_results(self, rule_id: str = None):
12151220
12161221 def fetch_evaluation_result_download_url (self , raw_data_key : str = None ):
12171222 """Fetch evaluation result Download URL for Alert Rule configured in J1 account"""
1218- variables = {"rawDataKey" : raw_data_key }
1223+ variables = {
1224+ "rawDataKey" : raw_data_key
1225+ }
12191226
12201227 response = self ._execute_query (GET_RAW_DATA_DOWNLOAD_URL , variables = variables )
12211228 return response
@@ -1236,7 +1243,12 @@ def list_questions(self):
12361243 """List all defined Questions configured in J1 account Questions Library"""
12371244 results = []
12381245
1239- data = {"query" : QUESTIONS , "flags" : {"variableResultSize" : True }}
1246+ data = {
1247+ "query" : QUESTIONS ,
1248+ "flags" : {
1249+ "variableResultSize" : True
1250+ }
1251+ }
12401252
12411253 r = requests .post (
12421254 url = self .graphql_url , headers = self .headers , json = data , verify = True
@@ -1270,7 +1282,9 @@ def get_compliance_framework_item_details(self, item_id: str = None):
12701282
12711283 def get_parameter_details (self , name : str = None ):
12721284 """Fetch Details of a configured Parameter in J1 account"""
1273- variables = {"name" : name }
1285+ variables = {
1286+ "name" : name
1287+ }
12741288
12751289 response = self ._execute_query (PARAMETER , variables = variables )
12761290 return response
@@ -1310,7 +1324,28 @@ def create_update_parameter(
13101324 secret : bool = False ,
13111325 ):
13121326 """Create or Update Account Parameter in J1 account"""
1313- variables = {"name" : name , "value" : value , "secret" : secret }
1327+ variables = {
1328+ "name" : name ,
1329+ "value" : value ,
1330+ "secret" : secret
1331+ }
13141332
13151333 response = self ._execute_query (UPSERT_PARAMETER , variables = variables )
13161334 return response
1335+
1336+ def update_entity_v2 (self , entity_id : str = None , properties : Dict = None ) -> Dict :
1337+ """
1338+ Update an existing entity by adding new or updating existing properties.
1339+
1340+ args:
1341+ entity_id (str): The _id of the entity to update
1342+ properties (dict): Dictionary of key/value entity properties
1343+ """
1344+ properties ['_id' ] = entity_id
1345+
1346+ variables = {
1347+ "entity" : properties ,
1348+ }
1349+
1350+ response = self ._execute_query (UPDATE_ENTITYV2 , variables = variables )
1351+ return response ["data" ]["updateEntityV2" ]
0 commit comments