Skip to content

Commit

Permalink
Merge pull request #37 from JupiterOne/KNO-514
Browse files Browse the repository at this point in the history
1.3.0 release
SeaBlooms authored Dec 16, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 0227037 + 330232e commit 95760d5
Showing 2 changed files with 206 additions and 8 deletions.
212 changes: 205 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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='<id-of-entity-to-update>',
properties=properties
)

```


@@ -112,30 +116,35 @@ j1.create_relationship(
from_entity_id='<id-of-source-entity>',
to_entity_id='<id-of-destination-entity>'
)

```

##### Delete a relationship

```python
j1.delete_relationship(relationship_id='<id-of-relationship-to-delete>')

```

##### 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='<id-of-entity>')

```

##### Create Integration Instance
@@ -144,12 +153,14 @@ j1.fetch_entity_raw_data(entity_id='<id-of-entity>')
j1.create_integration_instance(
instance_name="Integration Name",
instance_description="Description Text")

```

##### Start Synchronization Job

```python
j1.start_sync_job(instance_id='<id-of-integration-instance>')

```

##### Upload Batch of Entities
@@ -181,6 +192,7 @@ entities_payload = [

j1.upload_entities_batch_json(instance_job_id='<id-of-integration-sync-job>',
entities_list=entities_payload)

```

##### Upload Batch of Relationships
@@ -207,6 +219,7 @@ relationships_payload = [

j1.upload_relationships_batch_json(instance_job_id='<id-of-integration-sync-job>',
relationships_list=relationships_payload)

```

##### Upload Batch of Entities and Relationships
@@ -258,17 +271,20 @@ combined_payload = {

j1.upload_combined_batch_json(instance_job_id='<id-of-integration-sync-job>',
combined_payload=combined_payload)

```

##### Finalize Synchronization Job

```python
j1.finalize_sync_job(instance_job_id='<id-of-integration-sync-job>')

```

##### Fetch Integration Instance Jobs

```python

j1.fetch_integration_jobs(instance_id='<id-of-integration-instance>')
```

@@ -277,13 +293,15 @@ j1.fetch_integration_jobs(instance_id='<id-of-integration-instance>')
```python
j1.fetch_integration_job_events(instance_id='<id-of-integration-instance>',
instance_job_id='<id-of-integration-instance-job>')

```

##### Create SmartClass

```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='<id-of-smartclass>',
query='<J1QL-query-to-be-added>',
query_description='Query Description Text')

```

##### Run SmartClass Evaluation

```python
j1.evaluate_smartclass(smartclass_id='<id-of-smartclass>')

```

##### Get SmartClass Details

```python
j1.get_smartclass_details(smartclass_id='<id-of-smartclass>')

```

##### Generate J1QL from Natural Language Prompt

```python
j1.generate_j1ql(natural_language_prompt='<natural-language-input-text>')

```

##### List Alert Rules

```python
j1.list_alert_rules()

```

##### Get Alert Rule Details

```python
j1.get_alert_rule_details(rule_id='<id-of-alert-rule>')

```

##### 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='<id-of-alert-rule')

```

##### Update Alert Rule

```python

# polling_interval can be DISABLED, THIRTY_MINUTES, ONE_HOUR, FOUR_HOURS, EIGHT_HOURS, TWELVE_HOURS, ONE_DAY, and ONE_WEEK
# polling_interval can be DISABLED, THIRTY_MINUTES, ONE_HOUR, FOUR_HOURS, EIGHT_HOURS, TWELVE_HOURS, ONE_DAY, or ONE_WEEK
# tag_op can be OVERWRITE or APPEND
# severity can be INFO, LOW, MEDIUM, HIGH, or CRITICAL
# action_configs_op can be OVERWRITE or APPEND

alert_rule_config_alert = [
{
"type": "CREATE_ALERT"
}
]

alert_rule_config_tag = [
{
"type": "TAG_ENTITIES",
"entities": "{{queries.query0.data}}",
"tags": [
{
"name": "tagName",
"value": "tagValue"
}
]
}
]

j1.update_alert_rule(rule_id='<id-of-alert-rule',
j1ql="find jupiterone_user as i return i._key",
alert_rule_config_webhook = [
{
"type": "WEBHOOK",
"endpoint": "https://webhook.example",
"headers": {
"Authorization": "Bearer <TOKEN>"
},
"method": "POST",
"body": {
"queryData": "{{queries.query0.data}}"
}
}
]

alert_rule_config_multiple = [
{
"type": "WEBHOOK",
"endpoint": "https://webhook.example",
"headers": {
"Authorization": "Bearer <TOKEN>"
},
"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="<id-of-alert-rule>",
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='<id-of-alert-rule',
j1.update_alert_rule(rule_id='<id-of-alert-rule>',
tags=['newTag1', 'newTag1'],
tag_op="OVERWRITE")

j1.update_alert_rule(rule_id='<id-of-alert-rule',
j1.update_alert_rule(rule_id='<id-of-alert-rule>',
tags=['additionalTag1', 'additionalTag2'],
tag_op="APPEND")

```

##### Evaluate Alert Rule

```python

j1.evaluate_alert_rule(rule_id='<id-of-alert-rule')
j1.evaluate_alert_rule(rule_id='<id-of-alert-rule>')

```

##### Get Compliance Framework Item

```python

j1.get_compliance_framework_item_details(item_id="<id-of-item>")

```

##### List Alert Rule Evaluation Results

```python

j1.list_alert_rule_evaluation_results(rule_id="<id-of-rule>")

```

##### Fetch Evaluation Result Download URL

```python

j1.fetch_evaluation_result_download_url(raw_data_key="RULE_EVALUATION/<id-of-evaluation>/query0.json")

```

##### Fetch Evaluation Result Download URL

```python

j1.fetch_evaluation_result_download_url(raw_data_key="RULE_EVALUATION/<id-of-evaluation>/query0.json")

```

##### Fetch Downloaded Evaluation Results

```python

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>")

```

##### Get Integration Definition Details

```python

# examples: 'aws', 'azure', 'google_cloud'

j1.get_integration_definition_details(integration_type="<integration-type>")

```

##### Fetch Integration Instances

```python

j1.fetch_integration_instances(definition_id="<id-of-definition>")


```

##### Fetch Integration Instance Details

```python

j1.get_integration_instance_details(instance_id="<id-of-integration-instance>")


```

##### Get Account Parameter Details

```python

j1.get_parameter_details(name="ParameterName")


```

##### List Account Parameters

```python

j1.list_account_parameters()


```

##### Create or Update Acount Parameter

```python

j1.create_update_parameter(name="ParameterName", value="stored_value", secret=False)


```
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

setup(
name="jupiterone",
version="1.2.1",
version="1.3.0",
description="A Python client for the JupiterOne API",
license="MIT License",
author="JupiterOne",

0 comments on commit 95760d5

Please sign in to comment.