Commit graph

215 commits

Author SHA1 Message Date
Mikhail Shustov b3a9754394
[Core] Explicit typings for request handler context (#88718)
* move context to server part. couple with RequestHandlerContext

Context implementation will be simplified in follow-up.

* adopt core code

* adopt bfetch code

* adopt data code

* adopt search examples

* adopt vis_type_timelion

* adopt vis_type_timeseries

* adopt plugin functional tests

* adopt actions

* adopt alerting plugin

* adopt APM plugin

* adopt beats_management

* adopt case plugin

* adopt cross_cluster_replication

* adopt data_enhanced

* adopt event_log

* adopt global_search

* adopt index_management

* adopt infra

* adopt licensing

* adopt lists

* adopt logstash

* adopt reporting

* adopt observability

* adopt monitoring

* adopt rollup

* adopt so tagging

* adopt security

* adopt security_solutions

* adopt watcher

* adopt uptime

* adopt spaces

* adopt snapshot_restore

* adopt features changes

* mute error when null used to extend context

* update docs

* small cleanup

* add type safety for return type

* refactor registerRouteHandlerContext type

* update docs

* update license header

* update docs

* fix type error. fetch body does not accept array of strings

* fix telemetry test

* remove unnecessary ts-ignore

* address comments

* update docs
2021-01-21 15:20:22 +01:00
Robert Austin c3a69fe28b
Remove plugin circular deps between actions -> case and case -> securitySolution (#88106) 2021-01-21 08:47:15 -05:00
Yuliia Naumenko 8b1a228c29
[Alerting] Migrate Actions, Alerts, Stack Alerts and TriggersActionsUI plugins to TS project references (#88556)
* [Alerting] Migrate Actions plugin to TS project references

* alerts plugin ts migration

* triggers_actions_ui plugin ts migration

* fixed build

* fixed build
2021-01-20 10:53:01 -08:00
ymao1 60f8b24529
[Actions] Removed double parsing when passing action url for validation (#87928)
* Removed double parsing when passing action url for validation

* Fixing functional test

* PR fixes

* PR fixes

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-19 13:40:49 -05:00
Thom Heymann 3d749ad444
Bumped axios to 0.21.1 (#87776)
* Bumped axios to 0.21.1

* Update dist

* Consolidated dependencies

* Added missing mime-type types

* Rebuild dist

* Consolidated octokit/auth-token

* Fix axios wrapper ensuring non-200 throws error

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-13 19:41:31 +00:00
Yuliia Naumenko fb67443e6d
[EventLog] Added event log API to get events for multiple saved objects. (#87596)
* Added alerting API to get all active instances

* modofied event log findEventsBySavedObject to support bulk ids, renamed to findEventsBySavedObjectIds

* fixed faling typechecks

* fixed crash on zpd/api/event_log/alert/84c00970-5130-11eb-9fa7/_find for non existing id

* fixed faling typechecks

* fixed faling typechecks

* fixed due to comments

* fixed due to comments

* fixed failing test

* fixed due to comments
2021-01-12 16:25:23 -08:00
Patrick Mueller 8fe204fcab
[actions] fixes action proxies to set the right agent based on target url (#86415)
Previously, the http and https proxy agents used by actions were created based
on the protocol of the proxy URL itself - if the proxy was an http URL, both
the generated http and https agents supplied to axios were actually both
http proxy agents; if the proxy was an https URL, both the generated http and
https agents supplied to axios were both https proxy agents.

This PR changes so that both an http and https proxy agent are created and
assigned as the appropriate agents for axios.  Similar changes were made to
the slack action, which does not directly use axios.
2021-01-12 11:54:40 -05:00
Gidi Meir Morris a95fdbdec3
[Actions] Exposes the typing for Actions Type Params (#87465)
This PR exposes the types for the Params & ActionTypeIds of all Action Types
2021-01-06 17:18:57 +00:00
Steph Milovic b0ba4f47ab
[Security Solution] [Case] Fixes "Case connector cannot be updated when created with a wrong field" (#87223) 2021-01-05 15:33:36 -07:00
Mike Côté 875fde58fe
Improve webhook errror messages (#87044)
* Initial work

* Fix variables to pull from

* Rename some variables

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-01-05 08:04:58 -05:00
Mike Côté f3b43cbf3f
Deprecate services.callCluster in alerts and actions executors (#86474)
* Deprecate callCluster in alerts and actions services

* Update deprecation comment

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-29 11:21:48 -05:00
Patrick Mueller f693697c18
[actions] expand object context variables as JSON (#85903)
resolves https://github.com/elastic/kibana/issues/75601

Previously, if a context variable that is an object is referenced in a
mustache template used as an action parameter, the resulting variable
expansion will be `[Object object]`.  In this PR, we change this so that
the expansion is a JSON representation of the object.

This is primarily for diagnostic purposes, so that customers can see
all the context variables available, and their values, while testing
testing their alerting actions.
2020-12-15 16:31:36 -05:00
Mike Côté ccfb4b6b1d
Add footer to all emails sent by Kibana email connector with a link to open Kibana or to the alert details page (#84371)
* Initial work

* Change messaging from copy

* Fix jest tests for email connector

* Fix jest tests for alerts plugin

* Update copy

* Use server.publicBaseUrl

* Fix jest tests

* Update tests

* Cleanup jest test

* Code cleanup

* Improve email parameter names for kibana footer url

* Cleanup

* Add test for kibana footer link

* Fix type check

* Fix jest test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-15 13:51:44 -05:00
Steph Milovic 335cd1f6fc
[Security Solution] [Cases] Move field mappings from actions to cases (#84587) 2020-12-15 07:06:11 -07:00
Yuliia Naumenko 37525f80a0
License checks for alerts plugin (#85649)
* [Alerts][License] Define minimum license required for each alert type (#84997)

* Define minimum license required for each alert type

* fixed typechecks

* fixed tests

* fixed tests

* fixed due to comments

* fixed due to comments

* removed file

* removed casting to LicenseType

* [Alerts][License] Add license checks to alerts HTTP APIs and execution (#85223)

* [Alerts][License] Add license checks to alerts HTTP APIs and execution

* fixed typechecks

* resolved conflicts

* resolved conflicts

* added router tests

* fixed typechecks

* added license check support for alert task running

* fixed typechecks

* added integration tests

* fixed due to comments

* fixed due to comments

* fixed tests

* fixed typechecks

* [Alerting UI][License] Disable alert types in UI when the license doesn't support it. (#85496)

* [Alerting UI][License] Disable alert types in UI when the license doesn't support it.

* fixed typechecks

* added licensing for alert list and details page

* fixed multy select menu

* fixed due to comments

* fixed due to comments

* fixed due to comments

* fixed typechecks

* fixed license error message

* fixed license error message

* fixed typechecks

* fixed license error message

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-14 19:29:39 -08:00
Patrick Mueller 7873e3685b
Allow action types to perform their own mustache variable escaping in parameter templates (#83919)
resolves https://github.com/elastic/kibana/issues/79371
resolves https://github.com/elastic/kibana/issues/62928

In this PR, we allow action types to determine how to escape the
variables used in their parameters, when rendered as mustache
templates.  Prior to this, action parameters were recursively
rendered as mustache templates using the default mustache
templating, by the alerts library.  The default mustache
templating used html escaping.

Action types opt-in to the new capability via a new optional
method in the action type, `renderParameterTemplates()`.  If not
provided, the previous recursive rendering is done, but now with
no escaping at all.

For #62928, changed the mustache template rendering to be
replaced with the error message, if an error occurred,
so at least you can now see that an error occurred.  Useful
to diagnose problems with invalid mustache templates.
2020-12-14 20:41:13 -05:00
Yuliia Naumenko b7c9d22133
Removed Alerting & Event Log deprecated fields that should not be using (#85652)
* Removed Alerting & Event Log deprecated fields that should not be using

* fixed due to comments
2020-12-14 17:05:58 -08:00
Christos Nasikas dec668ab6b
[Actions] Fix external service urls (#85556)
* Fix services urls

* Improve tests
2020-12-10 23:24:53 +02:00
ymao1 18a99fcc43
[Alerting & Actions ] More debug logging (#85149)
* Adding debug messages

* Adding timestamp to action execution log

* Jest tests

* Merging in master

* PR fixes

* Cleanup

* PR fixes

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-08 18:41:20 -05:00
Thom Heymann f413957827
ECS audit events for alerting (#84113)
* ECS audit events for alerts plugin

* added api changes

* fixed linting and testing errors

* fix test

* Fixed linting errors after prettier update

* Revert "Allow predefined ids for encrypted saved objects (#83482)"

This reverts commit 7d929fe903.

* Added suggestions from code review

* Fixed unit tests

* Added suggestions from code review

* Changed names of alert events

* Changed naming as suggested in code review

* Added suggestions from PR

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-12-04 19:13:30 +00:00
Tyler Smalley b593781009
Jest multi-project configuration (#77894)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-12-02 11:42:23 -08:00
Yuliia Naumenko 67564b9776
Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. (#84598)
* Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents.

* fixed type check
2020-11-30 19:23:26 -08:00
Mikhail Shustov 95861a0fb0
[DX] Prettier v2.2 (#83899)
* update prettier with ts version support

* mute type-error

* run prettier on codebase

* fix examples

* fix errors after master merged
2020-11-23 13:17:05 +01:00
Yuliia Naumenko 3ee6e476ee
Fixed usage of isReady for usage collection of alerts and actions (#83760)
* Fixed usage of `isReady` for usage collection of alerts and actions

* fixed index

* fixed due to comments

* fixed type check

* fixed due to comments
2020-11-20 20:27:03 -08:00
Brian Seeders 21995e6c5f
Revert "Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. (#83226)"
This reverts commit f79188aace.
2020-11-20 17:22:06 -05:00
Yuliia Naumenko f79188aace
Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. (#83226)
* Added default dedupKey value as an {{alertInstanceId}} to provide grouping functionality for PagerDuty incidents. Set default savedObjectId as  {{alertInstanceId}} for ServiceNow, Resilient and Jira

* fixed comment

* fixed due to comments

* fixed doc

* fixed due to comments
2020-11-20 13:04:33 -08:00
ymao1 8ca1e93763
[Actions] Microsoft Teams connector (#83169)
* First cut at adding teams connector

* Getting teams connector working

* Unit tests

* Updating docs

* PR comments

* PR comments

* Changing error to debug log

* Fixing imports

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-20 11:14:17 -05:00
Jonathan Budzenski 6c23302b36
[cli] Add bin/kibana-encryption-keys (#82838)
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: Tyler Smalley <tylersmalley@me.com>
2020-11-19 12:41:48 -06:00
Larry Gregory 7f962e5839
Removing circular dependency between spaces and security (#81891)
* Removing circular dependency between spaces and security

* Apply suggestions from code review

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* Tests refactor

- Reorganize top level describes into 3 space-based blocks into based on spaces:
  - space disabled
  - spaces plugin unavailable
  - space enabled (most previous tests go under this new block) with new beforeEach

- wrote new tests for uncovered lines 58, 66-69

* Review1: address PR feedback

* changing fake requests for alerts/actions

* Fixing tests

* fixing more tests

* Additional testing and refactoring

* Apply suggestions from code review

Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* Review 2: Address feedback

* Make ESLint happy again

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
2020-11-19 13:41:13 -05:00
Thomas Watson 4c49d5d1be
Upgrade Node.js to version 12 (#61587) 2020-11-12 22:00:57 +01:00
Gidi Meir Morris 3151e7e5e4
enables actions scoped within the stack to register at Basic license (#82931)
Enables actions scoped within the stack to register at Basic license
2020-11-12 17:31:44 +00:00
Steph Milovic e1b7073a64
[Alerting][Connectors] Add new executor subaction to get 3rd party case fields (#82519) 2020-11-09 10:08:00 -07:00
Christos Nasikas 7abb1e3033
[Security Solution][Case] Case action type (#80870)
* Init connector

* Add test

* Improve comment type

* Add integration tests

* Fix i18n

* Improve tests

* Show unknown when username is null

* Improve comment type

* Pass connector to case client

* Improve type after PR #82125

* Add comment migration test

* Fix integration tests

* Fix reporter on table

* Create case connector ui

* Add connector to README

* Improve casting on executor

* Translate name

* Improve test

* Create comment type enum

* Fix type

* Fix i18n

* Move README to cases

* Filter out case connector from alerting

Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>

Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
2020-11-04 12:07:17 +02:00
ymao1 057e9a72e0
Initialize to empty state when registering telemetry tasks (#82169)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-02 15:34:16 -05:00
Thomas Watson 700225061a
Upgrade to hapi version 18 (#80468) 2020-11-02 13:18:00 +01:00
Christos Nasikas 22f4b8400b
[Actions] Fix type contract (#82168) 2020-10-31 00:26:12 +02:00
Christos Nasikas 70807c98bd
[Actions] Fix actionType type on registerType function (#82125) 2020-10-30 16:45:24 +02:00
Thomas Watson 1407f713e5
Update KibanaRequest to use the new WHATWG URL API (#80713) 2020-10-29 14:35:48 +01:00
Mikhail Shustov 2782204cc1
Get rid of global types (#81739)
* move global typings to packages/kbn-utility-types

* update all imports

* add tests

* mute error

* update docs

* ok

* rename kbn-utility-types/test --> kbn-utility-types/jest
2020-10-28 11:03:04 +01:00
ymao1 8b1ff4ca59
[Actions] Adding hasAuth to Webhook Configuration to avoid confusing UX (#81778)
* Adding hasAuth to server and client

* Adding migration and fixing tests

* Fixing test

* Adding spacing

* Adding functional test

* Fixing migration

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-27 13:34:23 -04:00
Ying Mao 9d602e364e Revert "[Actions] Adding hasAuth to Webhook Configuration to avoid confusing UX (#81390)"
This reverts commit fd7f6b5716.
2020-10-27 09:38:36 -04:00
ymao1 fd7f6b5716
[Actions] Adding hasAuth to Webhook Configuration to avoid confusing UX (#81390)
* Adding hasAuth to server and client

* Adding migration and fixing tests

* Fixing test

* Adding spacing

* Adding functional test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-27 07:45:02 -04:00
Yuliia Naumenko ee7f16e312
Fixed migration issue for case specific actions, by extending email action migrator checks (#81673)
* Fixed migration issue for case specific actions, by extending email action migrator checks

* Fixed e2e test

* fixed due to comments
2020-10-26 17:03:41 -07:00
Larry Gregory bf0f8bbb42
Cleanup feature registration (#80909) 2020-10-20 12:53:43 -04:00
Justin Kambic cc43b14d17
[Alerting] Add scoped cluster client to alerts and actions services (#80794)
* Add scoped cluster client to alerts and actions services.

* Modify functional test to use new ES client.
2020-10-20 09:54:48 -04:00
Gidi Meir Morris 5460ad741c
[Task Manager] Cleans up legacy plugin structure (#80381)
This PR addresses a list of legacy code debt the plugin has incurred over the past year due to extensive changes in its internals and the adoption of the Kibana Platform.

It includes:
1. The `TaskManager` class has been split into several independent components: `TaskTypeDictionary`,  `TaskPollingLifecycle`,  `TaskScheduling`,  `Middleware`. This has made it easier to understand the roles of the different parts and makes it easier to plug them into the observability work.
2. The exposed `mocks` have been corrected to correctly express the Kibana Platform api
3. The lifecycle has been corrected to remove the need for  intermediary streames/promises which we're needed when we first introduced the `setup`/`start` lifecycle to support legacy.
4. The Logger mocks have been replaced with the platform's `coreMocks` implementation
5. The integration tests now test the plugin's actual public api (instead of the internals).
6. The Legacy Elasticsearch client has been replaced with the typed client in response to the deprecation notice.
7. Typing has been narrowed to prevent the `type` field from conflicting with the key in the `TaskDictionary`. This could have caused the displayed `type` on a task to differ from the `type` used in the Dictionary itself (this broke a test during refactoring and could have caused a bug in production code if left).
2020-10-20 13:00:13 +01:00
Thom Heymann bc8a1dac99
ECS audit logging (#74640)
* ECS audit logging

* Apply suggestions from code review

Co-authored-by: Larry Gregory <larry.gregory@elastic.co>

* Update x-pack/plugins/security/server/authentication/audit_events.ts

Co-authored-by: Larry Gregory <larry.gregory@elastic.co>

* Update docs/settings/security-settings.asciidoc

Co-authored-by: Larry Gregory <larry.gregory@elastic.co>

* remove audit trail service from core

* fix test

* Updated docs and added beta warning

* Added dev docs

* Tweaks

* Plugin list changes

* Apply suggestions from technical writers

Co-authored-by: Kaarina Tungseth <kaarina.tungseth@elastic.co>

* Added docs suggestion

* Added api integration tests

* Added suggestions from platform team

* Update x-pack/plugins/security/server/audit/audit_service.test.ts

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>

* Update x-pack/plugins/security/server/audit/audit_service.test.ts

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>

* Update x-pack/plugins/security/server/audit/audit_service.test.ts

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>

* Update docs/user/security/audit-logging.asciidoc

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>

* Update docs/settings/security-settings.asciidoc

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>

* Update x-pack/plugins/security/server/config.ts

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>

* Added suggestions from PR

* Grouped events table

* Update x-pack/plugins/security/server/audit/audit_events.ts

Co-authored-by: Larry Gregory <larry.gregory@elastic.co>

* Update x-pack/plugins/security/server/audit/audit_events.ts

Co-authored-by: Larry Gregory <larry.gregory@elastic.co>

* Fixed ECS version number in docs

Co-authored-by: Larry Gregory <larry.gregory@elastic.co>

* Added suggestions from code review

* Removed beta

* Added suggestions from code review

Co-authored-by: Larry Gregory <larry.gregory@elastic.co>
Co-authored-by: Kaarina Tungseth <kaarina.tungseth@elastic.co>
Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>
2020-10-16 20:40:38 +01:00
Mike Côté 3ad698d6a0
Licensed feature usage for connectors (#77679)
* Initial work

* Fix type check and jest failures

* Add unit tests

* No need to notifyUsage from alert execution handler

* Fix ESLint

* Log action usage from alerts

* Add integration tests

* Fix jest test

* Skip feature usage of basic action types

* Fix types

* Fix ESLint issue

* Clarify comment

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-10-15 14:47:46 -04:00
Christos Nasikas 287541891e
[Security Solutions][Case] Settings per case per connector (#77327)
Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com>
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-06 20:03:46 +03:00
Gidi Meir Morris 25c5daa83a
Renames "Built-In Alerts" feature to "Stack Alerts" and "Actions" feature to "Actions and Connectors" (#79513)
Renames "Built-In Alerts" feature to "Stack Alerts" and "Actions" feature to "Actions and Connectors" as we've decided these names make more appropriate and better communicate what these features are.
2020-10-06 17:51:05 +01:00
Patrick Mueller 6b80eb20ab
[Actions] write action executor errors to the Kibana log (#79474)
resolves https://github.com/elastic/kibana/issues/72058

Finally, we're logging the action executor error responses to the Kibana log.
We have not been doing this previously, out of an abundance of caution.  The
message written may contain data returned from a 3rd party service call, and
we weren't sure this would be "safe" to log, in a PII sense.

After several minor releases, and seeing these service messages in the event
log for almost all the built-in action types, we've decided they are "safe" and
it's time to add them, as they provide some **very** helpful diagnostic
feedback to customers.
2020-10-06 11:40:35 -04: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
Alejandro Fernández Haro f398b49200
[Usage Collection] [schema] actions (#78832) 2020-10-02 16:03:42 +01:00
Yuliia Naumenko 63ff0606df
Extended Email action configuration with hasAuth property to identify if the connector require user credentials. Improved UX for Email connector (#78235)
* Extended Email action configuration with hasAuth property to identify if the connector require user credentials. Improved UX for Email connector

* Fixed failing tests and comments

* Fixed type check and reverted logic of Add user and password switch button

* Fixed due to the latest design requirenments

* Fixed due to review comments
2020-10-01 13:57:28 -07:00
Christos Nasikas cbc83003d3
[Actions][Jira] Fix bug with Jira sub-task (#79070) 2020-10-01 14:21:34 +03:00
Alejandro Fernández Haro 65cf6393c7
[Task names in TaskManager] Rename "telemetry" to "usage" (#78129)
* [Task names in TaskManager] Rename "telemetry" to "usage"

* Revert task IDs but leaving renamed titles

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-10-01 08:26:14 +01:00
Alejandro Fernández Haro 9fdb23769b
[Loggers] Rename "telemetry" to "usage" (#78130)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-10-01 08:25:05 +01:00
Christos Nasikas 3d9ea52803
[Actions][Jira] Set parent issue for Sub-task issue type (#78772) 2020-10-01 09:34:25 +03:00
Christos Nasikas 4f6df624e9
[Actions] Migrate cases configuration object (#77998)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Gidi Meir Morris <github@gidi.io>
2020-09-29 21:10:57 +03:00
Gidi Meir Morris 8547b32bab
[Actions] avoids setting a default dedupKey on PagerDuty (#77773)
The PagerDuty Action currently defaults to a dedupKey that's shared between all action executions of the same connector.
To ensure we don't group unrelated executions together this PR avoids setting a default, which means each execution will result in its own incident in PD.

As part of this change we've also made the `dedupKey` a required field whenever a `resolve` or `acknowledge` event_action is chosen. This ensure we don't try to resolve without a dedupKey, which would result in an error in PD.

A migration has been introduced to migrate existing alerts which might not have a `dedupKey` configured.
2020-09-28 14:56:20 +01:00
Pierre Gayvallet 0d09cea436
Remove legacy plugins support (#77599)
* remove ALL the things.

* adapt some types and tests

* restore ensureValidConfiguration

* fix legacy service tests

* adapt uiRender mixin

* remove legacy types

* update generated doc

* restore legacy plugin schema

* update generated doc

* remove remaining code of x-pack/legacy

* adapt imports due to merge

* cleanup CODEOWNERS

* cleanup gitignore & i18nrc

* cleanup tsconfig.json

* remove unused i18n keys

* add back `"legacy/plugins/**/*",` to tsconfig until legacy space plugin is deleted

* fix create_jest_config

* remove references from eslintrc

* more eslint cleanup

* remove `x-pack/index.js`

* fix xpack gulp scripts

* fix bug with default + named imports from boom

* remove rules from eslintrc

* remove LegacyInternals

* review comments

* update generated doc

* cleanup legacy metadatas

* revert changes to eslintrc

* update generated doc
2020-09-23 09:52:51 +02: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
Larry Gregory 9f3992f6c2
Grouped features for space management (#74151)
* Grouped features for space management

* Apply suggestions from code review

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>

* Address PR Feedback

* docs changes

* updating types/docs

* update APM feature name

* Reintroduce extraAction following EUI update

* change ordering of infra features, and render callout for management category

Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-09-18 12:30:59 -04:00
Gidi Meir Morris 3101ca3195
[Alerting] renames code in alerting RBAC exemption to make it easier to maintain (#77598)
Refactor of code to make it a little clearer what it's doing and improve maintenance.
2020-09-18 09:54:49 +01:00
Gidi Meir Morris fd624b1077
[Alerting & Actions] Overwrite SOs when updating instead of partially updating (#73688)
This PR changes the Alerts & Actions clients to ensure they require full updates (rather than partial) to SOs and overwrites the entire document when making the update.
This is to prevent the situation where nested objects get _merged_ instead of replaced when a user makes an `update`.

We also enhanced the EncryptedSavedObjectsClient to allow specified `id`s when overwriting an existing object.
2020-09-18 09:53:35 +01:00
Gidi Meir Morris efe76121c7
[Alerting] Exempt Alerts pre 7.10 from RBAC on their Action execution until updated (#75563)
Marks all Alerts with a `versionApiKeyLastmodified ` field that tracks what version the alert's Api Key was last updated in. We then use this field to exempt legacy alerts (created pre `7.10.0`) in order to use a _dialed down_ version of RBAC which should allow old alerts to continue to function after the upgrade, until they are updates (at which point they will no longer be **Legacy**).

More details here: https://github.com/elastic/kibana/issues/74858#issuecomment-688324039
2020-09-16 11:47:37 +01:00
Pierre Gayvallet 043ef5e1d7
Create the @kbn/std package (#77329)
* move `src/core/utils` to the @kbn/std package

* update README

* update codeowners and add yarn lock file

* remove export from src/core/public and src/core/server and use package import instead

* update generated doc

* adapt forgotten import

* update `data` plugin doc
2020-09-15 15:21:05 +02:00
Larry Gregory 2e34eb239f
Hide management sections based on cluster/index privileges (#67791)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-09-14 09:30:47 -04:00
Christos Nasikas 22b4e40ea0
[Alerting][Connectors] Refactor IBM Resilient: Generic Implementation (phase one) (#74357)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-09-11 10:24:46 +03:00
Christos Nasikas db5652e020
[Alerting][Connectors] Refactor Jira: Generic Implementation (phase one) (#73778) 2020-09-09 16:17:11 +03:00
Yuliia Naumenko 630d2d5fad
Exposed separate from ProxySettings rejectUnauthorized configuration option. (#76061)
* Exposed separate from ProxySettings rejectUnauthorized configuration option.

* Fixed type checks

* fixed tests
2020-08-31 18:11:57 -07:00
Yuliia Naumenko 08f9dccb1c
Added deprecation for renaming config option 'xpack.actions.whitelistedHosts' to 'xpack.actions.allowedHosts' (#76325) 2020-08-31 14:39:12 -07:00
Mikhail Shustov 37ec1e1053
Update to TS v4 (#73924)
* bump ts to v4

* MOAR RAM

* fix type errors for OSS

* first pass on x-pack errors

* second pass on x-pack type errors

* 3rd pass on x-pack type-errors

* mute errors if complex cases

* don't delete if spread suffices

* mute other complex cases

* make User fields optional

* fix optional types

* fix tests

* fix typings for time_range

* fix type errors in x-pack/tests

* rebuild kbn-pm

* remove leftovers from master update

* fix alert tests

* [Telemetry Checker] TS4 Fixes

* bump to 4.0.1-rc

* fix new errors in master

* bump typescript-eslint to version supporting TS v4 syntax

* fix merge commit errors

* update to the stable TS version 4.0.2

* bump ts-eslint to version supporting ts v4

* fix typo

* fix type errors after merge

* update ts in another new package.json

* TEMP: remove me

* Revert "TEMP: remove me"

This reverts commit dc0fc3bae6.

* [Telemetry] Update snapshot for new TS4 SyntaxKind

* bump prettier to support TS v4 syntax

* fix prettier rules

* last style change

* fix new type errors

Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
2020-08-27 10:28:02 +02:00
Yuliia Naumenko e31a0c27e6
Fixed alerting_api_integration/security_and_spaces tests failing if actions proxy set on for parallel process running using commands 'scripts/functional_tests_server' and 'scripts/functional_test_runner' (#75232)
* Fixed alerting_api_integration/security_and_spaces tests failing if actions proxy set on for parallel process running using commands 'scripts/functional_tests_server' and 'scripts/functional_test_runner'

* -

* Fixed get port from range for Slack and webhook simulators, removed some test warnings

* Added check for listening proxy server

* changed logger to debug removed not useful error

* -

* changed proxy to dynamic target in a single place

* test retry

* -

* -

* -

* -

* test with no cleanup

* -

* -

* -

* -

* Added environment variable ALERTING_PROXY_PORT

* fixed type checks

* fixed clean up proxy server port
2020-08-24 16:43:44 -07:00
Yuliia Naumenko f28a9e6e2d
Rename Whitelist to AllowList in Actions and Alerting (#75099)
* Rename Whitelist to AllowList in Actions and Alerting

* revert not related change

* Fixed due to comments and tests failing

* Fixed failing tests

* Fixed due to comments
2020-08-24 16:25:05 -07:00
Yuliia Naumenko 52bd6d98ea
Actions add proxy support (#74289)
* Added proxy support for action types

* Fixed tests

* added rejectUnauthorizedCertificates config setting

* removed slack not used code

* Fixed Slack proxy

* fixed typecheck errors

* Cleanup code

* Fixed slack

* Added unit tests

* added proxy server for test

* Fixed build

* Added functional tests

* fixed due to comments

* Fixed tests and some changes due to comments

* Fixed functional tests

* fixed circular deps

* Added proxy unit test to action type
2020-08-14 14:20:12 -07:00
Gidi Meir Morris 67025579ba
[Event log] Use Alerts client & Actions client when fetching these types of SOs (#73257)
Introduces a pluggable API to Event Log which allows custom Providers for Saved Objects which is used to ensure a user is authorised to get the Saved Object referenced in the Event Log whenever the find api is called.
2020-08-11 15:00:02 +01:00
Mikhail Shustov 88c0631344
Update @typescript-eslint to ensure compatibility with TypeScript v3.9 (#74091)
* bump @typescript-eslint deps

* update rules

* fix errors in pacakges

* fix src/

* fix x-pack

* fix test

* fix typings

* fix examples

* allow _ as prefix and suffix

* roll back prefix and suffix changes

* add eslint-plugin-eslint-comments

* report unused rules

* remove unused eslint comments from tests

* remove unused eslint comments 2nd pass

* remove unused eslint comments from src/

* remove unused comments in x-pack

* use no-script-url and no-unsanitized/property for ts files

* remove unused eslint comments

* eui/href-or-on-click removed when not complained

* no import/* rules for ts files

* cleanup

* remove the unused eslint-disable

* rollback unnecessary changes

* allow underscore prefix & sufix in type name

* update docs

* fix type error in enterprise search plugin mocks

* rename platform hack __coreProvider --> _coreProvider

* rollback space removal in src/core/public/legacy/legacy_service.test.ts

* fix naming convention in APM
2020-08-05 17:32:19 +02:00
Mike Côté 54e13ad6f6
Make the actions plugin support generics (#71439)
* Initial attempt at making the actions plugin support generics

* Export WebhookMethods

* Fix typings for registry

* Usage of Record<string, unknown>

* Apply feedback from Gidi

* Cleanup

* Fix validate_with_schema

* Cleanup pt2

* Fix failing tests

* Add generics to ActionType for ActionTypeExecutorResult

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-08-04 15:50:17 -04:00
Gidi Meir Morris f4104743e3
[Alerting] Control Alerts Management via feature controls & privileges (#72029)
This PR removes the alerting and actions ui privileges (alerting:show, actions:show, etc...) and instead relies on the standard Kibana feature control model to decide whether management displays the Alerts Management section under management.
2020-07-28 15:20:24 +01:00
Gidi Meir Morris 4abe864f10
Adds Role Based Access-Control to the Alerting & Action plugins based on Kibana Feature Controls (#67157)
This PR adds _Role Based Access-Control_ to the Alerting framework & Actions feature using  Kibana Feature Controls, addressing most of the Meta issue: https://github.com/elastic/kibana/issues/43994

This also closes https://github.com/elastic/kibana/issues/62438

This PR includes the following:

1. Adds `alerting` specific Security Actions (not to be confused with Alerting Actions) to the `security` plugin which allows us to assign alerting specific privileges to users of other plugins using the `features` plugin.
2. Removes the security wrapper from the savedObjectsClient in AlertsClient and instead plugs in the new AlertsAuthorization which performs the privilege checks on each api call made to the AlertsClient.
3. Adds privileges in each plugin that is already using the Alerting Framework which mirror (as closely as possible) the existing api-level tag-based privileges and plugs them into the AlertsClient.
4. Adds feature granted privileges arounds Actions (by relying on Saved Object privileges under the hood) and plugs them into the ActionsClient
5. Removes the legacy api-level tag-based privilege system from both the Alerts and Action HTTP APIs
2020-07-22 14:45:57 +01:00
Yuliia Naumenko 5c5d75f6b0
Removed filtering for Case owned ServiceNow actions from the Management UI and make it usable for Alerts. Added documentation. (#71579)
* Removed filtering for Case owned ServiceNow actions from the Management UI and make it usable for Alerts. Added documentation.

* extended docs

* Fixed docs

* fixed connector page

* Changed SN variables components

* Fixed issues

* fixed order

* Update docs/user/alerting/action-types/servicenow.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/servicenow.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/servicenow.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/servicenow.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/servicenow.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/servicenow.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/servicenow.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/servicenow.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* -

* fixed tests

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
2020-07-15 11:01:34 -07:00
James Gowdy a1e511a727
[ML] Changing all calls to ML endpoints to use internal user (#70487)
* [ML] Changing all calls to ML endpoints to use internal user

* updating alerting

* updating documentation

* [ML] Changing all calls to ML endpoints to use internal user

* updating alerting

* updating documentation

* fixing missed types

* adding authorization headers to endpoint calls

* correcting has privileges call

* updating security tests

* odd eslint error

* adding auth header to module setup

* fixing missing auth argument

* fixing delete DFA job permission checks

* removing debug test tag

* removing additional ml privilege checks

* adding authorization header to _evaluate

* updating alerting cluster client name

* code clean up

* changing authorizationHeader name

* updating alterting documentation

* fixing secondary credentials

* adding management links

* updating SIEM telemetry

* fixing merge conflicts

* granting access to index patterns

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-07-14 15:48:24 +01:00
Yuliia Naumenko 2009447ab8
Added help text where needed on connectors and alert actions UI (#69601)
* Added help text where needed on connectors and alert actions UI

* fixed ui form

* Added index action type examples, fixed slack link

* Fixed email connector docs and links

* Additional cleanup on email

* Removed autofocus to avoid twice link click for opening in the new page

* Extended documentation for es index action type

* Fixed tests

* Fixed doc link

* fixed due to comments

* fixed due to comments

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/actions/README.md

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/actions/README.md

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update x-pack/plugins/triggers_actions_ui/README.md

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/email.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/index.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Update docs/user/alerting/action-types/slack.asciidoc

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* Fixed due to comments

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
2020-07-13 19:53:37 -07:00
Christos Nasikas 1a81eb5c19
[SIEM][CASE] IBM Resilient Connector (#66385) 2020-07-10 02:23:20 +03:00
Pierre Gayvallet 648468dae1
Rename legacy ES mock accessors (#70432)
* rename legacy client mocks

* move legacy client mocks to legacy folder

* fix usages

* adapt new usages

* adapt new usages
2020-07-07 13:38:17 +02:00
Yuliia Naumenko 438e905800
Added UI validation when creating a Webhook connector with invalid URL (#70025)
* Added UI validation when creating a Webhook connector with invalid URL

* fixed tests

* Fixed due to comments

* fixed type check and extended error message for invalid URL

* Fixed whitelisting of URL

* fixed failing tests

* fixed str
2020-07-06 17:35:47 -07:00
Yuliia Naumenko 57915e1641
ServiceNow push to Incident generic implementation (supporting both Case specific and generic Alerts) (#68464)
* Draft ServiceNow generic implementation

* simple working servicenow incident per alert

* fixed running times

* rely on externalId for update incident on the next execution

* Added consumer to the action type to be able to split ServiceNow for Cases and Alerts

* Added subActions support for ServiceNow action form

* Basic version for Alerts part for ServiceNow

* Keep Case ServiceNow functionality working

* Revert changes on app_router

* Fixed type checks

* Fixed language check issues

* Fixed actions unit tests

* Fixed functional tests

* Fixed jest tests

* fixed tests

* Copied case mappings to alerting plugin

* made consumer optional

* Cleanup tests

* more cleanup

* Fixed jest tests and type checks

* fixed tests

* fixed servicenow validation tests

* Added ServiceNow unit tests

* Removed consumer for actions

* fixed client side isCaseOwned support

* fixed failing tests

* fixed jest tests

* Fixed URL validation

* fixed due to comments

* fixed tests

* fixed jest tests

* Fixed due to comments. Moved ServiceNow filtering in case plugin to server side

* fixed mock for ServiceNow

* fixed consumer config

* fixed test

* fixed type check

* Fixed jest test

* fixed type check
2020-07-06 16:38:45 -07:00
Patrick Mueller 5226ea2112
[Alerting] document requirements for developing new action types (#69164)
* [Alerting] document requirements for developing new action types

resolves https://github.com/elastic/kibana/issues/67864

Adding this to the actions README.md, it should be published as asciidocs at GA.
2020-07-02 23:27:40 -04:00
Tiago Costa 6c62c686cf
chore(NA): upgrade to lodash@4 (#69868)
* chore(NA): upgrade oss to lodash4

chore(NA): migrate cli, cli_plugin, cli_keystore,  dev, test_utils and apm src script to lodash4

chore(NA): missing file for cli plugin

chore(NA): add src core

chore(NA): es archiver and fixtures

chore(NA): try to fix functional test failure

chore(NA): migrate src/legacy entirely to lodash4 except src/legacy/core_plugins

chore(NA): move legacy core plugins to lodash4

chore(NA): upgrade optimize to lodash4

chore(NA): upgrade to lodash4 on advanced_settings, charts, console and dashboard

chore(NA): migrate to lodash4 on dev_tools, discover, embeddable, es_ui)shared, expressions, home plugins

chore(NA): upgrade data plugin to lodash4

chore(NA): upgrade usage_collection, ui_actions, tile_map, telemtry, share, saved_objects, saved_objects_management, region_map and navigation to lodash4

chore(NA): missing data upgrades to lodash4

Revert "chore(NA): upgrade usage_collection, ui_actions, tile_map, telemtry, share, saved_objects, saved_objects_management, region_map and navigation to lodash4"

This reverts commit 137055c5fed2fc52bb26547e0bc1ad2e3d4fe309.

Revert "Revert "chore(NA): upgrade usage_collection, ui_actions, tile_map, telemtry, share, saved_objects, saved_objects_management, region_map and navigation to lodash4""

This reverts commit f7e73688782998513d9fb6d7e8f0765e9beb28d1.

Revert "chore(NA): missing data upgrades to lodash4"

This reverts commit 92b85bf947a89bfc70cc4052738a6b2128ffb076.

Revert "chore(NA): upgrade data plugin to lodash4"

This reverts commit 88fdb075ee1e26c4ac979b6681d8a2b002df74c6.

chore(NA): upgrade idx_pattern_mgt, input_control_vis, inspector, kbn_legacy, kbn_react, kbn_usage_collections, kbn_utils, management and maps_legacy to lodash4

chore(NA): map src plugin data to lodash3

chore(NA): missing lodash.clonedeep dep

chore(NA): change packages kbn-config-schema deps

chore(NA): update renovate config

chore(NA): upgrade vis_type plugins to lodash4

chore(NA): move vis_type_vislib to lodash3

chore(NA): update visualizations and visualize to lodash4

chore(NA): remove lodash 3 types from src and move test to lodash4

chore(NA): move home, usage_collection and management to lodash 3

Revert "chore(NA): move home, usage_collection and management to lodash 3"

This reverts commit f86e8585f02d21550746569af54215b076a79a3d.

chore(NA): move kibana_legacy, saved_objects saved_objects_management into lodash3

chore(NA): update x-pack test to mock lodash4

Revert "chore(NA): move kibana_legacy, saved_objects saved_objects_management into lodash3"

This reverts commit 2d10fe450533e1b36db21d99cfae3ce996a244e0.

* chore(NA): move x-pack and packages to lodash 4

* chore(NA): remove mention to lodash from main package.json

* chore(NA): remove helper alias for lodash4 and make it the default lodash

* chore(NA): fix last failing types in the repo

* chore(NA): fix public api

* chore(NA): fix types for agg_row.tsx

* chore(NA): fix increment of optimizer modules in the rollup plugin

* chore(NA): migrate `src/core/public/http/fetch.ts` (#5)

* omit undefined query props

* just remove merge usage

* fix types

* chore(NA): fixes for feedback from apm team

* chore(NA): recover old behaviour on apm LoadingIndeicatorContext.tsx

* chore(NA): fixes for feedback from watson

* Platform lodash4 tweaks (#6)

* chore(NA): fix types and behaviour on src/core/server/elasticsearch/errors.ts

* Canvas fixes for lodash upgrade

* [APM] Adds unit test for APM service maps transform (#7)

* Adds a snapshot unit test for getConnections and rearranges some code to make testing easier

* reverts `ArrayList` back to `String[]` in the painless script within `fetch_service_paths_from_trace_ids.ts`

* chore(NA): update yarn.lock

* chore(NA): remove any and use a real type for alerts task runner

Co-authored-by: Gidi Meir Morris <github@gidi.io>

* chore(NA): used named import for triggers_actions_ui file

* chore(NA): fix eslint

* chore(NA): fix types

* Delete most uptime lodash references.

* Simplify. Clean up types.

* [Uptime] Delete most uptime lodash references (#8)

* Delete most uptime lodash references.

* Simplify. Clean up types.

* chore(NA): add eslint rule to avoid using lodash3

* chore(NA): apply changes on feedback from es-ui team

* fix some types (#9)

* Clean up some expressions types.

* chore(NA): missing ts-expect-error statements

* Upgrade lodash 4 vislib (#11)

* replace lodash 3 with lodash 4 on vislib plugin

* Further changes

* further replacement of lodash3 to 4

* further work on upgrading to lodash 4

* final changes to update lodash

* chore(NA): upgrade data plugin to lodash4

chore(NA): upgrade data plugin public to lodash4

chore(NA): fix typecheck task

chore(NA): fix agg_config with hasIn

chore(NA): assign to assignIn and has to hasIn

chore(NA): upgrade data plugin server to lodash4

chore(NA): new signature for core api

fix(NA): match behaviour between lodash3 and lodash4 for set in search_source

* chore(NA): remove lodash3 completely from the repo

* chore(NA): fix x-pack/test/api_integration/apis/metrics_ui/snapshot.ts missing content

* chore(NA): fix lodash usage on apm

* chore(NA): fix typecheck for maps

* Patch lodash template (#12)

* Applying changes from https://github.com/elastic/kibana/pull/64985

* Using isIterateeCall, because it seems less brittle

* Also patching `lodash/template` and `lodash/fp/template`

* Reorganizing some files...

* Revising comment

* Ends up `_` is a function also... I hate JavaScript

Co-authored-by: Pierre Gayvallet <pierre.gayvallet@gmail.com>
Co-authored-by: Josh Dover <me@joshdover.com>
Co-authored-by: Clint Andrew Hall <clint.hall@elastic.co>
Co-authored-by: Oliver Gupte <ogupte@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Gidi Meir Morris <github@gidi.io>
Co-authored-by: Justin Kambic <justin.kambic@elastic.co>
Co-authored-by: Stratoula Kalafateli <stratoula1@gmail.com>
Co-authored-by: Luke Elmers <luke.elmers@elastic.co>
Co-authored-by: Brandon Kobel <brandon.kobel@gmail.com>
Co-authored-by: kobelb <brandon.kobel@elastic.co>
2020-07-03 01:30:13 +01:00
Pierre Gayvallet fe1c508d8d
Move and rename legacy elasticsearch client (#69797)
* move last snapshot to inline

* move legacy files to legacy subfolder

* move request types out of legacy

* export Headers from http instead of elasticsearch

* renaming - first pass

* renaming - second pass

* fix core mocks

* adapt new calls

* update generated doc

* fix IT test mocks

* fix new usages
2020-06-29 17:43:31 +02:00
Ahmad Bamieh 266f853b0b
[Telemetry] Collector Schema (#64942)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-06-27 02:52:26 +03:00
Josh Dover 200957bb63
Add plugin API for customizing the logging configuration (#68704) 2020-06-23 14:45:47 -06:00
Pierre Gayvallet d2006ea8a0
savedObjects: add score to repository.find results (#68894)
* add `score` to repository.find results

* update generated doc

* fix FTR result set

* remove score from exports

* fix FTR for find API

* fix label

* fix tsdoc
2020-06-18 11:39:25 +02:00
Gidi Meir Morris 833ce08259
[Alerting] Adds API for executing actions immediately (#68897)
This PR adds an API to the AlertsClient which allows users to execute actions immediately, rather than via TaskManager.

This also moves the TaskManager based execution to a new api on ActionsClient along side the immediate execution.
2020-06-16 09:33:10 +01:00
Mikhail Shustov f593455a62
Bump TypeScript to v3.9 (#67666)
* add babel support for export type

* bump ts version to 3.9.3

* rebuild kbn-pm

* bump typescript-eslint

* fix error in security plugin UI

* check export as works

* fix app migration type

* use correct test subj attribute

* fix errors from the old PR

* embeddable is already passed in props

* explicitly define type of fetch

* add some types for viz

* fix fetch type p.2

* add null to allow spreading without type errors due to override

* add type guard to fix type error

* cast to any, since cannot assign unknown

* add timestamp to known types

* fix type error in fetch

* fix type error. id is always defined in attibutes

* declare a type

* move ts-ignore to the lines with errors

* declare tuple type explicitly

* mute type error. cannot assign unknown

* fix errors. id is always defined

* fix error type

* fix override errors. id is always defined

* fix error. extends any doesn't work anymore

* fix type error. type is always defined

* env doesn't always contain values

* fix type error

* cast to string

* add: logs is already declared in getNodeLogsUrl

* state is already  passed in props

* fix some errors in timelion

* number of fragments is always defined

* 'absolute' is not just string, but value

* TEMP: option is always defined

* always true if cast to promise manually

* both props are always defined

* explicitly define returned SO type

* workaround type

* bump tslib to be compatible with ts v3.9

* test private property

* rebuild kbn-pm

* Fix ts errors for beats management

* Fix type inference broken by the TS 3.9 upgrade

* Fix ingest manager saved object attributes typings

* Fix TS errors in cross_cluster_replication and index_management.

* Fix TS error in Watcher.

* roll back colorRange wrong type

* fix security plugin types

* TypeScript 3.9 fixes for APM

* Fix ColorRange types.

* fix actions & alerts errors. ByGidi

* fix lists error

* More APM fixes

* Remove paramaterization from `removeEmpty in agent config SettingsPage component (it's only used there and doesn't need to be parameterized.)
* Add option chain for case in registerTransactionDurationAlertType
* Cast `overallValue` in transform_metrics_chart
* Use more specific type for custom link filters
* Add more option chaining for local UI filters buckets response
* Remove unused parameters from routes
* Fix getProjection type parameter
* Use destructuring in serviceNodesLocalFiltersRoute to hide `never` error
* Revert `UnionToIntersection` change in `AggregationResponseMap`

Fixes #67804.

* fix platform type error

* Fix visualizations types.

* Fix data plugin types.

* bump TS version to 3.9.5

* Fix telemetry TS errors

* Fix dashboard code

* Adding Canvas Fixes for TS 3.9

* Fix case and security_solution types

* roll back to the old export syntax. new one might cause problems in api-extractor

* update docs

* Fix timelion code

* Fix meta

* Fix types

* fix type errors om ingest_manager

* bump babel deps

* enable private props & methods syntax

* update kbn-pm dist

* whitelist 0BSD license

* use @babel/plugin-proposal-private-methods in default set as well

* disable new babel plugins

* Revert "disable new babel plugins"

This reverts commit 04d959431d.

* cleanup security_solution types

* Fixes type error for newer TypeScript

* update docs

Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
Co-authored-by: Felix Stürmer <stuermer@weltenwort.de>
Co-authored-by: CJ Cenizal <cj@cenizal.com>
Co-authored-by: Larry Gregory <larry.gregory@elastic.co>
Co-authored-by: Nathan L Smith <smith@nlsmith.com>
Co-authored-by: Walter Rafelsberger <walter@elastic.co>
Co-authored-by: Luke Elmers <luke.elmers@elastic.co>
Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
Co-authored-by: Tim Roes <tim.roes@elastic.co>
Co-authored-by: Clint Andrew Hall <clint.hall@elastic.co>
Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com>
Co-authored-by: FrankHassanabad <frank.hassanabad@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-06-11 10:04:09 +02:00
Xavier Mouligneau bc7655a80f
moving to jira to a gold license (#67178)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-06-05 12:34:18 -04:00
Yuliia Naumenko ce45dad8b6
Changed alerting API endpoints urls, bodies and params to follow Kibana STYLEGUIDE (#66838)
* Changed alerting API endpoints urls, bodies and params to follow Kibana STYLEGUIDE

* Changed alerting REST API to keep the pattern 'alerts/alert/{id}'

* fixed tests

* fixed tests

* Fixed jest tests

* Renamed plugin from alerting to alerts

* fixed tests

* fixed tests

* Fixed alert type check error

* Fixed find api

* fixed type checks

* fixed tests security issues

* Fixed view in app

* -

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-06-01 18:45:36 -07:00
Yuliia Naumenko 1d5933b9a6
Changed AlertsClient to use ActionsClient instead of direct interaction with the action saved objects (#67562) 2020-05-29 09:40:46 -07:00
Mikhail Shustov 4040c3090b
Mark elasticsearch client exposed via request context as deprecated (#67319)
* add legacy prefix for es client exposed via request handler context

* update src/plugins

* update core mocks and tests

* update test plugins

* update xpack plugins

* include x-pack/mocks.ts

* update after master merge

* update docs

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-05-27 19:00:16 +02:00