Skip to content
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

Create actions plugin #35679

Merged

Conversation

mikecote
Copy link
Contributor

@mikecote mikecote commented Apr 26, 2019

In this PR, we are introducing the actions kibana plugin with basic functionality. The basic functionality includes the ability to register action types and CRUD operations on actions. The actions are saved objects that use the encrypted saved objects plugin to encrypt all configuration attributes by default unless an attribute specifies to not be encrypted.

The plugin will expose the following functions (via server.plugins.actions):

  • registerType({ id, name, unencryptedAttributes, validate, executor })
  • listTypes()
  • fire({ id, params })

The request has a new function request.getActionsClient() which returns an instance of the client with the following functions:

  • create({ data, options })
  • get({ id })
  • find({ options = {} })
  • delete({ id })
  • update({ id, data, options = {} })

@mikecote mikecote self-assigned this Apr 26, 2019
@elasticmachine

This comment has been minimized.

@mikecote mikecote force-pushed the alerting/intro-alerting-plugin branch from 50be228 to 0311aff Compare April 30, 2019 13:25
@mikecote mikecote force-pushed the alerting/intro-alerting-plugin branch from 9b79a6d to d84f9d6 Compare April 30, 2019 14:38
@mikecote

This comment has been minimized.

@mikecote

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

Copy link
Contributor

@peterschretlen peterschretlen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍, left a few comments/questions

