Skip to content

Commit 0227037

Browse files
authored
Merge pull request #36 from JupiterOne/KNO-496
KNO-496 - 1.3.0
2 parents cc67098 + 403da5f commit 0227037

3 files changed

Lines changed: 1163 additions & 72 deletions

File tree

examples/examples.py

Lines changed: 120 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@
114114
print("fetch_entity_raw_data()")
115115
print(json.dumps(fetch_entity_raw_data_r, indent=1))
116116

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",
119119
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)
122122

123123
integration_instance_id = "<GUID>"
124124

@@ -305,7 +305,8 @@
305305
print(get_alert_rule_details_r)
306306

307307
# 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
309310
webhook_token = "<SECRET>"
310311

311312
webhook_action_config = {
@@ -346,10 +347,78 @@
346347
print(delete_alert_rule_r)
347348

348349
# 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",
351416
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")
353422
print("update_alert_rule()")
354423
print(json.dumps(update_alert_rule_r, indent=1))
355424

@@ -358,4 +427,46 @@
358427
print("evaluate_alert_rule()")
359428
print(json.dumps(evaluate_alert_rule_r, indent=1))
360429

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

Comments
 (0)