-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[RAM] System actions update rule api #171099
[RAM] System actions update rule api #171099
Conversation
@@ -84,7 +92,10 @@ const rewriteBodyRes: RewriteResponseCase<PartialRule<RuleTypeParams>> = ({ | |||
lastRun, | |||
nextRun, | |||
...rest | |||
}) => ({ | |||
}: PartialRule<RuleTypeParams>): Omit< | |||
AsApiContract<PartialRule<RuleTypeParams> & { actions?: RuleResponseV1['actions'] }>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to the latest and now versioning for now
AsApiContract<PartialRule<RuleTypeParams> & { actions?: RuleResponseV1['actions'] }>, | |
AsApiContract<PartialRule<RuleTypeParams> & { actions?: RuleResponse['actions'] }>, |
@@ -54,18 +54,26 @@ const bodySchema = schema.object({ | |||
), | |||
}); | |||
|
|||
const rewriteBodyReq: RewriteRequestCase<UpdateOptions<RuleTypeParams>> = (result) => { | |||
const rewriteBodyReq = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a little bit cleaner
type RuleBody = TypeOf<typeof bodySchema>;
interface RuleUpdateOptionsResult extends Omit<UpdateOptions<RuleTypeParams>, 'data'> {
data: RuleBody;
}
const rewriteBodyReq = (
result: RuleUpdateOptionsResult,
isSystemAction: (connectorId: string) => boolean
): UpdateOptions<RuleTypeParams> => {
const { notify_when: notifyWhen, actions, ...rest } = result.data;
return {
...result,
data: {
...rest,
notifyWhen,
actions: rewriteActionsReqWithSystemActions(actions, isSystemAction),
},
};
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked to @JiaweiWu about it since it is a work around since we did not migrate this route to versioning. We should add a note in the route file to let know the FUTURE ENGINEER
why we did that and that we should change all the type to an update specific type.
💔 Build FailedFailed CI Steps
Test Failures
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
Pinging @elastic/response-ops (Team:ResponseOps) |
Fix: #170831
Meta: #160367
Summary
This PR enables system actions for the Bulk Delete Rule API.