Commit graph

40 commits

Author SHA1 Message Date
Kibana Machine
3f4a7a561b
[8.12] [Response Ops][Actions] Adding configuration to override default MS Graph API Scope and Exchange URL values (#175812) (#176085)
# Backport

This will backport the following commits from `main` to `8.12`:
- [[Response Ops][Actions] Adding configuration to override default MS
Graph API Scope and Exchange URL values
(#175812)](https://github.com/elastic/kibana/pull/175812)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"ying.mao@elastic.co"},"sourceCommit":{"committedDate":"2024-02-01T17:41:52Z","message":"[Response
Ops][Actions] Adding configuration to override default MS Graph API
Scope and Exchange URL values (#175812)\n\nResolves
https://github.com/elastic/kibana/issues/166064\r\n\r\n##
Summary\r\n\r\nAdds the following configurations to the `kibana.yml`
config:\r\n* `xpack.actions.microsoftGraphApiScope` - overrides the
default Graph\r\nAPI scope value of
`https://graph.microsoft.com/.default`\r\n*
`xpack.actions.microsoftExchangeUrl` - overrides the default value
of\r\n`https://login.microsoftonline.com`\r\n\r\nThis allows users in
different Azure environments to customize their\r\nendpoints as
needed.\r\n\r\n## To Verify\r\n\r\nWe are unable to test this in a
different environment but we can verify\r\nthat the config overrides the
defaults as expected by setting the config\r\nvalues to something
different and the logging out the params that are\r\nsent to
`getOAuthClientCredentialsAccessToken`
in\r\n`x-pack/plugins/stack_connectors/server/connector_types/email/send_email.ts`.\r\nThen
create an MS Exchange email connector and test it to see that
the\r\nlogged values are overridden as
expected.\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"f7e4f7a636763d46cb6a38b21a5eb6e67595ddfe","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Actions","Team:ResponseOps","backport:prev-minor","backport:prev-MAJOR","v8.13.0"],"title":"[Response
Ops][Actions] Adding configuration to override default MS Graph API
Scope and Exchange URL
values","number":175812,"url":"https://github.com/elastic/kibana/pull/175812","mergeCommit":{"message":"[Response
Ops][Actions] Adding configuration to override default MS Graph API
Scope and Exchange URL values (#175812)\n\nResolves
https://github.com/elastic/kibana/issues/166064\r\n\r\n##
Summary\r\n\r\nAdds the following configurations to the `kibana.yml`
config:\r\n* `xpack.actions.microsoftGraphApiScope` - overrides the
default Graph\r\nAPI scope value of
`https://graph.microsoft.com/.default`\r\n*
`xpack.actions.microsoftExchangeUrl` - overrides the default value
of\r\n`https://login.microsoftonline.com`\r\n\r\nThis allows users in
different Azure environments to customize their\r\nendpoints as
needed.\r\n\r\n## To Verify\r\n\r\nWe are unable to test this in a
different environment but we can verify\r\nthat the config overrides the
defaults as expected by setting the config\r\nvalues to something
different and the logging out the params that are\r\nsent to
`getOAuthClientCredentialsAccessToken`
in\r\n`x-pack/plugins/stack_connectors/server/connector_types/email/send_email.ts`.\r\nThen
create an MS Exchange email connector and test it to see that
the\r\nlogged values are overridden as
expected.\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"f7e4f7a636763d46cb6a38b21a5eb6e67595ddfe"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/175812","number":175812,"mergeCommit":{"message":"[Response
Ops][Actions] Adding configuration to override default MS Graph API
Scope and Exchange URL values (#175812)\n\nResolves
https://github.com/elastic/kibana/issues/166064\r\n\r\n##
Summary\r\n\r\nAdds the following configurations to the `kibana.yml`
config:\r\n* `xpack.actions.microsoftGraphApiScope` - overrides the
default Graph\r\nAPI scope value of
`https://graph.microsoft.com/.default`\r\n*
`xpack.actions.microsoftExchangeUrl` - overrides the default value
of\r\n`https://login.microsoftonline.com`\r\n\r\nThis allows users in
different Azure environments to customize their\r\nendpoints as
needed.\r\n\r\n## To Verify\r\n\r\nWe are unable to test this in a
different environment but we can verify\r\nthat the config overrides the
defaults as expected by setting the config\r\nvalues to something
different and the logging out the params that are\r\nsent to
`getOAuthClientCredentialsAccessToken`
in\r\n`x-pack/plugins/stack_connectors/server/connector_types/email/send_email.ts`.\r\nThen
create an MS Exchange email connector and test it to see that
the\r\nlogged values are overridden as
expected.\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"f7e4f7a636763d46cb6a38b21a5eb6e67595ddfe"}}]}]
BACKPORT-->

