diff --git a/README.md b/README.md index 63a7ad0..bff8ebe 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ j1 = JupiterOneClient( url='https://graphql.us.jupiterone.io', sync_url='https://api.us.jupiterone.io' ) + ``` ## Regional or Custom Tenant Support @@ -58,6 +59,7 @@ query_result = j1.query_v1(QUERY) # Using cursor graphQL variable to return full set of paginated results QUERY = "FIND (Device | Person)" cursor_query_r = j1._cursor_query(QUERY) + ``` ##### Create an entity: @@ -78,6 +80,7 @@ entity = j1.create_entity( timestamp=int(time.time()) * 1000 # Optional, defaults to current datetime ) print(entity['entity']) + ``` @@ -93,6 +96,7 @@ j1.update_entity( entity_id='', properties=properties ) + ``` @@ -112,30 +116,35 @@ j1.create_relationship( from_entity_id='', to_entity_id='' ) + ``` ##### Delete a relationship ```python j1.delete_relationship(relationship_id='') + ``` ##### Fetch Graph Entity Properties ```python j1.fetch_all_entity_properties() + ``` ##### Fetch Graph Entity Tags ```python j1.fetch_all_entity_tags() + ``` ##### Fetch Entity Raw Data ```python j1.fetch_entity_raw_data(entity_id='') + ``` ##### Create Integration Instance @@ -144,12 +153,14 @@ j1.fetch_entity_raw_data(entity_id='') j1.create_integration_instance( instance_name="Integration Name", instance_description="Description Text") + ``` ##### Start Synchronization Job ```python j1.start_sync_job(instance_id='') + ``` ##### Upload Batch of Entities @@ -181,6 +192,7 @@ entities_payload = [ j1.upload_entities_batch_json(instance_job_id='', entities_list=entities_payload) + ``` ##### Upload Batch of Relationships @@ -207,6 +219,7 @@ relationships_payload = [ j1.upload_relationships_batch_json(instance_job_id='', relationships_list=relationships_payload) + ``` ##### Upload Batch of Entities and Relationships @@ -258,17 +271,20 @@ combined_payload = { j1.upload_combined_batch_json(instance_job_id='', combined_payload=combined_payload) + ``` ##### Finalize Synchronization Job ```python j1.finalize_sync_job(instance_job_id='') + ``` ##### Fetch Integration Instance Jobs ```python + j1.fetch_integration_jobs(instance_id='') ``` @@ -277,6 +293,7 @@ j1.fetch_integration_jobs(instance_id='') ```python j1.fetch_integration_job_events(instance_id='', instance_job_id='') + ``` ##### Create SmartClass @@ -284,6 +301,7 @@ j1.fetch_integration_job_events(instance_id='', ```python j1.create_smartclass(smartclass_name='SmartClassName', smartclass_description='SmartClass Description Text') + ``` ##### Create SmartClass Query @@ -292,36 +310,42 @@ j1.create_smartclass(smartclass_name='SmartClassName', j1.create_smartclass_query(smartclass_id='', query='', query_description='Query Description Text') + ``` ##### Run SmartClass Evaluation ```python j1.evaluate_smartclass(smartclass_id='') + ``` ##### Get SmartClass Details ```python j1.get_smartclass_details(smartclass_id='') + ``` ##### Generate J1QL from Natural Language Prompt ```python j1.generate_j1ql(natural_language_prompt='') + ``` ##### List Alert Rules ```python j1.list_alert_rules() + ``` ##### Get Alert Rule Details ```python j1.get_alert_rule_details(rule_id='') + ``` ##### Create Alert Rule @@ -336,6 +360,7 @@ j1.create_alert_rule(name="create_alert_rule-name", polling_interval="DISABLED", severity="INFO", j1ql="find jupiterone_user") + ``` ##### Create Alert Rule with Action Config @@ -354,6 +379,17 @@ webhook_action_config = { } } +tag_entities_action_config = { + "type": "TAG_ENTITIES", + "entities": "{{queries.query0.data}}", + "tags": [ + { + "name": "tagKey", + "value": "tagValue" + } + ] +} + j1.create_alert_rule(name="create_alert_rule-name", description="create_alert_rule-description", tags=['tag1', 'tag2'], @@ -369,33 +405,195 @@ j1.create_alert_rule(name="create_alert_rule-name", ```python j1.delete_alert_rule(rule_id='" + }, + "method": "POST", + "body": { + "queryData": "{{queries.query0.data}}" + } + } +] + +alert_rule_config_multiple = [ + { + "type": "WEBHOOK", + "endpoint": "https://webhook.example", + "headers": { + "Authorization": "Bearer " + }, + "method": "POST", + "body": { + "queryData": "{{queries.query0.data}}" + } + }, + { + "type": "TAG_ENTITIES", + "entities": "{{queries.query0.data}}", + "tags": [ + { + "name": "tagName", + "value": "tagValue" + } + ] + } +] + +j1.update_alert_rule(rule_id="", + name="Updated Alert Rule Name", + description="Updated Alert Rule Description", + j1ql="find jupiterone_user", polling_interval="ONE_WEEK", - tags=['new_tag1', 'new_tag2']) + tags=['tag1', 'tag2', 'tag3'], + tag_op="OVERWRITE", + severity="INFO", + action_configs=alert_rule_config_tag, + action_configs_op="OVERWRITE") -j1.update_alert_rule(rule_id='