Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2a93a37
Adding unsecured actions client
ymao1 Oct 13, 2022
2fe5ce5
Removing isESOCanEncrypt check
ymao1 Oct 13, 2022
dbed0a8
Only getting actions client when needed in executor
ymao1 Oct 13, 2022
00c611d
Changing to feature id allowlist. Adding unit tests
ymao1 Oct 14, 2022
b0fba11
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 14, 2022
baf051a
Removing execution id
ymao1 Oct 14, 2022
96b696f
Cleanup
ymao1 Oct 14, 2022
6cf7a3a
Fixing unit tests
ymao1 Oct 14, 2022
fa4a356
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 17, 2022
8865a80
Removing slack from allowlist
ymao1 Oct 17, 2022
7c884ae
Make getUnsecuredActionsClient synchronous
ymao1 Oct 17, 2022
f4c1851
Add comment
ymao1 Oct 17, 2022
9a58040
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 18, 2022
47f1ca9
Adding functional tests
ymao1 Oct 18, 2022
c87baee
Fixing types
ymao1 Oct 18, 2022
28c6632
Fixing tests
ymao1 Oct 18, 2022
db2dc2a
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 18, 2022
d5bf4ff
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 19, 2022
026646a
Removing unnecessary Promise.all
ymao1 Oct 19, 2022
802dfa0
Cleanup
ymao1 Oct 19, 2022
af826cb
Merge branch 'main' into actions/unsecured-client
kibanamachine Oct 24, 2022
557d5f0
Merge branch 'main' of https://github.com/elastic/kibana into actions…
ymao1 Oct 26, 2022
943ac49
PR feedback
ymao1 Oct 26, 2022
7bf6884
Merge branch 'actions/unsecured-client' of https://github.com/ymao1/k…
ymao1 Oct 26, 2022
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
71 changes: 34 additions & 37 deletions x-pack/plugins/actions/server/create_execute_function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface ExecuteOptions extends Pick<ActionExecutorOptions, 'params' | '
relatedSavedObjects?: RelatedSavedObjects;
}

export interface ActionTaskParams extends Pick<ActionExecutorOptions, 'params'> {
interface ActionTaskParams extends Pick<ActionExecutorOptions, 'params'> {
actionId: string;
apiKey: string | null;
executionId: string;
Expand Down Expand Up @@ -176,43 +176,40 @@ export function createBulkExecutionEnqueuerFunction({
connectorIsPreconfigured[id] = isPreconfigured;
});

const actions = await Promise.all(
actionsToExecute.map(async (actionToExecute) => {
// Get saved object references from action ID and relatedSavedObjects
const { references, relatedSavedObjectWithRefs } = extractSavedObjectReferences(
actionToExecute.id,
connectorIsPreconfigured[actionToExecute.id],
actionToExecute.relatedSavedObjects
);
const executionSourceReference = executionSourceAsSavedObjectReferences(
actionToExecute.source
);

const taskReferences = [];
if (executionSourceReference.references) {
taskReferences.push(...executionSourceReference.references);
}
if (references) {
taskReferences.push(...references);
}

spaceIds[actionToExecute.id] = actionToExecute.spaceId;

return {
type: ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE,
attributes: {
actionId: actionToExecute.id,
params: actionToExecute.params,
apiKey: actionToExecute.apiKey,
executionId: actionToExecute.executionId,
consumer: actionToExecute.consumer,
relatedSavedObjects: relatedSavedObjectWithRefs,
},
references: taskReferences,
};
})
);
const actions = actionsToExecute.map((actionToExecute) => {
// Get saved object references from action ID and relatedSavedObjects
const { references, relatedSavedObjectWithRefs } = extractSavedObjectReferences(
actionToExecute.id,
connectorIsPreconfigured[actionToExecute.id],
actionToExecute.relatedSavedObjects
);
const executionSourceReference = executionSourceAsSavedObjectReferences(
actionToExecute.source
);

const taskReferences = [];
if (executionSourceReference.references) {
taskReferences.push(...executionSourceReference.references);
}
if (references) {
taskReferences.push(...references);
}

spaceIds[actionToExecute.id] = actionToExecute.spaceId;

return {
type: ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE,
attributes: {
actionId: actionToExecute.id,
params: actionToExecute.params,
apiKey: actionToExecute.apiKey,
executionId: actionToExecute.executionId,
consumer: actionToExecute.consumer,
relatedSavedObjects: relatedSavedObjectWithRefs,
},
references: taskReferences,
};
});
const actionTaskParamsRecords: SavedObjectsBulkResponse<ActionTaskParams> =
await unsecuredSavedObjectsClient.bulkCreate(actions);
const taskInstances = actionTaskParamsRecords.saved_objects.map((so) => {
Expand Down
Loading