Co-authored-by: Ying Mao <ying.mao@elastic.co>
2024-02-01 12:03:05 -07:00
Kibana Machine
55d0900911
[8.12] Add generativeAIForObservability feature for stack connectors (#173826) (#173923)
# Backport

This will backport the following commits from `main` to `8.12`:
- [Add generativeAIForObservability feature for stack connectors
(#173826)](https://github.com/elastic/kibana/pull/173826)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Coen
Warmer","email":"coen.warmer@gmail.com"},"sourceCommit":{"committedDate":"2023-12-22T14:11:55Z","message":"Add
generativeAIForObservability feature for stack connectors
(#173826)\n\nResolves
https://github.com/elastic/obs-ai-assistant-team/issues/126\r\n\r\n##
Summary\r\n\r\nThis adds a a feature id called
`generativeAIForObservability` and adds\r\nit to the OpenAI connector.
That way the Add Connector Flyout can show\r\nonly the connectors
Observability currently
supports.\r\n\r\n\r\n\r\n378beef1-50de-44c4-9a06-c35bbf5680d8","sha":"f8100a8f80dc957ad574d9570f1781ba148990fb","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:prev-minor","v8.12.0","v8.13.0"],"number":173826,"url":"https://github.com/elastic/kibana/pull/173826","mergeCommit":{"message":"Add
generativeAIForObservability feature for stack connectors
(#173826)\n\nResolves
https://github.com/elastic/obs-ai-assistant-team/issues/126\r\n\r\n##
Summary\r\n\r\nThis adds a a feature id called
`generativeAIForObservability` and adds\r\nit to the OpenAI connector.
That way the Add Connector Flyout can show\r\nonly the connectors
Observability currently
supports.\r\n\r\n\r\n\r\n378beef1-50de-44c4-9a06-c35bbf5680d8","sha":"f8100a8f80dc957ad574d9570f1781ba148990fb"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173826","number":173826,"mergeCommit":{"message":"Add
generativeAIForObservability feature for stack connectors
(#173826)\n\nResolves
https://github.com/elastic/obs-ai-assistant-team/issues/126\r\n\r\n##
Summary\r\n\r\nThis adds a a feature id called
`generativeAIForObservability` and adds\r\nit to the OpenAI connector.
That way the Add Connector Flyout can show\r\nonly the connectors
Observability currently
supports.\r\n\r\n\r\n\r\n378beef1-50de-44c4-9a06-c35bbf5680d8","sha":"f8100a8f80dc957ad574d9570f1781ba148990fb"}}]}]
BACKPORT-->

Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
2023-12-22 08:26:38 -07:00
Jiawei Wu
e4805fc9e0
[RAM][Maintenance Window] Maintenance window scoped query frontend changes (#171949)
## Summary
Partially resolves: https://github.com/elastic/kibana/issues/164255,
this is 2/3 of the scoped query changes.

Maintenance window scoped query frontend changes. Adds the ability to
add and edit scoped query for maintenance windows. Due to limitations
with the alerts search bar and each solution fetches AAD fields, we only
allow users to associate scoped query with 1 category (manangement,
o11y, or security solution). The intended usage in this case is for the
user to create multiple maintenance windows if they wish to apply scoped
queries to multiple solutions.

### To test:
go to
`x-pack/plugins/alerting/public/pages/maintenance_windows/constants.ts`
and set `IS_SCOPED_QUERY_ENABLED` to `true`

### Scoped query off, multiple category allowed:

![image](dbf03e8e-f9bd-449c-8d23-0b474fe5a9c4)

### Scoped query on, multiple category disallowed:

![image](368f954a-7671-410b-839b-77f0420f26fa)

### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-12-04 15:18:33 -08:00
Ersin Erdal
e9777f67bf
Prepare the connector Get API for versioning (#166894)
Part of: https://github.com/elastic/response-ops-team/issues/125

This PR intends to prepare the `GET
${BASE_ACTION_API_PATH}/connector/{id}` API for versioning as shown in
the above issue.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-10-07 12:17:24 +02:00
Steph Milovic
b888ecb45c
[Security solution] Rename Generative AI connector to OpenAI (#167677)
[Redo this PR](https://github.com/elastic/kibana/pull/167220) because
[this PR](https://github.com/elastic/kibana/pull/167220) merged shortly
before broke it and I had to fix an import

---------

Co-authored-by: lcawl <lcawley@elastic.co>
2023-09-29 11:54:55 -05:00
Jonathan Budzenski
7dd352a65e Revert "[Security solution] Rename Generative AI connector to OpenAI (#167519)"
This reverts commit a81b620a41.
2023-09-29 11:09:02 -05:00
Steph Milovic
a81b620a41
[Security solution] Rename Generative AI connector to OpenAI (#167519) 2023-09-29 09:45:53 -06:00
Ying Mao
f35ecc6f96
[Response Ops][Actions] Prepare connector listTypes HTTP API for versioning (#162830)
Towards https://github.com/elastic/response-ops-team/issues/125

## Summary

Preparing the `GET ${BASE_ACTION_API_PATH}/connector_types` HTTP API for
versioning

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-30 08:50:00 -04:00
Ersin Erdal
d65b02cf06
Prepare the connector GetAll API for versioning (#162799)
Part of: https://github.com/elastic/response-ops-team/issues/125

This PR intends to prepare the `GET ${BASE_ACTION_API_PATH}/connectors`
API for versioning as shown in the above issue.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-23 15:33:07 +02:00
Alexi Doak
568ad803bc
[ResponseOps][Alerting] Deprecate and remove references to action variables in the ui and in tests that are no longer used (#161136)
Resolves https://github.com/elastic/kibana/issues/161126

## Summary

Removes references to the following list of action variables in the code
and in the UI:

| Mustache legacy variable | Recommended replacement expression | To be
deprecated
| ----------- | ----------- | ----------- |
| alertId | rule.id | yes |
| alertName | rule.name | yes |
| spaceId | rule.spaceId | yes |
| tags | rule.tags | yes |
| params | rule.params | yes |
| alertInstanceId | alert.id | yes |
| alertActionGroup | alert.actionGroup | yes |
| alertActionSubgroup | alert.actionSubgroup | yes |
| alertActionGroupName | alert.actionGroupName | yes |

Also deprecates `params` in favor of `rule.params`

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Checklist

1. Create an es query/index threshold rule and add a connector
2. Verify that the default message does not contain any legacy variables
3. Click on the list of available action variables and verify that
`params` is deprecated and all the params variables are prefixed with
`rules.`

## Release Note

The following rule action variables have been deprecated; use the
recommended variables (in parentheses) instead:

- `alertActionGroup` (`alert.actionGroup`)
- `alertActionGroupName` (`alert.actionGroupName`)
- `alertActionSubgroup` (`alert.actionSubgroup`)
- `alertId` (`rule.id`)
- `alertInstanceId` (`alert.id`)
- `alertName` (`rule.name`)
- `params` (`rule.params`)
- `spaceId` (`rule.spaceId`)
- `tags` (`rule.tags`)
2023-07-13 11:15:27 -04:00
Christos Nasikas
67fc8333e7
[Actions] Set system actions on Kibana start (#160983)
## Summary

This PR:

- Adds the ability to create system action types
- Creates system connectors on Kibana `start` from the system action
types
- Prevents system action to be created/updated/deleted
- Return system actions from the get/getAll endpoints

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 10:39:29 -07:00
Steph Milovic
029eb3104a
[Security solution] Generative AI Connector (#157228) 2023-05-24 15:47:35 -07:00
Ying Mao
ca3c0dc5cd
[Response Ops][Actions] Keep track of action execution source and show in connector exec log (#152030)
Resolves https://github.com/elastic/kibana/issues/143984

## Summary

This PR persists an execution source field to the action event log
`execute` document which indicates the source of the action. Currently,
we have 3 sources of action execution:
* `http_request` - these are executions triggered from the `_execute`
route in the actions API. This is used by the test connector
functionality in the UI but could also be used directly via curl
command. We do not differentiate between the two.
* `notification` - these are executions triggered by the notifications
service. currently, this only occurs when a case is assigned to a user.
* `saved_object` - these are executions triggered by another saved
object, like the `alert` saved object. Cases also triggers action
execution in `x-pack/plugins/cases/server/client/cases/push.ts`. The
source will be saved as the type of the saved object that triggered the
action

After persisting the source, we also updated the connector exec log to
show the source in a new column (hidden by default).

<img width="1710" alt="Screenshot 2023-03-01 at 4 12 35 PM"
src="https://user-images.githubusercontent.com/13104637/222266192-2877ad2b-0309-408e-ad44-ec37ef597afb.png">

## To Verify

1. Create a connector and run it via the Test Connector tab
2. Create a rule that will fire an action using the connector and let it
run
3. Create a case an assign it to a user (other than yourself)
4. Go to the connector exec log view, add the "Source" column and see
that it is populated. You can also inspect the event log docs for
`provider: "actions"` and see that `kibana.action.execution.source` is
populated.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-03-08 15:18:51 -05:00
Zacqary Adam Xeper
cb2f07b570
[RAM] Fix case conversion of frequency.notify_when in API (#148838)
## Summary

Closes #148572

Fixes an issue where rules APIs required `frequency.notifyWhen` to be
sent/received instead of `frequency.notify_when`


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

Co-authored-by: Julia <iuliia.guskova@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-24 16:53:59 -06:00
Alexi Doak
77742b8a9e
[ResponseOps][OnWeek] Connector logs view (#148291)
Resolves https://github.com/elastic/kibana/issues/147795

## Summary

Adds a connectors event log tab that gives the ability to see historical
activity of connectors.


### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### To verify

- Create a rule with a connector, create a few to help test the search
capability
- Go to
http://localhost:5601/app/management/insightsAndAlerting/triggersActionsConnectors/logs
- Verify that you can see the execution logs for the connector
- Verify that you can search
- Verify that you can filter by error/success

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Ying Mao <ying.mao@elastic.co>
2023-01-23 15:33:01 -07:00
Mike Côté
0c8c4d7d0a
[Actions] Remove duplicated ActionResult type from common folder (#148001)
Resolves https://github.com/elastic/kibana/issues/132412.

In this PR, I'm removing `ActionResult` type from the `/common` folder
as it is an old copy of the `ActionResult` used and provided by the
`/server` folder.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-01-03 08:45:37 -07:00
Ying Mao
914d1cd41c
[Response Ops] [Connectors] Move connectors to own plugin (#139867)
* Initial commit of stack connectors plugin

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Fixing up xmatters. Moving library functions around

* [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs'

* Fixing up webhook

* Fixing up teams and slack

* Fixing up index, email, pagerduty, server log

* Fixing i18n

* wip

* Moving well know email route to stack connectors plugin

* Fixing types

* Fixing unit tests

* Adding index.ts

* Cleanup

* Updating READMEs

* [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs'

* Moving to domain specific folders and updating codeowners

* Fixing codeowners

* Fixing types

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-09-15 15:50:15 -04:00
Ersin Erdal
5cb0c01072
Use "compatibility" rather than "availability" on connectors table (#139024)
* Use compatibility rather than availability on connectors table
* Replace Availability with Compatibility in create connector flyout.
2022-08-26 14:37:17 +02:00
Ying Mao
3c24511c16
[Response Ops][Connectors] Allow connectors to explicitly register which features they will be available in (#136331)
* Adding feature config to connector type and checking for validity on registration

* Updating actions APIs to filter by feature id if provided

* Fixing types

* Renaming allowedFeatureIds to featureConfig

* Adding siem feature config. Returning feature config to client. Showing availability in connector list

* Fixing types

* Showing availability in create connector flyout header

* Passing feature id into action form used by rule creators.

* Renaming some stuff

* Finishing triggers_actions_uis. Starting cases

* Fixing cases

* fixing types

* Fixing types and adding uptime feature

* Cleanup

* fixing tests

* Updating README

* Filtering action type filter on rule list

* Update x-pack/plugins/actions/common/connector_feature_config.ts

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>

* Fixing tests

* Renaming featureConfig to supportedFeatureIds

* PR feedback

* fixing i18n

* Updating docs

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-25 06:24:25 -07:00
Ersin Erdal
2b6fc197cb
Verify emails when creating an email connector, even if allowedDomains is not provided. (#133859) 2022-06-28 13:46:33 +02:00
Ying Mao
8da4cb29a7
[Response Ops] Log stack traces in alerting/actions/task executors on error (#133931)
* Showing stack track for alerting task runner

* Adding stack traces for action and task running

* wip

* Updating unit tests

* wip

* Dont return stack trace in action result

* Updating unit tests

* Updating functional tests

* Updating functional tests

* Separate log for error

* Separate log for error

* Moving error log

* Trying out putting stack trace in meta

* two logs and tags

* Adding tags to the error logging

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-06-16 13:57:39 -04:00
Patrick Mueller
6ad418b275
[ResponseOps][actions] add config for allow-listing email address domains (#129001)
resolves https://github.com/elastic/kibana/issues/126944

Adds a new configuration setting for the actions plugin,
xpack.actions.email.domain_allowlist, which is an array of domain name
strings which are allowed to be sent emails by the email connector.
2022-04-26 10:05:16 -04:00
spalger
3730dd0779 fix all violations 2022-04-16 01:37:30 -05:00
Yuliia Naumenko
03cd9e8886
[Actions][Connectors] Modify email connector UI flyout to support OAuth 2.0 Client Credentials flow for MS Exchange provider (#112375)
* [Actions][Connectors] Modify email connector UI flyout to support OAuth 2.0 Client Credentials flow for MS Exchange provider

* fixed test

* added unit test

* added validation unit test

* fixed fn test

* fixed prettier

* -

* Update email_connector.test.tsx

* Update use_email_config.test.ts

* fixed due to comments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-23 19:39:26 -07:00
Tyler Smalley
4681a80317
[DX] Upgrade prettier to v2.4.0 (#112359)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-09-19 22:34:30 -07:00
Chris Roberson
74d87db06a
[Actions] Telemetry for calling legacy routes (#111901)
* Telemetry for legacy http api routes

* PR feedback
2021-09-13 12:56:44 -04:00
ymao1
9ba00ee594
[Actions] Allowing service specification in email connector config (#110458)
* Initial commit of serverType in email connector config

* Fleshing in route to get well known email service configs from nodemailer

* Adding elastic cloud to well known server type

* Cleaning up email constants and allowing for empty selection

* Showing error if user doesn't select server type

* Adding hook for setting email config based on server type

* Adding tests and making sure settings are not overwritten on edit

* Fixing functional test

* Adding migration

* Adding functional test for migration

* Repurposing service instead of adding serverType

* Cleanup

* Disabling host/port/secure form fields when settings retrieved from API

* Updating docs for service

* Filtering options based on whether cloud is enabled

* Initialize as disabled

* Fixing types

* Update docs/management/connectors/action-types/email.asciidoc

Co-authored-by: David Kilfoyle <41695641+kilfoyle@users.noreply.github.com>

Co-authored-by: David Kilfoyle <41695641+kilfoyle@users.noreply.github.com>
2021-09-03 09:49:00 -04:00
Spencer
fecdba7eba
[eslint] add rule to prevent export* in plugin index files (#109357)
* [eslint] add rule to prevent export* in plugin index files

* deduplicate export names for types/instances with the same name

* attempt to auto-fix duplicate exports too

* capture exported enums too

* enforce no_export_all for core too

* disable rule by default, allow opting-in for help fixing

* update tests

* reduce yarn.lock duplication

* add rule but no fixes

* disable all existing violations

* update api docs with new line numbers

* revert unnecessary changes to yarn.lock which only had drawbacks

* remove unnecessary eslint-disable

* rework codegen to split type exports and use babel to generate valid code

* check for "export types" deeply

* improve test by using fixtures

* add comments to some helper functions

* disable fix for namespace exports including types

* label all eslint-disable comments with related team-specific issue

* ensure that child exports of `export type` are always tracked as types

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-01 18:05:45 -07:00
ymao1
71ed148cfe
[Alerting] Preconfigured alert history index connector (#94909)
* Adding preconfigured alert history index

* Adding functions to build alert history document

* Adding functions to build alert history document

* Moving index template creation to plugin start

* Adding unit tests

* Adding unit tests

* Adding unit tests

* Simplifying

* Revert "Merge branch 'master' of https://github.com/elastic/kibana into alerting/default-es-index-schema"

This reverts commit 957c333aa4, reversing
changes made to 4b1b78761e.

* Reverting some changes

* Reverting some changes

* Adding index override

* Updating UI with index override

* Only allow indexOverride for preconfigured alert history connector

* Handling preconfigured connector id clashes

* Cleanup

* UI unit tests

* Fixing default schema shown in UI

* Fixing functional tests

* Adding functional test

* Fixing functional tests

* Adding docs and link to docs

* Adding config to docker allowlist

* Fixing wrong typescript operator

* Changing default for config to false

* Cleanup

* Adding note about index privileges to docs

* Fixing i18n

* PR fixes

* PR fixes

* PR fixes

* PR fixes - wording

* PR fixes

* Fixing unit and functional tests

* Fixing types check

* ES -> Elasticsearch

* Moving files

* Adding kibana- to beginning of prefix

* Namespacing alert data within schema with kibana

* Fix i18n

* Updating docs

* Fixing unit tests

* Fixing doc links

* Fixing types check

* PR fixes

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-04-08 18:18:44 -04:00
Yuliia Naumenko
25baa3b558
[Connectors UI] Make UI use new connector APIs (#94180)
* [Connectors UI] Make UI use new connector APIs

* fixed tests

* fixed due to comment

* fixed due to comment

* fixed test

* fixed test

* fixed test

* moved rewrite_request_case to the common folder

* fixed due to comments
2021-03-16 12:59:46 -07:00
Brandon Kobel
4584a8b570
Elastic License 2.0 (#90099)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:12:39 -08:00
Gidi Meir Morris
4fdf2f1566
[Actions] makes savedObjectId field optional (#79186)
This PR makes the `savedObjectId` parameter optional in the Jira, ServiceNow and IBM Resilient Connectors.
This allows them to execute without this field outside of Alerts, as it is currently populated using the `alertId` which isn't available in other places.
Additionally this adds an optional field in the `Params` Components for all three of the connectors, which allows users to provide a value for the `savedObjectId` field if the so wish.
2020-10-05 18:21:20 +01:00
Gidi Meir Morris
41a7f1a1c2
[Actions] adds a Test Connector tab in the Connectors list (#77365)
Adds a tab in the _Edit Alert_ flyout which allows the user to _test_ their connector by executing it using an example action. The execution relies on the connector being updated, so is only enabled when there are no saved changes in the Connector form itself.
2020-09-22 11:18:33 +01:00
Yuliia Naumenko
d09bd63786
Changed actions API endpoints urls to follow Kibana STYLEGUIDE (#65936)
* Changed actions API endpoints urls to follow Kibana STYLEGUIDE

* Fixed tests

* fixed test

* fixed test

* resolved conflicts

* Fixed siem tests

* Fixed failing test

* fixed readme and test

* Changed actions api urls to follow the template 'api/{plugin}/{type}/{id}

* Fixed type checks

* Fixed tests and API

* fixed tests

* Fixed type checks

* fixed type check
2020-05-24 20:27:42 -07:00
Gidi Meir Morris
a012ddf9df
[alerting] removes usage of any throughout Alerting Services code (#64161)
This removes unneeded use of `any` throughout:
1. alerting
2. alerting_builtin
3. actions
4. task manager
5. event log

It also adds a linting rule that will prevent us from adding more `any` in the future unless an explicit exemption is made.
2020-04-24 17:04:36 +01:00
Yuliia Naumenko
730dcbf638
Implemented actions server API for supporting preconfigured connectors (#62382)
* Implemented actions server API for supporting preconfigured connectors defined in kibana.yaml

* Fixed type check

* Fixed due to comments and extended functional tests

* Fixed tests and renamed connectors

* fixed jest tests

* Fixed type checks

* Fixed failing alert save

* Fixed alert client tests

* fixed type checks

* Fixed language check error

* Fixed jest tests

* Added missing comments and docs

* fixed due to comments

* Fixed json config for preconfigured

* fixed type check, reverted config

* config experiment with json stringify

* revert experiment

* Removed the spaces from connector names in config
2020-04-08 09:54:42 -07:00
Mike Côté
851b8a82a5
License checks for actions plugin (#59070)
* Define minimum license required for each action type (#58668)

* Add minimum required license

* Require at least gold license as a minimum license required on third party action types

* Use strings for license references

* Ensure license type is valid

* Fix some tests

* Add servicenow to gold

* Add tests

* Set license requirements on other built in action types

* Use jest.Mocked<ActionType> instead

* Change servicenow to platinum

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* Make actions config mock and license state mock use factory pattern and jest mocks (#59370)

* Add license checks to action HTTP APIs (#59153)

* Initial work

* Handle errors in update action API

* Add unit tests for APIs

* Make action executor throw when action type isn't enabled

* Add test suite for basic license

* Fix ESLint errors

* Fix failing tests

* Attempt 1 to fix CI

* ESLint fixes

* Create sendResponse function on ActionTypeDisabledError

* Make disabled action types by config return 403

* Remove switch case

* Fix ESLint

* Add license checks within alerting / actions framework (#59699)

* Initial work

* Handle errors in update action API

* Add unit tests for APIs

* Verify action type before scheduling action task

* Make actions plugin.execute throw error if action type is disabled

* Bug fixes

* Make action executor throw when action type isn't enabled

* Add test suite for basic license

* Fix ESLint errors

* Stop action task from re-running when license check fails

* Fix failing tests

* Attempt 1 to fix CI

* ESLint fixes

* Create sendResponse function on ActionTypeDisabledError

* Make disabled action types by config return 403

* Remove switch case

* Fix ESLint

* Fix confusing assertion

* Add comment explaining double mock

* Log warning when alert action isn't scheduled

* Disable action types in UI when license doesn't support it (#59819)

* Initial work

* Handle errors in update action API

* Add unit tests for APIs

* Verify action type before scheduling action task

* Make actions plugin.execute throw error if action type is disabled

* Bug fixes

* Make action executor throw when action type isn't enabled

* Add test suite for basic license

* Fix ESLint errors

* Stop action task from re-running when license check fails

* Fix failing tests

* Attempt 1 to fix CI

* ESLint fixes

* Return enabledInConfig and enabledInLicense from actions get types API

* Disable cards that have invalid license in create connector flyout

* Create sendResponse function on ActionTypeDisabledError

* Make disabled action types by config return 403

* Remove switch case

* Fix ESLint

* Disable when creating alert action

* Return minimumLicenseRequired in /types API

* Disable row in connectors when action type is disabled

* Fix failing jest test

* Some refactoring

* Card in edit alert flyout

* Sort action types by name

* Add tooltips to create connector action type selector

* Add tooltips to alert flyout action type selector

* Add get more actions link in alert flyout

* Add callout when creating a connector

* Typos

* remove float right and use flexgroup

* replace pixels with eui variables

* turn on sass lint for triggers_actions_ui dir

* trying to add padding around cards

* Add callout in edit alert screen when some actions are disabled

* improve card selection for Add Connector flyout

* Fix cards for create connector

* Add tests

* ESLint issue

* Cleanup

* Cleanup pt2

* Fix type check errors

* moving to 3-columns cards for connector selection

* Change re-enable to enable terminology

* Revert "Change re-enable to enable terminology"

This reverts commit b497dfd6b6.

* Add re-enable comment

* Remove unecessary fragment

* Add type to actionTypeNodes

* Fix EuiLink to not have opacity of 0.7 when not hovered

* design cleanup in progress

* updating classNames

* using EuiIconTip

* Remove label on icon tip

* Fix failing jest test

Co-authored-by: Andrea Del Rio <delrio.andre@gmail.com>

* Add index to .index action type test

* PR feedback

* Add isErrorThatHandlesItsOwnResponse

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Andrea Del Rio <delrio.andre@gmail.com>
2020-03-20 10:49:37 -04:00
Gidi Meir Morris
8fd317c55a
[Alerting] Adds navigation by consumer and alert type to alerting (#58997)
Adds Navigation APIs to Alerting.

Parts to this PR:

Adds a client side (Public) plugin to Alerting, including two APIs: registerNavigation & registerDefaultNavigation. These allow a plugin to register navigation handlers for any alerts which it is the consumer of- one for specific AlertTypes and one for a default handler for all AlertTypes created by the plugin.
The Alert Details page now uses these navigation handlers for the View In App button. If there's an AlertType specific handler it uses that, otherwise it uses a default one and if the consumer has not registered a handler - it remains disabled.
A generic Alerting Example plugin that demonstrates usage of these APIs including two AlertTypes - one that always fires, and another that checks how many people are in Outer Space and allows you to trigger based on that. 😉 To enable the plugin run yarn start --ssl --run-examples
2020-03-19 09:49:05 +00:00
Chris Roberson
6398a9911d
[Monitoring] Migrate license expiration alert to Kibana alerting (#54306)
* License expiration

* Flip off

* Only require alerting and actions if enabled

* Support date formating and timezones in the alert UI messages, support ccs better

* Fix status tests

* Fix up front end tests

* Fix linting, and switch this back

* Add this back in so legacy alerts continue to work

* Fix type issues

* Handle CCS better

* Code cleanup

* Fix type issues

* Flip this off, and fix test

* Moved the email address config to advanced settings, but need help with test failures and typescript

* Fix issue with task manager

* Deprecate email_address

* Use any until we can figure out this TS issue

* Fix type issue

* More tests

* Fix mocha tests

* Use mock instead of any

* I'm not sure why these changed...

* Provide timezone in moment usage in tests for consistency

* Fix type issue

* Change how we get dateFormat and timezone

* Change where we calculate the dates to show in the alerts UI

* Show deprecation warning based on the feature toggle

* Ensure we are using UTC

* PR feedback

* Only add this if the feature flag is enabled

* Fix tests

* Ensure we only attempt to look this up if the feature flag is enabled

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-02-03 15:55:50 -05:00
Gidi Meir Morris
bb29cec20b
fixes shared types across alerting plugins (#55824)
This addresses two issues that have come up:

Alerting and Actions have TypeScript types that are needed across server and public plugins, and need to be extracted to a common path (thanks @chrisronline for bringing this to our attention)
Due to the above, types have been duplicated between the alerting and actions when needed in the Alerting UI, which has led to them diverging. This forces the UI to type check against the API, which will help reduce these errors in the future.
2020-01-24 17:06:59 +00:00