This repository was archived by the owner on Dec 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 138
[client] Add helpers for background tasks in worker execution (opencti #10274) #883
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9df8926
[client] Introduce background tasks support
richard-julien f58089b
[client] fix force delete args
JeremyCloarec 23b2da9
[client] now handle operations in extensions
JeremyCloarec 95543c3
[client] style
JeremyCloarec c3cce95
[client] operation fix
JeremyCloarec 6e15181
[client] handle indicator field patch
JeremyCloarec 403277e
[client] handle indicator field patch
JeremyCloarec 50c9932
[client] handle indicator field patch
JeremyCloarec 68fef9f
[client] indicator update fix
JeremyCloarec 79171b3
[client] indicator update fix
JeremyCloarec 09f9b6b
[client] fix
JeremyCloarec ca04399
[client] PR review
JeremyCloarec 6268181
[client] fix trash delete mutation
JeremyCloarec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| class OpenCTIApiDraft: | ||
| """OpenCTIApiDraft""" | ||
|
|
||
| def __init__(self, api): | ||
| self.api = api | ||
|
|
||
| def delete(self, **kwargs): | ||
| id = kwargs.get("id", None) | ||
| query = """ | ||
| mutation DraftWorkspaceDelete($id: ID!) { | ||
| draftWorkspaceDelete(id: $id) | ||
| } | ||
| """ | ||
| self.api.query( | ||
| query, | ||
| { | ||
| "id": id, | ||
| }, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| class OpenCTIApiPublicDashboard: | ||
| """OpenCTIApiPublicDashboard""" | ||
|
|
||
| def __init__(self, api): | ||
| self.api = api | ||
|
|
||
| def delete(self, **kwargs): | ||
| id = kwargs.get("id", None) | ||
JeremyCloarec marked this conversation as resolved.
Show resolved
Hide resolved
JeremyCloarec marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if id is not None: | ||
| query = """ | ||
| mutation PublicDashboardDelete($id: ID!) { | ||
| publicDashboardDelete(id: $id) | ||
| } | ||
| """ | ||
| self.api.query( | ||
| query, | ||
| { | ||
| "id": id, | ||
| }, | ||
| ) | ||
| else: | ||
| self.opencti.app_logger.error( | ||
| "[stix_public_dashboard] Cant delete public dashboard, missing parameters: id" | ||
| ) | ||
| return None | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| class OpenCTIApiTrash: | ||
| """OpenCTIApiTrash""" | ||
|
|
||
| def __init__(self, api): | ||
| self.api = api | ||
|
|
||
| def restore(self, operation_id: str): | ||
| query = """ | ||
| mutation DeleteOperationRestore($id: ID!) { | ||
| deleteOperationRestore(id: $id) | ||
| } | ||
| """ | ||
| self.api.query( | ||
| query, | ||
| { | ||
| "id": operation_id, | ||
| }, | ||
| ) | ||
|
|
||
| def delete(self, **kwargs): | ||
| """Delete a trash item given its ID | ||
|
|
||
| :param id: ID for the delete operation on the platform. | ||
| :type id: str | ||
| """ | ||
| id = kwargs.get("id", None) | ||
| if id is None: | ||
| self.api.admin_logger.error( | ||
| "[opencti_trash] Cant confirm delete, missing parameter: id" | ||
| ) | ||
| return None | ||
| query = """ | ||
| mutation DeleteOperationConfirm($id: ID!) { | ||
| deleteOperationConfirm(id: $id) | ||
| } | ||
| """ | ||
| self.api.query( | ||
| query, | ||
| { | ||
| "id": id, | ||
| }, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| class OpenCTIApiWorkspace: | ||
| """OpenCTIApiWorkspace""" | ||
|
|
||
| def __init__(self, api): | ||
| self.api = api | ||
|
|
||
| def delete(self, **kwargs): | ||
| id = kwargs.get("id", None) | ||
JeremyCloarec marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if id is None: | ||
| self.api.admin_logger.error( | ||
| "[opencti_workspace] Cant delete workspace, missing parameter: id" | ||
| ) | ||
| return None | ||
| query = """ | ||
| mutation WorkspaceDelete($id: ID!) { | ||
| workspaceDelete(id: $id) | ||
| } | ||
| """ | ||
| self.api.query( | ||
| query, | ||
| { | ||
| "id": id, | ||
| }, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.