-
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
[Uptime] migrate legacy alert apis #107863
[Uptime] migrate legacy alert apis #107863
Conversation
Pinging @elastic/uptime (Team:uptime) |
const response = (await apiService.get(API_URLS.RULE_CONNECTORS)) as Array< | ||
AsApiContract<ActionConnector> | ||
>; | ||
/* eslint-disable @typescript-eslint/naming-convention */ |
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.
@justinkambic Any better ideas for how to handle this?
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.
LGTM!
@elasticmachine merge upstream |
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.
Looking pretty good. Not approving yet as I've only done code review so far; I will post another review with my smoke-test results.
/* eslint-disable @typescript-eslint/naming-convention */ | ||
return response.map( | ||
({ connector_type_id, referenced_by_count, is_preconfigured, is_missing_secrets, ...res }) => ({ | ||
...res, | ||
actionTypeId: connector_type_id, | ||
referencedByCount: referenced_by_count, | ||
isPreconfigured: is_preconfigured, | ||
isMissingSecrets: is_missing_secrets, | ||
}) | ||
); | ||
/* eslint-enable @typescript-eslint/naming-convention */ |
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.
How about we do this instead, we can make the return object a little cleaner and it avoids the eslint messiness in exchange for some added verbiage in the parameter destructuring.
/* eslint-disable @typescript-eslint/naming-convention */ | |
return response.map( | |
({ connector_type_id, referenced_by_count, is_preconfigured, is_missing_secrets, ...res }) => ({ | |
...res, | |
actionTypeId: connector_type_id, | |
referencedByCount: referenced_by_count, | |
isPreconfigured: is_preconfigured, | |
isMissingSecrets: is_missing_secrets, | |
}) | |
); | |
/* eslint-enable @typescript-eslint/naming-convention */ | |
return response.map( | |
({ | |
connector_type_id: actionTypeId, | |
referenced_by_count: referencedByCount, | |
is_preconfigured: isPreconfigured, | |
is_missing_secrets: isMissingSecrets, | |
...res | |
}) => ({ | |
...res, | |
actionTypeId, | |
referencedByCount, | |
isPreconfigured, | |
isMissingSecrets, | |
}) | |
); |
/* eslint-disable @typescript-eslint/naming-convention */ | ||
return response.map<ActionType>( | ||
({ | ||
enabled_in_config, | ||
enabled_in_license, | ||
minimum_license_required, | ||
...res | ||
}: AsApiContract<ActionType>) => ({ | ||
...res, | ||
enabledInConfig: enabled_in_config, | ||
enabledInLicense: enabled_in_license, | ||
minimumLicenseRequired: minimum_license_required, | ||
}) | ||
); | ||
/* eslint-enable @typescript-eslint/naming-convention */ |
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.
Same recommendation here; this allows us to remove the eslint-disable
.
/* eslint-disable @typescript-eslint/naming-convention */ | |
return response.map<ActionType>( | |
({ | |
enabled_in_config, | |
enabled_in_license, | |
minimum_license_required, | |
...res | |
}: AsApiContract<ActionType>) => ({ | |
...res, | |
enabledInConfig: enabled_in_config, | |
enabledInLicense: enabled_in_license, | |
minimumLicenseRequired: minimum_license_required, | |
}) | |
); | |
/* eslint-enable @typescript-eslint/naming-convention */ | |
return response.map<ActionType>( | |
({ | |
enabled_in_config: enabledInConfig, | |
enabled_in_license: enabledInLicense, | |
minimum_license_required: minimumLicenseRequired, | |
...res | |
}: AsApiContract<ActionType>) => ({ | |
...res, | |
enabledInConfig, | |
enabledInLicense, | |
minimumLicenseRequired, | |
}) | |
); |
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.
…s://github.com/dominiqueclarke/kibana into feature/94089-uptime-migrate-legacy-alert-apis
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
Unknown metric groupsAPI count
API count missing comments
History
To update your PR or re-run it, just comment with: |
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.
LGTM
* uptime - migrate legacy alert apis * update alert fetch actions Co-authored-by: Kibana Machine <[email protected]>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* uptime - migrate legacy alert apis * update alert fetch actions Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Dominique Clarke <[email protected]>
Summary
Migrates away to the updated Rule APIs
These APIs are responsible for 4 functions in Uptime, all of which should be tested for regression.
2. Display currently enabled rules
4. Displaying available configured connectors
Fixes #94089
Fixes #95839