@@ -47,26 +47,35 @@ the default of "https://api.us.jupiterone.io" is used.
47
47
48
48
``` python
49
49
QUERY = ' FIND Host'
50
- query_result = j1.query_v1(QUERY )
50
+ query_result = j1.query_v1(query = QUERY )
51
51
52
52
# Including deleted entities
53
- query_result = j1.query_v1(QUERY , include_deleted = True )
53
+ query_result = j1.query_v1(query = QUERY , include_deleted = True )
54
54
55
55
# Tree query
56
56
QUERY = ' FIND Host RETURN TREE'
57
- query_result = j1.query_v1(QUERY )
57
+ query_result = j1.query_v1(query = QUERY )
58
58
59
- # Using cursor graphQL variable to return full set of paginated results
59
+ # Using cursor query to return full set of paginated results
60
60
QUERY = " FIND (Device | Person)"
61
- cursor_query_r = j1._cursor_query(QUERY )
61
+ cursor_query_r = j1._cursor_query(query = QUERY )
62
62
63
+ # Using cursor query with parallel processing
64
+ QUERY = " FIND (Device | Person)"
65
+ cursor_query_r = j1._cursor_query(query = QUERY , max_workers = 5 )
66
+
67
+ # Using deferredResponse with J1QL to return large datasets
68
+ QUERY = " FIND UnifiedDevice"
69
+ deferred_response_query_r = j1.query_with_deferred_response(query = QUERY )
63
70
```
64
71
65
72
##### Create an entity:
66
73
67
74
Note that the CreateEntity mutation behaves like an upsert, so a non-existent entity will be created or an existing entity will be updated.
68
75
69
76
``` python
77
+ import time
78
+
70
79
properties = {
71
80
' myProperty' : ' myValue' ,
72
81
' tag.myTagProperty' : ' value_will_be_a_tag'
@@ -80,7 +89,6 @@ entity = j1.create_entity(
80
89
timestamp = int (time.time()) * 1000 # Optional, defaults to current datetime
81
90
)
82
91
print (entity[' entity' ])
83
-
84
92
```
85
93
86
94
@@ -96,7 +104,6 @@ j1.update_entity(
96
104
entity_id = ' <id-of-entity-to-update>' ,
97
105
properties = properties
98
106
)
99
-
100
107
```
101
108
102
109
@@ -116,7 +123,6 @@ j1.create_relationship(
116
123
from_entity_id = ' <id-of-source-entity>' ,
117
124
to_entity_id = ' <id-of-destination-entity>'
118
125
)
119
-
120
126
```
121
127
122
128
##### Update a relationship
@@ -128,35 +134,30 @@ j1.update_relationship(
128
134
" <relationship-property-name>" : " <relationship-property-updated-value>" ,
129
135
},
130
136
)
131
-
132
137
```
133
138
134
139
##### Delete a relationship
135
140
136
141
``` python
137
142
j1.delete_relationship(relationship_id = ' <id-of-relationship-to-delete>' )
138
-
139
143
```
140
144
141
145
##### Fetch Graph Entity Properties
142
146
143
147
``` python
144
148
j1.fetch_all_entity_properties()
145
-
146
149
```
147
150
148
151
##### Fetch Graph Entity Tags
149
152
150
153
``` python
151
154
j1.fetch_all_entity_tags()
152
-
153
155
```
154
156
155
157
##### Fetch Entity Raw Data
156
158
157
159
``` python
158
160
j1.fetch_entity_raw_data(entity_id = ' <id-of-entity>' )
159
-
160
161
```
161
162
162
163
##### Create Integration Instance
@@ -165,14 +166,12 @@ j1.fetch_entity_raw_data(entity_id='<id-of-entity>')
165
166
j1.create_integration_instance(
166
167
instance_name = " Integration Name" ,
167
168
instance_description = " Description Text" )
168
-
169
169
```
170
170
171
171
##### Start Synchronization Job
172
172
173
173
``` python
174
174
j1.start_sync_job(instance_id = ' <id-of-integration-instance>' )
175
-
176
175
```
177
176
178
177
##### Upload Batch of Entities
@@ -204,7 +203,6 @@ entities_payload = [
204
203
205
204
j1.upload_entities_batch_json(instance_job_id = ' <id-of-integration-sync-job>' ,
206
205
entities_list = entities_payload)
207
-
208
206
```
209
207
210
208
##### Upload Batch of Relationships
@@ -231,7 +229,6 @@ relationships_payload = [
231
229
232
230
j1.upload_relationships_batch_json(instance_job_id = ' <id-of-integration-sync-job>' ,
233
231
relationships_list = relationships_payload)
234
-
235
232
```
236
233
237
234
##### Upload Batch of Entities and Relationships
@@ -283,14 +280,12 @@ combined_payload = {
283
280
284
281
j1.upload_combined_batch_json(instance_job_id = ' <id-of-integration-sync-job>' ,
285
282
combined_payload = combined_payload)
286
-
287
283
```
288
284
289
285
##### Finalize Synchronization Job
290
286
291
287
``` python
292
288
j1.finalize_sync_job(instance_job_id = ' <id-of-integration-sync-job>' )
293
-
294
289
```
295
290
296
291
##### Fetch Integration Instance Jobs
@@ -305,15 +300,13 @@ j1.fetch_integration_jobs(instance_id='<id-of-integration-instance>')
305
300
``` python
306
301
j1.fetch_integration_job_events(instance_id = ' <id-of-integration-instance>' ,
307
302
instance_job_id = ' <id-of-integration-instance-job>' )
308
-
309
303
```
310
304
311
305
##### Create SmartClass
312
306
313
307
``` python
314
308
j1.create_smartclass(smartclass_name = ' SmartClassName' ,
315
309
smartclass_description = ' SmartClass Description Text' )
316
-
317
310
```
318
311
319
312
##### Create SmartClass Query
@@ -322,42 +315,36 @@ j1.create_smartclass(smartclass_name='SmartClassName',
322
315
j1.create_smartclass_query(smartclass_id = ' <id-of-smartclass>' ,
323
316
query = ' <J1QL-query-to-be-added>' ,
324
317
query_description = ' Query Description Text' )
325
-
326
318
```
327
319
328
320
##### Run SmartClass Evaluation
329
321
330
322
``` python
331
323
j1.evaluate_smartclass(smartclass_id = ' <id-of-smartclass>' )
332
-
333
324
```
334
325
335
326
##### Get SmartClass Details
336
327
337
328
``` python
338
329
j1.get_smartclass_details(smartclass_id = ' <id-of-smartclass>' )
339
-
340
330
```
341
331
342
332
##### Generate J1QL from Natural Language Prompt
343
333
344
334
``` python
345
335
j1.generate_j1ql(natural_language_prompt = ' <natural-language-input-text>' )
346
-
347
336
```
348
337
349
338
##### List Alert Rules
350
339
351
340
``` python
352
341
j1.list_alert_rules()
353
-
354
342
```
355
343
356
344
##### Get Alert Rule Details
357
345
358
346
``` python
359
347
j1.get_alert_rule_details(rule_id = ' <id-of-alert-rule>' )
360
-
361
348
```
362
349
363
350
##### Create Alert Rule
@@ -372,13 +359,11 @@ j1.create_alert_rule(name="create_alert_rule-name",
372
359
polling_interval = " DISABLED" ,
373
360
severity = " INFO" ,
374
361
j1ql = " find jupiterone_user" )
375
-
376
362
```
377
363
378
364
##### Create Alert Rule with Action Config
379
365
380
366
``` python
381
-
382
367
webhook_action_config = {
383
368
" type" : " WEBHOOK" ,
384
369
" endpoint" : " https://webhook.domain.here/endpoint" ,
@@ -443,21 +428,17 @@ j1.create_alert_rule(name="create_alert_rule-name",
443
428
severity = " INFO" ,
444
429
j1ql = " find jupiterone_user" ,
445
430
action_configs = webhook_action_config)
446
-
447
431
```
448
432
449
433
##### Delete Alert Rule
450
434
451
435
``` python
452
-
453
436
j1.delete_alert_rule(rule_id = ' <id-of-alert-rule' )
454
-
455
437
```
456
438
457
439
##### Update Alert Rule
458
440
459
441
``` python
460
-
461
442
# polling_interval can be DISABLED, THIRTY_MINUTES, ONE_HOUR, FOUR_HOURS, EIGHT_HOURS, TWELVE_HOURS, ONE_DAY, or ONE_WEEK
462
443
# tag_op can be OVERWRITE or APPEND
463
444
# severity can be INFO, LOW, MEDIUM, HIGH, or CRITICAL
@@ -572,108 +553,77 @@ j1.update_alert_rule(rule_id='<id-of-alert-rule>',
572
553
j1.update_alert_rule(rule_id = ' <id-of-alert-rule>' ,
573
554
tags = [' additionalTag1' , ' additionalTag2' ],
574
555
tag_op = " APPEND" )
575
-
576
556
```
577
557
578
558
##### Evaluate Alert Rule
579
559
580
560
``` python
581
-
582
561
j1.evaluate_alert_rule(rule_id = ' <id-of-alert-rule>' )
583
-
584
562
```
585
563
586
564
##### Get Compliance Framework Item
587
565
588
566
``` python
589
-
590
567
j1.get_compliance_framework_item_details(item_id = " <id-of-item>" )
591
-
592
568
```
593
569
594
570
##### List Alert Rule Evaluation Results
595
571
596
572
``` python
597
-
598
573
j1.list_alert_rule_evaluation_results(rule_id = " <id-of-rule>" )
599
-
600
574
```
601
575
602
576
##### Fetch Evaluation Result Download URL
603
577
604
578
``` python
605
-
606
579
j1.fetch_evaluation_result_download_url(raw_data_key = " RULE_EVALUATION/<id-of-evaluation>/query0.json" )
607
-
608
580
```
609
581
610
582
##### Fetch Evaluation Result Download URL
611
583
612
584
``` python
613
-
614
585
j1.fetch_evaluation_result_download_url(raw_data_key = " RULE_EVALUATION/<id-of-evaluation>/query0.json" )
615
-
616
586
```
617
587
618
588
##### Fetch Downloaded Evaluation Results
619
589
620
590
``` python
621
-
622
591
j1.fetch_downloaded_evaluation_results(download_url = " https://download.us.jupiterone.io/<id-of-rule>/RULE_EVALUATION/<id-of-evaluation>/<epoch>/query0.json?token=<TOKEN>&Expires=<epoch>" )
623
-
624
592
```
625
593
626
594
##### Get Integration Definition Details
627
595
628
596
``` python
629
-
630
597
# examples: 'aws', 'azure', 'google_cloud'
631
-
632
598
j1.get_integration_definition_details(integration_type = " <integration-type>" )
633
-
634
599
```
635
600
636
601
##### Fetch Integration Instances
637
602
638
603
``` python
639
-
640
604
j1.fetch_integration_instances(definition_id = " <id-of-definition>" )
641
-
642
-
643
605
```
644
606
645
607
##### Fetch Integration Instance Details
646
608
647
609
``` python
648
-
649
610
j1.get_integration_instance_details(instance_id = " <id-of-integration-instance>" )
650
-
651
-
652
611
```
653
612
654
613
##### Get Account Parameter Details
655
614
656
615
``` python
657
-
658
616
j1.get_parameter_details(name = " ParameterName" )
659
-
660
-
661
617
```
662
618
663
619
##### List Account Parameters
664
620
665
621
``` python
666
-
667
622
j1.list_account_parameters()
668
-
669
-
670
623
```
671
624
672
- ##### Create or Update Acount Parameter
625
+ ##### Create or Update Account Parameter
673
626
674
627
``` python
675
-
676
628
j1.create_update_parameter(name = " ParameterName" , value = " stored_value" , secret = False )
677
-
678
-
679
629
```
0 commit comments