|
114 | 114 | print("fetch_entity_raw_data()") |
115 | 115 | print(json.dumps(fetch_entity_raw_data_r, indent=1)) |
116 | 116 |
|
117 | | -# create_integration_instance |
118 | | -create_integration_instance_r = j1.create_integration_instance(instance_name="pythonclient-customintegration", |
| 117 | +# create_custom_integration_instance |
| 118 | +create_custom_integration_instance_r = j1.create_custom_integration_instance(instance_name="pythonclient-customintegration", |
119 | 119 | instance_description="dev-testing") |
120 | | -print("create_integration_instance()") |
121 | | -print(create_integration_instance_r) |
| 120 | +print("create_custom_integration_instance()") |
| 121 | +print(create_custom_integration_instance_r) |
122 | 122 |
|
123 | 123 | integration_instance_id = "<GUID>" |
124 | 124 |
|
|
305 | 305 | print(get_alert_rule_details_r) |
306 | 306 |
|
307 | 307 | # create_alert_rule |
308 | | -# polling_interval can be DISABLED, THIRTY_MINUTES, ONE_HOUR, FOUR_HOURS, EIGHT_HOURS, TWELVE_HOURS, ONE_DAY, and ONE_WEEK |
| 308 | +# polling_interval can be DISABLED, THIRTY_MINUTES, ONE_HOUR, FOUR_HOURS, EIGHT_HOURS, TWELVE_HOURS, ONE_DAY, or ONE_WEEK |
| 309 | +# severity can be INFO, LOW, MEDIUM, HIGH, or CRITICAL |
309 | 310 | webhook_token = "<SECRET>" |
310 | 311 |
|
311 | 312 | webhook_action_config = { |
|
346 | 347 | print(delete_alert_rule_r) |
347 | 348 |
|
348 | 349 | # update_alert_rule |
349 | | -update_alert_rule_r = j1.update_alert_rule(rule_id="<GUID>", |
350 | | - j1ql="find jupiterone_user as i return i._key", |
| 350 | +alert_rule_config_alert = [ |
| 351 | + { |
| 352 | + "type": "CREATE_ALERT" |
| 353 | + } |
| 354 | +] |
| 355 | + |
| 356 | +alert_rule_config_tag = [ |
| 357 | + { |
| 358 | + "type": "TAG_ENTITIES", |
| 359 | + "entities": "{{queries.query0.data}}", |
| 360 | + "tags": [ |
| 361 | + { |
| 362 | + "name": "tagName", |
| 363 | + "value": "tagValue" |
| 364 | + } |
| 365 | + ] |
| 366 | + } |
| 367 | +] |
| 368 | + |
| 369 | +alert_rule_config_webhook = [ |
| 370 | + { |
| 371 | + "type": "WEBHOOK", |
| 372 | + "endpoint": "https://webhook.example", |
| 373 | + "headers": { |
| 374 | + "Authorization": "Bearer <TOKEN>" |
| 375 | + }, |
| 376 | + "method": "POST", |
| 377 | + "body": { |
| 378 | + "queryData": "{{queries.query0.data}}" |
| 379 | + } |
| 380 | + } |
| 381 | +] |
| 382 | + |
| 383 | +alert_rule_config_multiple = [ |
| 384 | + { |
| 385 | + "type": "WEBHOOK", |
| 386 | + "endpoint": "https://webhook.example", |
| 387 | + "headers": { |
| 388 | + "Authorization": "Bearer <TOKEN>" |
| 389 | + }, |
| 390 | + "method": "POST", |
| 391 | + "body": { |
| 392 | + "queryData": "{{queries.query0.data}}" |
| 393 | + } |
| 394 | + }, |
| 395 | + { |
| 396 | + "type": "TAG_ENTITIES", |
| 397 | + "entities": "{{queries.query0.data}}", |
| 398 | + "tags": [ |
| 399 | + { |
| 400 | + "name": "tagName", |
| 401 | + "value": "tagValue" |
| 402 | + } |
| 403 | + ] |
| 404 | + } |
| 405 | +] |
| 406 | + |
| 407 | +# polling_interval can be DISABLED, THIRTY_MINUTES, ONE_HOUR, FOUR_HOURS, EIGHT_HOURS, TWELVE_HOURS, ONE_DAY, or ONE_WEEK |
| 408 | +# tag_op can be OVERWRITE or APPEND |
| 409 | +# severity can be INFO, LOW, MEDIUM, HIGH, or CRITICAL |
| 410 | +# action_configs_op can be OVERWRITE or APPEND |
| 411 | + |
| 412 | +update_alert_rule_r = j1.update_alert_rule(rule_id="GUID>", |
| 413 | + name="Updated Alert Rule Name", |
| 414 | + description="Updated Alert Rule Description", |
| 415 | + j1ql="find jupiterone_user", |
351 | 416 | polling_interval="ONE_WEEK", |
352 | | - tags=['new_tag1', 'new_tag2']) |
| 417 | + tags=['tag1', 'tag2', 'tag3'], |
| 418 | + tag_op="OVERWRITE", |
| 419 | + severity="INFO", |
| 420 | + action_configs=alert_rule_config_tag, |
| 421 | + action_configs_op="OVERWRITE") |
353 | 422 | print("update_alert_rule()") |
354 | 423 | print(json.dumps(update_alert_rule_r, indent=1)) |
355 | 424 |
|
|
358 | 427 | print("evaluate_alert_rule()") |
359 | 428 | print(json.dumps(evaluate_alert_rule_r, indent=1)) |
360 | 429 |
|
361 | | - |
| 430 | +# get_compliance_framework_item_details |
| 431 | +r = j1.get_compliance_framework_item_details(item_id="<GUID>") |
| 432 | +print("get_compliance_framework_item_details()") |
| 433 | +print(json.dumps(r, indent=1)) |
| 434 | + |
| 435 | +# list alert rule evaluation results |
| 436 | +r = j1.list_alert_rule_evaluation_results(rule_id="<GUID>") |
| 437 | +print("list_alert_rule_evaluation_results()") |
| 438 | +print(json.dumps(r, indent=1)) |
| 439 | + |
| 440 | +# fetch_evaluation_result_download_url |
| 441 | +r = j1.fetch_evaluation_result_download_url(raw_data_key="RULE_EVALUATION/<GUID>/query0.json") |
| 442 | +print("fetch_evaluation_result_download_url()") |
| 443 | +print(json.dumps(r, indent=1)) |
| 444 | + |
| 445 | +# fetch_downloaded_evaluation_results |
| 446 | +r = j1.fetch_downloaded_evaluation_results(download_url="https://download.us.jupiterone.io/<GUID>%2FRULE_EVALUATION%2F<GUID>%2F<epoch>%2Fquery0.json?token=<TOKEN>&Expires=<epoch>") |
| 447 | +print("fetch_downloaded_evaluation_results()") |
| 448 | +print(json.dumps(r, indent=1)) |
| 449 | + |
| 450 | +# get_integration_definition_details |
| 451 | +r = j1.get_integration_definition_details(integration_type="aws") |
| 452 | +print("get_integration_definition_details()") |
| 453 | +print(json.dumps(r, indent=1)) |
| 454 | + |
| 455 | +# fetch_integration_instances |
| 456 | +r = j1.fetch_integration_instances(definition_id="<GUID>") |
| 457 | +print("fetch_integration_instances()") |
| 458 | +print(json.dumps(r, indent=1)) |
| 459 | + |
| 460 | +# get_integration_instance_details |
| 461 | +r = j1.get_integration_instance_details(instance_id="<GUID>") |
| 462 | +print("get_integration_instance_details()") |
| 463 | +print(json.dumps(r, indent=1)) |
| 464 | + |
| 465 | +r = j1.get_parameter_details(name="ParameterName") |
| 466 | +print(json.dumps(r, indent=1)) |
| 467 | + |
| 468 | +r = j1.list_account_parameters() |
| 469 | +print(json.dumps(r, indent=1)) |
| 470 | + |
| 471 | +r = j1.create_update_parameter(name="ParameterName", value="stored_value", secret=False) |
| 472 | +print(json.dumps(r, indent=1)) |
0 commit comments