Skip to content

Adding additional methods for v1.6.0 #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Aug 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
277e0ab
add create_question with tests and examples
SeaBlooms Aug 14, 2025
72ee82f
Update 08_questions_management.py
SeaBlooms Aug 14, 2025
c9d201e
Potential fix for code scanning alert no. 115: Unused import
SeaBlooms Aug 14, 2025
24e9fde
Potential fix for code scanning alert no. 116: Unused import
SeaBlooms Aug 14, 2025
dc1dadf
Potential fix for code scanning alert no. 113: Unused local variable
SeaBlooms Aug 14, 2025
a8e952f
Potential fix for code scanning alert no. 117: Unused import
SeaBlooms Aug 15, 2025
9a93211
Update test_create_question.py
SeaBlooms Aug 15, 2025
7cdaf91
Merge branch 'KNO-606' of https://github.com/JupiterOne/jupiterone-ap…
SeaBlooms Aug 15, 2025
594241a
Update test_create_question.py
SeaBlooms Aug 15, 2025
4a097e8
add list_questions() documentation
SeaBlooms Aug 15, 2025
750e6e9
add keyword search and tag filtering to list_questions()
SeaBlooms Aug 15, 2025
84fe389
add get_question_details() method
SeaBlooms Aug 15, 2025
2b229be
add get_cft_upload_url() and update client to use deleteEntityV2
SeaBlooms Aug 19, 2025
014d97b
add new CFT methods and create usage example script
SeaBlooms Aug 19, 2025
35f2056
remove unused imports
SeaBlooms Aug 19, 2025
c913715
add update_question()
SeaBlooms Aug 19, 2025
14657ef
add delete_question()
SeaBlooms Aug 19, 2025
23fa34c
update to 1.6.0
SeaBlooms Aug 19, 2025
802dc6b
Delete create_question_usage.md
SeaBlooms Aug 19, 2025
711d42d
created tests
SeaBlooms Aug 19, 2025
61ddfb0
remove imports
SeaBlooms Aug 19, 2025
2b12fe8
remove resource_group from question methods
SeaBlooms Aug 20, 2025
e65f6ac
add input validation for 'queries' in 'update_question()' method
SeaBlooms Aug 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions examples/07_account_parameters_list_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env python3
"""
JupiterOne Python SDK - Account Parameter (List Value) Example

This example demonstrates how to create or update an Account Parameter where the
value is a list of strings.

Prerequisites (environment variables):
- JUPITERONE_ACCOUNT_ID
- JUPITERONE_API_TOKEN
- (optional) JUPITERONE_URL
- (optional) JUPITERONE_SYNC_URL

Usage:
python 07_account_parameters_list_example.py
"""

import os
from jupiterone import JupiterOneClient


def setup_client() -> JupiterOneClient:
"""Instantiate the JupiterOne client using environment variables."""
return JupiterOneClient(
account=os.getenv("JUPITERONE_ACCOUNT_ID"),
token=os.getenv("JUPITERONE_API_TOKEN"),
url=os.getenv("JUPITERONE_URL", "https://graphql.us.jupiterone.io"),
sync_url=os.getenv("JUPITERONE_SYNC_URL", "https://api.us.jupiterone.io"),
)


def main() -> None:
print("JupiterOne - Create/Update Account Parameter (List Value)")
print("=" * 70)

# Configure the parameter name and value
# Name can be anything meaningful to your workflows
parameter_name = os.getenv("J1_LIST_PARAM_NAME", "ENTITY_TYPES_TO_INCLUDE")

# Example list value requested: ["aws_account", "aws_security_group"]
parameter_value = ["aws_account", "aws_security_group"]

try:
j1 = setup_client()

print(f"Creating/Updating parameter '{parameter_name}' with value: {parameter_value}")
result = j1.create_update_parameter(
name=parameter_name,
value=parameter_value,
secret=False,
)

# The mutation returns a success flag; fetch the parameter to verify
if result and result.get("setParameter", {}).get("success") is True:
print("✓ Parameter upsert reported success")
else:
print("! Parameter upsert did not report success (check details below)")
print(result)

# Verify by reading it back (non-secret parameters will return the value)
details = j1.get_parameter_details(name=parameter_name)
print("\nFetched parameter details:")
print(details)

print("\n✓ Completed creating/updating list-valued account parameter")

except Exception as exc:
print(f"✗ Error: {exc}")
print("\nMake sure you have set the following environment variables:")
print("- JUPITERONE_ACCOUNT_ID")
print("- JUPITERONE_API_TOKEN")
print("- JUPITERONE_URL (optional)")
print("- JUPITERONE_SYNC_URL (optional)")


if __name__ == "__main__":
main()


Loading
Loading