Commit graph

450 commits

Author SHA1 Message Date
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
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
Nicolas Chaulet 441a0d4ec9
[Fleet] Move ingestManager plugin to fleet (#82886) 2020-11-09 11:07:04 -05:00
John Schulz 3e211e938b
[Ingest Manager] Unify install* under installPackage (#82916)
## Summary

  * Add `installPackage` with `installSource` param, to provide a single interface the `install*` functions.
    ```diff
    -    const res = await installPackageFromRegistry({
    +    const res = await installPackage({
    +      installSource: 'registry',
    ```
    and
    ```diff
    -    const res = await installPackageByUpload({
    +    const res = await installPackage({
    +      installSource: 'upload',
    ```
  * Push some repeated work (`install`, `removable`) from `install*` into `_installPackage`. Which also simplifies its interface.

### installPackage

For now `installPackage` checks the `installSource` and calls the same `install*` functions to prevent any change in behavior but there's still a lot of overlap between `installPackageFromRegistry` & `installPackageByUpload`. I think we can bring them together into `installPackage` using the same branching on `installSource`.

### local checks with curl
<details><summary>curl request/responses for happy path:</summary>

```
## zip:
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_0.1.4.zip -H 'kbn-xsrf: xyz' -H 'Content-Type: application/zip'
{"response":[{"id":"apache-Logs-Apache-Dashboard-ecs","type":"dashboard"},{"id":"apache-Metrics-Apache-HTTPD-server-status-ecs","type":"dashboard"},{"id":"Apache-HTTPD-CPU-ecs","type":"visualization"},{"id":"Apache-HTTPD-Hostname-list-ecs","type":"visualization"},{"id":"Apache-HTTPD-Load1-slash-5-slash-15-ecs","type":"visualization"},{"id":"Apache-HTTPD-Scoreboard-ecs","type":"visualization"},{"id":"Apache-HTTPD-Total-accesses-and-kbytes-ecs","type":"visualization"},{"id":"Apache-HTTPD-Uptime-ecs","type":"visualization"},{"id":"Apache-HTTPD-Workers-ecs","type":"visualization"},{"id":"Apache-access-unique-IPs-map-ecs","type":"visualization"},{"id":"Apache-browsers-ecs","type":"visualization"},{"id":"Apache-error-logs-over-time-ecs","type":"visualization"},{"id":"Apache-operating-systems-ecs","type":"visualization"},{"id":"Apache-response-codes-of-top-URLs-ecs","type":"visualization"},{"id":"Apache-response-codes-over-time-ecs","type":"visualization"},{"id":"Apache-HTTPD-ecs","type":"search"},{"id":"Apache-access-logs-ecs","type":"search"},{"id":"Apache-errors-log-ecs","type":"search"}]}

## Uploaded packages can be deleted as expected:
curl -X DELETE -u elastic:changeme http://localhost:5601/api/fleet/epm/packages/apache-0.1.4 -H 'kbn-xsrf: xxx'
{"response":[{"id":"apache-Logs-Apache-Dashboard-ecs","type":"dashboard"},{"id":"apache-Metrics-Apache-HTTPD-server-status-ecs","type":"dashboard"},{"id":"Apache-HTTPD-CPU-ecs","type":"visualization"},{"id":"Apache-HTTPD-Hostname-list-ecs","type":"visualization"},{"id":"Apache-HTTPD-Load1-slash-5-slash-15-ecs","type":"visualization"},{"id":"Apache-HTTPD-Scoreboard-ecs","type":"visualization"},{"id":"Apache-HTTPD-Total-accesses-and-kbytes-ecs","type":"visualization"},{"id":"Apache-HTTPD-Uptime-ecs","type":"visualization"},{"id":"Apache-HTTPD-Workers-ecs","type":"visualization"},{"id":"Apache-access-unique-IPs-map-ecs","type":"visualization"},{"id":"Apache-browsers-ecs","type":"visualization"},{"id":"Apache-error-logs-over-time-ecs","type":"visualization"},{"id":"Apache-operating-systems-ecs","type":"visualization"},{"id":"Apache-response-codes-of-top-URLs-ecs","type":"visualization"},{"id":"Apache-response-codes-over-time-ecs","type":"visualization"},{"id":"Apache-HTTPD-ecs","type":"search"},{"id":"Apache-access-logs-ecs","type":"search"},{"id":"Apache-errors-log-ecs","type":"search"}]}

## Now upload
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_0.1.4.tar.gz -H 'kbn-xsrf: xyz' -H 'Content-Type: application/gzip'
{"response":[{"id":"apache-Metrics-Apache-HTTPD-server-status-ecs","type":"dashboard"},{"id":"apache-Logs-Apache-Dashboard-ecs","type":"dashboard"},{"id":"Apache-access-unique-IPs-map-ecs","type":"visualization"},{"id":"Apache-HTTPD-CPU-ecs","type":"visualization"},{"id":"Apache-HTTPD-Load1-slash-5-slash-15-ecs","type":"visualization"},{"id":"Apache-response-codes-over-time-ecs","type":"visualization"},{"id":"Apache-HTTPD-Workers-ecs","type":"visualization"},{"id":"Apache-HTTPD-Hostname-list-ecs","type":"visualization"},{"id":"Apache-error-logs-over-time-ecs","type":"visualization"},{"id":"Apache-HTTPD-Scoreboard-ecs","type":"visualization"},{"id":"Apache-HTTPD-Uptime-ecs","type":"visualization"},{"id":"Apache-operating-systems-ecs","type":"visualization"},{"id":"Apache-HTTPD-Total-accesses-and-kbytes-ecs","type":"visualization"},{"id":"Apache-browsers-ecs","type":"visualization"},{"id":"Apache-response-codes-of-top-URLs-ecs","type":"visualization"},{"id":"Apache-access-logs-ecs","type":"search"},{"id":"Apache-errors-log-ecs","type":"search"},{"id":"Apache-HTTPD-ecs","type":"search"},{"id":"logs-apache.error-0.1.4","type":"ingest_pipeline"},{"id":"logs-apache.access-0.1.4","type":"ingest_pipeline"},{"id":"logs-apache.error","type":"index_template"},{"id":"metrics-apache.status","type":"index_template"},{"id":"logs-apache.access","type":"index_template"}]}
```
</details>

<details><summary>curl request/responses for archive errors:</summary>

```
## Wrong content type:
### tar.gz with application/zip:
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_0.1.4.tar.gz -H 'kbn-xsrf: xyz' -H 'Content-Type: application/zip'
{"statusCode":400,"error":"Bad Request","message":"Error during extraction of package: Error: end of central directory record signature not found. Assumed content type was application/zip, check if this matches the archive type."}

### zip with application/gzip:
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_0.1.4.zip -H 'kbn-xsrf: xyz' -H 'Content-Type: application/gzip'
{"statusCode":400,"error":"Bad Request","message":"Archive seems empty. Assumed content type was application/gzip, check if this matches the archive type."}

## Invalid packages
### Two top-level directories:
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_invalid_two_toplevels_0.1.4.zip -H 'kbn-xsrf: xyz' -H 'Content-Type: application/zip'
{"statusCode":400,"error":"Bad Request","message":"Package contains more than one top-level directory."}

### No manifest:
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_invalid_no_manifest_0.1.4.zip -H 'kbn-xsrf: xyz' -H 'Content-Type: application/zip'
{"statusCode":400,"error":"Bad Request","message":"Package must contain a top-level manifest.yml file."}

### Invalid YAML in manifest:
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_invalid_manifest_invalid_yaml_0.1.4.zip -H 'kbn-xsrf: xyz' -H 'Content-Type: application/zip'
{"statusCode":400,"error":"Bad Request","message":"Could not parse top-level package manifest: YAMLException: bad indentation of a mapping entry at line 2, column 7:\n      name: apache\n          ^."}

### Mandatory field missing in manifest:
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_invalid_manifest_missing_field_0.1.4.zip -H 'kbn-xsrf: xyz' -H 'Content-Type: application/zip'
{"statusCode":400,"error":"Bad Request","message":"Invalid top-level package manifest: one or more fields missing of name, version, description, type, categories, format_version"}

### Top-level directory doesn't match name and version from manifest:
curl -X POST -u elastic:changeme http://localhost:5601/api/fleet/epm/packages --data-binary @$KIBANA_HOME/x-pack/test/ingest_manager_api_integration/apis/fixtures/direct_upload_packages/apache_invalid_toplevel_mismatch_0.1.4.zip -H 'kbn-xsrf: xyz' -H 'Content-Type: application/zip'
{"statusCode":400,"error":"Bad Request","message":"Name thisIsATypo and version 0.1.4 do not match top-level directory apache-0.1.4"}
```
</details>

#### TS type check examples on `installPackage`
<details><summary>screenshots</summary>

<img width="379" alt="Screen Shot 2020-11-08 at 4 00 14 PM" src="https://user-images.githubusercontent.com/57655/98484251-1d1e9f80-21dc-11eb-93f8-601036b45355.png">
<img width="890" alt="Screen Shot 2020-11-08 at 4 00 21 PM" src="https://user-images.githubusercontent.com/57655/98484252-1db73600-21dc-11eb-88d1-5faa498f94fc.png">
<img width="396" alt="Screen Shot 2020-11-08 at 4 01 06 PM" src="https://user-images.githubusercontent.com/57655/98484253-1db73600-21dc-11eb-8e2a-10a5762f4a95.png">
<img width="441" alt="Screen Shot 2020-11-08 at 4 01 25 PM" src="https://user-images.githubusercontent.com/57655/98484254-1db73600-21dc-11eb-9d9a-c1620dcad11e.png">
<img width="879" alt="Screen Shot 2020-11-08 at 4 02 54 PM" src="https://user-images.githubusercontent.com/57655/98484255-1db73600-21dc-11eb-8f36-7da3e9256feb.png">

</details>

### Checklist
- [ ] [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
2020-11-09 05:42:45 -05:00
Nicolas Chaulet 8560b2dcc0
[Fleet] Make stream id unique in agent policy (#82447) 2020-11-08 18:51:31 -05:00
John Schulz e8ec392a94
Move single use function in line (#82885)
## Summary

 * Function rename to follow existing get/fetch convention
    ```diff
    - export async function loadRegistryPackage(
    + export async function getRegistryPackage(
    ```
 * Moved `unpackRegistryPackageToCache` into `getRegistryPackage`
    * In my opinion, those three/four statements are more clear than the previous name
    * It isn't used anywhere else
2020-11-06 17:21:29 -05:00
John Schulz 715d43be35
[Ingest Manager] Move cache functions to from registry to archive (#82871)
## Summary

Moving the memory store functions to `archive/cache.ts` to better express their role. 

They are archive-related functions. The registry is just one possible source of an archive/assets. Also considered moving to `assets`, but can always come back to that.

`deletePackageCache` undoes side-effects from `unpackArchiveToCache` so put them in the same file
2020-11-06 15:15:22 -05:00
John Schulz b19a342def
Move parseAndVerify* functions to validation.ts (#82845)
## Summary

Basic cut-and-paste of `parseAndVerify*` functions from `archive/index.ts` to `archive/validation.ts`.

Should be easier to mock now, replace later, etc.
2020-11-06 12:14:03 -05:00
John Schulz 82a8302243
[Ingest Manager] Remove dupe code between two unpack*ToCache fns (#82801)
## Summary

Update `unpackRegistryPackageToCache` to call `unpackArchiveToCache` instead of duplicating much of it.

Now an archive is iterated & put in cache via the same function regardless of its initial source.
2020-11-06 11:26:12 -05:00
Sonja Krause-Harder 1046fc299c
[Ingest Manager] Add tests to verify field parsing behavior. (#82809)
* Add tests to verify field parsing behavior.

* Verify behavior for multiple field redefinitions.
2020-11-06 13:16:03 +01:00
John Schulz ca04175ae9
Combine related getBuffer* functions. Add tests (#82766)
## Summary
Move logic from `getBufferExtractorForContentType` into `getBufferExtractor` & change the interface so one function can be used.

### Diff showing old vs new call
```diff
-  getBufferExtractorForContentType(contentType);
+  getBufferExtractor({ contentType });
```
```diff
-  getBufferExtractor(archivePath);
+  getBufferExtractor({ archivePath });
```

### 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
2020-11-05 15:29:33 -05:00
Corey Robertson 64371392b0
[Fleet] Remove asterix from test file name (#82721)
* Revert "Revert "[Fleet] Allow snake cased Kibana assets (#77515)" (#82706)"

This reverts commit bc05e79b85.

* Rename test index pattern
2020-11-05 15:06:31 -05:00
Corey Robertson bc05e79b85
Revert "[Fleet] Allow snake cased Kibana assets (#77515)" (#82706)
This reverts commit 1cd477a793.
2020-11-05 07:19:36 -05:00
Jonathan Buttner f8f163c1b7
Moving reinstall function outside of promise.all (#82672) 2020-11-04 20:24:40 -05:00
Corey Robertson 1cd477a793
[Fleet] Allow snake cased Kibana assets (#77515)
* Properly handle kibana assets with underscores in their path

* Recomment test

* Fix type check

* Don't install index patterns that are reserved

* Introduce SavedObjectType to use on AssetReference

* Fix Test

* Update install.ts

Use new `dataTypes` const which replaced `DataType` enum

* Update install.ts

Remove unused `indexPatternTypes` from outer scope

* Update install.ts

fix (?) bad updates from before where new/correct value was used but result wasn't exported

* Update install.ts

* Update install.ts

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: John Schulz <john.schulz@elastic.co>
2020-11-04 14:44:46 -05:00
John Schulz c3f402433b
[Ingest Manager] Switch DefaultPackage enum to approach from #82188 (#82512)
## Summary

Follow pattern from #82188. Same behavior as now. Stronger type safety.

 * `defaultPackages` is runtime value (JS object)
 * `DefaultPackage` is TS type (`typeof defaultPackages`)
 * `ValueOf<DefaultPackage>` is TS union type `'system' | 'endpoint'`
 * Can access values directly as `defaultPackages.System` (JS) or `DefaultPackage['System']` (TS)
2020-11-04 09:45:27 -05:00
John Schulz 13dae5e5fa
Switch to new 'as const' + typeof + ValueOf approach (#82499)
## Summary

Follow pattern from #82188. Same behavior as now. Stronger type safety.

 * `installationSources` is runtime value (JS object)
 * `InstallationSource` is TS type (`typeof installationSources`)
 * `ValueOf<InstallationSource>` is TS union type `'installed' | 'not_installed'`
 * Can access values directly as `installationSources.Installed` (JS) or `InstallationSource['Installed']` (TS)
2020-11-03 17:56:06 -05:00
John Schulz e54d2c0f11
[Ingest Manager] Replace logs/metrics strings with const (#82424)
## Summary

Use new runtime & type values added in https://github.com/elastic/kibana/pull/82231 (related to #82188 ) instead of strings. Same results. Stronger type safety.

Some before/after pics below:

<img width="680" alt="Screen Shot 2020-11-03 at 6 40 04 AM" src="https://user-images.githubusercontent.com/57655/97989501-9ff2c500-1dac-11eb-8a2d-96ddadfe2477.png">
<img width="525" alt="Screen Shot 2020-11-03 at 6 40 19 AM" src="https://user-images.githubusercontent.com/57655/97989503-a08b5b80-1dac-11eb-97ee-371a0487fbd3.png">

<img width="790" alt="Screen Shot 2020-11-03 at 7 47 42 AM" src="https://user-images.githubusercontent.com/57655/97989505-a08b5b80-1dac-11eb-9db9-54a2719a85b2.png">
<img width="738" alt="Screen Shot 2020-11-03 at 7 47 34 AM" src="https://user-images.githubusercontent.com/57655/97989504-a08b5b80-1dac-11eb-8d1d-692feafd5fe3.png">


<img width="778" alt="Screen Shot 2020-11-03 at 7 54 17 AM" src="https://user-images.githubusercontent.com/57655/97989507-a123f200-1dac-11eb-879d-ab9be4e060eb.png">
<img width="813" alt="Screen Shot 2020-11-03 at 7 54 45 AM" src="https://user-images.githubusercontent.com/57655/97989508-a123f200-1dac-11eb-8725-c44068d6b233.png">
2020-11-03 15:06:48 -05:00
John Schulz 58a5b1f5b9
[IngestManager] Convert AgentPolicyStatus from enum to type (#82186)
## Summary

Expands on pattern added in https://github.com/elastic/kibana/pull/82188

Split `enum AgentPolicyStatus` into `type AgentPolicyStatus` and JS value `agentPolicyStatuses`. Still have type safety

<img width="604" alt="Screen Shot 2020-11-02 at 6 05 29 PM" src="https://user-images.githubusercontent.com/57655/97929572-7ba8d100-1d37-11eb-88db-3785381ebfbf.png">
<img width="931" alt="Screen Shot 2020-11-02 at 6 08 41 PM" src="https://user-images.githubusercontent.com/57655/97929574-7ba8d100-1d37-11eb-8db5-ee5d07d171c6.png">
<img width="605" alt="Screen Shot 2020-11-02 at 6 09 02 PM" src="https://user-images.githubusercontent.com/57655/97929575-7c416780-1d37-11eb-8297-e90ffe695161.png">
2020-11-03 09:43:21 -05:00
John Schulz a49473b05e
[Ingest Manager] Replace AgentAssetType enum with new approach (#82387)
## Summary

Expands on pattern added in #82188

`AgentAssetType` `enum` is only used as part of a single type definition
2020-11-03 08:37:31 -05:00
John Schulz c2af3aa5d3
[Ingest Manager] Add code required for APM (#68043)
# Using APM for server traces
Kibana ships with the [Elastic APM Node.js Agent](https://github.com/elastic/apm-agent-nodejs) built-in for debugging purposes.  We don't currently merge this to release builds, but it can be very helpful to diagnose or confirm the flow & timing of a request traveling through multiple services. 

To use it in Fleet, 
  1. Import the shared apm instance as needed (HTTP handler, service layer, etc)
    `import { apm } from '../path/to/ingest_manager/server'`
  1. add <code>apm.startTransaction</code> and/or <code>apm.startSpan</code></summary>
      - One example from `reporting` plugin: 
      a537f9af50/x-pack/plugins/reporting/server/export_types/png/execute_job/index.ts (L30-L31)
      - <details><summary>an example for <code>startTransaction</code></summary> <a href="https://www.elastic.co/guide/en/apm/agent/nodejs/current/transaction-api.html"><code>Transaction</code> docs</a><p><img width="700" alt="Screen Shot 2020-11-02 at 9 06 50 AM" src="https://user-images.githubusercontent.com/57655/97877262-e7b11800-1cea-11eb-9883-aeb4fb6b4554.png"></details>
      - <details><summary>an example for <code>startSpan</code></summary><a href="https://www.elastic.co/guide/en/apm/agent/nodejs/current/span-api.html"><code>Span</code> docs</a><p><img width="1008" alt="Screen Shot 2020-06-02 at 9 15 42 PM" src="https://user-images.githubusercontent.com/57655/83584866-590b5580-a516-11ea-8133-286353000d5c.png"></details>
  1. start Kibana with APM enabled (as described in [Instrumenting with Elastic APM](https://github.com/elastic/kibana/blob/master/docs/developer/getting-started/debugging.asciidoc#instrumenting-with-elastic-apm))
      - <details><summary>via env variable or <code>config/apm.dev.js</code></summary>
        <code>ELASTIC_APM_ACTIVE=true yarn start</code>
        <p>or <code>module.exports = {
          active: true,
        };</code>
        </details>
      - By default traces are sent to a remote server, but you can send to a local APM by setting the <code>serverUrl</code> value in  <code>config/apm.dev.js</code>
  1. Run the code where you added the annotations e.g. make an HTTP request
  1. Go to `/app/apm#/traces` and see your trace
    search filter by host, transaction result, etc
      <details><summary>example screenshot</summary><img width="1932" alt="Screen Shot 2020-05-14 at 11 00 30 AM (1)" src="https://user-images.githubusercontent.com/57655/97907678-a123e380-1d13-11eb-93bf-bb22d189fb25.png"></details>
### Checklist

Delete any items that are not applicable to this PR.

- [x] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
2020-11-03 06:18:29 -05:00
John Schulz e916a1d70c
[Ingest Manager] Replace OutputType enum with separate type and runtime object (#82230)
## Summary

Expands on pattern added in https://github.com/elastic/kibana/pull/82188

### rutime value is now `outputType.Elasticsearch` (lowercase b/c JS value)

```diff
-  type: OutputType.Elasticsearch,
+  type: outputType.Elasticsearch,
```

<img width="821" alt="Screen Shot 2020-11-02 at 4 46 24 PM" src="https://user-images.githubusercontent.com/57655/97923244-ae4ccc80-1d2b-11eb-9cc9-d98636ca9a40.png">
<img width="594" alt="Screen Shot 2020-11-02 at 4 46 35 PM" src="https://user-images.githubusercontent.com/57655/97923245-aee56300-1d2b-11eb-917e-483a68280e8e.png">
<img width="429" alt="Screen Shot 2020-11-02 at 4 46 47 PM" src="https://user-images.githubusercontent.com/57655/97923246-aee56300-1d2b-11eb-964a-37b496211167.png">

### TS type is `OutputType`
#### Can get union type of values with `ValueOf<OutputType>`
<img width="455" alt="Screen Shot 2020-11-02 at 4 47 31 PM" src="https://user-images.githubusercontent.com/57655/97923247-aee56300-1d2b-11eb-8492-40a9367ad90e.png">

#### Or access as `OutputType['Elasticsearch']`
2020-11-03 06:15:45 -05:00
John Schulz 15e446d4e3
Replace DataType enum with type & add runtime dataTypes (#82231)
## Summary

Expands on pattern added in https://github.com/elastic/kibana/pull/82188

Replace `enum DataType` with TS type `DataType` & runtime JS `dataTypes`
```diff
- export enum DataType {
-  logs = 'logs',
-  metrics = 'metrics',
-}
+ export const dataTypes = {
+  Logs: 'logs',
+  Metrics: 'metrics',
+ } as const;
+ export type DataType = typeof dataTypes;
```

<img width="513" alt="Screen Shot 2020-11-02 at 5 13 56 PM" src="https://user-images.githubusercontent.com/57655/97926339-f5898c00-1d30-11eb-8935-92aad936aeea.png">
<img width="774" alt="Screen Shot 2020-11-02 at 5 14 05 PM" src="https://user-images.githubusercontent.com/57655/97926341-f5898c00-1d30-11eb-8d68-b39e2904cf85.png">
<img width="780" alt="Screen Shot 2020-11-02 at 5 19 50 PM" src="https://user-images.githubusercontent.com/57655/97926342-f5898c00-1d30-11eb-9799-95d77bfc1757.png">
2020-11-02 19:09:55 -05:00
John Schulz f83a47b489
[IngestManager] Move RequiredPackage type near DefaultPackages (#82188)
## Summary

- [x] Move the `RequiredPackage` type to the same location as `DefaultPackages` so anyone looking at one will see the other as well
- [x] New approach to defining & using enum-like values. 

## The basic outline of the approach 
  1. Export a JS object `as const` from `common/constants/*` (expose runtime value)
    d66cf601bb/x-pack/plugins/ingest_manager/common/constants/epm.ts (L12-L15)
  1. Import that JS value and convert to a TS type as `type TSType = typeof jsValue` 
    <img width="484" alt="Screen Shot 2020-11-02 at 2 12 27 PM" src="https://user-images.githubusercontent.com/57655/97910756-2e693700-1d18-11eb-9605-e33ceb64e857.png"> 
  1. The values (right-hand side) of that type can be converted to a union type with `ValueOf<X>`
    <img width="557" alt="Screen Shot 2020-11-02 at 3 10 22 PM" src="https://user-images.githubusercontent.com/57655/97914250-99693c80-1d1d-11eb-9605-92379aa4db38.png">
  1. The values can be accessed as TS types `TSType['key']` or JS  `jsValue.key`

This way we
  - still get the readability of TS `enum`s
  - can choose to only import the types of values we need (compile time or runtime) 
  - use the TS utility types like `Pick`, `Omit`, etc

## More detail on 1
  * Value which can be access/iterated at runtime, e.g. `Object.values(requiredPackages)` or `requiredPackages.System`
  * narrows the type those exact values, not `string`
    <img width="823" alt="Screen Shot 2020-11-02 at 2 15 58 PM" src="https://user-images.githubusercontent.com/57655/97910538-e0ecca00-1d17-11eb-9153-71171e9fba75.png">
  * can't be modified (it's `readonly`) 
      <img width="443" alt="Screen Shot 2020-11-02 at 2 12 09 PM" src="https://user-images.githubusercontent.com/57655/97910753-2dd0a080-1d18-11eb-82d4-3fe635ba3071.png">
2020-11-02 16:21:50 -05:00
Tiago Costa 0eeaafa722
chore(NA): move into single pkg json (#80015)
* chore(NA): update gitignore to include first changes from moving into a single package.json

* chore(NA): update gitignore

* chore(NA): move all the dependencies into the single package.json and apply changes to bootstrap

* chore(NA): fix types problems after the single package json

* chore(NA): include code to find the dependencies used across the code

* chore(NA): introduce pure lockfile for install dependencies on build

* chore(NA): update clean task to not delete anything from xpack node_modules

* chore(NA): update gitignore to remove development temporary rules

* chore(NA): update notice file

* chore(NA): update jest snapshots

* chore(NA): fix whitelisted licenses to include a new specify form of an already included one

* chore(NA): remove check lockfile symlinks from child projects

* chore(NA): fix eslint and add missing declared deps on single pkg json

* chore(NA): correctly update notice

* chore(NA): fix failing jest test for storyshots.test.tsx

* chore(NA): fix cypress multi reporter path

* chore(NA): fix Project tests check

* chore(NA): fix problem with logic to detect used dependes on oss build

* chore(NA): include correct x-pack plugins dep discovery

* chore(NA): discover entries under dynamic requires on vis_type_timelion

* chore(NA): remove canvas

* test(NA): fix jest unit tests

* chore(NA): remove double react declaration from storyshot test file

* chore(NA): try removing isOSS check

* chore(NA): support for plugin development

* chore(NA): update logic to fix unit tests and typechecking

* chore(NA): support to run npm scripts in child kbn projects across all envs

* chore(NA): support github checks reporter on x-pack and remove cpy types as the package correctly provides them

* chore(NA): update cpy version

* chore(NA): include last kbn pm changes

* chore(NA): update style on build_production_projects.ts

* chore(NA): remove any cast fom telemetry opt in stats

* chore(NA): remove del and re-use rm -rf again

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-02 21:18:52 +00:00
Sandra Gonzales f2bf8c9ea7
[Fleet] add force flag to upgrade agents api (#82178)
* add force flag to upgrade agents api

* use 1.0.0 as version that wont match to see if test passes
2020-11-02 13:11:53 -05:00
Thomas Watson 700225061a
Upgrade to hapi version 18 (#80468) 2020-11-02 13:18:00 +01:00
Greg Thompson 6fdc7eb1fa
Upgrade EUI to v30.1.1 (#81499)
* eui to v30.0.0

* removed unused RecentLinks component

* update compressed -> display prop

* euiformrow compressed -> display

* euipopover remove withtitle

* euibuttongroup prop updates

* remove euibuttontoggle

* src snapshot updates

* tutorial euibuttongroup update

* x-pack snapshot updates

* euibuttongroup test updates

* TODO

* misc. js file updates

* remove euinavdrawer scss references

* translation removals

* more x-pack snapshot updates

* update data-test-subj lookup

* icons logoAMP -> logoObservability

* cypress selector updates

* update euibuttontoggle onchange, test interaction

* Fix auto-update toggle in Visualize

* some more change -> click test updates

* idtoselectedmap change

* Fix feature table button group

* Remove empty SASS file

* Fix feature table button group II

* Using `compressed` to also dictate dual range row

* Fix a few security labels

* An ML fix

* Apply suggestions from code review

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>

* remove unused translation

* update view_type_toggle snapshot

* more snapshot updates

* eui to 30.1.0

* undo temp ts-ignore

* more x-pack snapshot updates

* eui to 30.1.1

* update feature privilege text

* Update x-pack/plugins/security/public/management/roles/edit_role/privileges/kibana/feature_table/sub_feature_form.tsx

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

* reuse i18n token

* Adapt log entry action button to new `minWidth` prop

* clean up label

* Combine auto apply strings into one

* ternary fix

* cases status useCallback

Co-authored-by: cchaos <caroline.horn@elastic.co>
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Joe Portner <5295965+jportner@users.noreply.github.com>
Co-authored-by: Felix Stürmer <stuermer@weltenwort.de>
2020-10-30 16:18:27 -06:00
Sandra Gonzales 81c0e126cc
[Fleet] fix duplicate ingest pipeline refs (#82078)
* check if pipeline refs for version already exists

* use the right version
2020-10-30 08:28:28 -04:00
Jen Huang 0094f7ea8e
[Fleet] Add experimental copy to upgrade agent(s) (#81410)
* Add experimental copy to upgrade agent(s)

* Adjust copy after review

* Fix string

* Adjust quotes
2020-10-29 13:26:51 -07:00
Sandra Gonzales 40fc944f30
add experimental when getting packages, add integration tests for side effects like recreation of index patterns (#81940) 2020-10-29 10:32:13 -04:00
Thomas Watson 1407f713e5
Update KibanaRequest to use the new WHATWG URL API (#80713) 2020-10-29 14:35:48 +01:00
nnamdifrankie f88c664461
[Fleet]: add log statement when deleting transform (#81927)
[Fleet]: add log statement when deleting transform
2020-10-28 15:35:53 -04:00
Nicolas Chaulet 415a90fb69
[Fleet] Rename ingestManager translations fleet (#81837) 2020-10-28 08:27:20 -04:00
Jen Huang 26cfda6f14
Add exact match filtering to in memory tables (#81539) 2020-10-23 13:23:31 -07:00
Jen Huang d3753ef33a
Allow default packages to be deleted from the default agent policy (#81535) 2020-10-22 15:04:35 -07:00
Jen Huang 17e1578869
[Fleet] Show beta message without scrolling (#81416)
* Show beta message without scrolling

* Update EUI var
2020-10-22 11:08:58 -07:00
Dan Panzarella c4b8f4c6c8
create detection index from create package policy (#79198) 2020-10-22 09:48:39 -04:00
Nicolas Chaulet 8e34546bf7
[Fleet] Fix agent action observable for long polling (#81376) 2020-10-21 20:52:22 -04:00
Jen Huang f4e5a3b8da
[Fleet] Show agent/package policy name on successful deletion (#81247)
* Return package policy name on successful deletion

* Return agent policy name on successful deletion
2020-10-21 10:58:53 -07:00
Jen Huang 71511765db
Show no agents found message when inactive and upgradable filters are applied (#81257) 2020-10-21 10:58:37 -07:00
Nicolas Chaulet b362ed1c6b
[Fleet] Fix POLICY_CHANGE action creation for new policy (#81236) 2020-10-20 23:25:58 -04:00
Candace Park b4864ab265
[Security Solution][Endpoint][Admin] Malware user notification checkbox (#78084)
includes migration for endpoint package policy 7.11
2020-10-20 22:42:15 -04:00
Nicolas Chaulet 770bc4c18f
[Fleet] Fix creation of POLICY_CHANGE action during 7.9 => 7.10 migration (#81041) 2020-10-20 14:55:52 -04:00
Larry Gregory bf0f8bbb42
Cleanup feature registration (#80909) 2020-10-20 12:53:43 -04:00
Sandra Gonzales 5da0cb3f90
[Ingest Manager] Fix for comparing versions with -SNAPSHOT suffix (#80742)
* remove -SNAPSHOT from kibana version

* add integration tests with -SNAPSHOT version of kibana

* update isAgentUpgradeable to compare version numbers only

* continue to send the kibana version with snapshot suffix to agent

* cleanup code into one function

* fix test to check for snapshot before adding suffix
2020-10-16 15:45:19 -04:00
nnamdifrankie cba7e58482
[Ingest]: ignore 404, check if there are transforms in results. (#80721)
[Ingest]: ignore 404, check if there are transforms in results
2020-10-16 11:28:29 -04:00
Jen Huang da2f2db646
Emit info log when using custom registry URL (#80768) 2020-10-15 16:57:45 -07:00
Nicolas Chaulet d10d70b2ac
[Ingest Manager] Better validation of registry urls (#80685) 2020-10-15 13:02:20 -04:00
Sandra Gonzales fb9ccc0e86
send kibana path to fleet (#80540) 2020-10-14 14:00:39 -04:00