x-pack/plugins/actions/server/action_type_service.ts Outdated Show resolved Hide resolved
x-pack/plugins/actions/server/actions_client.ts Outdated Show resolved Hide resolved
public async update({ id, data, options = {} }: UpdateOptions) {
const { actionTypeId } = data;
if (!this.actionTypeService.has(actionTypeId)) {
throw Boom.badRequest(`Action type "${actionTypeId}" is not registered.`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, seems like we could leave the checks to ActionTypeService which already handles it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah for this one I think changing it to this.actionTypeService.get(actionTypeId); would do the trick and let it throw an error. In this function here, it's a bit tricky since we do support partial updates where the if (data.actionTypeConfig) { can be skipped.

/**
* Fire an action
*/
public async fire({ id, params }: FireOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the client has a fire method, but we don't have a fire API route exposed, just curious why not be able to fire an action from API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This came across my mind at one point. I think I skipped the endpoint and was planning to develop it as needed. The main use case that came to my mind is being called from alerting / task manager services. Adding a basic endpoint is definitely something that can be done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider moving fire out of the ActionsClient to a different class? All of the other methods on the ActionsClient are safe to consume within route handlers while ignoring security (because the saved objects client enforces it), but the fire method is using the internal server user to decrypt the attributes and actually fire the action, hence getDecryptedAsInternalUser. If we do wish for fire to be able to triggered by the end user from an api request, we'll need to ensure that we aren't returning sensitive information. Having "safe" and "potentially unsafe" operations on the same class could lead to potential problems long-term.

x-pack/plugins/actions/server/routes/find.ts Show resolved Hide resolved
@peterschretlen
Copy link
Contributor

One other question - since actions are backed by saved objects, are the ActionsClient APIs confined to a Kibana space? If I call the "find" API I won't see actions across all spaces, only actions in the space I'm working in?

@mikecote
Copy link
Contributor Author

@peterschretlen They will be confined to the user's current space. The saved object client gets wrapped by the spaces plugin and injects the spaceId as a namespace in all the functions on the client. (that happens here: https://github.com/elastic/kibana/blob/master/x-pack/plugins/spaces/server/lib/saved_objects_client/spaces_saved_objects_client.ts).

So as long as we get the saved objects client via request.getSavedObjectsClient();, it will return us a wrapped client with spaces and security in mind.

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@mikecote

This comment has been minimized.

@elasticmachine

This comment has been minimized.

},
init,
uiExports: {
mappings,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we anticipate all "actions" being "space specific"? How will this interact with Stack Monitoring's usage of alerting, which will likely be "space agnostic"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this time, we haven't decided how we're going to approach this. I will setup a design discussion for spaces and another one for feature controls. Until then I'm thinking of keeping it space specific until we have those discussions.

x-pack/plugins/actions/server/action_type_service.ts Outdated Show resolved Hide resolved
*/
public validateParams(id: string, params: Record<string, any>) {
const actionType = this.get(id);
const validator = actionType.validate && actionType.validate.params;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the types feel off for this... validator ends up being Record<string, any> so we lose some type safety and could potentially get a run-time error if validator.validate isn't specified and a function.

*/
public validateActionTypeConfig(id: string, actionTypeConfig: Record<string, any>) {
const actionType = this.get(id);
const validator = actionType.validate && actionType.validate.actionTypeConfig;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same nit about the types as above.

},
init,
uiExports: {
mappings,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a single "saved object type" for all actions means we won't be able to restrict users to only access certain "action types", similar to the discussion which I raised here: #36836

If we're going to want to restrict users to a subset of actions in the future, it might be advantageous to create different saved object types for the various alert types.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to what I wrote above, I'm thinking we do a future phase post design discussion to properly implement feature controls / actions limiting.

/**
* Fire an action
*/
public async fire({ id, params }: FireOptions) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider moving fire out of the ActionsClient to a different class? All of the other methods on the ActionsClient are safe to consume within route handlers while ignoring security (because the saved objects client enforces it), but the fire method is using the internal server user to decrypt the attributes and actually fire the action, hence getDecryptedAsInternalUser. If we do wish for fire to be able to triggered by the end user from an api request, we'll need to ensure that we aren't returning sensitive information. Having "safe" and "potentially unsafe" operations on the same class could lead to potential problems long-term.

@elasticmachine

This comment has been minimized.

Copy link
Contributor

@kobelb kobelb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on green CI

@elasticmachine

This comment has been minimized.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mikecote mikecote merged commit 0241553 into elastic:feature/alerting May 23, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

mikecote added a commit to mikecote/kibana that referenced this pull request Jun 20, 2019
* Create actions plugin (elastic#35679)

* Basic alerting plugin with actions

* Remove relative imports

* Code cleanup

* Split service into 3 parts, change connector structure

* Ability to disable plugin, ability to get actions

* Add slack connector

* Add email connector

* Ability to validate params and connector options

* Remove connectorOptionsSecrets for now

* Fix plugin config validation

* Add tests for slack connector

* Default connectors register on plugin init, console renamed to log, slack to message_slack

* Add remaining API endpoints for action CRUD

* Add list connectors API

* Change actions CRUD APIs to be closer with saved objects structure

* WIP

* Fix broken tests

* Add encrypted attribute support

* Add params and connectorOptions for email

* WIP

* Remove action's ability to have custom ids

* Remove ts-ignore

* Fix broken test

* Remove default connectors from this branch

* Fix API integration tests to use fixture connector

* Rename connector terminology to action type

* Rename actionTypeOptions to actionTypeConfig

* Code cleanup

* Fix broken tests

* Rename alerting plugin to actions

* Some code cleanup and add API unit tests

* Change signature of action type service execute function

* Add some plugin api integration tests

* Fix type check failure

* Code cleanup

* Create an actions client instead of an action service

* Apply Bill's PR feedback

* Fix broken test

* Find function to have destructured params

* Add tests to ensure encrypted attributes are not returned

* Fix broken test

* Add tests for validation

* Ensure actions can be updated without re-passing the config

* Remove dead code

* Test cleanup

* Fix eslint issue

* Apply Peter's PR feedback

* Code cleanup and fix broken tests

* Apply Brandon's PR feedback

* Add namespace support

* Fix broken test

* Pass services to action executors (elastic#37194)

* Pass services to action executors

* Fix tests

* Apply PR feedback

* Apply PR feedback pt2

* Cleanup actions plugin (elastic#37250)

* Cleanup actions, move code from alerting plugin PR

* Rename service terminology to registry

* Use static encryption key for encrypted attributes plugin inside of tests

* Empty data after create test is done running

* Fix type checks

* Fix inconsistent naming

* add server log action for alerting (elastic#37530)

adds the first "builtin" alertType for performing a `server.log()`

* Create alerting plugin (elastic#37043)

* WIP

* Rename fire function and remove @ts-ignore in all places

* Change naming in alerting service

* Remove alert instance class for now, support interval configuration

* Cleanup TS

* Split alerting between registry and client

* Use saved object alongside task manager instance

* Add remaining alerting APIs

* Change create structure

* Rename some variables, change actionGroups structure

* Use handlebars for templating strings at fire time

* Fix params given to alert type execute function

* Use alert instance class

* Alert instances support meta attributes

* Move alert instances deserialization

* Change interval to be ms

* Rename actions es archive

* Fix tests to use encrypted esArchive for action record

* Add create alert test to demo end to end flow

* Fix type check issue

* Alerts to use references to action objects

* Only update task manager tasks after saved objects are fully updated

* Use scope in task manager

* Fix type check

* Use task manager to execute actions

* Convert ids into references and back

* Apply PR feedback

* Fix broken test

* Fix some bugs

* Fix test errors

* Alert interval to be previous runAt + interval instead of now + interval

* Add range support

* Remove extra line

* Cleanup

* Add alert_instance.test.ts

* Add alert_type_registry.test.ts

* Move tests around

* Create generic task manager mock

* Add note about saved objects client mock

* Create alert_type_registry.mock.ts

* Add alerts_client.test.ts

* Add create_alert_instance_factory.test.ts

* Add create_fire_handler.test.ts

* WIP

* Fix get_create_task_runner_function.test.ts and make test pass

* Make get_create_task_runner_function.test.ts 100% coverage

* Add unit tests for routes

* Move files around

* Created transform_action_params.ts

* Add get_next_run_at.ts

* Add comment explaining why we copy nextRunAt

* Re-use state within alert instance

* Finalize code coverage in unit tests

* Create base api integration tests

* Add a test that ensures end to end functionality of an alert

* Fix ui capabilities test

* Fix broken plugin api integration test

* Fix jest tests with new saved objects client

* Fix broken integration tests

* Change api integration test fixture to make more sense, add functions for future tests

* Move alerts integration testing into own file, prep to add more tests

* Add tests to ensure failed task instances get retried

* Add get_create_task_runner_function.test.ts for actions, create encrypted saved objects mock

* Add action validation tests

* Ensure action type validation occurs on update

* Test 400 on unregistered alert types

* Ensure alertTypeId can't be updated

* Add validation test for alert create / update

* Fix broken checks / tests

* Skip failing test for now

* Cleanup jest tests

* Ensure action objects can be updated while keeping encrypted attributes readable

* Remove partial update sopport, remove ability to change actionTypeId, require config

* Ensure actionTypeConfig is validated on create and update

* Add alertTypeParams validation support

* Fix failing tests

* Ensure alert cleanup errors don't replace the original error

* Pass callCluster as a service to alerts and actions

* Only pass log to alerts client

* Pass savedObjectsClient as a service to alerting and actions

* Fix failing tests

* Remove range support, provide when current and previous task got scheduled

* Ensure Joi validation happens before every execute

* Remove skipped tests, to be done in future PR

* Apply self feedback pt1

* Apply self feedback pt2

* Fix broken tests

* Apply PR feedback

* PR feedback pt1

* Apply security team PR feedback

* PR feedback pt1

* PR feedback pt2

* PR feedback pt3

* Fix broken tests

* Fix callCluster to have signature

* Revert f11a6ae

* PR feedback pt4

* Remove __jest__ folders

* PR feedback pt5

* Fix Joi from leaking secrets

* Fire instance actions in parallel instead of series

* Fix failing jest tests

* Accept core api changes

* Fix saved objects client mock

* PR feedback pt1

* Fix eslint issues

* Throw error when alert instance already fired (elastic#39251)

* Throw error when alert instance already fired

* shouldFire doesn't need its own boolean value

* Actions & alerting getting started user guides (elastic#39093)

* Initial user guides

* Cleanup

* Typos, example changes

* Switch to tables, use ordered list for usage

* Start docs around alert instances and templating

* Documentation changes

* Some adjustments

* Apply PR feedback

* Apply suggestions from code review

Co-Authored-By: gchaps <[email protected]>

* PR feedback pt2

* Provide better examples for alert types

* Apply PR feedback

* Update README locations
mikecote added a commit to mikecote/kibana that referenced this pull request Jun 21, 2019
* Create actions plugin (elastic#35679)

* Basic alerting plugin with actions

* Remove relative imports

* Code cleanup

* Split service into 3 parts, change connector structure

* Ability to disable plugin, ability to get actions

* Add slack connector

* Add email connector

* Ability to validate params and connector options

* Remove connectorOptionsSecrets for now

* Fix plugin config validation

* Add tests for slack connector

* Default connectors register on plugin init, console renamed to log, slack to message_slack

* Add remaining API endpoints for action CRUD

* Add list connectors API

* Change actions CRUD APIs to be closer with saved objects structure

* WIP

* Fix broken tests

* Add encrypted attribute support

* Add params and connectorOptions for email

* WIP

* Remove action's ability to have custom ids

* Remove ts-ignore

* Fix broken test

* Remove default connectors from this branch

* Fix API integration tests to use fixture connector

* Rename connector terminology to action type

* Rename actionTypeOptions to actionTypeConfig

* Code cleanup

* Fix broken tests

* Rename alerting plugin to actions

* Some code cleanup and add API unit tests

* Change signature of action type service execute function

* Add some plugin api integration tests

* Fix type check failure

* Code cleanup

* Create an actions client instead of an action service

* Apply Bill's PR feedback

* Fix broken test

* Find function to have destructured params

* Add tests to ensure encrypted attributes are not returned

* Fix broken test

* Add tests for validation

* Ensure actions can be updated without re-passing the config

* Remove dead code

* Test cleanup

* Fix eslint issue

* Apply Peter's PR feedback

* Code cleanup and fix broken tests

* Apply Brandon's PR feedback

* Add namespace support

* Fix broken test

* Pass services to action executors (elastic#37194)

* Pass services to action executors

* Fix tests

* Apply PR feedback

* Apply PR feedback pt2

* Cleanup actions plugin (elastic#37250)

* Cleanup actions, move code from alerting plugin PR

* Rename service terminology to registry

* Use static encryption key for encrypted attributes plugin inside of tests

* Empty data after create test is done running

* Fix type checks

* Fix inconsistent naming

* add server log action for alerting (elastic#37530)

adds the first "builtin" alertType for performing a `server.log()`

* Create alerting plugin (elastic#37043)

* WIP

* Rename fire function and remove @ts-ignore in all places

* Change naming in alerting service

* Remove alert instance class for now, support interval configuration

* Cleanup TS

* Split alerting between registry and client

* Use saved object alongside task manager instance

* Add remaining alerting APIs

* Change create structure

* Rename some variables, change actionGroups structure

* Use handlebars for templating strings at fire time

* Fix params given to alert type execute function

* Use alert instance class

* Alert instances support meta attributes

* Move alert instances deserialization

* Change interval to be ms

* Rename actions es archive

* Fix tests to use encrypted esArchive for action record

* Add create alert test to demo end to end flow

* Fix type check issue

* Alerts to use references to action objects

* Only update task manager tasks after saved objects are fully updated

* Use scope in task manager

* Fix type check

* Use task manager to execute actions

* Convert ids into references and back

* Apply PR feedback

* Fix broken test

* Fix some bugs

* Fix test errors

* Alert interval to be previous runAt + interval instead of now + interval

* Add range support

* Remove extra line

* Cleanup

* Add alert_instance.test.ts

* Add alert_type_registry.test.ts

* Move tests around

* Create generic task manager mock

* Add note about saved objects client mock

* Create alert_type_registry.mock.ts

* Add alerts_client.test.ts

* Add create_alert_instance_factory.test.ts

* Add create_fire_handler.test.ts

* WIP

* Fix get_create_task_runner_function.test.ts and make test pass

* Make get_create_task_runner_function.test.ts 100% coverage

* Add unit tests for routes

* Move files around

* Created transform_action_params.ts

* Add get_next_run_at.ts

* Add comment explaining why we copy nextRunAt

* Re-use state within alert instance

* Finalize code coverage in unit tests

* Create base api integration tests

* Add a test that ensures end to end functionality of an alert

* Fix ui capabilities test

* Fix broken plugin api integration test

* Fix jest tests with new saved objects client

* Fix broken integration tests

* Change api integration test fixture to make more sense, add functions for future tests

* Move alerts integration testing into own file, prep to add more tests

* Add tests to ensure failed task instances get retried

* Add get_create_task_runner_function.test.ts for actions, create encrypted saved objects mock

* Add action validation tests

* Ensure action type validation occurs on update

* Test 400 on unregistered alert types

* Ensure alertTypeId can't be updated

* Add validation test for alert create / update

* Fix broken checks / tests

* Skip failing test for now

* Cleanup jest tests

* Ensure action objects can be updated while keeping encrypted attributes readable

* Remove partial update sopport, remove ability to change actionTypeId, require config

* Ensure actionTypeConfig is validated on create and update

* Add alertTypeParams validation support

* Fix failing tests

* Ensure alert cleanup errors don't replace the original error

* Pass callCluster as a service to alerts and actions

* Only pass log to alerts client

* Pass savedObjectsClient as a service to alerting and actions

* Fix failing tests

* Remove range support, provide when current and previous task got scheduled

* Ensure Joi validation happens before every execute

* Remove skipped tests, to be done in future PR

* Apply self feedback pt1

* Apply self feedback pt2

* Fix broken tests

* Apply PR feedback

* PR feedback pt1

* Apply security team PR feedback

* PR feedback pt1

* PR feedback pt2

* PR feedback pt3

* Fix broken tests

* Fix callCluster to have signature

* Revert f11a6ae

* PR feedback pt4

* Remove __jest__ folders

* PR feedback pt5

* Fix Joi from leaking secrets

* Fire instance actions in parallel instead of series

* Fix failing jest tests

* Accept core api changes

* Fix saved objects client mock

* PR feedback pt1

* Fix eslint issues

* Throw error when alert instance already fired (elastic#39251)

* Throw error when alert instance already fired

* shouldFire doesn't need its own boolean value

* Actions & alerting getting started user guides (elastic#39093)

* Initial user guides

* Cleanup

* Typos, example changes

* Switch to tables, use ordered list for usage

* Start docs around alert instances and templating

* Documentation changes

* Some adjustments

* Apply PR feedback

* Apply suggestions from code review

Co-Authored-By: gchaps <[email protected]>

* PR feedback pt2

* Provide better examples for alert types

* Apply PR feedback

* Update README locations
mikecote added a commit that referenced this pull request Jun 21, 2019
* Create actions plugin (#35679)

* Basic alerting plugin with actions

* Remove relative imports

* Code cleanup

* Split service into 3 parts, change connector structure

* Ability to disable plugin, ability to get actions

* Add slack connector

* Add email connector

* Ability to validate params and connector options

* Remove connectorOptionsSecrets for now

* Fix plugin config validation

* Add tests for slack connector

* Default connectors register on plugin init, console renamed to log, slack to message_slack

* Add remaining API endpoints for action CRUD

* Add list connectors API

* Change actions CRUD APIs to be closer with saved objects structure

* WIP

* Fix broken tests

* Add encrypted attribute support

* Add params and connectorOptions for email

* WIP

* Remove action's ability to have custom ids

* Remove ts-ignore

* Fix broken test

* Remove default connectors from this branch

* Fix API integration tests to use fixture connector

* Rename connector terminology to action type

* Rename actionTypeOptions to actionTypeConfig

* Code cleanup

* Fix broken tests

* Rename alerting plugin to actions

* Some code cleanup and add API unit tests

* Change signature of action type service execute function

* Add some plugin api integration tests

* Fix type check failure

* Code cleanup

* Create an actions client instead of an action service

* Apply Bill's PR feedback

* Fix broken test

* Find function to have destructured params

* Add tests to ensure encrypted attributes are not returned

* Fix broken test

* Add tests for validation

* Ensure actions can be updated without re-passing the config

* Remove dead code

* Test cleanup

* Fix eslint issue

* Apply Peter's PR feedback

* Code cleanup and fix broken tests

* Apply Brandon's PR feedback

* Add namespace support

* Fix broken test

* Pass services to action executors (#37194)

* Pass services to action executors

* Fix tests

* Apply PR feedback

* Apply PR feedback pt2

* Cleanup actions plugin (#37250)

* Cleanup actions, move code from alerting plugin PR

* Rename service terminology to registry

* Use static encryption key for encrypted attributes plugin inside of tests

* Empty data after create test is done running

* Fix type checks

* Fix inconsistent naming

* add server log action for alerting (#37530)

adds the first "builtin" alertType for performing a `server.log()`

* Create alerting plugin (#37043)

* WIP

* Rename fire function and remove @ts-ignore in all places

* Change naming in alerting service

* Remove alert instance class for now, support interval configuration

* Cleanup TS

* Split alerting between registry and client

* Use saved object alongside task manager instance

* Add remaining alerting APIs

* Change create structure

* Rename some variables, change actionGroups structure

* Use handlebars for templating strings at fire time

* Fix params given to alert type execute function

* Use alert instance class

* Alert instances support meta attributes

* Move alert instances deserialization

* Change interval to be ms

* Rename actions es archive

* Fix tests to use encrypted esArchive for action record

* Add create alert test to demo end to end flow

* Fix type check issue

* Alerts to use references to action objects

* Only update task manager tasks after saved objects are fully updated

* Use scope in task manager

* Fix type check

* Use task manager to execute actions

* Convert ids into references and back

* Apply PR feedback

* Fix broken test

* Fix some bugs

* Fix test errors

* Alert interval to be previous runAt + interval instead of now + interval

* Add range support

* Remove extra line

* Cleanup

* Add alert_instance.test.ts

* Add alert_type_registry.test.ts

* Move tests around

* Create generic task manager mock

* Add note about saved objects client mock

* Create alert_type_registry.mock.ts

* Add alerts_client.test.ts

* Add create_alert_instance_factory.test.ts

* Add create_fire_handler.test.ts

* WIP

* Fix get_create_task_runner_function.test.ts and make test pass

* Make get_create_task_runner_function.test.ts 100% coverage

* Add unit tests for routes

* Move files around

* Created transform_action_params.ts

* Add get_next_run_at.ts

* Add comment explaining why we copy nextRunAt

* Re-use state within alert instance

* Finalize code coverage in unit tests

* Create base api integration tests

* Add a test that ensures end to end functionality of an alert

* Fix ui capabilities test

* Fix broken plugin api integration test

* Fix jest tests with new saved objects client

* Fix broken integration tests

* Change api integration test fixture to make more sense, add functions for future tests

* Move alerts integration testing into own file, prep to add more tests

* Add tests to ensure failed task instances get retried

* Add get_create_task_runner_function.test.ts for actions, create encrypted saved objects mock

* Add action validation tests

* Ensure action type validation occurs on update

* Test 400 on unregistered alert types

* Ensure alertTypeId can't be updated

* Add validation test for alert create / update

* Fix broken checks / tests

* Skip failing test for now

* Cleanup jest tests

* Ensure action objects can be updated while keeping encrypted attributes readable

* Remove partial update sopport, remove ability to change actionTypeId, require config

* Ensure actionTypeConfig is validated on create and update

* Add alertTypeParams validation support

* Fix failing tests

* Ensure alert cleanup errors don't replace the original error

* Pass callCluster as a service to alerts and actions

* Only pass log to alerts client

* Pass savedObjectsClient as a service to alerting and actions

* Fix failing tests

* Remove range support, provide when current and previous task got scheduled

* Ensure Joi validation happens before every execute

* Remove skipped tests, to be done in future PR

* Apply self feedback pt1

* Apply self feedback pt2

* Fix broken tests

* Apply PR feedback

* PR feedback pt1

* Apply security team PR feedback

* PR feedback pt1

* PR feedback pt2

* PR feedback pt3

* Fix broken tests

* Fix callCluster to have signature

* Revert f11a6ae

* PR feedback pt4

* Remove __jest__ folders

* PR feedback pt5

* Fix Joi from leaking secrets

* Fire instance actions in parallel instead of series

* Fix failing jest tests

* Accept core api changes

* Fix saved objects client mock

* PR feedback pt1

* Fix eslint issues

* Throw error when alert instance already fired (#39251)

* Throw error when alert instance already fired

* shouldFire doesn't need its own boolean value

* Actions & alerting getting started user guides (#39093)

* Initial user guides

* Cleanup

* Typos, example changes

* Switch to tables, use ordered list for usage

* Start docs around alert instances and templating

* Documentation changes

* Some adjustments

* Apply PR feedback

* Apply suggestions from code review

Co-Authored-By: gchaps <[email protected]>

* PR feedback pt2

* Provide better examples for alert types

* Apply PR feedback

* Update README locations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants