|
109 | 109 | print("fetch_all_entity_tags()") |
110 | 110 | print(fetch_all_entity_tags_r) |
111 | 111 |
|
| 112 | +# fetch_entity_raw_data |
| 113 | +fetch_entity_raw_data_r = j1.fetch_entity_raw_data(entity_id="<GUID>") |
| 114 | +print("fetch_entity_raw_data()") |
| 115 | +print(json.dumps(fetch_entity_raw_data_r, indent=1)) |
| 116 | + |
112 | 117 | # create_integration_instance |
113 | 118 | create_integration_instance_r = j1.create_integration_instance(instance_name="pythonclient-customintegration", |
114 | 119 | instance_description="dev-testing") |
|
118 | 123 | integration_instance_id = "<GUID>" |
119 | 124 |
|
120 | 125 | # start_sync_job |
121 | | -start_sync_job_r = j1.start_sync_job(instance_id=integration_instance_id) |
| 126 | +# sync_mode can be "DIFF", "CREATE_OR_UPDATE", or "PATCH" |
| 127 | +start_sync_job_r = j1.start_sync_job(instance_id=integration_instance_id, |
| 128 | + sync_mode='CREATE_OR_UPDATE', |
| 129 | + source='integration-external') |
122 | 130 | print("start_sync_job()") |
123 | 131 | print(start_sync_job_r) |
124 | 132 |
|
125 | 133 | # upload_entities_batch_json |
| 134 | +rand_val_range = [x / 10.0 for x in range(0, 100)] |
| 135 | +rand_val = random.choice(rand_val_range) |
| 136 | + |
| 137 | +epoch_now = round(time.time() * 1000) |
| 138 | + |
126 | 139 | entity_payload = [ |
127 | 140 | { |
128 | 141 | "_key": "1", |
|
131 | 144 | "displayName": "pythonclient1", |
132 | 145 | "propertyName": "value", |
133 | 146 | "relationshipProperty": "source", |
| 147 | + "value": rand_val, |
| 148 | + "bulkUploadedOn": epoch_now |
134 | 149 | }, |
135 | 150 | { |
136 | 151 | "_key": "2", |
137 | 152 | "_type": "pythonclient", |
138 | 153 | "_class": "API", |
139 | 154 | "displayName": "pythonclient2", |
140 | | - "propertyName": "value" |
141 | | - }, |
142 | | - { |
143 | | - "_key": "3", |
144 | | - "_type": "pythonclient", |
145 | | - "_class": "API", |
146 | | - "displayName": "pythonclient3", |
147 | | - "propertyName": "value" |
| 155 | + "propertyName": "value", |
| 156 | + "relationshipProperty": "source", |
| 157 | + "value": rand_val, |
| 158 | + "bulkUploadedOn": epoch_now |
148 | 159 | } |
149 | 160 | ] |
150 | 161 |
|
|
188 | 199 | "_type": "pythonclient", |
189 | 200 | "_class": "API", |
190 | 201 | "displayName": "pythonclient4", |
191 | | - "propertyName": "value", |
192 | | - "relationshipProperty": "source", |
| 202 | + "enrichProp": "value1" |
193 | 203 | }, |
194 | 204 | { |
195 | 205 | "_key": "5", |
196 | 206 | "_type": "pythonclient", |
197 | 207 | "_class": "API", |
198 | 208 | "displayName": "pythonclient5", |
199 | | - "propertyName": "value" |
| 209 | + "enrichProp": "value2" |
200 | 210 | }, |
201 | 211 | { |
202 | 212 | "_key": "6", |
203 | 213 | "_type": "pythonclient", |
204 | 214 | "_class": "API", |
205 | 215 | "displayName": "pythonclient6", |
206 | | - "propertyName": "value" |
| 216 | + "enrichProp": "value3" |
207 | 217 | } |
208 | 218 | ], |
209 | 219 | "relationships": [ |
|
278 | 288 | print("get_smartclass_details()") |
279 | 289 | print(get_smartclass_details_r) |
280 | 290 |
|
281 | | -# list_configured_alert_rules |
282 | | -list_configured_alert_rules_r = j1.list_configured_alert_rules() |
283 | | -print("list_configured_alert_rules()") |
284 | | -print(list_configured_alert_rules_r) |
285 | | - |
286 | 291 | # generate_j1ql |
287 | 292 | generate_j1ql_r = j1.generate_j1ql(natural_language_prompt="show me all Users containing 'jupiterone' in their email address") |
288 | 293 | print("generate_j1ql()") |
289 | 294 | print(generate_j1ql_r) |
| 295 | + |
| 296 | +# list_alert_rules |
| 297 | +list_alert_rules_r = j1.list_alert_rules() |
| 298 | +print("list_configured_alert_rules()") |
| 299 | +print(list_alert_rules_r) |
| 300 | +print(len(list_alert_rules_r)) |
| 301 | + |
| 302 | +# get_alert_rule_details |
| 303 | +get_alert_rule_details_r = j1.get_alert_rule_details(rule_id="<GUID>") |
| 304 | +print("get_alert_rule_details()") |
| 305 | +print(get_alert_rule_details_r) |
| 306 | + |
| 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 |
| 309 | +webhook_token = "<SECRET>" |
| 310 | + |
| 311 | +webhook_action_config = { |
| 312 | + "type": "WEBHOOK", |
| 313 | + "endpoint": "https://webhook.domain.here/endpoint", |
| 314 | + "headers": { |
| 315 | + "Authorization": "Bearer {}".format(webhook_token), |
| 316 | + }, |
| 317 | + "method": "POST", |
| 318 | + "body": { |
| 319 | + "queryData": "{{queries.query0.data}}" |
| 320 | + } |
| 321 | +} |
| 322 | + |
| 323 | +tag_entities_action_config = { |
| 324 | + "type": "TAG_ENTITIES", |
| 325 | + "entities": "{{queries.query0.data}}", |
| 326 | + "tags": [ |
| 327 | + { |
| 328 | + "name": "tagKey", |
| 329 | + "value": "tagValue" |
| 330 | + } |
| 331 | + ] |
| 332 | +} |
| 333 | + |
| 334 | +create_alert_rule_r = j1.create_alert_rule(name="create_alert_rule-name", |
| 335 | + description="create_alert_rule-description", |
| 336 | + tags=['tag1', 'tag2'], |
| 337 | + polling_interval="DISABLED", |
| 338 | + severity="INFO", |
| 339 | + j1ql="find jupiterone_user") |
| 340 | +print("create_alert_rule()") |
| 341 | +print(create_alert_rule_r) |
| 342 | + |
| 343 | +# delete_alert_rule |
| 344 | +delete_alert_rule_r = j1.delete_alert_rule(rule_id="<GUID>") |
| 345 | +print("delete_alert_rule()") |
| 346 | +print(delete_alert_rule_r) |
| 347 | + |
| 348 | +# 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", |
| 351 | + polling_interval="ONE_WEEK", |
| 352 | + tags=['new_tag1', 'new_tag2']) |
| 353 | +print("update_alert_rule()") |
| 354 | +print(json.dumps(update_alert_rule_r, indent=1)) |
| 355 | + |
| 356 | +# evaluate_alert_rule |
| 357 | +evaluate_alert_rule_r = j1.evaluate_alert_rule(rule_id="<GUID>") |
| 358 | +print("evaluate_alert_rule()") |
| 359 | +print(json.dumps(evaluate_alert_rule_r, indent=1)) |
| 360 | + |
| 361 | + |
0 commit comments