diff --git a/package.json b/package.json index 3abd69a616682..62ace20c25ead 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,7 @@ "@types/lodash.clonedeep": "^4.5.4", "@types/react-grid-layout": "^0.16.7", "@types/recompose": "^0.30.5", + "@use-it/interval": "^0.1.3", "JSONStream": "1.3.5", "abortcontroller-polyfill": "^1.3.0", "angular": "^1.7.8", diff --git a/packages/kbn-test/src/kbn/users.js b/packages/kbn-test/src/kbn/users.js index 1d4a903d60cfa..c5f62b4a3e823 100644 --- a/packages/kbn-test/src/kbn/users.js +++ b/packages/kbn-test/src/kbn/users.js @@ -25,7 +25,7 @@ export const kibanaTestUser = { }; export const kibanaServerTestUser = { - username: env.TEST_KIBANA_SERVER_USER || 'kibana', + username: env.TEST_KIBANA_SERVER_USER || 'elastic', password: env.TEST_KIBANA_SERVER_PASS || 'changeme', }; diff --git a/src/cli/serve/serve.js b/src/cli/serve/serve.js index 1f7593d788304..44fb6bff77587 100644 --- a/src/cli/serve/serve.js +++ b/src/cli/serve/serve.js @@ -80,7 +80,7 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) { set('optimize.watch', true); if (!has('elasticsearch.username')) { - set('elasticsearch.username', 'kibana'); + set('elasticsearch.username', 'elastic'); } if (!has('elasticsearch.password')) { diff --git a/src/dev/typescript/projects.ts b/src/dev/typescript/projects.ts index 2f8894f77ebc1..c2349aef6a8d9 100644 --- a/src/dev/typescript/projects.ts +++ b/src/dev/typescript/projects.ts @@ -19,7 +19,6 @@ import glob from 'glob'; import { resolve } from 'path'; - import { REPO_ROOT } from '../constants'; import { Project } from './project'; diff --git a/src/legacy/ui/public/management/sections_register.js b/src/legacy/ui/public/management/sections_register.js index b25b381eef67b..20ed6242e9695 100644 --- a/src/legacy/ui/public/management/sections_register.js +++ b/src/legacy/ui/public/management/sections_register.js @@ -45,8 +45,16 @@ management.register('kibana', { icon: 'logoKibana', }); +management.register('ingest', { + display: i18n.translate('common.ui.management.dataIngestionDisplayName', { + defaultMessage: 'Data Ingestion', + }), + order: 30, + icon: 'logoAPM', +}); + management.register('logstash', { display: 'Logstash', - order: 30, + order: 40, icon: 'logoLogstash', }); diff --git a/src/test_utils/kbn_server.ts b/src/test_utils/kbn_server.ts index 1494c01166e20..8217eafe79eef 100644 --- a/src/test_utils/kbn_server.ts +++ b/src/test_utils/kbn_server.ts @@ -252,7 +252,7 @@ export function createTestServers({ return { startES: async () => { - await es.start(); + await es.start(get(settings, 'es.esArgs', [])); if (['gold', 'trial'].includes(license)) { await setupUsers({ diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 6d0da2f0b693d..ea7324e0f1c38 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -11,11 +11,13 @@ "xpack.dashboardMode": "legacy/plugins/dashboard_mode", "xpack.features": "plugins/features", "xpack.fileUpload": "legacy/plugins/file_upload", + "xpack.fleet": "legacy/plugins/fleet", "xpack.graph": "legacy/plugins/graph", "xpack.grokDebugger": "legacy/plugins/grokdebugger", "xpack.idxMgmt": "legacy/plugins/index_management", "xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management", "xpack.infra": "legacy/plugins/infra", + "xpack.ingest": "legacy/plugins/ingest", "xpack.kueryAutocomplete": "legacy/plugins/kuery_autocomplete", "xpack.lens": "legacy/plugins/lens", "xpack.licensing": "plugins/licensing", diff --git a/x-pack/index.js b/x-pack/index.js index 2b467d2525d9b..a9e69f3ed9819 100644 --- a/x-pack/index.js +++ b/x-pack/index.js @@ -43,6 +43,8 @@ import { transform } from './legacy/plugins/transform'; import { actions } from './legacy/plugins/actions'; import { alerting } from './legacy/plugins/alerting'; import { lens } from './legacy/plugins/lens'; +import { ingest } from './legacy/plugins/ingest'; +import { fleet } from './legacy/plugins/fleet'; module.exports = function (kibana) { return [ @@ -85,5 +87,7 @@ module.exports = function (kibana) { snapshotRestore(kibana), actions(kibana), alerting(kibana), + ingest(kibana), + fleet(kibana), ]; }; diff --git a/x-pack/legacy/plugins/fleet/common/constants/agent.ts b/x-pack/legacy/plugins/fleet/common/constants/agent.ts new file mode 100644 index 0000000000000..b204ab79f29d2 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/constants/agent.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const AGENT_TYPE_PERMANENT = 'PERMANENT'; +export const AGENT_TYPE_EPHEMERAL = 'EPHEMERAL'; +export const AGENT_TYPE_TEMPORARY = 'TEMPORARY'; + +export const AGENT_POLLING_THRESHOLD_MS = 30000; + +export const DEFAULT_AGENTS_PAGE_SIZE = 20; +export const AGENTS_PAGE_SIZE_OPTIONS = [20, 50, 100]; diff --git a/x-pack/legacy/plugins/fleet/common/constants/index.ts b/x-pack/legacy/plugins/fleet/common/constants/index.ts new file mode 100644 index 0000000000000..c18d67f38dbf9 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/constants/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { INDEX_NAMES } from './index_names'; +export { PLUGIN } from './plugin'; +export * from './agent'; +export const BASE_PATH = '/fleet'; + +export const DEFAULT_POLICY_ID = 'default'; diff --git a/x-pack/legacy/plugins/fleet/common/constants/index_names.ts b/x-pack/legacy/plugins/fleet/common/constants/index_names.ts new file mode 100644 index 0000000000000..b45194e48fa88 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/constants/index_names.ts @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const INDEX_NAMES = { + FLEET: '.kibana', +}; + +export const POLICY_NAMES = {}; diff --git a/x-pack/legacy/plugins/fleet/common/constants/plugin.ts b/x-pack/legacy/plugins/fleet/common/constants/plugin.ts new file mode 100644 index 0000000000000..5a482bc92f987 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/constants/plugin.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const PLUGIN = { + ID: 'fleet', +}; +export const CONFIG_PREFIX = 'xpack.fleet'; diff --git a/x-pack/legacy/plugins/fleet/common/constants/security.ts b/x-pack/legacy/plugins/fleet/common/constants/security.ts new file mode 100644 index 0000000000000..f27c45fc903b4 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/constants/security.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const REQUIRED_ROLES = ['fleet_admin']; +export const REQUIRED_LICENSES = ['standard', 'gold', 'trial', 'platinum']; +export const LICENSES = ['oss', 'basic', 'standard', 'gold', 'trial', 'platinum']; diff --git a/x-pack/legacy/plugins/fleet/common/return_types.ts b/x-pack/legacy/plugins/fleet/common/return_types.ts new file mode 100644 index 0000000000000..2d3efaf96535b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/return_types.ts @@ -0,0 +1,137 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export interface BaseReturnType { + error?: { + message: string; + code?: number; + }; + success: boolean; +} + +export interface ReturnTypeCreate extends BaseReturnType { + item: T; + action: 'created'; +} + +export interface ReturnTypeUpdate extends BaseReturnType { + item: T; + action: 'updated'; +} + +export interface ReturnTypeBulkCreate extends BaseReturnType { + results: Array<{ + item: T; + success: boolean; + action: 'created'; + error?: { + message: string; + code?: number; + }; + }>; +} + +// delete +export interface ReturnTypeDelete extends BaseReturnType { + action: 'deleted'; +} + +export interface ReturnTypeCheckin extends BaseReturnType { + action: 'checkin'; + actions: Array<{ + type: string; + data?: object; + }>; + policy: { [k: string]: any } | null; +} + +export interface ReturnTypeBulkDelete extends BaseReturnType { + results: Array<{ + success: boolean; + action: 'deleted'; + error?: { + message: string; + code?: number; + }; + }>; +} + +// upsert +export interface ReturnTypeUpsert extends BaseReturnType { + item: T; + action: 'created' | 'updated'; +} + +// upsert bulk +export interface ReturnTypeBulkUpsert extends BaseReturnType { + results: Array<{ + success: boolean; + action: 'created' | 'updated'; + error?: { + message: string; + code?: number; + }; + }>; +} + +export interface ReturnTypeBulkUnenroll extends BaseReturnType { + results: Array<{ + id: string; + success: boolean; + action: 'unenrolled'; + error?: { + message: string; + }; + }>; +} + +// list +export interface ReturnTypeList extends BaseReturnType { + list: T[]; + page: number; + total: number; + perPage: number; +} + +// get +export interface ReturnTypeGet extends BaseReturnType { + item: T; +} + +export interface ReturnTypeBulkGet extends BaseReturnType { + items: T[]; +} + +// action -- e.g. validate config block. Like ES simulate endpoint +export interface ReturnTypeAction extends BaseReturnType { + result: { + [key: string]: any; + }; +} +// e.g. +// { +// result: { +// username: { valid: true }, +// password: { valid: false, error: 'something' }, +// hosts: [ +// { valid: false }, { valid: true }, +// ] +// } +// } + +// bulk action -- e.g. assign tags to beats +export interface ReturnTypeBulkAction extends BaseReturnType { + results?: Array<{ + success: boolean; + result?: { + [key: string]: any; + }; + error?: { + message: string; + code?: number; + }; + }>; +} diff --git a/x-pack/legacy/plugins/fleet/common/types/domain_data.ts b/x-pack/legacy/plugins/fleet/common/types/domain_data.ts new file mode 100644 index 0000000000000..b7ec451d1428c --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/types/domain_data.ts @@ -0,0 +1,55 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import * as t from 'io-ts'; +import { RuntimeAgent, RuntimeAgentAction } from '../../server/repositories/agents/types'; +import { RuntimeAgentEvent } from '../../server/repositories/agent_events/types'; +import { EnrollmentApiKey } from '../../server/repositories/enrollment_api_keys/types'; + +// Here we create the runtime check for a generic, unknown beat config type. +// We can also pass in optional params to create spacific runtime checks that +// can be used to validate blocs on the API and UI +export const createConfigurationInterface = (beatConfigInterface: t.Mixed = t.Dictionary) => + t.interface( + { + id: t.union([t.undefined, t.string]), + name: t.string, + description: t.union([t.undefined, t.string]), + config: beatConfigInterface, + last_updated_by: t.union([t.undefined, t.string]), + last_updated: t.union([t.undefined, t.number]), + }, + 'Config' + ); +const BaseConfiguration = createConfigurationInterface(); +export interface ConfigurationBlock + extends Pick< + t.TypeOf, + Exclude, 'id'> + > { + id: string; +} + +export type Agent = t.TypeOf; +export type AgentAction = t.TypeOf; +export type AgentEvent = t.TypeOf; + +export type EnrollmentApiKey = EnrollmentApiKey; + +export type PolicyUpdatedEvent = + | { + type: 'created'; + policyId: string; + payload: any; + } + | { + type: 'updated'; + policyId: string; + payload: any; + } + | { + type: 'deleted'; + policyId: string; + }; diff --git a/x-pack/legacy/plugins/fleet/common/types/helpers.ts b/x-pack/legacy/plugins/fleet/common/types/helpers.ts new file mode 100644 index 0000000000000..f9d648fd61bb0 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/types/helpers.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export type FlatObject = { [Key in keyof T]: string }; +export type RendererResult = React.ReactElement | null; +export type RendererFunction = (args: RenderArgs) => Result; diff --git a/x-pack/legacy/plugins/fleet/common/types/io_ts.ts b/x-pack/legacy/plugins/fleet/common/types/io_ts.ts new file mode 100644 index 0000000000000..dcb1f3179ad16 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/types/io_ts.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as t from 'io-ts'; +import { isLeft } from 'fp-ts/lib/Either'; + +export class DateFromStringType extends t.Type { + // eslint-disable-next-line + public readonly _tag: 'DateFromISOStringType' = 'DateFromISOStringType'; + constructor() { + super( + 'DateFromString', + (u): u is Date => u instanceof Date, + (u, c) => { + const validation = t.string.validate(u, c); + if (isLeft(validation)) { + return validation as any; + } else { + const s = validation.right; + const d = new Date(s); + return isNaN(d.getTime()) ? t.failure(s, c) : t.success(d); + } + }, + a => a.toISOString() + ); + } +} +// eslint-disable-next-line +export interface DateFromString extends DateFromStringType {} + +export const DateFromString: DateFromString = new DateFromStringType(); diff --git a/x-pack/legacy/plugins/fleet/common/types/security.ts b/x-pack/legacy/plugins/fleet/common/types/security.ts new file mode 100644 index 0000000000000..691ea82b294d3 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/common/types/security.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export type LicenseType = 'oss' | 'basic' | 'trial' | 'standard' | 'basic' | 'gold' | 'platinum'; diff --git a/x-pack/legacy/plugins/fleet/dev_docs/api/agents_checkin.md b/x-pack/legacy/plugins/fleet/dev_docs/api/agents_checkin.md new file mode 100644 index 0000000000000..ae74d150e504e --- /dev/null +++ b/x-pack/legacy/plugins/fleet/dev_docs/api/agents_checkin.md @@ -0,0 +1,49 @@ +# Fleet agent checkin API + +Agent checkin +Report current state of a Fleet agent. + +## Request + +`POST /api/fleet/agents/{agentId}/checkin` + +## Headers + +- `Authorization` (Required, string) A valid fleet access api key.. + +## Request body + +- `events` (Required, array) An array of events with the properties `type`, `subtype`, `message`, `timestamp`, `payload`, and `data`. + +- `local_metadata` (Optional, object) An object that contains the local metadata for an agent. The metadata is a dictionary of strings (example: `{ "os": "macos" }`). + +## Response code + +- `200` Indicates a successful call. + +## Example + +```js +POST /api/fleet/agents/a4937110-e53e-11e9-934f-47a8e38a522c/checkin +Authorization: ApiKey VALID_ACCESS_API_KEY +{ + "events": [{ + "type": "STATE", + "subtype": "STARTING", + "message": "state changed from STOPPED to STARTING", + "timestamp": "2019-10-01T13:42:54.323Z", + "payload": {}, + "data": "{}" + }] +} +``` + +```js +{ + "action": "checkin", + "success": true, + "policy": { + }, + "actions": [] +} +``` diff --git a/x-pack/legacy/plugins/fleet/dev_docs/api/agents_enroll.md b/x-pack/legacy/plugins/fleet/dev_docs/api/agents_enroll.md new file mode 100644 index 0000000000000..977b3029371ba --- /dev/null +++ b/x-pack/legacy/plugins/fleet/dev_docs/api/agents_enroll.md @@ -0,0 +1,79 @@ +# Enroll Fleet agent API + +Enroll agent + +## Request + +`POST /api/fleet/agents/enroll` + +## Headers + +- `Authorization` (Required, string) a valid enrollemnt api key. + +## Request body + +- `type` (Required, string) Agent type should be one of `EPHEMERAL`, `TEMPORARY`, `PERMANENT` +- `shared_id` (Optional, string) An ID for the agent. +- `metadata` (Optional, object) Objects with `local` and `user_provided` properties that contain the metadata for an agent. The metadata is a dictionary of strings (example: `"local": { "os": "macos" }`). + +## Response code + +`200` Indicates a successful call. +`400` For an invalid request. +`401` For an invalid api key. + +## Example + +```js +POST /api/fleet/agents/enroll +Authorization: ApiKey VALID_API_KEY +{ + "type": "PERMANENT", + "metadata": { + "local": { "os": "macos"}, + "userProvided": { "region": "us-east"} + } +} +``` + +The API returns the following: + +```js +{ + "action": "created", + "success": true, + "item": { + "id": "a4937110-e53e-11e9-934f-47a8e38a522c", + "active": true, + "policy_id": "default", + "type": "PERMANENT", + "enrolled_at": "2019-10-02T18:01:22.337Z", + "user_provided_metadata": {}, + "local_metadata": {}, + "actions": [], + "access_api_key": "ACCESS_API_KEY" + } +} +``` + +## Expected errors + +The API will return a response with a `401` status code and an error if the enrollment apiKey is invalid like this: + +```js +{ + "statusCode": 401, + "error": "Unauthorized", + "message": "Enrollment apiKey is not valid: Enrollement api key does not exists or is not active" +} +``` + +The API will return a response with a `400` status code and an error if you enroll an agent with the same `shared_id` than an already active agent: + +```js +{ + "statusCode": 400, + "error": "BadRequest", + "message": "Impossible to enroll an already active agent" +} +``` diff --git a/x-pack/legacy/plugins/fleet/dev_docs/api/agents_list.md b/x-pack/legacy/plugins/fleet/dev_docs/api/agents_list.md new file mode 100644 index 0000000000000..5038a44701217 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/dev_docs/api/agents_list.md @@ -0,0 +1,22 @@ +# Fleet agent listing API + +## Request + +`GET /api/fleet/agents` + +## Query + +- `showInactive` (Optional, boolean) Show inactive agents (default to false) +- `kuery` (Optional, string) Filter using kibana query language +- `page` (Optional, number) +- `perPage` (Optional, number) + +## Response code + +- `200` Indicates a successful call. + +## Example + +```js +GET /api/fleet/agents?kuery=agents.last_checkin:2019-10-01T13:42:54.323Z +``` diff --git a/x-pack/legacy/plugins/fleet/dev_docs/api/agents_unenroll.md b/x-pack/legacy/plugins/fleet/dev_docs/api/agents_unenroll.md new file mode 100644 index 0000000000000..fbf8122ec70f3 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/dev_docs/api/agents_unenroll.md @@ -0,0 +1,40 @@ +# Enroll Fleet agent API + +Unenroll an agent + +## Request + +`POST /api/fleet/agents/unenroll` + +## Request body + +- `ids` (Optional, string) An list of agent id to unenroll. +- `kuery` (Optional, string) a kibana query to search for agent to unenroll. + +> Note: one and only of this keys should be present: + +## Response code + +`200` Indicates a successful call. + +## Example + +```js +POST /api/fleet/agents/enroll +{ + "ids": ['agent1'], +} +``` + +The API returns the following: + +```js +{ + "results": [{ + "success":true, + "id":"agent1", + "action":"unenrolled" + }], + "success":true +} +``` diff --git a/x-pack/legacy/plugins/fleet/index.ts b/x-pack/legacy/plugins/fleet/index.ts new file mode 100644 index 0000000000000..8af32cac2a7b7 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/index.ts @@ -0,0 +1,92 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import { resolve } from 'path'; +// import { i18n } from '@kbn/i18n'; +import { PLUGIN } from './common/constants'; +import { CONFIG_PREFIX } from './common/constants/plugin'; +import { initServerWithKibana } from './server/kibana.index'; +import { mappings } from './server/mappings'; + +export const config = Joi.object({ + enabled: Joi.boolean().default(true), + encryptionKey: Joi.string().default('xpack_fleet_default_encryptionKey'), +}).default(); + +export function fleet(kibana: any) { + return new kibana.Plugin({ + id: PLUGIN.ID, + require: ['kibana', 'elasticsearch', 'xpack_main', 'encryptedSavedObjects', 'ingest'], + publicDir: resolve(__dirname, 'public'), + uiExports: { + // app: { + // title: 'Elastic Fleet', + // description: i18n.translate('xpack.fleet.elasticFleetDescription', { + // defaultMessage: 'Manage your elastic data ingestion stack', + // }), + // main: 'plugins/fleet/index', + // icon: 'plugins/fleet/icon.svg', + // euiIconType: 'apmApp', + // order: 8000, + // }, + styleSheetPaths: resolve(__dirname, 'public/index.scss'), + managementSections: ['plugins/fleet'], + savedObjectSchemas: { + agents: { + isNamespaceAgnostic: true, + // TODO https://github.com/elastic/kibana/issues/46373 + // indexPattern: INDEX_NAMES.FLEET, + }, + events: { + isNamespaceAgnostic: true, + // TODO https://github.com/elastic/kibana/issues/46373 + // indexPattern: INDEX_NAMES.EVENT, + }, + enrollment_api_keys: { + isNamespaceAgnostic: true, + // TODO https://github.com/elastic/kibana/issues/46373 + // indexPattern: INDEX_NAMES.FLEET, + }, + }, + mappings, + }, + config: () => config, + configPrefix: CONFIG_PREFIX, + init(server: any) { + server.newPlatform.setup.plugins.encryptedSavedObjects.registerType({ + type: 'enrollment_api_keys', + attributesToEncrypt: new Set(['api_key']), + attributesToExcludeFromAAD: new Set(['enrollment_rules']), + }); + server.plugins.xpack_main.registerFeature({ + id: 'fleet', + name: 'Fleet', + app: ['fleet', 'kibana'], + excludeFromBasePrivileges: true, + privileges: { + all: { + savedObject: { + all: ['agents', 'events', 'enrollment_api_keys'], + read: [], + }, + ui: ['read', 'write'], + api: ['fleet-read', 'fleet-all'], + }, + read: { + savedObject: { + all: [], + read: ['agents', 'events', 'enrollment_api_keys'], + }, + ui: ['read'], + api: ['fleet-read'], + }, + }, + }); + initServerWithKibana(server); + }, + }); +} diff --git a/x-pack/legacy/plugins/fleet/package.json b/x-pack/legacy/plugins/fleet/package.json new file mode 100644 index 0000000000000..a5c186f43fbeb --- /dev/null +++ b/x-pack/legacy/plugins/fleet/package.json @@ -0,0 +1,15 @@ +{ + "author": "Elastic", + "name": "fleet", + "version": "8.0.0", + "private": true, + "license": "Elastic-License", + "devDependencies": { + "@stoplight/prism-cli": "^3.1.1" + }, + "workspaces": { + "nohoist": [ + "@stoplight/**" + ] + } +} diff --git a/x-pack/legacy/plugins/fleet/public/components/agent_health.tsx b/x-pack/legacy/plugins/fleet/public/components/agent_health.tsx new file mode 100644 index 0000000000000..8007934c63dfa --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/agent_health.tsx @@ -0,0 +1,102 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React from 'react'; +import { FormattedMessage, FormattedRelative } from '@kbn/i18n/react'; +import { EuiHealth, EuiToolTip } from '@elastic/eui'; +import { + AGENT_TYPE_PERMANENT, + AGENT_TYPE_TEMPORARY, + AGENT_POLLING_THRESHOLD_MS, +} from '../../common/constants'; +import { Agent } from '../../common/types/domain_data'; + +interface Props { + agent: Agent; +} + +const Status = { + Online: ( + + + + ), + Offline: ( + + + + ), + Inactive: ( + + + + ), + Warning: ( + + + + ), + Error: ( + + + + ), +}; + +export const AgentHealth: React.SFC = ({ agent }) => { + // TODO: Use agent events as part of health calculation once we have them; + // until then, we just use last check in time + const { type, last_checkin: lastCheckIn } = agent; + const msLastCheckIn = new Date(lastCheckIn || 0).getTime(); + const msSinceLastCheckIn = new Date().getTime() - msLastCheckIn; + const intervalsSinceLastCheckIn = Math.floor(msSinceLastCheckIn / AGENT_POLLING_THRESHOLD_MS); + + let status: React.ReactElement = Status.Online; + + if (!agent.active) { + status = Status.Inactive; + } else { + switch (type) { + case AGENT_TYPE_PERMANENT: + if (intervalsSinceLastCheckIn >= 4) { + status = Status.Error; + break; + } + if (intervalsSinceLastCheckIn >= 2) { + status = Status.Warning; + break; + } + case AGENT_TYPE_TEMPORARY: + if (intervalsSinceLastCheckIn >= 3) { + status = Status.Offline; + break; + } + } + } + + return ( + , + }} + /> + ) : ( + + ) + } + > + {status} + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/components/agent_unenroll_provider.tsx b/x-pack/legacy/plugins/fleet/public/components/agent_unenroll_provider.tsx new file mode 100644 index 0000000000000..256ee1eef893f --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/agent_unenroll_provider.tsx @@ -0,0 +1,172 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { Fragment, useRef, useState } from 'react'; +import { EuiConfirmModal, EuiOverlayMask } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { useLibs } from '../hooks/use_libs'; + +interface Props { + children: (unenrollAgents: UnenrollAgents) => React.ReactElement; +} + +export type UnenrollAgents = ( + agents: string[] | string, + agentsCount: number, + onSuccess?: OnSuccessCallback +) => void; + +type OnSuccessCallback = (agentsUnenrolled: string[]) => void; + +export const AgentUnenrollProvider: React.FunctionComponent = ({ children }) => { + const libs = useLibs(); + const [agents, setAgents] = useState([]); + const [agentsCount, setAgentsCount] = useState(0); + const [isModalOpen, setIsModalOpen] = useState(false); + const [isLoading, setIsLoading] = useState(false); + const onSuccessCallback = useRef(null); + + const unenrollAgentsPrompt: UnenrollAgents = ( + agentsToUnenroll, + agentsToUnenrollCount, + onSuccess = () => undefined + ) => { + if ( + agentsToUnenroll === undefined || + (Array.isArray(agentsToUnenroll) && agentsToUnenroll.length === 0) + ) { + throw new Error('No agents specified for unenrollment'); + } + setIsModalOpen(true); + setAgents(agentsToUnenroll); + setAgentsCount(agentsToUnenrollCount); + onSuccessCallback.current = onSuccess; + }; + + const closeModal = () => { + setAgents([]); + setAgentsCount(0); + setIsLoading(false); + setIsModalOpen(false); + }; + + const unenrollAgents = async () => { + setIsLoading(true); + + try { + const unenrollByKuery = typeof agents === 'string'; + const agentsToUnenroll = + unenrollByKuery && !(agents as string).trim() ? 'agents.active:true' : agents; + const unenrollMethod = unenrollByKuery ? libs.agents.unenrollByKuery : libs.agents.unenroll; + const { results } = await unenrollMethod(agentsToUnenroll as string & string[]); + + const successfulResults = results.filter(result => result.success); + const failedResults = results.filter(result => !result.success); + + if (successfulResults.length) { + const hasMultipleSuccesses = successfulResults.length > 1; + const successMessage = hasMultipleSuccesses + ? i18n.translate('xpack.fleet.unenrollAgents.successMultipleNotificationTitle', { + defaultMessage: 'Unenrolled {count} agents', + values: { count: successfulResults.length }, + }) + : i18n.translate('xpack.fleet.unenrollAgents.successSingleNotificationTitle', { + defaultMessage: "Unenrolled agent '{id}'", + values: { id: successfulResults[0].id }, + }); + libs.framework.notifications.addSuccess(successMessage); + } + + if (failedResults.length) { + const hasMultipleFailures = failedResults.length > 1; + const failureMessage = hasMultipleFailures + ? i18n.translate('xpack.fleet.unenrollAgents.failureMultipleNotificationTitle', { + defaultMessage: 'Error unenrolling {count} agents', + values: { count: failedResults.length }, + }) + : i18n.translate('xpack.fleet.unenrollAgents.failureSingleNotificationTitle', { + defaultMessage: "Error unenrolling agent '{id}'", + values: { id: failedResults[0].id }, + }); + libs.framework.notifications.addDanger(failureMessage); + } + + if (onSuccessCallback.current) { + onSuccessCallback.current(successfulResults.map(result => result.id)); + } + } catch (e) { + libs.framework.notifications.addDanger( + i18n.translate('xpack.fleet.unenrollAgents.fatalErrorNotificationTitle', { + defaultMessage: 'Fatal error unenrolling agents', + }) + ); + } + + closeModal(); + }; + + const renderModal = () => { + if (!isModalOpen) { + return null; + } + + const unenrollByKuery = typeof agents === 'string'; + const isSingle = agentsCount === 1; + + return ( + + + ) : ( + + ) + } + onCancel={closeModal} + onConfirm={unenrollAgents} + cancelButtonText={ + + } + confirmButtonText={ + isLoading ? ( + + ) : ( + + ) + } + buttonColor="danger" + confirmButtonDisabled={isLoading} + /> + + ); + }; + + return ( + + {children(unenrollAgentsPrompt)} + {renderModal()} + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/components/layouts/background.tsx b/x-pack/legacy/plugins/fleet/public/components/layouts/background.tsx new file mode 100644 index 0000000000000..a8eeda1f6571b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/layouts/background.tsx @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import styled from 'styled-components'; + +export const Background = styled.div` + flex-grow: 1; +`; diff --git a/x-pack/legacy/plugins/fleet/public/components/layouts/no_data.tsx b/x-pack/legacy/plugins/fleet/public/components/layouts/no_data.tsx new file mode 100644 index 0000000000000..8d4c7703dfc4d --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/layouts/no_data.tsx @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiPageContent } from '@elastic/eui'; +import React from 'react'; +import { withRouter } from 'react-router-dom'; + +interface LayoutProps { + title: string | React.ReactNode; + actionSection?: React.ReactNode; + modalClosePath?: string; +} + +export const NoDataLayout: React.SFC = withRouter( + ({ actionSection, title, modalClosePath, children, history }) => { + return ( + + + + {title}} + body={children} + actions={actionSection} + /> + + + + ); + } +) as any; diff --git a/x-pack/legacy/plugins/fleet/public/components/layouts/primary.tsx b/x-pack/legacy/plugins/fleet/public/components/layouts/primary.tsx new file mode 100644 index 0000000000000..635ee687ba63d --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/layouts/primary.tsx @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + EuiPage, + EuiPageBody, + EuiPageContent, + EuiPageContentBody, + EuiPageHeader, + EuiPageHeaderSection, + EuiTitle, +} from '@elastic/eui'; +import React, { Component, ReactNode } from 'react'; + +type RenderCallback = (component: () => JSX.Element) => void; + +interface PrimaryLayoutProps { + title: string | React.ReactNode; + actionSection?: React.ReactNode; + hideBreadcrumbs?: boolean; +} +export class PrimaryLayout extends Component { + private actionSection: (() => JSX.Element) | null = null; + constructor(props: PrimaryLayoutProps) { + super(props); + } + + public render() { + const children: (callback: RenderCallback) => void | ReactNode = this.props.children as any; + return ( + + + + + + +

{this.props.title}

+
+
+ + {(this.actionSection && this.actionSection()) || this.props.actionSection} + +
+ + + {(children && typeof children === 'function' + ? children(this.renderAction) + : children) || } + + +
+
+
+ ); + } + + private renderAction = (component: () => JSX.Element) => { + this.actionSection = component; + this.forceUpdate(); + }; +} diff --git a/x-pack/legacy/plugins/fleet/public/components/layouts/walkthrough.tsx b/x-pack/legacy/plugins/fleet/public/components/layouts/walkthrough.tsx new file mode 100644 index 0000000000000..0a63ccdc87239 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/layouts/walkthrough.tsx @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; + +import { + EuiPageContent, + EuiPageContentBody, + // @ts-ignore + EuiStepsHorizontal, + EuiTitle, +} from '@elastic/eui'; + +interface LayoutProps { + title: string; + goTo: (path: string) => any; + walkthroughSteps: Array<{ + id: string; + name: string; + }>; + activePath: string; +} + +export const WalkthroughLayout: React.SFC = ({ + walkthroughSteps, + title, + activePath, + goTo, + children, +}) => { + const indexOfCurrent = walkthroughSteps.findIndex(step => activePath === step.id); + return ( + + +

{title}

+
+
+
+ ({ + title: step.name, + isComplete: i <= indexOfCurrent, + onClick: () => goTo(step.id), + }))} + /> +
+
+ {children} +
+ ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/components/loading.tsx b/x-pack/legacy/plugins/fleet/public/components/loading.tsx new file mode 100644 index 0000000000000..f1c2455ec85b9 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/loading.tsx @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; +import * as React from 'react'; + +export const Loading: React.SFC<{}> = () => ( + + + + + +); diff --git a/x-pack/legacy/plugins/fleet/public/components/navigation/child_routes.tsx b/x-pack/legacy/plugins/fleet/public/components/navigation/child_routes.tsx new file mode 100644 index 0000000000000..189d7b1d2a3bd --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/navigation/child_routes.tsx @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React, { SFC } from 'react'; +import { Route, Switch } from 'react-router-dom'; + +interface RouteConfig { + path: string; + component: React.ComponentType; + routes?: RouteConfig[]; +} + +export const ChildRoutes: SFC<{ + routes?: RouteConfig[]; + useSwitch?: boolean; + [other: string]: any; +}> = ({ routes, useSwitch = true, ...rest }) => { + if (!routes) { + return null; + } + const Parent = useSwitch ? Switch : React.Fragment; + return ( + + {routes.map(route => ( + { + const Component = route.component; + return ; + }} + /> + ))} + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/components/navigation/connected_link.tsx b/x-pack/legacy/plugins/fleet/public/components/navigation/connected_link.tsx new file mode 100644 index 0000000000000..30d12c9ce10de --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/navigation/connected_link.tsx @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React from 'react'; + +import { EuiLink } from '@elastic/eui'; +import { Link, withRouter } from 'react-router-dom'; + +export function ConnectedLinkComponent({ + location, + path, + query, + disabled, + children, + ...props +}: { + location: any; + path: string; + disabled: boolean; + query: any; + [key: string]: any; +}) { + if (disabled) { + return ; + } + + // Shorthand for pathname + const pathname = path || _.get(props.to, 'pathname') || location.pathname; + + return ( + + ); +} + +export const ConnectedLink = withRouter(ConnectedLinkComponent); diff --git a/x-pack/legacy/plugins/fleet/public/components/search_bar.tsx b/x-pack/legacy/plugins/fleet/public/components/search_bar.tsx new file mode 100644 index 0000000000000..f0641e413c4c6 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/components/search_bar.tsx @@ -0,0 +1,107 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { SFC, useState, useEffect } from 'react'; +import { + // @ts-ignore + EuiSuggest, +} from '@elastic/eui'; +import { useDebounce } from '../hooks/use_debounce'; +import { useLibs } from '../hooks/use_libs'; + +const DEBOUNCE_SEARCH_MS = 150; + +interface Suggestion { + label: string; + description: string; + value: string; + type: { + color: string; + iconType: string; + }; + start: number; + end: number; +} + +interface Props { + value: string; + fieldPrefix: string; + onChange: (newValue: string) => void; +} + +export const SearchBar: SFC = ({ value, fieldPrefix, onChange }) => { + const { suggestions } = useSuggestions(fieldPrefix, value); + + const onAutocompleteClick = (suggestion: Suggestion) => { + onChange( + [value.slice(0, suggestion.start), suggestion.value, value.slice(suggestion.end, -1)].join('') + ); + }; + const onChangeSearch = (s: string) => { + onChange(s); + }; + + return ( + + ); +}; + +function transformSuggestionType(type: string): { iconType: string; color: string } { + switch (type) { + case 'field': + return { iconType: 'kqlField', color: 'tint4' }; + case 'value': + return { iconType: 'kqlValue', color: 'tint0' }; + case 'conjunction': + return { iconType: 'kqlSelector', color: 'tint3' }; + case 'operator': + return { iconType: 'kqlOperand', color: 'tint1' }; + default: + return { iconType: 'kqlOther', color: 'tint1' }; + } +} + +function useSuggestions(fieldPrefix: string, search: string) { + const { elasticsearch } = useLibs(); + const debouncedSearch = useDebounce(search, DEBOUNCE_SEARCH_MS); + const [suggestions, setSuggestions] = useState([]); + + const fetchSuggestions = async () => { + try { + const esSuggestions = (await elasticsearch.getSuggestions( + debouncedSearch, + debouncedSearch.length, + fieldPrefix + )).map(suggestion => ({ + label: suggestion.text, + description: suggestion.description || '', + type: transformSuggestionType(suggestion.type), + start: suggestion.start, + end: suggestion.end, + value: suggestion.text, + })); + setSuggestions(esSuggestions); + } catch (err) { + setSuggestions([]); + } + }; + + useEffect(() => { + fetchSuggestions(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [debouncedSearch]); + + return { + suggestions, + }; +} diff --git a/x-pack/legacy/plugins/fleet/public/hooks/use_debounce.tsx b/x-pack/legacy/plugins/fleet/public/hooks/use_debounce.tsx new file mode 100644 index 0000000000000..f701ebeaadbe5 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/hooks/use_debounce.tsx @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { useState, useEffect } from 'react'; + +export function useDebounce(value: T, delay: number) { + const [debouncedValue, setDebouncedValue] = useState(value); + + useEffect(() => { + const handler = setTimeout(() => { + setDebouncedValue(value); + }, delay); + + return () => { + clearTimeout(handler); + }; + }, [value, delay]); + + return debouncedValue; +} diff --git a/x-pack/legacy/plugins/fleet/public/hooks/use_libs.tsx b/x-pack/legacy/plugins/fleet/public/hooks/use_libs.tsx new file mode 100644 index 0000000000000..bba7e6e2eb405 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/hooks/use_libs.tsx @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useContext } from 'react'; +import { FrontendLibs } from '../lib/types'; + +export const LibsContext = React.createContext(null); + +export function useLibs() { + const libs = useContext(LibsContext); + if (libs === null) { + throw new Error('You need to provide LibsContext'); + } + return libs; +} diff --git a/x-pack/legacy/plugins/fleet/public/hooks/use_pagination.tsx b/x-pack/legacy/plugins/fleet/public/hooks/use_pagination.tsx new file mode 100644 index 0000000000000..16c9262934478 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/hooks/use_pagination.tsx @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { useState } from 'react'; +import { DEFAULT_AGENTS_PAGE_SIZE, AGENTS_PAGE_SIZE_OPTIONS } from '../../common/constants'; + +export function usePagination() { + const [pagination, setPagination] = useState<{ + currentPage: number; + pageSize: number; + }>({ + currentPage: 1, + pageSize: DEFAULT_AGENTS_PAGE_SIZE, + }); + + return { + pagination, + setPagination, + pageSizeOptions: AGENTS_PAGE_SIZE_OPTIONS, + }; +} diff --git a/x-pack/legacy/plugins/fleet/public/hooks/with_url_state.tsx b/x-pack/legacy/plugins/fleet/public/hooks/with_url_state.tsx new file mode 100644 index 0000000000000..2db45f50b2c6c --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/hooks/with_url_state.tsx @@ -0,0 +1,100 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { parse, stringify } from 'querystring'; +import React from 'react'; +import { withRouter } from 'react-router-dom'; +import { FlatObject, RendererFunction } from '../../common/types/helpers'; + +type StateCallback = (previousState: T) => T; + +export interface URLStateProps { + goTo: (path: string) => void; + setUrlState: ( + newState: + | Partial> + | StateCallback + | Promise> + ) => void; + urlState: URLState; +} +interface ComponentProps { + history: any; + match: any; + children: RendererFunction>; +} + +export class WithURLStateComponent extends React.Component< + ComponentProps +> { + private get URLState(): URLState { + // slice because parse does not account for the initial ? in the search string + return parse(decodeURIComponent(this.props.history.location.search).substring(1)) as URLState; + } + + private historyListener: (() => void) | null = null; + + public componentWillUnmount() { + if (this.historyListener) { + this.historyListener(); + } + } + public render() { + return this.props.children({ + goTo: this.goTo, + setUrlState: this.setURLState, + urlState: this.URLState || {}, + }); + } + + private setURLState = async ( + state: + | Partial> + | StateCallback + | Promise> + ) => { + let newState; + const pastState = this.URLState; + if (typeof state === 'function') { + newState = await state(pastState); + } else { + newState = state; + } + + const search: string = stringify({ + ...(pastState as any), + ...(newState as any), + }); + + const newLocation = { + ...this.props.history.location, + search, + }; + + this.props.history.replace(newLocation); + this.forceUpdate(); + }; + + private goTo = (path: string) => { + this.props.history.push({ + pathname: path, + search: this.props.history.location.search, + }); + }; +} +export const WithURLState = withRouter(WithURLStateComponent); + +export function withUrlState( + UnwrappedComponent: React.ComponentType +): React.SFC { + return (origProps: OP) => { + return ( + + {(URLProps: URLStateProps) => } + + ); + }; +} diff --git a/x-pack/legacy/plugins/fleet/public/index.scss b/x-pack/legacy/plugins/fleet/public/index.scss new file mode 100644 index 0000000000000..eab372c3707c5 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/index.scss @@ -0,0 +1 @@ +@import 'pages/agent_list/index.scss'; diff --git a/x-pack/legacy/plugins/fleet/public/index.tsx b/x-pack/legacy/plugins/fleet/public/index.tsx new file mode 100644 index 0000000000000..17d3b072bf29f --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/index.tsx @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { HashRouter } from 'react-router-dom'; +import { i18n } from '@kbn/i18n'; +import { I18nContext } from 'ui/i18n'; +import { BASE_PATH } from '../common/constants'; +import { compose } from './lib/compose/kibana'; +import { FrontendLibs } from './lib/types'; +import { AppRoutes } from './routes'; +import { LibsContext } from './hooks/use_libs'; + +async function startApp(libs: FrontendLibs) { + libs.framework.renderUIAtPath( + BASE_PATH, + + + + + + + , + 'management' + ); + + await libs.framework.waitUntilFrameworkReady(); + + if (libs.framework.licenseIsAtLeast('standard')) { + libs.framework.registerManagementUI({ + sectionId: 'ingest', + name: i18n.translate('xpack.fleet.fleetManagementLinkLabel', { + defaultMessage: 'Fleet', + }), + basePath: BASE_PATH, + }); + } +} + +startApp(compose()); diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/agent/memory_agent_adapter.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/agent/memory_agent_adapter.ts new file mode 100644 index 0000000000000..060d20f0d4df0 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/agent/memory_agent_adapter.ts @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { omit } from 'lodash'; +import { Agent, AgentEvent } from '../../../../common/types/domain_data'; +import { ReturnTypeBulkUnenroll } from '../../../../common/return_types'; + +export class AgentAdapter { + private memoryDB: Agent[]; + + constructor(db: Agent[]) { + this.memoryDB = db; + } + + public async get(id: string) { + return this.memoryDB.find(beat => beat.id === id) || null; + } + + public async getAgentEvents( + id: string, + page: number, + perPage: number, + kuery?: string + ): Promise<{ + total: number; + list: AgentEvent[]; + }> { + return { total: 0, list: [] }; + } + + public async update(id: string, beatData: Partial): Promise { + const index = this.memoryDB.findIndex(beat => beat.id === id); + + if (index === -1) { + return false; + } + + this.memoryDB[index] = { ...this.memoryDB[index], ...beatData }; + return true; + } + + public async getAll(page: number, perPage: number, kuery?: string, showInactive?: boolean) { + const list = this.memoryDB.map((beat: any) => omit(beat, ['access_token'])); + return { list, success: true, page, perPage, total: list.length }; + } + public async getOnPolicy(tagId: string): Promise { + return this.memoryDB.map((beat: any) => omit(beat, ['access_token'])); + } + + public async getWithToken(enrollmentToken: string): Promise { + return this.memoryDB.map((beat: any) => omit(beat, ['access_token']))[0]; + } + + public async unenrollByIds(ids: string[]): Promise { + return { + results: [], + success: true, + }; + } + + public async unenrollByKuery(ids: string): Promise { + return { + results: [], + success: true, + }; + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/agent/rest_agent_adapter.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/agent/rest_agent_adapter.ts new file mode 100644 index 0000000000000..ad5cd8e016faf --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/agent/rest_agent_adapter.ts @@ -0,0 +1,109 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Agent } from '../../../../common/types/domain_data'; +import { + ReturnTypeGet, + ReturnTypeList, + ReturnTypeUpdate, + ReturnTypeBulkUnenroll, +} from '../../../../common/return_types'; +import { RestAPIAdapter } from '../rest_api/adapter_types'; +import { AgentAdapter } from './memory_agent_adapter'; +import { AgentEvent } from '../../../../common/types/domain_data'; + +export class RestAgentAdapter extends AgentAdapter { + constructor(private readonly REST: RestAPIAdapter) { + super([]); + } + + public async get(id: string): Promise { + try { + return (await this.REST.get>(`/api/fleet/agents/${id}`)).item; + } catch (e) { + return null; + } + } + + public async getAgentEvents( + id: string, + page: number, + perPage: number, + kuery?: string + ): Promise<{ + total: number; + list: AgentEvent[]; + }> { + const { total, list } = await this.REST.get>( + `/api/fleet/agents/${id}/events`, + { page, per_page: perPage, kuery: kuery !== '' ? kuery : undefined } + ); + + return { + total, + list, + }; + } + + public async getWithToken(enrollmentToken: string): Promise { + try { + return (await this.REST.get>( + `/api/fleet/agent/unknown/${enrollmentToken}` + )).item; + } catch (e) { + return null; + } + } + + public async getAll( + page: number, + perPage: number, + kuery?: string, + showInactive: boolean = false + ): Promise> { + try { + return await this.REST.get>('/api/fleet/agents', { + page, + perPage, + kuery: kuery !== '' ? kuery : undefined, + showInactive, + }); + } catch (e) { + return { + list: [], + success: false, + page, + total: 0, + perPage, + }; + } + } + + public async getOnConfig(tagId: string): Promise { + try { + return (await this.REST.get>(`/api/fleet/agents/tag/${tagId}`)).list; + } catch (e) { + return []; + } + } + + public async update(id: string, beatData: Partial): Promise { + await this.REST.put>(`/api/fleet/agents/${id}`, beatData); + return true; + } + + public async unenrollByIds(ids: string[]): Promise { + return await this.REST.post(`/api/fleet/agents/unenroll`, { + ids, + }); + } + + public async unenrollByKuery(kuery: string): Promise { + return await this.REST.post(`/api/fleet/agents/unenroll`, { + kuery, + }); + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/adapter_types.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/adapter_types.ts new file mode 100644 index 0000000000000..4f4ce70e817c6 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/adapter_types.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { AutocompleteSuggestion } from '../../../../../../../../src/plugins/data/public'; + +export interface ElasticsearchAdapter { + convertKueryToEsQuery: (kuery: string) => Promise; + getSuggestions: (kuery: string, selectionStart: any) => Promise; + isKueryValid(kuery: string): boolean; +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/memory.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/memory.ts new file mode 100644 index 0000000000000..e001bf6c6e844 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/memory.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { AutocompleteSuggestion } from '../../../../../../../../src/plugins/data/public'; +import { ElasticsearchAdapter } from './adapter_types'; + +export class MemoryElasticsearchAdapter implements ElasticsearchAdapter { + constructor( + private readonly mockIsKueryValid: (kuery: string) => boolean, + private readonly mockKueryToEsQuery: (kuery: string) => string, + private readonly suggestions: AutocompleteSuggestion[] + ) {} + + public isKueryValid(kuery: string): boolean { + return this.mockIsKueryValid(kuery); + } + public async convertKueryToEsQuery(kuery: string): Promise { + return this.mockKueryToEsQuery(kuery); + } + public async getSuggestions( + kuery: string, + selectionStart: any + ): Promise { + return this.suggestions; + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/rest.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/rest.ts new file mode 100644 index 0000000000000..d4a42ba662db4 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/elasticsearch/rest.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; +import { isEmpty } from 'lodash'; +import { npStart } from 'ui/new_platform'; +import { RestAPIAdapter } from '../rest_api/adapter_types'; +import { ElasticsearchAdapter } from './adapter_types'; +import { AutocompleteSuggestion } from '../../../../../../../../src/plugins/data/public'; + +const getAutocompleteProvider = (language: string) => + npStart.plugins.data.autocomplete.getProvider(language); + +export class RestElasticsearchAdapter implements ElasticsearchAdapter { + private cachedIndexPattern: any = null; + constructor(private readonly api: RestAPIAdapter, private readonly indexPatternName: string) {} + + public isKueryValid(kuery: string): boolean { + try { + fromKueryExpression(kuery); + } catch (err) { + return false; + } + + return true; + } + public async convertKueryToEsQuery(kuery: string): Promise { + if (!this.isKueryValid(kuery)) { + return ''; + } + const ast = fromKueryExpression(kuery); + const indexPattern = await this.getIndexPattern(); + return JSON.stringify(toElasticsearchQuery(ast, indexPattern)); + } + public async getSuggestions( + kuery: string, + selectionStart: any + ): Promise { + const autocompleteProvider = getAutocompleteProvider('kuery'); + if (!autocompleteProvider) { + return []; + } + const config = { + get: () => true, + }; + const indexPattern = await this.getIndexPattern(); + + const getAutocompleteSuggestions = autocompleteProvider({ + config, + indexPatterns: [indexPattern], + boolFilter: null, + }); + const results = getAutocompleteSuggestions({ + query: kuery || '', + selectionStart, + selectionEnd: selectionStart, + }); + return results; + } + + private async getIndexPattern() { + if (this.cachedIndexPattern) { + return this.cachedIndexPattern; + } + const res = await this.api.get( + `/api/index_patterns/_fields_for_wildcard?pattern=${this.indexPatternName}` + ); + if (isEmpty(res.fields)) { + return; + } + this.cachedIndexPattern = { + fields: res.fields, + title: `${this.indexPatternName}`, + }; + return this.cachedIndexPattern; + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/adapter_types.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/adapter_types.ts new file mode 100644 index 0000000000000..750bae8b4792b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/adapter_types.ts @@ -0,0 +1,93 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +/* eslint-disable @typescript-eslint/no-empty-interface */ + +import * as t from 'io-ts'; +import { LICENSES } from '../../../../common/constants/security'; + +export interface FrameworkAdapter { + // Instance vars + info: FrameworkInfo; + version: string; + capabilities: { read: boolean; write: boolean }; + currentUser: FrameworkUser; + notifications: any; + // Methods + waitUntilFrameworkReady(): Promise; + renderUIAtPath( + path: string, + component: React.ReactElement, + toController: 'management' | 'self' + ): void; + registerManagementSection(settings: { + id?: string; + name: string; + iconName: string; + order?: number; + }): void; + registerManagementUI(settings: { + sectionId?: string; + name: string; + basePath: string; + visable?: boolean; + order?: number; + }): void; +} + +const licenseLiterals = LICENSES.map(s => t.literal(s)); +if (licenseLiterals.length < 2) { + throw new Error('expected LICENSES array to include at least 2 items'); +} + +export const RuntimeFrameworkInfo = t.type({ + basePath: t.string, + license: t.type({ + type: t.union([licenseLiterals[0], licenseLiterals[1], ...licenseLiterals.slice(2)]), + expired: t.boolean, + expiry_date_in_millis: t.number, + }), + security: t.type({ + enabled: t.boolean, + available: t.boolean, + }), + settings: t.type({ + // encryptionKey: t.string, + // enrollmentTokensTtlInSeconds: t.number, + // defaultUserRoles: t.array(t.string), + }), +}); + +export interface FrameworkInfo extends t.TypeOf {} + +interface ManagementSection { + register( + sectionId: string, + options: { + visible: boolean; + display: string; + order: number; + url: string; + } + ): void; +} +export interface ManagementAPI { + getSection(sectionId: string): ManagementSection; + hasItem(sectionId: string): boolean; + register(sectionId: string, options: { display: string; icon: string; order: number }): void; +} + +export const RuntimeFrameworkUser = t.interface( + { + username: t.string, + roles: t.array(t.string), + full_name: t.union([t.null, t.string]), + email: t.union([t.null, t.string]), + enabled: t.boolean, + }, + 'FrameworkUser' +); +export interface FrameworkUser extends t.TypeOf {} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/kibana_framework_adapter.ts new file mode 100644 index 0000000000000..ecded5335ab66 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/kibana_framework_adapter.ts @@ -0,0 +1,270 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +/* eslint-disable max-classes-per-file */ +import { IScope } from 'angular'; +import { PathReporter } from 'io-ts/lib/PathReporter'; +import { isLeft } from 'fp-ts/lib/Either'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { UIRoutes } from 'ui/routes'; +import { capabilities } from 'ui/capabilities'; +import { toastNotifications } from 'ui/notify'; +import { BufferedKibanaServiceCall, KibanaAdapterServiceRefs, KibanaUIConfig } from '../../types'; +import { + FrameworkAdapter, + FrameworkInfo, + FrameworkUser, + ManagementAPI, + RuntimeFrameworkInfo, + RuntimeFrameworkUser, +} from './adapter_types'; +interface IInjector { + get(injectable: string): any; +} + +export class KibanaFrameworkAdapter implements FrameworkAdapter { + public get info() { + if (this.xpackInfo) { + return this.xpackInfo; + } else { + throw new Error('framework adapter must have init called before anything else'); + } + } + + public get currentUser() { + return this.shieldUser!; + } + public get capabilities(): Readonly<{ read: boolean; write: boolean }> { + return capabilities.get().fleet as { read: boolean; write: boolean }; + } + + private xpackInfo: FrameworkInfo | null = null; + private adapterService: KibanaAdapterServiceProvider; + private shieldUser: FrameworkUser | null = null; + constructor( + private readonly PLUGIN_ID: string, + private readonly management: ManagementAPI, + private readonly routes: UIRoutes, + private readonly getBasePath: () => string, + private readonly onKibanaReady: () => Promise, + private readonly XPackInfoProvider: unknown, + public readonly version: string, + public readonly notifications: typeof toastNotifications + ) { + this.adapterService = new KibanaAdapterServiceProvider(); + } + + public setUISettings = (key: string, value: any) => { + this.adapterService.callOrBuffer(({ config }) => { + config.set(key, value); + }); + }; + + public async waitUntilFrameworkReady(): Promise { + const $injector = await this.onKibanaReady(); + + let xpackInfo: any; + try { + xpackInfo = this.XPackInfoProvider; + } catch (e) { + xpackInfo = false; + } + + let xpackInfoUnpacked: FrameworkInfo; + try { + xpackInfoUnpacked = { + basePath: this.getBasePath(), + license: { + type: xpackInfo ? xpackInfo.getLicense().type : 'oss', + expired: xpackInfo ? !xpackInfo.getLicense().isActive : false, + expiry_date_in_millis: + xpackInfo.getLicense().expiryDateInMillis !== undefined + ? xpackInfo.getLicense().expiryDateInMillis + : -1, + }, + security: { + enabled: xpackInfo + ? xpackInfo.get(`features.${this.PLUGIN_ID}.security.enabled`, false) + : false, + available: xpackInfo + ? xpackInfo.get(`features.${this.PLUGIN_ID}.security.available`, false) + : false, + }, + settings: xpackInfo ? xpackInfo.get(`features.${this.PLUGIN_ID}.settings`, {}) : {}, + }; + } catch (e) { + throw new Error(`Unexpected data structure from XPackInfoProvider, ${JSON.stringify(e)}`); + } + + const assertData = RuntimeFrameworkInfo.decode(xpackInfoUnpacked); + if (isLeft(assertData)) { + throw new Error( + `Error parsing xpack info in ${this.PLUGIN_ID}, ${PathReporter.report(assertData)[0]}` + ); + } + this.xpackInfo = xpackInfoUnpacked; + + try { + this.shieldUser = await $injector.get('ShieldUser').getCurrent().$promise; + const assertUser = RuntimeFrameworkUser.decode(this.shieldUser); + + if (isLeft(assertUser)) { + throw new Error( + `Error parsing user info in ${this.PLUGIN_ID}, ${PathReporter.report(assertUser)[0]}` + ); + } + } catch (e) { + this.shieldUser = null; + } + } + + public renderUIAtPath( + path: string, + component: React.ReactElement, + toController: 'management' | 'self' = 'self' + ) { + const adapter = this; + this.routes.when( + `${path}${[...Array(6)].map((e, n) => `/:arg${n}?`).join('')}`, // Hack because angular 1 does not support wildcards + { + template: + toController === 'self' + ? `<${this.PLUGIN_ID}>
` + : ` +
+
+ `, + // eslint-disable-next-line max-classes-per-file + controller: ($scope: any, $route: any) => { + try { + $scope.$$postDigest(() => { + const elem = document.getElementById(`${this.PLUGIN_ID}ReactRoot`); + ReactDOM.render(component, elem); + adapter.manageAngularLifecycle($scope, $route, elem); + }); + $scope.$onInit = () => { + $scope.topNavMenu = []; + }; + } catch (e) { + throw new Error(`Error rendering Elastic Fleet to the dom, ${e.message}`); + } + }, + } + ); + } + + public registerManagementSection(settings: { + id?: string; + name: string; + iconName: string; + order?: number; + }) { + const sectionId = settings.id || this.PLUGIN_ID; + + if (!this.management.hasItem(sectionId)) { + this.management.register(sectionId, { + display: settings.name, + icon: settings.iconName, + order: settings.order || 30, + }); + } + } + + public registerManagementUI(settings: { + sectionId?: string; + name: string; + basePath: string; + visable?: boolean; + order?: number; + }) { + const sectionId = settings.sectionId || this.PLUGIN_ID; + + if (!this.management.hasItem(sectionId)) { + throw new Error( + `registerManagementUI was called with a sectionId of ${sectionId}, and that is is not yet regestered as a section` + ); + } + + const section = this.management.getSection(sectionId); + + section.register(sectionId, { + visible: settings.visable || true, + display: settings.name, + order: settings.order || 30, + url: `#${settings.basePath}`, + }); + } + + private manageAngularLifecycle($scope: any, $route: any, elem: any) { + const lastRoute = $route.current; + const deregister = $scope.$on('$locationChangeSuccess', () => { + const currentRoute = $route.current; + // if templates are the same we are on the same route + if (lastRoute.$$route.template === currentRoute.$$route.template) { + // this prevents angular from destroying scope + $route.current = lastRoute; + } else { + if (elem) { + ReactDOM.unmountComponentAtNode(elem); + elem.remove(); + } + } + }); + $scope.$on('$destroy', () => { + if (deregister) { + deregister(); + } + + // manually unmount component when scope is destroyed + if (elem) { + ReactDOM.unmountComponentAtNode(elem); + elem.remove(); + } + }); + } +} + +class KibanaAdapterServiceProvider { + public serviceRefs: KibanaAdapterServiceRefs | null = null; + public bufferedCalls: Array> = []; + + public $get($rootScope: IScope, config: KibanaUIConfig) { + this.serviceRefs = { + config, + rootScope: $rootScope, + }; + + this.applyBufferedCalls(this.bufferedCalls); + + return this; + } + + public callOrBuffer(serviceCall: (serviceRefs: KibanaAdapterServiceRefs) => void) { + if (this.serviceRefs !== null) { + this.applyBufferedCalls([serviceCall]); + } else { + this.bufferedCalls.push(serviceCall); + } + } + + public applyBufferedCalls( + bufferedCalls: Array> + ) { + if (!this.serviceRefs) { + return; + } + + this.serviceRefs.rootScope.$apply(() => { + bufferedCalls.forEach(serviceCall => { + if (!this.serviceRefs) { + return; + } + return serviceCall(this.serviceRefs); + }); + }); + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/testing_framework_adapter.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/testing_framework_adapter.ts new file mode 100644 index 0000000000000..5b79b6c32ddc5 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/framework/testing_framework_adapter.ts @@ -0,0 +1,80 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as React from 'react'; +import { FrameworkAdapter, FrameworkInfo, FrameworkUser } from './adapter_types'; + +export class TestingFrameworkAdapter implements FrameworkAdapter { + public get info() { + if (this.xpackInfo) { + return this.xpackInfo; + } else { + throw new Error('framework adapter must have init called before anything else'); + } + } + + public get currentUser() { + return this.shieldUser!; + } + private settings: any; + constructor( + private readonly xpackInfo: FrameworkInfo | null, + private readonly shieldUser: FrameworkUser | null, + public readonly version: string + ) {} + + public get notifications(): any { + return { + addSuccess: () => {}, + addDanger: () => {}, + }; + } + + // We dont really want to have this, but it's needed to conditionaly render for k7 due to + // when that data is needed. + public getUISetting(key: 'k7design'): boolean { + return this.settings[key]; + } + + public get capabilities(): Readonly<{ read: boolean; write: boolean }> { + return { read: true, write: true }; + } + + public setUISettings = (key: string, value: any) => { + this.settings[key] = value; + }; + + public async waitUntilFrameworkReady(): Promise { + return; + } + + public renderUIAtPath( + path: string, + component: React.ReactElement, + toController: 'management' | 'self' = 'self' + ) { + throw new Error('not yet implamented'); + } + + public registerManagementSection(settings: { + id?: string; + name: string; + iconName: string; + order?: number; + }) { + throw new Error('not yet implamented'); + } + + public registerManagementUI(settings: { + sectionId?: string; + name: string; + basePath: string; + visable?: boolean; + order?: number; + }) { + throw new Error('not yet implamented'); + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/policy/memory_policy_adapter.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/policy/memory_policy_adapter.ts new file mode 100644 index 0000000000000..51e826796b5ad --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/policy/memory_policy_adapter.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { Policy } from '../../../../scripts/mock_spec/types'; + +export class PolicyAdapter { + private memoryDB: Policy[]; + + constructor(db: Policy[]) { + this.memoryDB = db; + } + + public async getAll(): Promise { + return this.memoryDB; + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/policy/rest_policy_adapter.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/policy/rest_policy_adapter.ts new file mode 100644 index 0000000000000..1073a6ae84bb6 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/policy/rest_policy_adapter.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Policy } from '../../../../scripts/mock_spec/types'; +import { RestAPIAdapter } from '../rest_api/adapter_types'; +import { PolicyAdapter } from './memory_policy_adapter'; + +const POLICIES_SERVER_HOST = `${window.location.protocol}//${window.location.hostname}:4010`; + +export class RestPolicyAdapter extends PolicyAdapter { + constructor(private readonly REST: RestAPIAdapter) { + super([]); + } + + public async getAll() { + try { + return await this.REST.get(`${POLICIES_SERVER_HOST}/policies`); + } catch (e) { + return []; + } + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/adapter_types.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/adapter_types.ts new file mode 100644 index 0000000000000..c40575eb6567f --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/adapter_types.ts @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { FlatObject } from '../../../../common/types/helpers'; + +export interface RestAPIAdapter { + get(url: string, query?: FlatObject): Promise; + post(url: string, body?: { [key: string]: any }): Promise; + delete(url: string): Promise; + put(url: string, body?: any): Promise; +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/axios_rest_api_adapter.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/axios_rest_api_adapter.ts new file mode 100644 index 0000000000000..4d0a1728c28f8 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/axios_rest_api_adapter.ts @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import axios, { AxiosInstance } from 'axios'; +import { FlatObject } from '../../../../common/types/helpers'; +import { RestAPIAdapter } from './adapter_types'; +let globalAPI: AxiosInstance; + +export class AxiosRestAPIAdapter implements RestAPIAdapter { + constructor(private readonly xsrfToken: string, private readonly basePath: string) {} + + public async get(url: string, query?: FlatObject): Promise { + return await this.REST.get(url, query ? { params: query } : {}).then(resp => resp.data); + } + + public async post( + url: string, + body?: { [key: string]: any } + ): Promise { + return await this.REST.post(url, body).then(resp => resp.data); + } + + public async delete(url: string): Promise { + return await this.REST.delete(url).then(resp => resp.data); + } + + public async put(url: string, body?: any): Promise { + return await this.REST.put(url, body).then(resp => resp.data); + } + + private get REST() { + if (globalAPI) { + return globalAPI; + } + + globalAPI = axios.create({ + baseURL: this.basePath, + withCredentials: true, + responseType: 'json', + timeout: 30000, + headers: { + Accept: 'application/json', + credentials: 'same-origin', + 'Content-Type': 'application/json', + 'kbn-version': this.xsrfToken, + 'kbn-xsrf': this.xsrfToken, + }, + }); + // Add a request interceptor + globalAPI.interceptors.request.use( + config => { + // Do something before request is sent + return config; + }, + error => { + // Do something with request error + return Promise.reject(error); + } + ); + + // Add a response interceptor + globalAPI.interceptors.response.use( + response => { + // Do something with response data + return response; + }, + error => { + // Do something with response error + return Promise.reject(error); + } + ); + + return globalAPI; + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/node_axios_api_adapter.ts b/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/node_axios_api_adapter.ts new file mode 100644 index 0000000000000..112d8b2210065 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/adapters/rest_api/node_axios_api_adapter.ts @@ -0,0 +1,92 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import axios, { AxiosInstance } from 'axios'; +import fs from 'fs'; +import { join, resolve } from 'path'; +import { FlatObject } from '../../../../common/types/helpers'; +import { RestAPIAdapter } from './adapter_types'; +const pkg = JSON.parse( + fs.readFileSync(resolve(join(__dirname, '../../../../../../../package.json'))).toString() +); + +let globalAPI: AxiosInstance; + +export class NodeAxiosAPIAdapter implements RestAPIAdapter { + constructor( + private readonly username: string, + private readonly password: string, + private readonly basePath: string + ) {} + + public async get(url: string, query?: FlatObject): Promise { + return await this.REST.get(url, query ? { params: query } : {}).then(resp => resp.data); + } + + public async post( + url: string, + body?: { [key: string]: any } + ): Promise { + return await this.REST.post(url, body).then(resp => resp.data); + } + + public async delete(url: string): Promise { + return await this.REST.delete(url).then(resp => resp.data); + } + + public async put(url: string, body?: any): Promise { + return await this.REST.put(url, body).then(resp => resp.data); + } + + private get REST() { + if (globalAPI) { + return globalAPI; + } + + globalAPI = axios.create({ + baseURL: this.basePath, + withCredentials: true, + responseType: 'json', + timeout: 60 * 10 * 1000, // 10min + auth: { + username: this.username, + password: this.password, + }, + headers: { + 'Access-Control-Allow-Origin': '*', + Accept: 'application/json', + 'Content-Type': 'application/json', + 'kbn-version': (pkg as any).version, + 'kbn-xsrf': 'xxx', + }, + }); + // Add a request interceptor + globalAPI.interceptors.request.use( + config => { + // Do something before request is sent + return config; + }, + error => { + // Do something with request error + return Promise.reject(error); + } + ); + + // Add a response interceptor + globalAPI.interceptors.response.use( + response => { + // Do something with response data + return response; + }, + error => { + // Do something with response error + return Promise.reject(JSON.stringify(error.response.data)); + } + ); + + return globalAPI; + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/agent.ts b/x-pack/legacy/plugins/fleet/public/lib/agent.ts new file mode 100644 index 0000000000000..46d0a6a7ef838 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/agent.ts @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ReturnTypeList } from '../../common/return_types'; +import { Agent, AgentEvent } from '../../common/types/domain_data'; +import { AgentAdapter } from './adapters/agent/memory_agent_adapter'; + +export class AgentsLib { + constructor(private readonly adapter: AgentAdapter) {} + + /** + * Get an agent by id + * @param id + */ + public async get(id: string): Promise { + const agent = await this.adapter.get(id); + return agent; + } + + /** + * Get an agent by id + * @param id + */ + public async getAgentEvents( + id: string, + page: number, + perPage: number, + kuery?: string + ): Promise<{ total: number; list: AgentEvent[] }> { + return await this.adapter.getAgentEvents(id, page, perPage, kuery); + } + + /** Get a single agent using the token it was enrolled in for lookup */ + public getWithToken = async (enrollmentToken: string): Promise => { + const agent = await this.adapter.getWithToken(enrollmentToken); + return agent; + }; + + /** Get an array of agents that have a given tag id assigned to it */ + public getOnPolicy = async (policyId: string): Promise => { + const agents = await this.adapter.getOnPolicy(policyId); + return agents; + }; + + /** Get an array of all enrolled agents. */ + public getAll = async ( + page: number, + perPage: number, + kuery?: string, + showInactive?: boolean + ): Promise> => { + return await this.adapter.getAll(page, perPage, kuery, showInactive); + }; + + /** Update a given agent via it's ID */ + public update = async (id: string, agentData: Partial): Promise => { + return await this.adapter.update(id, agentData); + }; + + public unenroll = async (ids: string[]) => { + return await this.adapter.unenrollByIds(ids); + }; + + public unenrollByKuery = async (kuery: string = '') => { + return await this.adapter.unenrollByKuery(kuery); + }; +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/compose/kibana.ts b/x-pack/legacy/plugins/fleet/public/lib/compose/kibana.ts new file mode 100644 index 0000000000000..bf5d456e528ca --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/compose/kibana.ts @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { camelCase } from 'lodash'; +// @ts-ignore not typed yet +import { xpackInfo as XPackInfoProvider } from 'plugins/xpack_main/services/xpack_info'; +import 'ui/autoload/all'; +import chrome from 'ui/chrome'; +// @ts-ignore not typed yet +import { management } from 'ui/management'; +import { toastNotifications } from 'ui/notify'; +import routes from 'ui/routes'; +import { RestAgentAdapter } from '../adapters/agent/rest_agent_adapter'; +import { RestPolicyAdapter } from '../adapters/policy/rest_policy_adapter'; +import { RestElasticsearchAdapter } from '../adapters/elasticsearch/rest'; +import { KibanaFrameworkAdapter } from '../adapters/framework/kibana_framework_adapter'; +import { AxiosRestAPIAdapter } from '../adapters/rest_api/axios_rest_api_adapter'; +import { AgentsLib } from '../agent'; +import { PoliciesLib } from '../policy'; +import { ElasticsearchLib } from '../elasticsearch'; +import { FrontendLibs } from '../types'; +import { PLUGIN } from '../../../common/constants/plugin'; +import { FrameworkLib } from '../framework'; +import { INDEX_NAMES } from '../../../common/constants'; + +// A super early spot in kibana loading that we can use to hook before most other things +const onKibanaReady = chrome.dangerouslyGetActiveInjector; + +export function compose(): FrontendLibs { + const api = new AxiosRestAPIAdapter(chrome.getXsrfToken(), chrome.getBasePath()); + const esAdapter = new RestElasticsearchAdapter(api, INDEX_NAMES.FLEET); + const elasticsearchLib = new ElasticsearchLib(esAdapter); + const agents = new AgentsLib(new RestAgentAdapter(api)); + const policies = new PoliciesLib(new RestPolicyAdapter(api)); + + const framework = new FrameworkLib( + new KibanaFrameworkAdapter( + camelCase(PLUGIN.ID), + management, + routes, + chrome.getBasePath, + onKibanaReady, + XPackInfoProvider, + chrome.getKibanaVersion(), + toastNotifications + ) + ); + + const libs: FrontendLibs = { + framework, + elasticsearch: elasticsearchLib, + agents, + policies, + }; + return libs; +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/compose/memory.ts b/x-pack/legacy/plugins/fleet/public/lib/compose/memory.ts new file mode 100644 index 0000000000000..60f7ffd689759 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/compose/memory.ts @@ -0,0 +1,66 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import 'ui/autoload/all'; +// @ts-ignore: path dynamic for kibana +import { management } from 'ui/management'; +// @ts-ignore: path dynamic for kibana +import { toastNotifications } from 'ui/notify'; +// @ts-ignore: path dynamic for kibana +import { uiModules } from 'ui/modules'; +// @ts-ignore: path dynamic for kibana +import routes from 'ui/routes'; +// @ts-ignore: path dynamic for kibana +import { MemoryAgentAdapter } from '../adapters/agent/memory_agent_adapter'; +import { PolicyAdapter } from '../adapters/policy/memory_policy_adapter'; +import { KibanaFrameworkAdapter } from '../adapters/framework/kibana_framework_adapter'; +import { AgentsLib } from '../agent'; +import { PoliciesLib } from '../policy'; +import { FrameworkLib } from '../framework'; +import { FrontendLibs } from '../types'; +import { MemoryElasticsearchAdapter } from '../adapters/elasticsearch/memory'; +import { AutocompleteSuggestion } from '../../../../../../../src/plugins/data/public'; +import { ElasticsearchLib } from '../elasticsearch'; + +const onKibanaReady = uiModules.get('kibana').run; + +export function compose( + mockIsKueryValid: (kuery: string) => boolean, + mockKueryToEsQuery: (kuery: string) => string, + suggestions: AutocompleteSuggestion[] +): FrontendLibs { + const esAdapter = new MemoryElasticsearchAdapter( + mockIsKueryValid, + mockKueryToEsQuery, + suggestions + ); + const elasticsearchLib = new ElasticsearchLib(esAdapter); + + const agents = new AgentsLib(new MemoryAgentAdapter([])); + const policies = new PoliciesLib(new PolicyAdapter([])); + + const pluginUIModule = uiModules.get('app/fleet'); + + const framework = new FrameworkLib( + new KibanaFrameworkAdapter( + pluginUIModule, + management, + routes, + () => '', + onKibanaReady, + null, + '7.0.0', + toastNotifications + ) + ); + const libs: FrontendLibs = { + framework, + elasticsearch: elasticsearchLib, + agents, + policies, + }; + return libs; +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/compose/scripts.ts b/x-pack/legacy/plugins/fleet/public/lib/compose/scripts.ts new file mode 100644 index 0000000000000..cd328af207374 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/compose/scripts.ts @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { RestAgentAdapter } from '../adapters/agent/rest_agent_adapter'; +import { RestPolicyAdapter } from '../adapters/policy/rest_policy_adapter'; +import { MemoryElasticsearchAdapter } from '../adapters/elasticsearch/memory'; +import { TestingFrameworkAdapter } from '../adapters/framework/testing_framework_adapter'; +import { NodeAxiosAPIAdapter } from '../adapters/rest_api/node_axios_api_adapter'; +import { AgentsLib } from '../agent'; +import { PoliciesLib } from '../policy'; +import { ElasticsearchLib } from '../elasticsearch'; +import { FrameworkLib } from '../framework'; +import { FrontendLibs } from '../types'; + +export function compose(basePath: string): FrontendLibs { + const api = new NodeAxiosAPIAdapter('elastic', 'changeme', basePath); + const esAdapter = new MemoryElasticsearchAdapter(() => true, () => '', []); + const elasticsearchLib = new ElasticsearchLib(esAdapter); + + const agents = new AgentsLib(new RestAgentAdapter(api)); + const policies = new PoliciesLib(new RestPolicyAdapter(api)); + + const framework = new FrameworkLib( + new TestingFrameworkAdapter( + { + basePath, + license: { + type: 'gold', + expired: false, + expiry_date_in_millis: 34353453452345, + }, + security: { + enabled: true, + available: true, + }, + settings: {}, + }, + { + username: 'joeuser', + roles: ['fleet_admin'], + enabled: true, + full_name: null, + email: null, + }, + '6.7.0' + ) + ); + + const libs: FrontendLibs = { + framework, + elasticsearch: elasticsearchLib, + agents, + policies, + }; + return libs; +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/elasticsearch.ts b/x-pack/legacy/plugins/fleet/public/lib/elasticsearch.ts new file mode 100644 index 0000000000000..ceebe33c266aa --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/elasticsearch.ts @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { AutocompleteSuggestion } from '../../../../../../src/plugins/data/public'; +import { ElasticsearchAdapter } from './adapters/elasticsearch/adapter_types'; + +const HIDDEN_FIELDS = ['agents.actions']; + +export class ElasticsearchLib { + constructor(private readonly adapter: ElasticsearchAdapter) {} + + public isKueryValid(kuery: string): boolean { + return this.adapter.isKueryValid(kuery); + } + + public async getSuggestions( + kuery: string, + selectionStart: any, + fieldPrefix?: string + ): Promise { + const suggestions = await this.adapter.getSuggestions(kuery, selectionStart); + + const filteredSuggestions = suggestions.filter(suggestion => { + if (suggestion.type === 'conjunction') { + return true; + } + if (suggestion.type === 'value') { + return true; + } + if (suggestion.type === 'operator') { + return true; + } + + if (fieldPrefix && suggestion.text.startsWith(fieldPrefix)) { + for (const hiddenField of HIDDEN_FIELDS) { + if (suggestion.text.startsWith(hiddenField)) { + return false; + } + } + return true; + } + + return false; + }); + + return filteredSuggestions; + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/framework.ts b/x-pack/legacy/plugins/fleet/public/lib/framework.ts new file mode 100644 index 0000000000000..9cbd9100c9e30 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/framework.ts @@ -0,0 +1,47 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { difference, get } from 'lodash'; +import { LICENSES } from '../../common/constants/security'; +import { LicenseType } from '../../common/types/security'; +import { FrameworkAdapter } from './adapters/framework/adapter_types'; + +export class FrameworkLib { + public waitUntilFrameworkReady = this.adapter.waitUntilFrameworkReady.bind(this.adapter); + public renderUIAtPath = this.adapter.renderUIAtPath.bind(this.adapter); + public registerManagementSection = this.adapter.registerManagementSection.bind(this.adapter); + public registerManagementUI = this.adapter.registerManagementUI.bind(this.adapter); + + constructor(private readonly adapter: FrameworkAdapter) {} + + public get currentUser() { + return this.adapter.currentUser; + } + + public get capabilities(): { read: boolean; write: boolean } { + return this.adapter.capabilities; + } + + public get info() { + return this.adapter.info; + } + + public get notifications() { + return this.adapter.notifications; + } + + public licenseIsAtLeast(type: LicenseType) { + return ( + LICENSES.indexOf(get(this.adapter.info, 'license.type', 'oss')) >= LICENSES.indexOf(type) + ); + } + + public currentUserHasOneOfRoles(roles: string[]) { + // If the user has at least one of the roles requested, the returnd difference will be less + // then the orig array size. difference only compares based on the left side arg + return difference(roles, get(this.currentUser, 'roles', [])).length < roles.length; + } +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/policy.ts b/x-pack/legacy/plugins/fleet/public/lib/policy.ts new file mode 100644 index 0000000000000..dfee7039abf22 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/policy.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Policy } from '../../scripts/mock_spec/types'; +import { PolicyAdapter } from './adapters/policy/memory_policy_adapter'; + +export class PoliciesLib { + constructor(private readonly adapter: PolicyAdapter) {} + + /** Get an array of all policies */ + public getAll = async (): Promise => { + return await this.adapter.getAll(); + }; +} diff --git a/x-pack/legacy/plugins/fleet/public/lib/types.ts b/x-pack/legacy/plugins/fleet/public/lib/types.ts new file mode 100644 index 0000000000000..c7b33e1b8a2ea --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/lib/types.ts @@ -0,0 +1,54 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { IModule, IScope } from 'angular'; +import { AxiosRequestConfig } from 'axios'; +import { FrameworkAdapter } from './adapters/framework/adapter_types'; +import { AgentsLib } from './agent'; +import { PoliciesLib } from './policy'; +import { ElasticsearchLib } from './elasticsearch'; +import { FrameworkLib } from './framework'; + +export interface FrontendLibs { + elasticsearch: ElasticsearchLib; + framework: FrameworkLib; + agents: AgentsLib; + policies: PoliciesLib; +} + +export type FramworkAdapterConstructable = new (uiModule: IModule) => FrameworkAdapter; + +// FIXME: replace AxiosRequestConfig with something more defined +export type RequestConfig = AxiosRequestConfig; + +export interface ApiAdapter { + kbnVersion: string; + + get(url: string, config?: RequestConfig | undefined): Promise; + post(url: string, data?: any, config?: AxiosRequestConfig | undefined): Promise; + delete(url: string, config?: RequestConfig | undefined): Promise; + put(url: string, data?: any, config?: RequestConfig | undefined): Promise; +} + +export interface UiKibanaAdapterScope extends IScope { + breadcrumbs: any[]; + topNavMenu: any[]; +} + +export interface KibanaUIConfig { + get(key: string): any; + set(key: string, value: any): Promise; +} + +export interface KibanaAdapterServiceRefs { + config: KibanaUIConfig; + rootScope: IScope; +} + +export type BufferedKibanaServiceCall = (serviceRefs: ServiceRefs) => void; + +export interface Chrome { + setRootTemplate(template: string): void; +} diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/agent_events_table.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/agent_events_table.tsx new file mode 100644 index 0000000000000..ed6baacbcb242 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/agent_events_table.tsx @@ -0,0 +1,202 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useState, useEffect, SFC } from 'react'; +import { + EuiBasicTable, + // @ts-ignore + EuiSuggest, + EuiFlexGroup, + EuiButton, + EuiSpacer, + EuiFlexItem, + EuiTitle, +} from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; +import { FormattedMessage, FormattedTime } from '@kbn/i18n/react'; +import { AgentEvent, Agent } from '../../../../common/types/domain_data'; +import { usePagination } from '../../../hooks/use_pagination'; +import { SearchBar } from '../../../components/search_bar'; +import { useDebounce } from '../../../hooks/use_debounce'; +import { useLibs } from '../../../hooks/use_libs'; + +const DEBOUNCE_SEARCH_MS = 300; + +function useSearch() { + const [state, setState] = useState<{ search: string }>({ + search: '', + }); + + const setSearch = (s: string) => + setState({ + search: s, + }); + + return { + ...state, + setSearch, + }; +} + +function useGetAgentEvents( + agent: Agent, + search: string, + pagination: { currentPage: number; pageSize: number } +) { + const libs = useLibs(); + const [state, setState] = useState<{ list: AgentEvent[]; total: number; isLoading: boolean }>({ + list: [], + total: 0, + isLoading: false, + }); + const debouncedSearch = useDebounce(search, DEBOUNCE_SEARCH_MS); + const fetchAgentEvents = async () => { + setState({ + isLoading: true, + total: state.total, + list: state.list, + }); + if (!libs.elasticsearch.isKueryValid(debouncedSearch)) { + return; + setState({ + isLoading: false, + total: 0, + list: [], + }); + } + try { + const { list, total } = await libs.agents.getAgentEvents( + agent.id, + pagination.currentPage, + pagination.pageSize, + debouncedSearch + ); + + setState({ + isLoading: false, + total, + list, + }); + } catch (err) { + setState({ + isLoading: false, + total: 0, + list: [], + }); + } + }; + useEffect(() => { + fetchAgentEvents(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [agent.id, debouncedSearch, pagination]); + + return { ...state, refresh: fetchAgentEvents }; +} + +export const AgentEventsTable: SFC<{ agent: Agent }> = ({ agent }) => { + const { pageSizeOptions, pagination, setPagination } = usePagination(); + const { search, setSearch } = useSearch(); + + const { list, total, isLoading, refresh } = useGetAgentEvents(agent, search, pagination); + const paginationOptions = { + pageIndex: pagination.currentPage - 1, + pageSize: pagination.pageSize, + totalItemCount: total, + pageSizeOptions, + }; + + const columns = [ + { + field: 'timestamp', + name: i18n.translate('xpack.fleet.agentEventsList.timestampColumnTitle', { + defaultMessage: 'Timestamp', + }), + render: (timestamp: string) => ( + + ), + sortable: true, + }, + { + field: 'type', + name: i18n.translate('xpack.fleet.agentEventsList.typeColumnTitle', { + defaultMessage: 'Type', + }), + width: '90px', + }, + { + field: 'subtype', + name: i18n.translate('xpack.fleet.agentEventsList.subtypeColumnTitle', { + defaultMessage: 'Subtype', + }), + width: '90px', + }, + { + field: 'message', + name: i18n.translate('xpack.fleet.agentEventsList.messageColumnTitle', { + defaultMessage: 'Message', + }), + }, + { + field: 'payload', + name: i18n.translate('xpack.fleet.agentEventsList.paylodColumnTitle', { + defaultMessage: 'Payload', + }), + truncateText: true, + render: (payload: any) => ( + + {payload && JSON.stringify(payload, null, 2)} + + ), + }, + ]; + + const onClickRefresh = () => { + refresh(); + }; + + const onChange = ({ page }: { page: { index: number; size: number } }) => { + const newPagination = { + ...pagination, + currentPage: page.index + 1, + pageSize: page.size, + }; + + setPagination(newPagination); + }; + + return ( + <> + +

+ +

+
+ + + + + + + + + + + + + + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/details_section.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/details_section.tsx new file mode 100644 index 0000000000000..83f9fbb5790ac --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/details_section.tsx @@ -0,0 +1,135 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { SFC, useState } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiTitle, + EuiSpacer, + EuiFlexGroup, + EuiFlexItem, + EuiDescriptionList, + EuiButton, + EuiDescriptionListTitle, + EuiDescriptionListDescription, + EuiButtonEmpty, + EuiLink, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { Agent } from '../../../../common/types/domain_data'; +import { AgentHealth } from '../../../components/agent_health'; +import { AgentUnenrollProvider } from '../../../components/agent_unenroll_provider'; +import { AgentMetadataFlyout } from './metadata_flyout'; +import { useAgentRefresh } from '../hooks/use_agent'; + +const Item: SFC<{ label: string }> = ({ label, children }) => { + return ( + + + {label} + {children} + + + ); +}; + +function useFlyout() { + const [isVisible, setVisible] = useState(false); + return { + isVisible, + show: () => setVisible(true), + hide: () => setVisible(false), + }; +} + +interface Props { + agent: Agent; +} +export const AgentDetailSection: SFC = ({ agent }) => { + const metadataFlyout = useFlyout(); + const refreshAgent = useAgentRefresh(); + + const items = [ + { + title: i18n.translate('xpack.fleet.agentDetails.statusLabel', { + defaultMessage: 'Status', + }), + description: , + }, + { + title: i18n.translate('xpack.fleet.agentDetails.idLabel', { + defaultMessage: 'ID', + }), + description: agent.id, + }, + { + title: i18n.translate('xpack.fleet.agentDetails.typeLabel', { + defaultMessage: 'Type', + }), + description: agent.type, + }, + { + title: i18n.translate('xpack.fleet.agentDetails.policyLabel', { + defaultMessage: 'Policy', + }), + description: ( + + + + ), + }, + ]; + + return ( + <> + + + +

+ +

+
+
+ + + {unenrollAgentsPrompt => ( + { + unenrollAgentsPrompt([agent.id], 1, refreshAgent); + }} + > + + + )} + + +
+ + + {items.map((item, idx) => ( + + {item.description} + + ))} + + metadataFlyout.show()}>View metadata + + + {metadataFlyout.isVisible && } + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/metadata_flyout.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/metadata_flyout.tsx new file mode 100644 index 0000000000000..e25b923be0091 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/metadata_flyout.tsx @@ -0,0 +1,77 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { SFC } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiTitle, + EuiSpacer, + EuiDescriptionList, + EuiFlyout, + EuiFlyoutHeader, + EuiFlyoutBody, + EuiHorizontalRule, +} from '@elastic/eui'; + +import { Agent } from '../../../../common/types/domain_data'; +import { MetadataForm } from './metadata_form'; + +interface Props { + agent: Agent; + flyout: { hide: () => void }; +} +export const AgentMetadataFlyout: SFC = ({ agent, flyout }) => { + const mapMetadata = (obj: { [key: string]: string } | undefined) => { + return Object.keys(obj || {}).map(key => ({ + title: key, + description: obj ? obj[key] : '', + })); + }; + + const localItems = mapMetadata(agent.local_metadata); + const userProvidedItems = mapMetadata(agent.user_provided_metadata); + + return ( + flyout.hide()} size="s" aria-labelledby="flyoutTitle"> + + +

+ +

+
+
+ + +

+ +

+
+ + + + +

+ +

+
+ + + + + +
+
+ ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/metadata_form.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/metadata_form.tsx new file mode 100644 index 0000000000000..6df53cd0ec1d7 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_details/components/metadata_form.tsx @@ -0,0 +1,171 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { SFC, useState } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiButtonEmpty, + EuiPopover, + EuiFormRow, + EuiButton, + EuiFlexItem, + EuiFieldText, + EuiFlexGroup, + EuiForm, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { AxiosError } from 'axios'; +import { Agent } from '../../../../common/types/domain_data'; +import { useLibs } from '../../../hooks/use_libs'; +import { useAgentRefresh } from '../hooks/use_agent'; + +function useInput() { + const [value, setValue] = useState(''); + + return { + value, + onChange: (e: React.ChangeEvent) => { + setValue(e.target.value); + }, + clear: () => { + setValue(''); + }, + }; +} + +function useAddMetadataForm(agent: Agent, done: () => void) { + const libs = useLibs(); + const refreshAgent = useAgentRefresh(); + const keyInput = useInput(); + const valueInput = useInput(); + const [state, setState] = useState<{ + isLoading: boolean; + error: null | string; + }>({ + isLoading: false, + error: null, + }); + + function clearInputs() { + keyInput.clear(); + valueInput.clear(); + } + + function setError(error: AxiosError) { + setState({ + isLoading: false, + error: error.response && error.response.data ? error.response.data.message : error.message, + }); + } + + async function success() { + await refreshAgent(); + setState({ + isLoading: false, + error: null, + }); + clearInputs(); + done(); + } + + return { + state, + onSubmit: async (e: React.FormEvent | React.MouseEvent) => { + e.preventDefault(); + setState({ + ...state, + isLoading: true, + }); + + try { + await libs.agents.update(agent.id, { + user_provided_metadata: { + ...agent.user_provided_metadata, + [keyInput.value]: valueInput.value, + }, + }); + await success(); + } catch (error) { + setError(error); + } + }, + inputs: { + keyInput, + valueInput, + }, + }; +} + +export const MetadataForm: SFC<{ agent: Agent }> = ({ agent }) => { + const [isOpen, setOpen] = useState(false); + + const form = useAddMetadataForm(agent, () => { + setOpen(false); + }); + const { keyInput, valueInput } = form.inputs; + + const button = ( + setOpen(true)} color={'text'}> + + + ); + return ( + <> + setOpen(false)} + initialFocus="[id=fleet-details-metadata-form]" + > +
+ + + + + + + + + + + + + + + + + + + + + +
+
+ + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_details/hooks/use_agent.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_details/hooks/use_agent.tsx new file mode 100644 index 0000000000000..cd3888774f12d --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_details/hooks/use_agent.tsx @@ -0,0 +1,58 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React, { useState, useEffect } from 'react'; +import { Agent } from '../../../../common/types/domain_data'; +import { useLibs } from '../../../hooks/use_libs'; + +export function useGetAgent(id: string) { + const { agents } = useLibs(); + const [state, setState] = useState<{ + isLoading: boolean; + agent: Agent | null; + error: Error | null; + }>({ + isLoading: false, + agent: null, + error: null, + }); + + const fetchAgent = async (refresh = false) => { + setState({ + ...state, + error: null, + isLoading: !refresh, + }); + try { + const agent = await agents.get(id); + setState({ + isLoading: false, + agent, + error: null, + }); + } catch (error) { + setState({ + isLoading: false, + agent: null, + error, + }); + } + }; + useEffect(() => { + fetchAgent(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [id]); + + return { + ...state, + refreshAgent: () => fetchAgent(true), + }; +} + +export const AgentRefreshContext = React.createContext({ refresh: () => {} }); + +export function useAgentRefresh() { + return React.useContext(AgentRefreshContext).refresh; +} diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_details/index.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_details/index.tsx new file mode 100644 index 0000000000000..81aa6d5b41383 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_details/index.tsx @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React, { SFC } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiPageBody, EuiPageContent, EuiCallOut, EuiText, EuiSpacer } from '@elastic/eui'; +import { RouteComponentProps } from 'react-router-dom'; +import { Loading } from '../../components/loading'; +import { AgentEventsTable } from './components/agent_events_table'; +import { AgentDetailSection } from './components/details_section'; +import { useGetAgent, AgentRefreshContext } from './hooks/use_agent'; + +export const Layout: SFC = ({ children }) => ( + + {children} + +); + +type Props = RouteComponentProps<{ + agentId: string; +}>; + +export const AgentDetailsPage: SFC = ({ + match: { + params: { agentId }, + }, +}) => { + const { agent, isLoading, error, refreshAgent } = useGetAgent(agentId); + + if (isLoading) { + return ; + } + + if (error) { + return ( + + +

+ {error.message} +

+
+
+ ); + } + + if (!agent) { + return ( + + + + ); + } + + return ( + + + + + + + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/agent_enrollment.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/agent_enrollment.tsx new file mode 100644 index 0000000000000..18914f957a887 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/agent_enrollment.tsx @@ -0,0 +1,139 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React, { useState, Fragment } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiFlyout, + EuiFlyoutHeader, + EuiTitle, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiFlexGroup, + EuiFlexItem, + EuiButtonEmpty, + EuiButton, + EuiSpacer, + EuiText, + EuiFilterGroup, + EuiFilterButton, +} from '@elastic/eui'; +import { + ShellEnrollmentInstructions, + ContainerEnrollmentInstructions, + ToolsEnrollmentInstructions, +} from './enrollment_instructions'; +import { useLibs } from '../../../hooks/use_libs'; + +interface RouterProps { + onClose: () => void; +} + +export const AgentEnrollmentFlyout: React.SFC = ({ onClose }) => { + const libs = useLibs(); + const [quickInstallType, setQuickInstallType] = useState<'shell' | 'container' | 'tools'>( + 'shell' + ); + + const renderHeader = () => ( + + +

+ +

+
+ + +

+ +

+
+
+ ); + + const renderInstructions = () => ( + + +
+ +
+
+ + + setQuickInstallType('shell')} + > + + + setQuickInstallType('container')} + > + + + setQuickInstallType('tools')} + > + + + + + {quickInstallType === 'shell' ? ( + + ) : null} + {quickInstallType === 'container' ? : null} + {quickInstallType === 'tools' ? : null} +
+ ); + + const renderBody = () => {renderInstructions()}; + + const renderFooter = () => ( + + + + + Close + + + + + Continue + + + + + ); + + return ( + + {renderHeader()} + {renderBody()} + {renderFooter()} + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/container/index.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/container/index.tsx new file mode 100644 index 0000000000000..03711d531b3aa --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/container/index.tsx @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React from 'react'; + +export const ContainerEnrollmentInstructions: React.SFC = () => { + return
Container instructions
; +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/index.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/index.tsx new file mode 100644 index 0000000000000..4640746ca7ad9 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/index.tsx @@ -0,0 +1,64 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React from 'react'; +import { EuiSteps, EuiText, EuiCodeBlock } from '@elastic/eui'; +import { Writer } from 'mustache'; + +export { ShellEnrollmentInstructions } from './shell'; +export { ContainerEnrollmentInstructions } from './container'; +export { ToolsEnrollmentInstructions } from './tools'; + +export type ManualEnrollmentInstructions = Array<{ + title: string; + textPre?: string; + commands?: string; + commandsLang?: 'bash' | 'yaml'; +}>; + +export const ManualEnrollmentSteps: React.SFC<{ instructions: ManualEnrollmentInstructions }> = ({ + instructions, +}) => ( + ({ + title, + children: ( + + {textPre ?

{textPre}

: null} + {commands ? ( + // TODO: Increase overflowHeight when https://github.com/elastic/eui/issues/2435 is fixed + // or be smarter with setting this number before release + + {replaceTemplateStrings(commands.trim())} + + ) : null} +
+ ), + }))} + /> +); + +// Setup for replacing template variables in install instructions +const mustacheWriter = new Writer(); + +// do not html escape output +// @ts-ignore +mustacheWriter.escapedValue = function escapedValue(token, context) { + const value = context.lookup(token[1]); + if (value != null) { + return value; + } +}; + +// Configure available variable values +export function replaceTemplateStrings(text: string = '') { + const variables = { + config: { + enrollmentToken: 'sometesttoken', + }, + }; + mustacheWriter.parse(text); + return mustacheWriter.render(text, variables, () => {}); +} diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/shell/index.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/shell/index.tsx new file mode 100644 index 0000000000000..a518a75ccdb9a --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/shell/index.tsx @@ -0,0 +1,145 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React, { useState, Fragment } from 'react'; +import { + EuiFieldText, + EuiCopy, + EuiButtonEmpty, + EuiPopover, + EuiSpacer, + EuiContextMenuPanel, + EuiContextMenuItem, +} from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; +import { ManualEnrollmentInstructions, ManualEnrollmentSteps } from '../'; +import * as MAC_COMMANDS from './mac_commands'; + +// No need for i18n as these are platform names +const PLATFORMS = { + macos: 'macOS', + windows: 'Windows', + linux: 'Linux', +}; + +// Manual instructions based on platform +const PLATFORM_INSTRUCTIONS: { + [key: string]: ManualEnrollmentInstructions; +} = { + macos: [ + { + title: i18n.translate('xpack.fleet.agentEnrollment.typeShell.manualInstall.stepOneTitle', { + defaultMessage: 'Download and install Elastic Agent', + }), + textPre: 'Lorem ipsum instructions here.', + commands: MAC_COMMANDS.INSTALL, + }, + { + title: i18n.translate('xpack.fleet.agentEnrollment.typeShell.manualInstall.stepTwoTitle', { + defaultMessage: 'Edit the configuration', + }), + textPre: 'Modify the configuration file to set the connection information:', + commands: MAC_COMMANDS.CONFIG, + commandsLang: 'yaml', + }, + { + title: i18n.translate('xpack.fleet.agentEnrollment.typeShell.manualInstall.stepThreeTitle', { + defaultMessage: 'Start the agent', + }), + commands: MAC_COMMANDS.START, + }, + ], +}; + +interface Props { + kibanaUrl: string; +} + +export const ShellEnrollmentInstructions: React.SFC = ({ kibanaUrl }) => { + // Platform state + const [currentPlatform, setCurrentPlatform] = useState('macos'); + const [isPlatformOptionsOpen, setIsPlatformOptionsOpen] = useState(false); + const [isManualInstallationOpen, setIsManualInstallationOpen] = useState(false); + + // Build quick installation command + const quickInstallInstructions = `curl ${kibanaUrl}/api/fleet/install/${currentPlatform} | bash`; + + return ( + + setIsPlatformOptionsOpen(true)} + > + {PLATFORMS[currentPlatform]} + + } + isOpen={isPlatformOptionsOpen} + closePopover={() => setIsPlatformOptionsOpen(false)} + > + ( + { + setCurrentPlatform(platform as typeof currentPlatform); + setIsPlatformOptionsOpen(false); + }} + > + {name} + + ))} + /> + + } + append={ + + {copy => ( + + + + )} + + } + /> + + + + setIsManualInstallationOpen(!isManualInstallationOpen)} + iconType={isManualInstallationOpen ? 'arrowUp' : 'arrowDown'} + iconSide="right" + size="xs" + flush="left" + > + + + + {isManualInstallationOpen ? ( + + + + + ) : null} + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/shell/mac_commands.ts b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/shell/mac_commands.ts new file mode 100644 index 0000000000000..e853dcf1100cc --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/shell/mac_commands.ts @@ -0,0 +1,43 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const INSTALL = ` +curl -L -O https://artifacts.elastic.co/downloads/some-file-to-download.tar.gz +tar xzvf some-file-to-download.tar.gz +cd some-file-to-download/ +`; + +export const CONFIG = ` +output.elasticsearch: + hosts: [""] + username: "elastic" + password: "" +setup.kibana: + host: "" +output.elasticsearch: + hosts: [""] + username: "elastic" + password: "" +setup.kibana: + host: "" +output.elasticsearch: + hosts: [""] + username: "elastic" + password: "" +setup.kibana: + host: "" +output.elasticsearch: + hosts: [""] + username: "elastic" + password: "" +setup.kibana: + host: "" +`; + +export const START = ` +./somefile setup +./somefile --token={{config.enrollmentToken}} +`; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/tools/index.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/tools/index.tsx new file mode 100644 index 0000000000000..ad7da6928ec7a --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_list/components/enrollment_instructions/tools/index.tsx @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React from 'react'; + +export const ToolsEnrollmentInstructions: React.SFC = () => { + return
Tools instructions
; +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_list/index.scss b/x-pack/legacy/plugins/fleet/public/pages/agent_list/index.scss new file mode 100644 index 0000000000000..10e809c5f5566 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_list/index.scss @@ -0,0 +1,6 @@ +.fleet__agentList__table .euiTableFooterCell { + .euiTableCellContent, + .euiTableCellContent__text { + overflow: visible; + } +} \ No newline at end of file diff --git a/x-pack/legacy/plugins/fleet/public/pages/agent_list/index.tsx b/x-pack/legacy/plugins/fleet/public/pages/agent_list/index.tsx new file mode 100644 index 0000000000000..67ac84e4157d8 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/agent_list/index.tsx @@ -0,0 +1,446 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React, { useState, useEffect } from 'react'; +import useInterval from '@use-it/interval'; +import { + EuiBasicTable, + EuiPageBody, + EuiPageContent, + EuiTitle, + EuiSpacer, + EuiText, + EuiFlexGroup, + EuiFlexItem, + EuiButton, + EuiEmptyPrompt, + // @ts-ignore + EuiSearchBar, + EuiLink, + EuiSwitch, + EuiFilterGroup, + EuiPopover, + EuiFilterSelectItem, + EuiFilterButton, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { AGENT_POLLING_THRESHOLD_MS } from '../../../common/constants'; +import { Agent } from '../../../common/types/domain_data'; +import { AgentHealth } from '../../components/agent_health'; +import { AgentUnenrollProvider } from '../../components/agent_unenroll_provider'; +import { ConnectedLink } from '../../components/navigation/connected_link'; +import { usePagination } from '../../hooks/use_pagination'; +import { SearchBar } from '../../components/search_bar'; +import { AgentEnrollmentFlyout } from './components/agent_enrollment'; +import { useLibs } from '../../hooks/use_libs'; + +export const AgentListPage: React.SFC<{}> = () => { + const libs = useLibs(); + // Agent data states + const [isLoading, setIsLoading] = useState(true); + const [agents, setAgents] = useState([]); + const [lastPolledAgentsMs, setLastPolledAgentsMs] = useState(0); + const [totalAgents, setTotalAgents] = useState(0); + const [showInactive, setShowInactive] = useState(false); + + // Table and search states + const [search, setSearch] = useState(''); + const { pagination, pageSizeOptions, setPagination } = usePagination(); + const [selectedAgents, setSelectedAgents] = useState([]); + const [areAllAgentsSelected, setAreAllAgentsSelected] = useState(false); + + // Policies state (for filtering) + const [policies, setPolicies] = useState([]); + const [isPoliciesLoading, setIsPoliciesLoading] = useState(false); + const [isPoliciesFilterOpen, setIsPoliciesFilterOpen] = useState(false); + const [selectedPolicies, setSelectedPolicies] = useState([]); + + // Add a policy id to current search + const addPolicyFilter = (policyId: string) => { + setSelectedPolicies([...selectedPolicies, policyId]); + }; + + // Remove a policy id from current search + const removePolicyFilter = (policyId: string) => { + setSelectedPolicies(selectedPolicies.filter(policy => policy !== policyId)); + }; + + // Agent enrollment flyout state + const [isEnrollmentFlyoutOpen, setIsEnrollmentFlyoutOpen] = useState(false); + + // Fetch agents method + const fetchAgents = async () => { + setIsLoading(true); + setLastPolledAgentsMs(new Date().getTime()); + + // Build kuery from current search and policy filter states + let kuery = search.trim(); + if (selectedPolicies.length) { + if (kuery) { + kuery = `(${kuery}) and`; + } + kuery = `${kuery} agents.policy_id : (${selectedPolicies + .map(policy => `"${policy}"`) + .join(' or ')})`; + } + + const { list, total } = await libs.agents.getAll( + pagination.currentPage, + pagination.pageSize, + kuery, + showInactive + ); + + setAgents(list); + setTotalAgents(total); + setIsLoading(false); + }; + + // Fetch policies method + const fetchPolicies = async () => { + setIsPoliciesLoading(true); + setPolicies(await libs.policies.getAll()); + setIsPoliciesLoading(false); + }; + + // Load initial list of policies + useEffect(() => { + fetchPolicies(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [showInactive]); + + // Update agents if pagination, query, or policy filter state changes + useEffect(() => { + fetchAgents(); + setAreAllAgentsSelected(false); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [pagination, search, showInactive, selectedPolicies]); + + // Poll for agents on interval + useInterval(() => { + if (new Date().getTime() - lastPolledAgentsMs >= AGENT_POLLING_THRESHOLD_MS) { + fetchAgents(); + } + }, AGENT_POLLING_THRESHOLD_MS); + + // Some agents retrieved, set up table props + const columns = [ + { + field: 'local_metadata.host', + name: i18n.translate('xpack.fleet.agentList.hostColumnTitle', { + defaultMessage: 'Host', + }), + footer: () => { + if (selectedAgents.length === agents.length && totalAgents > selectedAgents.length) { + return areAllAgentsSelected ? ( + setAreAllAgentsSelected(false)}> + + + ), + }} + /> + ) : ( + setAreAllAgentsSelected(true)}> + + + ), + }} + /> + ); + } + return null; + }, + }, + { + field: 'policy_id', + name: i18n.translate('xpack.fleet.agentList.policyColumnTitle', { + defaultMessage: 'Policy', + }), + truncateText: true, + }, + { + field: 'active', + name: i18n.translate('xpack.fleet.agentList.statusColumnTitle', { + defaultMessage: 'Status', + }), + truncateText: true, + render: (active: boolean, agent: any) => , + }, + { + name: i18n.translate('xpack.fleet.agentList.actionsColumnTitle', { + defaultMessage: 'Actions', + }), + actions: [ + { + render: (agent: Agent) => { + return ( + + + + ); + }, + }, + ], + width: '100px', + }, + ]; + + const emptyPrompt = ( + + + + } + actions={ + libs.framework.capabilities.write ? ( + setIsEnrollmentFlyoutOpen(true)}> + + + ) : null + } + /> + ); + + return ( + + + {isEnrollmentFlyoutOpen ? ( + setIsEnrollmentFlyoutOpen(false)} /> + ) : null} + + +

+ +

+
+ + + + + + + + + + + setShowInactive(!showInactive)} + /> + + + + + + {selectedAgents.length ? ( + + + {unenrollAgentsPrompt => ( + { + unenrollAgentsPrompt( + areAllAgentsSelected ? search : selectedAgents.map(agent => agent.id), + areAllAgentsSelected ? totalAgents : selectedAgents.length, + () => { + // Reload agents if on first page and no search query, otherwise + // reset to first page and reset search, which will trigger a reload + if (pagination.currentPage === 1 && !search) { + fetchAgents(); + } else { + setPagination({ + ...pagination, + currentPage: 1, + }); + setSearch(''); + } + + setAreAllAgentsSelected(false); + setSelectedAgents([]); + } + ); + }} + > + + + )} + + + ) : null} + + + + { + setPagination({ + ...pagination, + currentPage: 1, + }); + setSearch(newSearch); + }} + fieldPrefix="agents" + /> + + + + setIsPoliciesFilterOpen(!isPoliciesFilterOpen)} + isSelected={isPoliciesFilterOpen} + hasActiveFilters={selectedPolicies.length > 0} + disabled={isPoliciesLoading} + > + Policies + + } + isOpen={isPoliciesFilterOpen} + closePopover={() => setIsPoliciesFilterOpen(false)} + panelPaddingSize="none" + > +
+ {policies.map((policy, index) => ( + { + if (selectedPolicies.includes(policy.id)) { + removePolicyFilter(policy.id); + } else { + addPolicyFilter(policy.id); + } + }} + > + {policy.name} + + ))} +
+
+
+
+
+
+ {libs.framework.capabilities.write && ( + + setIsEnrollmentFlyoutOpen(true)} + > + + + + )} +
+ + + + ) : !search.trim() && selectedPolicies.length === 0 && totalAgents === 0 ? ( + emptyPrompt + ) : ( + setSearch('')}> + + + ), + }} + /> + ) + } + items={totalAgents ? agents : []} + itemId="id" + columns={columns} + isSelectable={true} + selection={{ + selectable: (agent: Agent) => agent.active, + onSelectionChange: (newSelectedAgents: Agent[]) => { + setSelectedAgents(newSelectedAgents); + setAreAllAgentsSelected(false); + }, + }} + pagination={{ + pageIndex: pagination.currentPage - 1, + pageSize: pagination.pageSize, + totalItemCount: totalAgents, + pageSizeOptions, + }} + onChange={({ page }: { page: { index: number; size: number } }) => { + const newPagination = { + ...pagination, + currentPage: page.index + 1, + pageSize: page.size, + }; + setPagination(newPagination); + }} + /> +
+
+ ); +}; diff --git a/x-pack/legacy/plugins/fleet/public/pages/error/enforce_security.tsx b/x-pack/legacy/plugins/fleet/public/pages/error/enforce_security.tsx new file mode 100644 index 0000000000000..07f7efbb05e33 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/error/enforce_security.tsx @@ -0,0 +1,26 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; +import * as React from 'react'; +import { NoDataLayout } from '../../components/layouts/no_data'; + +export const EnforceSecurityPage = injectI18n(({ intl }) => ( + +

+ +

+
+)); diff --git a/x-pack/legacy/plugins/fleet/public/pages/error/invalid_license.tsx b/x-pack/legacy/plugins/fleet/public/pages/error/invalid_license.tsx new file mode 100644 index 0000000000000..5565be059569a --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/error/invalid_license.tsx @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; +import * as React from 'react'; +import { NoDataLayout } from '../../components/layouts/no_data'; + +export const InvalidLicensePage = injectI18n(({ intl }) => ( + +

+ +

+
+)); diff --git a/x-pack/legacy/plugins/fleet/public/pages/error/no_access.tsx b/x-pack/legacy/plugins/fleet/public/pages/error/no_access.tsx new file mode 100644 index 0000000000000..9115532d5cfd3 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/error/no_access.tsx @@ -0,0 +1,27 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; +import * as React from 'react'; +import { NoDataLayout } from '../../components/layouts/no_data'; + +export const NoAccessPage = injectI18n(({ intl }) => ( + +

+ +

+
+)); diff --git a/x-pack/legacy/plugins/fleet/public/pages/index.tsx b/x-pack/legacy/plugins/fleet/public/pages/index.tsx new file mode 100644 index 0000000000000..322874af2dee1 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/pages/index.tsx @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { EnforceSecurityPage } from './error/enforce_security'; +import { InvalidLicensePage } from './error/invalid_license'; +import { NoAccessPage } from './error/no_access'; +import { AgentListPage } from './agent_list'; +import { AgentDetailsPage } from './agent_details'; + +export const routeMap = [ + { path: '/error/enforce_security', component: EnforceSecurityPage }, + { path: '/error/invalid_license', component: InvalidLicensePage }, + { path: '/error/no_access', component: NoAccessPage }, + { path: '/agents/:agentId', component: AgentDetailsPage }, + { path: '/agents', component: AgentListPage }, +]; diff --git a/x-pack/legacy/plugins/fleet/public/routes.tsx b/x-pack/legacy/plugins/fleet/public/routes.tsx new file mode 100644 index 0000000000000..57966c57254ca --- /dev/null +++ b/x-pack/legacy/plugins/fleet/public/routes.tsx @@ -0,0 +1,92 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { get } from 'lodash'; +import React, { useState, useEffect, SFC } from 'react'; +import { Redirect, Route, Switch } from 'react-router-dom'; +import { Loading } from './components/loading'; +import { ChildRoutes } from './components/navigation/child_routes'; +import { URLStateProps, WithURLState } from './hooks/with_url_state'; +import { routeMap } from './pages'; +import { useLibs } from './hooks/use_libs'; + +function useWaitUntilFrameworkReady() { + const libs = useLibs(); + const [isLoading, setIsLoading] = useState(true); + + const waitUntilReady = async () => { + try { + await libs.framework.waitUntilFrameworkReady(); + } catch (e) { + // Silently swallow error + } + setIsLoading(false); + }; + + useEffect(() => { + waitUntilReady(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return { isLoading }; +} + +export const AppRoutes: SFC = () => { + const { isLoading } = useWaitUntilFrameworkReady(); + const libs = useLibs(); + + if (isLoading === true) { + return ; + } + + return ( + + {/* Redirects mapping */} + + {/* License check (UI displays when license exists but is expired) */} + {get(libs.framework.info, 'license.expired', true) && ( + + !props.location.pathname.includes('/error') ? ( + + ) : null + } + /> + )} + + {!libs.framework.capabilities.read && ( + + !props.location.pathname.includes('/error') ? ( + + ) : null + } + /> + )} + + {/* Ensure security is eanabled for elastic and kibana */} + {/* TODO: Disabled for now as we don't have this info set up on backend yet */} + {/* {!get(this.props.libs.framework.info, 'security.enabled', true) && ( + + !props.location.pathname.includes('/error') ? ( + + ) : null + } + /> + )} */} + + {/* This app does not make use of a homepage. The main page is agents list */} + } /> + + + {/* Render routes from the FS */} + + {(URLProps: URLStateProps) => } + + + ); +}; diff --git a/x-pack/legacy/plugins/fleet/scripts/dev_agent/index.js b/x-pack/legacy/plugins/fleet/scripts/dev_agent/index.js new file mode 100644 index 0000000000000..ac0de67296adb --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/dev_agent/index.js @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +require('../../../../../../src/setup_node_env'); +require('./script'); diff --git a/x-pack/legacy/plugins/fleet/scripts/dev_agent/script.ts b/x-pack/legacy/plugins/fleet/scripts/dev_agent/script.ts new file mode 100644 index 0000000000000..88de888d16200 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/dev_agent/script.ts @@ -0,0 +1,123 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { createFlagError, run, ToolingLog } from '@kbn/dev-utils'; +import fetch from 'node-fetch'; +import os from 'os'; + +const CHECKIN_INTERVAL = 3000; // 3 seconds + +interface Agent { + id: string; + access_api_key: string; +} + +let closing = false; + +process.once('SIGINT', () => { + closing = true; +}); + +run( + async ({ flags, log }) => { + if (!flags.kibanaUrl || typeof flags.kibanaUrl !== 'string') { + throw createFlagError('please provide a single --path flag'); + } + + if (!flags.enrollmentApiKey || typeof flags.enrollmentApiKey !== 'string') { + throw createFlagError('please provide a single --enrollmentApiKey flag'); + } + const kibanaUrl: string = (flags.kibanaUrl as string) || 'http://localhost:5601'; + const agent = await enroll(kibanaUrl, flags.enrollmentApiKey as string, log); + + log.info('Enrolled with sucess', agent); + + while (!closing) { + await new Promise((resolve, reject) => + setTimeout(() => checkin(kibanaUrl, agent, log).then(resolve, reject), CHECKIN_INTERVAL) + ); + } + }, + { + description: ` + Run a fleet development agent. + `, + flags: { + string: ['kibanaUrl', 'enrollmentApiKey'], + help: ` + --kibanaUrl kibanaURL to run the fleet agent + --enrollmentApiKey enrollment api key + `, + }, + } +); + +async function checkin(kibanaURL: string, agent: Agent, log: ToolingLog) { + const res = await fetch(`${kibanaURL}/api/fleet/agents/${agent.id}/checkin`, { + method: 'POST', + body: JSON.stringify({ + events: [ + { + type: 'STATE', + subtype: 'RUNNING', + message: 'state changed from STOPPED to RUNNING', + timestamp: new Date().toISOString(), + payload: { random: 'data', state: 'RUNNING', previous_state: 'STOPPED' }, + data: '{}', + }, + ], + }), + headers: { + 'kbn-xsrf': 'xxx', + Authorization: `ApiKey ${agent.access_api_key}`, + }, + }); + + if (res.status === 403) { + closing = true; + log.info('Unenrolling agent'); + return; + } + + const json = await res.json(); + log.info('checkin', json); +} + +async function enroll(kibanaURL: string, apiKey: string, log: ToolingLog): Promise { + const res = await fetch(`${kibanaURL}/api/fleet/agents/enroll`, { + method: 'POST', + body: JSON.stringify({ + type: 'PERMANENT', + metadata: { + local: { + host: 'localhost', + ip: '127.0.0.1', + system: `${os.type()} ${os.release()}`, + memory: os.totalmem(), + }, + user_provided: { + dev_agent_version: '0.0.1', + region: 'us-east', + }, + }, + }), + headers: { + 'kbn-xsrf': 'xxx', + Authorization: `ApiKey ${apiKey}`, + }, + }); + const json = await res.json(); + + if (!json.success) { + log.error(JSON.stringify(json, null, 2)); + throw new Error('unable to enroll'); + } + + return { + id: json.item.id, + access_api_key: json.item.access_api_key, + }; +} diff --git a/x-pack/legacy/plugins/fleet/scripts/dev_env_setup/index.js b/x-pack/legacy/plugins/fleet/scripts/dev_env_setup/index.js new file mode 100644 index 0000000000000..ac0de67296adb --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/dev_env_setup/index.js @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +require('../../../../../../src/setup_node_env'); +require('./script'); diff --git a/x-pack/legacy/plugins/fleet/scripts/dev_env_setup/script.ts b/x-pack/legacy/plugins/fleet/scripts/dev_env_setup/script.ts new file mode 100644 index 0000000000000..d6aec090c9935 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/dev_env_setup/script.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { createFlagError, run } from '@kbn/dev-utils'; +import fetch from 'node-fetch'; + +run( + async ({ flags, log }) => { + const kibanaUrl = flags.kibanaUrl || 'http://localhost:5601'; + + const kibanaUser = flags.kibanaUser || 'elastic'; + const kibanaPassword = flags.kibanaPassword || 'changeme'; + + if (kibanaUrl && typeof kibanaUrl !== 'string') { + throw createFlagError('please provide a single --kibanaUrl flag'); + } + if (kibanaUser && typeof kibanaUser !== 'string') { + throw createFlagError('please provide a single --kibanaUser flag'); + } + if (kibanaPassword && typeof kibanaPassword !== 'string') { + throw createFlagError('please provide a single --kibanaPassword flag'); + } + + const apiKey = await createEnrollmentApiKey(kibanaUrl, kibanaUser, kibanaPassword); + log.info('Enrollment API Key', apiKey); + }, + { + description: ` + Setup a fleet enrollment API Key. + `, + flags: { + string: ['kibanaUrl', 'kibanaUser', 'kibanaPassword'], + help: ` + --kibanaUrl kibanaURL to run the fleet agent + --kibanaUser Kibana username + --kibanaPassword Kibana password + `, + }, + } +); + +async function createEnrollmentApiKey( + kibanaURL: string, + kibanaUser: string, + kibanaPassword: string, + policyId?: string +): Promise { + const res = await fetch(`${kibanaURL}/api/fleet/enrollment-api-keys`, { + method: 'POST', + body: JSON.stringify({ + policy_id: policyId, + }), + headers: { + 'kbn-xsrf': 'xsrf', + 'content-type': 'application/json', + authorization: `Basic ${Buffer.from(`${kibanaUser}:${kibanaPassword}`).toString('base64')}`, + }, + }); + + const json = await res.json(); + return json.item.api_key; +} diff --git a/x-pack/legacy/plugins/fleet/scripts/load_testing/artillery.yml b/x-pack/legacy/plugins/fleet/scripts/load_testing/artillery.yml new file mode 100644 index 0000000000000..07fd6d11f331b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/load_testing/artillery.yml @@ -0,0 +1,14 @@ +config: + target: 'http://0.0.0.0:5601' + phases: + - duration: 20 + arrivalRate: 10 + rampTo: 50 + name: 'Warm up the stack' + - duration: 400 + arrivalRate: 100000 + name: 'Sustained max load' +scenarios: + - flow: + - get: + url: '/wuc/api/fleet/load' diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/index.js b/x-pack/legacy/plugins/fleet/scripts/mock_spec/index.js new file mode 100644 index 0000000000000..ac0de67296adb --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/index.js @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +require('../../../../../../src/setup_node_env'); +require('./script'); diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/asset.v1.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/asset.v1.json new file mode 100644 index 0000000000000..7cdb03733975c --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/asset.v1.json @@ -0,0 +1,16 @@ +{ + "title": "Asset", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "$ref": "./asset_type.v1.json" + } + }, + "required": [ + "id", + "type" + ] +} diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/asset_type.v1.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/asset_type.v1.json new file mode 100644 index 0000000000000..837115982f198 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/asset_type.v1.json @@ -0,0 +1,13 @@ +{ + "type": "string", + "title": "AssetType", + "description": "Types of assets which can be installed/removed", + "enum": [ + "index-template", + "ingest-pipeline", + "ilm-policy", + "rollup-job", + "ml-job", + "data-frame-transform" + ] + } diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/datasource.v1.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/datasource.v1.json new file mode 100644 index 0000000000000..4a7bba82a9032 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/datasource.v1.json @@ -0,0 +1,33 @@ +{ + "title": "Datasource", + "type": "object", + "description": "A package with a use case (eg prod_west). The use case ID must be unique. A datasource can have multiple streams.", + "properties": { + "name": { + "type": "string", + "example": "prod_west", + "description": "Should be unique" + }, + "package": { + "$ref": "./package.v1.json" + }, + "streams": { + "type": "array", + "items": { + "$ref": "./stream.v1.json" + } + }, + "id": { + "type": "string", + "format": "uuid" + }, + "read_alias": { + "type": "string" + } + }, + "required": [ + "name", + "package", + "streams" + ] +} diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/input.v1.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/input.v1.json new file mode 100644 index 0000000000000..01fe26df97cee --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/input.v1.json @@ -0,0 +1,50 @@ +{ + "title": "Input", + "type": "object", + "description": "Where the data comes from", + "properties": { + "type": { + "type": "string", + "enum": [ + "log", + "metric/system", + "metric/docker", + "etc" + ] + }, + "config": { + "type": "object", + "example": "{paths: \"/var/log/*.log\"} or {metricsets: [\"container\", \"cpu\"]} or {username: \"elastic\", password: \"changeme\"}", + "description": "Mix of configurable and required properties still TBD. Object for now might become string" + }, + "ingest_pipelines": { + "type": "array", + "description": "Need a distinction for \"main\" ingest pipeline. Should be handled during install. Likely by package/manifest format", + "items": { + "type": "string" + } + }, + "id": { + "type": "string", + "format": "uuid" + }, + "index_template": { + "type": "string" + }, + "ilm_policy": { + "type": "string" + }, + "fields": { + "type": "array", + "description": "", + "items": { + "type": "object", + "description": "contents from fields.yml" + } + } + }, + "required": [ + "type", + "config" + ] +} diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/output.v1.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/output.v1.json new file mode 100644 index 0000000000000..c21cc27b80fcf --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/output.v1.json @@ -0,0 +1,47 @@ +{ + "title": "Output", + "type": "object", + "description": "Where to send the data", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string", + "example": "\"default\" or \"infosec1\"" + }, + "type": { + "type": "string", + "enum": [ + "elasticsearch", + "something", + "else" + ] + }, + "url": { + "type": "string", + "format": "uri" + }, + "api_token": { + "type": "string" + }, + "index_name": { + "type": "string", + "example": "metrics-mysql-prod_west-access", + "description": "unique alias with write index" + }, + "ingest_pipeline": { + "type": "string", + "example": "metrics-mysql-prod_west-access" + }, + "config": { + "type": "object", + "description": "contains everything not otherwise specified (e.g. TLS, etc)" + } + }, + "required": [ + "id", + "name", + "type" + ] +} diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/package.v1.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/package.v1.json new file mode 100644 index 0000000000000..553fc800a41c7 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/package.v1.json @@ -0,0 +1,34 @@ +{ + "title": "Package", + "type": "object", + "description": "Multiple dashboard templates and multiple input templates, eg access log, error log, metrics, consisting of index template, ingest pipeline, ML jobs.", + "properties": { + "name": { + "type": "string", + "example": "coredns" + }, + "version": { + "type": "string", + "example": "1.0.1, 1.3.1" + }, + "description": { + "type": "string", + "example": "CoreDNS logs and metrics integration.\nThe CoreDNS integrations allows to gather logs and metrics from the CoreDNS DNS server to get better insights.\n" + }, + "title": { + "type": "string", + "example": "CoreDNS" + }, + "assets": { + "type": "array", + "items": { + "$ref": "./asset.v1.json" + } + } + }, + "required": [ + "name", + "version", + "assets" + ] +} diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/policy.v1.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/policy.v1.json new file mode 100644 index 0000000000000..b910f17e0fb93 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/policy.v1.json @@ -0,0 +1,53 @@ +{ + "title": "Policy", + "type": "object", + "description": "Has config from zero or more datasources.", + "x-examples": { + "example-1": { + "value": { + "id": "policy_example", + "name": "Example Policy", + "datasources": [ + { + "use_case": "prod_west", + "packcage": {}, + "streams": [ + {} + ] + } + ] + } + } + }, + "properties": { + "id": { + "type": "string", + "example": "policy_example" + }, + "name": { + "type": "string", + "example": "Example Policy" + }, + "datasources": { + "type": "array", + "uniqueItems": true, + "items": { + "$ref": "./datasource.v1.json" + } + }, + "description": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "active", + "inactive" + ] + } + }, + "required": [ + "id", + "status" + ] +} diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/stream.v1.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/stream.v1.json new file mode 100644 index 0000000000000..76c531d3cd317 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/models/stream.v1.json @@ -0,0 +1,31 @@ +{ + "title": "Stream", + "type": "object", + "description": "A combination of an input type, the required config, an output, and any processors", + "properties": { + "id": { + "type": "string" + }, + "input": { + "$ref": "./input.v1.json" + }, + "config": { + "type": "object", + "example": "{paths: \"/var/log/*.log\"} or {metricsets: [\"container\", \"cpu\"]} or {username: \"elastic\", password: \"changeme\"}" + }, + "output": { + "$ref": "./output.v1.json" + }, + "processors": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "id", + "input", + "output" + ] +} diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/openapi.json b/x-pack/legacy/plugins/fleet/scripts/mock_spec/openapi.json new file mode 100644 index 0000000000000..42259058ec853 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/openapi.json @@ -0,0 +1,137 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Ingest", + "version": "1.0", + "description": "Strawman API for fka Ingest Plugin", + "license": { + "url": "https://raw.githubusercontent.com/elastic/elasticsearch/master/licenses/ELASTIC-LICENSE.txt", + "name": "Elastic" + }, + "contact": { + "name": "Elastic Observability Team" + } + }, + "servers": [ + { + "url": "http://localhost:5601/api/integrations_manager" + } + ], + "paths": { + "/policies": { + "get": { + "summary": "Get policies", + "tags": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "array", + "items": { + "$ref": "./models/policy.v1.json" + } + }, + { + "$ref": "./models/policy.v1.json" + } + ] + } + } + }, + "headers": { + "$ref": "#/components/headers" + } + } + }, + "parameters": [ + { + "schema": {}, + "in": "query", + "name": "datasource" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "policyid" + } + ], + "description": "Return polices linked to a datasource", + "operationId": "getPolicies" + }, + "options": { + "responses": { + "200": { + "description": "OK", + "headers": { + "$ref": "#/components/headers" + } + } + } + }, + "parameters": [] + }, + "/datasources": { + "get": { + "summary": "Get datasources", + "tags": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "./models/datasource.v1.json" + } + } + } + } + } + }, + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "policyId" + } + ], + "description": "Return datasources", + "operationId": "getDatasourcs" + } + } + }, + "components": { + "headers": { + "Access-Control-Allow-Origin": { + "description": "CORS", + "schema": { + "type": "string" + }, + "example": "http://localhost:5601" + }, + "Access-Control-Allow-Credentials": { + "description": "CORS", + "schema": { + "type": "boolean" + }, + "example": "true" + }, + "Access-Control-Allow-Headers": { + "description": "CORS", + "schema": { + "type": "string" + }, + "example": "kbn-xsrf, kbn-version, credentials" + } + } + } +} \ No newline at end of file diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/script.ts b/x-pack/legacy/plugins/fleet/scripts/mock_spec/script.ts new file mode 100644 index 0000000000000..8cfa687f8e9ed --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/script.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { run } from '@kbn/dev-utils'; +import { spawn } from 'child_process'; +import { resolve } from 'path'; + +run( + async ({ log }) => { + const specPath = resolve(__dirname, 'openapi.json'); + const prismPath = resolve(__dirname, '../../node_modules/.bin/prism'); + const prismProc = spawn(prismPath, ['mock', specPath, '--cors=false']); + + prismProc.stdout.on('data', data => { + process.stdout.write(data); + }); + + prismProc.stderr.on('data', data => { + process.stderr.write(data); + }); + + prismProc.on('close', code => { + log.info(`Prism mock server exited with code ${code}`); + }); + }, + { + description: ` + Sets up a mock server with ingest endpoints defined by openapi spec. + `, + } +); diff --git a/x-pack/legacy/plugins/fleet/scripts/mock_spec/types.ts b/x-pack/legacy/plugins/fleet/scripts/mock_spec/types.ts new file mode 100644 index 0000000000000..38bc7e8b4b72f --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/mock_spec/types.ts @@ -0,0 +1,129 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +/** + * Has config from zero or more datasources. + */ +export interface Policy { + datasources?: Datasource[]; + description?: string; + id: string; + name?: string; + status: Status; +} + +/** + * A package with a use case (eg prod_west). The use case ID must be unique. A datasource + * can have multiple streams. + */ +export interface Datasource { + id?: string; + /** + * Should be unique + */ + name: string; + package: Package; + read_alias?: string; + streams: Stream[]; +} + +/** + * Multiple dashboard templates and multiple input templates, eg access log, error log, + * metrics, consisting of index template, ingest pipeline, ML jobs. + */ +export interface Package { + assets: Asset[]; + description?: string; + name: string; + title?: string; + version: string; +} + +export interface Asset { + id: string; + type: AssetType; +} + +/** + * Types of assets which can be installed/removed + */ +export enum AssetType { + DataFrameTransform = 'data-frame-transform', + IlmPolicy = 'ilm-policy', + IndexTemplate = 'index-template', + IngestPipeline = 'ingest-pipeline', + MlJob = 'ml-job', + RollupJob = 'rollup-job', +} + +/** + * A combination of an input type, the required config, an output, and any processors + */ +export interface Stream { + config?: { [key: string]: any }; + id: string; + input: Input; + output: Output; + processors?: string[]; +} + +/** + * Where the data comes from + */ +export interface Input { + /** + * Mix of configurable and required properties still TBD. Object for now might become string + */ + config: { [key: string]: any }; + fields?: Array<{ [key: string]: any }>; + id?: string; + ilm_policy?: string; + index_template?: string; + /** + * Need a distinction for "main" ingest pipeline. Should be handled during install. Likely + * by package/manifest format + */ + ingest_pipelines?: string[]; + type: InputType; +} + +export enum InputType { + Etc = 'etc', + Log = 'log', + MetricDocker = 'metric/docker', + MetricSystem = 'metric/system', +} + +/** + * Where to send the data + */ +export interface Output { + api_token?: string; + /** + * contains everything not otherwise specified (e.g. TLS, etc) + */ + config?: { [key: string]: any }; + id: string; + /** + * unique alias with write index + */ + index_name?: string; + ingest_pipeline?: string; + name: string; + type: OutputType; + url?: string; +} + +export enum OutputType { + Elasticsearch = 'elasticsearch', + Else = 'else', + Something = 'something', +} + +export enum Status { + Active = 'active', + Inactive = 'inactive', +} diff --git a/x-pack/legacy/plugins/fleet/scripts/readme.md b/x-pack/legacy/plugins/fleet/scripts/readme.md new file mode 100644 index 0000000000000..a4da2e3767e24 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/scripts/readme.md @@ -0,0 +1,27 @@ +### Dev agents + +You can run a development fleet agent that is going to enroll and checkin every 3 seconds. +For this you can run the following command in the fleet pluging directory. + +``` +node scripts/dev_agent --enrollmentApiKey= --kibanaUrl=http://localhost:5603/qed +``` + +To generate a dummy config and an enrollment enrollmentApiKey you can use this script + +``` +node scripts/dev_env_setup --kibanaUrl=http://localhost:5603/qed --kibanaUser=elastic --kibanaPassword=changeme +``` + +### Ingest endpoints + +To spin up a mock server with ingest endpoints (policies, datasources, etc), run: + +``` +node scripts/mock_spec +``` + +#### Testing load + +`artillery run x-pack/legacy/plugins/fleet/dev/load_testing/artillery.yml` +but edit for kibana path first... diff --git a/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/__memorize_snapshots__/default.contract.test.slap_snap b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/__memorize_snapshots__/default.contract.test.slap_snap new file mode 100644 index 0000000000000..9fdd79bae58bd --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/__memorize_snapshots__/default.contract.test.slap_snap @@ -0,0 +1,18 @@ + +exports['AgentsEventsRepository Api Keys allow to create and delete an api key - createApiKey (1)'] = { + "results": { + "id": "tLNEZW4B4KwD6w8oPuUl", + "name": "test api key", + "api_key": "RXqjPJhUQ8O7LWLMH4Wuvw" + } +} + +exports['AgentsEventsRepository Api Keys allow to create and delete an api key - deleteApiKey (2)'] = { + "results": { + "invalidated_api_keys": [ + "tLNEZW4B4KwD6w8oPuUl" + ], + "previously_invalidated_api_keys": [], + "error_count": 0 + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/adapter_types.ts b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/adapter_types.ts new file mode 100644 index 0000000000000..0c57ee408c58b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/adapter_types.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { FrameworkUser } from '../framework/adapter_types'; + +export interface ElasticsearchAdapter { + authenticate(user: FrameworkUser): Promise; + createApiKey( + user: FrameworkUser, + data: { name: string; expiration?: any; role_descriptors?: any } + ): Promise<{ id: string; api_key: string }>; + deleteApiKey(user: FrameworkUser, data: { id: string }): Promise; +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/default.contract.test.ts b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/default.contract.test.ts new file mode 100644 index 0000000000000..0dac8aa0ab519 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/default.contract.test.ts @@ -0,0 +1,61 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import { FrameworkUser } from '../../adapters/framework/adapter_types'; +import { MemorizedElasticsearchAdapter } from './memorize_adapter'; +import { ElasticsearchAdapter } from './default'; +import { ElasticsearchAdapter as ElasticsearchAdapterType } from './adapter_types'; + +describe('AgentsEventsRepository', () => { + let servers: any; + + let esAdapter: ElasticsearchAdapterType; + + function getUser(): FrameworkUser { + return ({ + kind: 'internal', + } as unknown) as FrameworkUser; + } + + beforeAll(async () => { + await Slapshot.callWhenOnline(async () => { + const { createKibanaServer } = await import( + '../../../../../../test_utils/jest/contract_tests/servers' + ); + servers = await createKibanaServer({ + security: { enabled: false }, + }); + + esAdapter = new MemorizedElasticsearchAdapter( + new ElasticsearchAdapter(servers.kbnServer.plugins.elasticsearch) + ); + }); + + if (!esAdapter) { + esAdapter = new MemorizedElasticsearchAdapter(); + } + }); + + afterAll(async () => { + if (servers) { + await servers.shutdown; + } + }); + + describe('Api Keys', () => { + it('allow to create and delete an api key', async () => { + const key = await esAdapter.createApiKey(getUser(), { + name: 'test api key', + }); + expect(key).toHaveProperty('id'); + expect(key).toHaveProperty('api_key'); + await esAdapter.deleteApiKey(getUser(), { + id: key.id, + }); + }); + }); +}); diff --git a/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/default.ts b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/default.ts new file mode 100644 index 0000000000000..8beea99db0e85 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/default.ts @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ElasticsearchPlugin } from 'src/legacy/core_plugins/elasticsearch'; +import { ElasticsearchAdapter as ElasticsearchAdapterType } from './adapter_types'; +import { FrameworkUser, internalAuthData } from '../framework/adapter_types'; + +export class ElasticsearchAdapter implements ElasticsearchAdapterType { + constructor(private readonly elasticsearch: ElasticsearchPlugin) {} + + public async createApiKey( + user: FrameworkUser, + data: { name: string; expiration?: any; role_descriptors?: any } + ) { + const options = { + method: 'POST', + path: '/_security/api_key', + body: data, + }; + return await this._call(user, 'transport.request', options); + } + + public async deleteApiKey(user: FrameworkUser, data: { id: string }) { + const options = { + method: 'DELETE', + path: '/_security/api_key', + body: data, + }; + return await this._call(user, 'transport.request', options); + } + + public async authenticate(user: FrameworkUser) { + if (user.kind !== 'authenticated') { + throw new Error('Not supported'); + } + const options = { + method: 'GET', + path: '/_security/_authenticate', + }; + return await this._call(user, 'transport.request', options); + } + + private async _call(user: FrameworkUser, endpoint: any, params: any): Promise { + const { callWithInternalUser, callWithRequest } = this.elasticsearch.getCluster('admin'); + if (user.kind === 'internal') { + return await callWithInternalUser(endpoint, params); + throw new Error('Elastic search call is only implemented for internal user'); + } + + if (user.kind === 'authenticated') { + return await callWithRequest({ headers: user[internalAuthData] }, endpoint, params); + } + + throw new Error('Elastic search call is not implemented for unauthenticated user'); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/in_memory.ts b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/in_memory.ts new file mode 100644 index 0000000000000..cb5bfb78dbcdd --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/in_memory.ts @@ -0,0 +1,47 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ElasticsearchAdapter as ElasticsearchAdapterType } from './adapter_types'; +import { FrameworkUser } from '../framework/adapter_types'; + +/** + * In memory fake elastic search adapter for tests purpose only + */ +export class InMemoryElasticsearchAdapter implements ElasticsearchAdapterType { + public apiKeys: { + [k: string]: { + api_key: string; + id: string; + }; + } = {}; + + private keyId = 1; + + public async createApiKey( + user: FrameworkUser, + data: { name: string; expiration?: any; role_descriptors?: any } + ) { + const id = `api-key-${this.keyId++}`; + const key = Buffer.from(`${id}:VALID_API_KEY`).toString('base64'); + + const apiKey = { + id, + api_key: key, + }; + + this.apiKeys[apiKey.id] = apiKey; + + return this.apiKeys[apiKey.id]; + } + + public async deleteApiKey(user: FrameworkUser, data: { id: string }) { + delete this.apiKeys[data.id]; + } + + public async authenticate(user: FrameworkUser) { + return; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/memorize_adapter.ts b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/memorize_adapter.ts new file mode 100644 index 0000000000000..e6fe00c9ae6ad --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/elasticsearch/memorize_adapter.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import { ElasticsearchAdapter } from './adapter_types'; +import { FrameworkUser } from '../framework/adapter_types'; + +export class MemorizedElasticsearchAdapter implements ElasticsearchAdapter { + constructor(private readonly esAdapter?: ElasticsearchAdapter) {} + public async authenticate(user: FrameworkUser): Promise { + return Slapshot.memorize( + `authenticate`, + async () => { + if (!this.esAdapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.esAdapter.authenticate(user); + }, + { pure: false } + ); + } + public async createApiKey( + user: FrameworkUser, + data: { name: string; expiration?: any; role_descriptors?: any } + ): Promise<{ id: string; api_key: string }> { + return Slapshot.memorize( + `createApiKey`, + async () => { + if (!this.esAdapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.esAdapter.createApiKey(user, data); + }, + { pure: false } + ); + } + + public async deleteApiKey(user: FrameworkUser, data: { id: string }): Promise { + return Slapshot.memorize( + `deleteApiKey`, + async () => { + if (!this.esAdapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.esAdapter.deleteApiKey(user, data); + }, + { pure: false } + ); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/adapter_types.ts b/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/adapter_types.ts new file mode 100644 index 0000000000000..0a3374324f38b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/adapter_types.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { SavedObjectsBaseOptions, SavedObjectAttributes, SavedObject } from 'src/core/server'; + +export interface EncryptedSavedObjects { + getDecryptedAsInternalUser( + type: string, + id: string, + options?: SavedObjectsBaseOptions + ): Promise>; +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/default.ts b/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/default.ts new file mode 100644 index 0000000000000..41bb8025fe5e3 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/default.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { SavedObjectsBaseOptions, SavedObjectAttributes, SavedObject } from 'src/core/server'; +import { PluginStartContract } from '../../../../../../plugins/encrypted_saved_objects/server'; +import { EncryptedSavedObjects as EncryptedSavedObjectsType } from './adapter_types'; + +export class EncryptedSavedObjects implements EncryptedSavedObjectsType { + constructor(private readonly plugin: PluginStartContract) {} + + public async getDecryptedAsInternalUser( + type: string, + id: string, + options?: SavedObjectsBaseOptions + ): Promise> { + return await this.plugin.getDecryptedAsInternalUser(type, id, options); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/memorize_adapter.ts b/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/memorize_adapter.ts new file mode 100644 index 0000000000000..bb933a5a2919b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/encrypted_saved_objects/memorize_adapter.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { memorize } from '@mattapperson/slapshot/lib/memorize'; +import { SavedObjectsBaseOptions, SavedObjectAttributes, SavedObject } from 'src/core/server'; +import { EncryptedSavedObjects } from './adapter_types'; + +/** + * Memorize adpater for test purpose only + */ +export class MemorizeEncryptedSavedObjects implements EncryptedSavedObjects { + constructor(private readonly adapter?: EncryptedSavedObjects) {} + + public async getDecryptedAsInternalUser( + type: string, + id: string, + options?: SavedObjectsBaseOptions + ): Promise> { + return await memorize( + `getDecryptedAsInternalUser:${type}:${id}`, + async () => { + if (!this.adapter) { + throw new Error('You must provide an adapter to run this method online'); + } + + return await this.adapter.getDecryptedAsInternalUser(type, id, options); + }, + { + pure: false, + } + ); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/framework/__memorize_snapshots__/default.contract.test.slap_snap b/x-pack/legacy/plugins/fleet/server/adapters/framework/__memorize_snapshots__/default.contract.test.slap_snap new file mode 100644 index 0000000000000..319adc2839696 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/framework/__memorize_snapshots__/default.contract.test.slap_snap @@ -0,0 +1,5 @@ + +exports['Agent Adapter getSetting Work - getSetting'] = { + "results": "xpack_fleet_default_encryptionKey", + "thrownError": null +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/framework/adapter_types.ts b/x-pack/legacy/plugins/fleet/server/adapters/framework/adapter_types.ts new file mode 100644 index 0000000000000..1f69534cbe387 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/framework/adapter_types.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Legacy } from 'kibana'; +import { ResponseToolkit, ResponseObject } from 'hapi'; +import { Request } from 'src/legacy/server/kbn_server'; + +export type KibanaLegacyServer = Legacy.Server; + +export interface FrameworkAdapter { + getSetting(settingPath: string): string; + getServerInfo(): { + protocol: string; + }; + expose(name: string, thing: any): void; +} + +export interface FrameworkRequest = any> { + query: KibanaServerRequestGenaric['query']; + params: KibanaServerRequestGenaric['params']; + payload: KibanaServerRequestGenaric['payload']; + headers: KibanaServerRequestGenaric['headers']; + user: FrameworkUser; +} + +export type FrameworkResponseToolkit = ResponseToolkit; + +export type FrameworkResponseObject = ResponseObject; + +export const internalAuthData = Symbol('internalAuthData'); +export const internalUser: FrameworkInternalUser = { + kind: 'internal', +}; + +export interface FrameworkAuthenticatedUser { + kind: 'authenticated'; + [internalAuthData]: AuthDataType; +} + +export interface FrameworkUnAuthenticatedUser { + kind: 'unauthenticated'; +} + +export interface FrameworkInternalUser { + kind: 'internal'; +} + +export type FrameworkUser = + | FrameworkAuthenticatedUser + | FrameworkUnAuthenticatedUser + | FrameworkInternalUser; + +export interface FrameworkRoute< + RouteRequest extends FrameworkRequest = FrameworkRequest, + RouteResponse extends ResponseObject = any +> { + path: string; + method: string | string[]; + vhost?: string; + licenseRequired?: string[]; + requiredRoles?: string[]; + handler: (request: RouteRequest, h: FrameworkResponseToolkit) => RouteResponse; + config?: {}; +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/framework/default.contract.test.ts b/x-pack/legacy/plugins/fleet/server/adapters/framework/default.contract.test.ts new file mode 100644 index 0000000000000..6a347dfb54ee3 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/framework/default.contract.test.ts @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import { MemorizeFrameworkAdapter } from './memorize'; +import { FrameworkAdapter } from './default'; +import { FrameworkAdapter as FrameworkAdapterType } from './adapter_types'; + +describe('Agent Adapter', () => { + let adapter: FrameworkAdapterType; + let servers: any; + + beforeAll(async () => { + await Slapshot.callWhenOnline(async () => { + const { createKibanaServer } = await import( + '../../../../../../test_utils/jest/contract_tests/servers' + ); + + servers = await createKibanaServer({ + security: { enabled: false }, + }); + adapter = new MemorizeFrameworkAdapter(new FrameworkAdapter(servers.kbnServer)); + }); + + if (!adapter) { + adapter = new MemorizeFrameworkAdapter(); + } + }); + + afterAll(async () => { + if (servers) { + await servers.shutdown; + } + }); + describe('getSetting', () => { + it('Work', () => { + const setting = adapter.getSetting('xpack.fleet.encryptionKey'); + + expect(setting).toBe('xpack_fleet_default_encryptionKey'); + }); + }); +}); diff --git a/x-pack/legacy/plugins/fleet/server/adapters/framework/default.ts b/x-pack/legacy/plugins/fleet/server/adapters/framework/default.ts new file mode 100644 index 0000000000000..9650689804e69 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/framework/default.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { KibanaLegacyServer, FrameworkAdapter as FrameworkAdapterType } from './adapter_types'; + +export class FrameworkAdapter implements FrameworkAdapterType { + constructor(private readonly server: KibanaLegacyServer) {} + + public getSetting(settingPath: string): string { + return this.server.config().get(settingPath); + } + + public getServerInfo() { + return this.server.info; + } + + public expose(name: string, thing: any) { + this.server.expose(name, thing); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/framework/hapi_framework_adapter.ts b/x-pack/legacy/plugins/fleet/server/adapters/framework/hapi_framework_adapter.ts new file mode 100644 index 0000000000000..379168103b590 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/framework/hapi_framework_adapter.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Server, Request, ResponseToolkit } from 'hapi'; +import { + FrameworkRoute, + FrameworkRequest, + FrameworkUser, + internalAuthData, + FrameworkResponseToolkit, +} from './adapter_types'; + +export class HapiFrameworkAdapter { + constructor(private readonly server: Server) {} + + public registerRoute(route: FrameworkRoute) { + this.server.route({ + ...route, + handler: async function frameworkRouteHandler(request: Request, h: ResponseToolkit) { + const frameworkRequest = HapiFrameworkAdapter.getFrameworkRequestFromRequest(request); + + return await route.handler(frameworkRequest, h as FrameworkResponseToolkit); + }, + }); + } + + public static getFrameworkRequestFromRequest(request: Request): FrameworkRequest { + const { params, payload, query, headers } = request; + return { + params, + payload, + query, + headers, + user: HapiFrameworkAdapter.getUserFromRequest(request), + }; + } + public static getUserFromRequest(request: Request): FrameworkUser { + const isAuthenticated = request.headers.authorization != null; + + return isAuthenticated + ? { + kind: 'authenticated', + [internalAuthData]: request.headers, + } + : { + kind: 'unauthenticated', + }; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/framework/memorize.ts b/x-pack/legacy/plugins/fleet/server/adapters/framework/memorize.ts new file mode 100644 index 0000000000000..e8a6e7fb70cb9 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/framework/memorize.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import { FrameworkAdapter } from './adapter_types'; + +export class MemorizeFrameworkAdapter implements FrameworkAdapter { + constructor(private readonly adapter?: FrameworkAdapter) {} + + public getSetting(settingPath: string): string { + return Slapshot.memorize('getSetting', () => { + if (!this.adapter) { + throw new Error('an adapter must be provided to run online'); + } + return this.adapter.getSetting(settingPath); + }) as string; + } + + public getServerInfo() { + return { + protocol: 'http://', + }; + } + + public expose(name: string, thing: any) {} +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/adapter_type.ts b/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/adapter_type.ts new file mode 100644 index 0000000000000..9b1ab6a4e37d0 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/adapter_type.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export interface HttpOptions { + baseURL?: string; + url?: string; + responseType: 'stream' | 'text'; +} + +export interface HttpAdapter { + get( + options: HttpOptions & { + responseType: 'stream'; + } + ): Promise; + + get( + options: HttpOptions & { + responseType: 'text'; + } + ): Promise; +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/default.ts b/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/default.ts new file mode 100644 index 0000000000000..81224322ed63c --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/default.ts @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import axios, { AxiosInstance } from 'axios'; +import { HttpAdapter as HttpAdapterType, HttpOptions } from './adapter_type'; + +/** + * Basic http adapter to make external request + */ +export class HttpAdapter implements HttpAdapterType { + private readonly client: AxiosInstance; + constructor() { + this.client = axios.create(); + } + + get( + options: HttpOptions & { + responseType: 'stream'; + } + ): Promise; + + get( + options: HttpOptions & { + responseType: 'text'; + } + ): Promise; + public async get( + options: (HttpOptions & { responseType: 'text' }) | (HttpOptions & { responseType: 'stream' }) + ): Promise { + const res = await this.client(options); + + switch (options.responseType) { + case 'stream': + return res.data as NodeJS.ReadableStream; + default: + return res.data as string; + } + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/in_memory.ts b/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/in_memory.ts new file mode 100644 index 0000000000000..63887e1aea715 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/http_adapter/in_memory.ts @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Duplex } from 'stream'; +import { HttpAdapter as HttpAdapterType, HttpOptions } from './adapter_type'; + +/** + * In memory http adapter for test purpose + */ +export class InMemoryHttpAdapter implements HttpAdapterType { + public responses: { [key: string]: any } = {}; + + get( + options: HttpOptions & { + responseType: 'stream'; + } + ): Promise; + + get( + options: HttpOptions & { + responseType: 'text'; + } + ): Promise; + public async get( + options: (HttpOptions & { responseType: 'text' }) | (HttpOptions & { responseType: 'stream' }) + ): Promise { + const key = `${options.baseURL || ''}/${options.url || ''}`; + switch (options.responseType) { + case 'stream': + const stream = new Duplex(); + stream.push(this.responses[key]); + stream.push(null); + return stream; + default: + return this.responses[key] as string; + } + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/adapter_types.ts b/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/adapter_types.ts new file mode 100644 index 0000000000000..39859e61cc44a --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/adapter_types.ts @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + SavedObjectAttributes, + SavedObjectsBulkCreateObject, + SavedObjectsBaseOptions, + SavedObjectsFindOptions, + SavedObjectsFindResponse, + SavedObjectsBulkResponse, + SavedObject, + SavedObjectsUpdateOptions, + SavedObjectsCreateOptions, + SavedObjectsBulkGetObject, + SavedObjectsUpdateResponse, +} from 'src/core/server'; +import { FrameworkUser } from '../framework/adapter_types'; + +export interface SODatabaseAdapter { + create( + user: FrameworkUser, + type: string, + data: T, + options?: SavedObjectsCreateOptions + ): Promise>; + + bulkCreate( + user: FrameworkUser, + objects: Array>, + options?: SavedObjectsCreateOptions + ): Promise>; + + delete( + user: FrameworkUser, + type: string, + id: string, + options?: SavedObjectsBaseOptions + ): Promise<{}>; + + find( + user: FrameworkUser, + options: SavedObjectsFindOptions + ): Promise>; + + bulkGet( + user: FrameworkUser, + objects: SavedObjectsBulkGetObject[], + options?: SavedObjectsBaseOptions + ): Promise>; + + get( + user: FrameworkUser, + type: string, + id: string, + options?: SavedObjectsBaseOptions + ): Promise | null>; + + update( + user: FrameworkUser, + type: string, + id: string, + attributes: Partial, + options?: SavedObjectsUpdateOptions + ): Promise>; +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/default.ts b/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/default.ts new file mode 100644 index 0000000000000..c57f1ee9ef6a4 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/default.ts @@ -0,0 +1,172 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + SavedObjectAttributes, + SavedObjectsBulkCreateObject, + SavedObjectsBaseOptions, + SavedObjectsFindOptions, + SavedObjectsFindResponse, + SavedObjectsBulkResponse, + SavedObject, + SavedObjectsUpdateOptions, + SavedObjectsCreateOptions, + SavedObjectsBulkGetObject, + SavedObjectsUpdateResponse, + SavedObjectsClient as SavedObjectsClientType, + SavedObjectsLegacyService, +} from 'src/core/server'; +import { ElasticsearchPlugin } from 'src/legacy/core_plugins/elasticsearch'; +import { SODatabaseAdapter as SODatabaseAdapterType } from './adapter_types'; +import { FrameworkUser, internalAuthData } from '../framework/adapter_types'; + +export class SODatabaseAdapter implements SODatabaseAdapterType { + private readonly internalClient: SavedObjectsClientType; + constructor( + private readonly savedObject: SavedObjectsLegacyService, + elasticsearch: ElasticsearchPlugin + ) { + const { SavedObjectsClient, getSavedObjectsRepository } = savedObject; + const { callWithInternalUser } = elasticsearch.getCluster('admin'); + const internalRepository = getSavedObjectsRepository(callWithInternalUser); + + this.internalClient = new SavedObjectsClient(internalRepository); + this.savedObject = savedObject; + } + + private getClient(user: FrameworkUser) { + if (user.kind === 'authenticated') { + return this.savedObject.getScopedSavedObjectsClient({ + headers: user[internalAuthData], + }); + } + + if (user.kind === 'internal') { + return this.internalClient; + } + + throw new Error('Not supported'); + } + /** + * Persists a SavedObject + * + * @param type + * @param attributes + * @param options + */ + async create( + user: FrameworkUser, + type: string, + data: T, + options?: SavedObjectsCreateOptions + ) { + return await this.getClient(user).create(type, data, options); + } + + /** + * Persists multiple documents batched together as a single request + * + * @param objects + * @param options + */ + async bulkCreate( + user: FrameworkUser, + objects: Array>, + options?: SavedObjectsCreateOptions + ) { + return await this.getClient(user).bulkCreate(objects, options); + } + + /** + * Deletes a SavedObject + * + * @param type + * @param id + * @param options + */ + async delete( + user: FrameworkUser, + type: string, + id: string, + options: SavedObjectsBaseOptions = {} + ) { + return await this.getClient(user).delete(type, id, options); + } + + /** + * Find all SavedObjects matching the search query + * + * @param options + */ + async find( + user: FrameworkUser, + options: SavedObjectsFindOptions + ): Promise> { + return await this.getClient(user).find(options); + } + + /** + * Returns an array of objects by id + * + * @param objects - an array of ids, or an array of objects containing id, type and optionally fields + * @example + * + * bulkGet([ + * { id: 'one', type: 'config' }, + * { id: 'foo', type: 'index-pattern' } + * ]) + */ + async bulkGet( + user: FrameworkUser, + objects: SavedObjectsBulkGetObject[] = [], + options: SavedObjectsBaseOptions = {} + ): Promise> { + return await this.getClient(user).bulkGet(objects, options); + } + + /** + * Retrieves a single object + * + * @param type - The type of SavedObject to retrieve + * @param id - The ID of the SavedObject to retrieve + * @param options + */ + async get( + user: FrameworkUser, + type: string, + id: string, + options: SavedObjectsBaseOptions = {} + ): Promise | null> { + try { + const savedObject = await this.getClient(user).get(type, id, options); + + return savedObject; + } catch (err) { + if (err.isBoom && err.output.statusCode === 404) { + return null; + } + + throw err; + } + } + + /** + * Updates an SavedObject + * + * @param type + * @param id + * @param options + */ + async update( + user: FrameworkUser, + type: string, + id: string, + attributes: Partial, + options: SavedObjectsUpdateOptions = {} + ): Promise> { + return await this.getClient(user).update(type, id, attributes, options); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/memorize_adapter.ts b/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/memorize_adapter.ts new file mode 100644 index 0000000000000..ecd6f79dc28d1 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/adapters/saved_objects_database/memorize_adapter.ts @@ -0,0 +1,150 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import { + SavedObjectAttributes, + SavedObjectsBulkCreateObject, + SavedObjectsBaseOptions, + SavedObjectsFindOptions, + SavedObjectsFindResponse, + SavedObjectsBulkResponse, + SavedObject, + SavedObjectsUpdateOptions, + SavedObjectsCreateOptions, + SavedObjectsBulkGetObject, + SavedObjectsUpdateResponse, +} from 'src/core/server'; +import { SODatabaseAdapter as SODatabaseAdapterType } from './adapter_types'; +import { SODatabaseAdapter } from './default'; +import { FrameworkUser } from '../framework/adapter_types'; + +export class MemorizeSODatabaseAdapter implements SODatabaseAdapterType { + constructor(private soAdadpter?: SODatabaseAdapter) {} + + async create( + user: FrameworkUser, + type: string, + data: T, + options?: SavedObjectsCreateOptions + ) { + return Slapshot.memorize( + `create:${type}`, + () => { + if (!this.soAdadpter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.soAdadpter.create(user, type, data, options); + }, + { pure: false } + ); + } + + async bulkCreate( + user: FrameworkUser, + objects: Array>, + options?: SavedObjectsCreateOptions + ) { + return Slapshot.memorize( + `bulkCreate`, + () => { + if (!this.soAdadpter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.soAdadpter.bulkCreate(user, objects, options); + }, + { pure: false } + ); + } + + async delete( + user: FrameworkUser, + type: string, + id: string, + options: SavedObjectsBaseOptions = {} + ) { + return Slapshot.memorize( + `delete`, + () => { + if (!this.soAdadpter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.soAdadpter.delete(user, type, id, options); + }, + { pure: false } + ); + } + + async find( + user: FrameworkUser, + options: SavedObjectsFindOptions + ): Promise> { + return Slapshot.memorize( + `find:${JSON.stringify(options.type)}`, + () => { + if (!this.soAdadpter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.soAdadpter.find(user, options); + }, + { pure: false } + ); + } + + async bulkGet( + user: FrameworkUser, + objects: SavedObjectsBulkGetObject[] = [], + options: SavedObjectsBaseOptions = {} + ): Promise> { + return Slapshot.memorize( + `bulkGet`, + () => { + if (!this.soAdadpter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.soAdadpter.bulkGet(user, objects, options); + }, + { pure: false } + ); + } + + async get( + user: FrameworkUser, + type: string, + id: string, + options: SavedObjectsBaseOptions = {} + ): Promise | null> { + return Slapshot.memorize( + `get:${type}`, + () => { + if (!this.soAdadpter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.soAdadpter.get(user, type, id, options); + }, + { pure: false } + ); + } + + async update( + user: FrameworkUser, + type: string, + id: string, + attributes: Partial, + options: SavedObjectsUpdateOptions = {} + ): Promise> { + return Slapshot.memorize( + `update:${type}`, + () => { + if (!this.soAdadpter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.soAdadpter.update(user, type, id, attributes, options); + }, + { pure: false } + ); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/kibana.index.ts b/x-pack/legacy/plugins/fleet/server/kibana.index.ts new file mode 100644 index 0000000000000..9da5a91f3d62d --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/kibana.index.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { compose } from './libs/compose/kibana'; +import { initRestApi } from './routes/init_api'; +import { FrameworkUser } from './adapters/framework/adapter_types'; +import { PolicyUpdatedEvent } from '../common/types/domain_data'; + +export const initServerWithKibana = (hapiServer: any) => { + const libs = compose(hapiServer); + initRestApi(hapiServer, libs); + // expose methods + libs.framework.expose('policyUpdated', async function handlePolicyUpdate( + event: PolicyUpdatedEvent, + user: FrameworkUser = { + kind: 'internal', + } + ) { + if (event.type === 'created') { + await libs.apiKeys.generateEnrollmentApiKey(user, { + policyId: event.policyId, + }); + } + if (event.type === 'deleted') { + await libs.agents.unenrollForPolicy(user, event.policyId); + await libs.apiKeys.deleteEnrollmentApiKeyForPolicyId(user, event.policyId); + } + }); +}; diff --git a/x-pack/legacy/plugins/fleet/server/libs/__memorize_snapshots__/agent.contract.test.slap_snap b/x-pack/legacy/plugins/fleet/server/libs/__memorize_snapshots__/agent.contract.test.slap_snap new file mode 100644 index 0000000000000..ba58de97ecc5d --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/__memorize_snapshots__/agent.contract.test.slap_snap @@ -0,0 +1,1582 @@ + +exports['Agent lib Enroll Should throw if the enrollment api key is not valid - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib Enroll Should enroll a new PERMANENT agent - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib Enroll Should enroll a new PERMANENT agent - find:"agents" (2)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib Enroll Should enroll a new PERMANENT agent - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "86bd7020-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "shared_id": "agent-1", + "active": true, + "policy_id": "policyId", + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:43.233Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:54:43.234Z", + "version": "WzIyNywxXQ==" + } +} + +exports['Agent lib Enroll Should enroll a new PERMANENT agent - update:agents (4)'] = { + "results": { + "id": "86bd7020-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:54:44.297Z", + "version": "WzIyOCwxXQ==", + "attributes": { + "access_api_key_id": "mock-access-api-key-id-1" + } + } +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "86bd7020-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "shared_id": "agent-1", + "active": true, + "policy_id": "policyId", + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:43.233Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [], + "access_api_key_id": "mock-access-api-key-id-1" + }, + "references": [], + "updated_at": "2019-11-13T14:54:44.297Z", + "version": "WzIyOCwxXQ==" + } + ] + } +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - delete (2)'] = { + "results": {} +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - find:"agents" (3)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "889eb340-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "shared_id": "agent-1", + "active": true, + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:46.387Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:54:46.388Z", + "version": "WzIzMCwxXQ==" + } +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - update:agents (5)'] = { + "results": { + "id": "889eb340-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:54:47.399Z", + "version": "WzIzMSwxXQ==", + "attributes": { + "access_api_key_id": "mock-access-api-key-id-1" + } + } +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - update:agents (6)'] = { + "results": { + "id": "889eb340-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:54:48.433Z", + "version": "WzIzMiwxXQ==", + "attributes": { + "active": false + } + } +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - find:"agents" (7)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "889eb340-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "shared_id": "agent-1", + "active": false, + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:46.387Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [], + "access_api_key_id": "mock-access-api-key-id-1" + }, + "references": [], + "updated_at": "2019-11-13T14:54:48.433Z", + "version": "WzIzMiwxXQ==" + } + ] + } +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - update:agents (8)'] = { + "results": { + "id": "889eb340-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:54:49.451Z", + "version": "WzIzMywxXQ==", + "attributes": { + "shared_id": "agent-1", + "active": true, + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:49.450Z" + } + } +} + +exports['Agent lib Enroll Should allow to enroll a new PERMANENT agent again if this agent is active - update:agents (9)'] = { + "results": { + "id": "889eb340-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:54:50.456Z", + "version": "WzIzNCwxXQ==", + "attributes": { + "access_api_key_id": "mock-access-api-key-id-2" + } + } +} + +exports['Agent lib Enroll Should not enroll a new PERMANENT agent if this agent is already active - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "889eb340-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "shared_id": "agent-1", + "active": true, + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:49.450Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [], + "access_api_key_id": "mock-access-api-key-id-2" + }, + "references": [], + "updated_at": "2019-11-13T14:54:50.456Z", + "version": "WzIzNCwxXQ==" + } + ] + } +} + +exports['Agent lib Enroll Should not enroll a new PERMANENT agent if this agent is already active - delete (2)'] = { + "results": {} +} + +exports['Agent lib Enroll Should not enroll a new PERMANENT agent if this agent is already active - find:"agents" (3)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib Enroll Should not enroll a new PERMANENT agent if this agent is already active - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "8c415570-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "shared_id": "agent-1", + "active": true, + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:52.486Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:54:52.487Z", + "version": "WzIzNiwxXQ==" + } +} + +exports['Agent lib Enroll Should not enroll a new PERMANENT agent if this agent is already active - update:agents (5)'] = { + "results": { + "id": "8c415570-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:54:53.498Z", + "version": "WzIzNywxXQ==", + "attributes": { + "access_api_key_id": "mock-access-api-key-id-1" + } + } +} + +exports['Agent lib Enroll Should not enroll a new PERMANENT agent if this agent is already active - find:"agents" (6)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "8c415570-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "shared_id": "agent-1", + "active": true, + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:52.486Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [], + "access_api_key_id": "mock-access-api-key-id-1" + }, + "references": [], + "updated_at": "2019-11-13T14:54:53.498Z", + "version": "WzIzNywxXQ==" + } + ] + } +} + +exports['Agent lib Enroll Should enroll a new EPHEMERAL agent - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "8c415570-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "shared_id": "agent-1", + "active": true, + "type": "PERMANENT", + "enrolled_at": "2019-11-13T14:54:52.486Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [], + "access_api_key_id": "mock-access-api-key-id-1" + }, + "references": [], + "updated_at": "2019-11-13T14:54:53.498Z", + "version": "WzIzNywxXQ==" + } + ] + } +} + +exports['Agent lib Enroll Should enroll a new EPHEMERAL agent - delete (2)'] = { + "results": {} +} + +exports['Agent lib Enroll Should enroll a new EPHEMERAL agent - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "8e132f40-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "active": true, + "policy_id": "policyId", + "type": "EPHEMERAL", + "enrolled_at": "2019-11-13T14:54:55.538Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:54:55.540Z", + "version": "WzIzOSwxXQ==" + } +} + +exports['Agent lib Enroll Should enroll a new EPHEMERAL agent - update:agents (4)'] = { + "results": { + "id": "8e132f40-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:54:56.551Z", + "version": "WzI0MCwxXQ==", + "attributes": { + "access_api_key_id": "mock-access-api-key-id-1" + } + } +} + +exports['Agent lib Delete should delete ephemeral instances - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "8e132f40-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "active": true, + "policy_id": "policyId", + "type": "EPHEMERAL", + "enrolled_at": "2019-11-13T14:54:55.538Z", + "user_provided_metadata": "{}", + "local_metadata": "{}", + "actions": [], + "access_api_key_id": "mock-access-api-key-id-1" + }, + "references": [], + "updated_at": "2019-11-13T14:54:56.551Z", + "version": "WzI0MCwxXQ==" + } + ] + } +} + +exports['Agent lib Delete should delete ephemeral instances - delete (2)'] = { + "results": {} +} + +exports['Agent lib Delete should delete ephemeral instances - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "8fe2bf20-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "EPHEMERAL", + "active": true, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:54:58.578Z", + "version": "WzI0MiwxXQ==" + } +} + +exports['Agent lib Delete should delete ephemeral instances - find:"agent_events" (4)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib Delete should delete ephemeral instances - delete (5)'] = { + "results": {} +} + +exports['Agent lib Delete should delete ephemeral instances - get:agents (6)'] = { + "results": null +} + +exports['Agent lib Delete should desactivate other agent - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib Delete should desactivate other agent - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "91180ad0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "PERMANENT", + "active": true, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:00.605Z", + "version": "WzI0NCwxXQ==" + } +} + +exports['Agent lib Delete should desactivate other agent - update:agents (3)'] = { + "results": { + "id": "91180ad0-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:01.614Z", + "version": "WzI0NSwxXQ==", + "attributes": { + "active": false + } + } +} + +exports['Agent lib Delete should desactivate other agent - get:agents (4)'] = { + "results": { + "id": "91180ad0-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:01.614Z", + "version": "WzI0NSwxXQ==", + "attributes": { + "type": "PERMANENT", + "active": false, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [] + } +} + +exports['Agent lib list should return all agents - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "91180ad0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "PERMANENT", + "active": false, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:01.614Z", + "version": "WzI0NSwxXQ==" + } + ] + } +} + +exports['Agent lib list should return all agents - delete (2)'] = { + "results": {} +} + +exports['Agent lib list should return all agents - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "92e74c90-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "PERMANENT", + "active": true, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:03.641Z", + "version": "WzI0NywxXQ==" + } +} + +exports['Agent lib list should return all agents - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "93844fe0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "PERMANENT", + "active": true, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:04.670Z", + "version": "WzI0OCwxXQ==" + } +} + +exports['Agent lib list should return all agents - find:"agents" (5)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 2, + "saved_objects": [ + { + "type": "agents", + "id": "92e74c90-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "PERMANENT", + "active": true, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:03.641Z", + "version": "WzI0NywxXQ==" + }, + { + "type": "agents", + "id": "93844fe0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "PERMANENT", + "active": true, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:04.670Z", + "version": "WzI0OCwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should throw if the agens do not exists - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 2, + "saved_objects": [ + { + "type": "agents", + "id": "92e74c90-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "PERMANENT", + "active": true, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:03.641Z", + "version": "WzI0NywxXQ==" + }, + { + "type": "agents", + "id": "93844fe0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "type": "PERMANENT", + "active": true, + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:04.670Z", + "version": "WzI0OCwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should throw if the agens do not exists - delete (2)'] = { + "results": {} +} + +exports['Agent lib checkin should throw if the agens do not exists - delete (3)'] = { + "results": {} +} + +exports['Agent lib checkin should throw if the agens do not exists - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib checkin should throw is the agent is not active - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib checkin should throw is the agent is not active - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "95578940-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "actions": [], + "active": false, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:07.732Z", + "version": "WzI1MSwxXQ==" + } +} + +exports['Agent lib checkin should throw is the agent is not active - find:"agents" (3)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "95578940-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "actions": [], + "active": false, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:07.732Z", + "version": "WzI1MSwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should persist new events - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "95578940-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "actions": [], + "active": false, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:07.732Z", + "version": "WzI1MSwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should persist new events - delete (2)'] = { + "results": {} +} + +exports['Agent lib checkin should persist new events - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "96890460-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:09.734Z", + "version": "WzI1MywxXQ==" + } +} + +exports['Agent lib checkin should persist new events - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "96890460-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:09.734Z", + "version": "WzI1MywxXQ==" + } + ] + } +} + +exports['Agent lib checkin should persist new events - update:agents (5)'] = { + "results": { + "id": "96890460-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:10.747Z", + "version": "WzI1NCwxXQ==", + "attributes": { + "last_checkin": "2019-11-13T14:55:10.745Z", + "actions": [] + } + } +} + +exports['Agent lib checkin should persist new events - bulkCreate (6)'] = { + "results": { + "saved_objects": [ + { + "id": "agent_events:97bd3ea0-0625-11ea-9674-75a3ee7c8618", + "type": "agent_events", + "updated_at": "2019-11-13T14:55:11.754Z", + "version": "WzI1NSwxXQ==", + "attributes": { + "agent_id": "96890460-0625-11ea-9674-75a3ee7c8618", + "timestamp": "2019-09-05T15:41:26+0000", + "type": "STATE", + "subtype": "STARTING", + "message": "State changed from PAUSE to STARTING" + }, + "references": [] + } + ] + } +} + +exports['Agent lib checkin should persist new events - find:"agent_events" (7)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agent_events", + "id": "97bd3ea0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "agent_id": "96890460-0625-11ea-9674-75a3ee7c8618", + "timestamp": "2019-09-05T15:41:26+0000", + "type": "STATE", + "subtype": "STARTING", + "message": "State changed from PAUSE to STARTING" + }, + "references": [], + "updated_at": "2019-11-13T14:55:11.754Z", + "version": "WzI1NSwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should not update agent metadata if none are provided - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "96890460-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "last_checkin": "2019-11-13T14:55:10.745Z" + }, + "references": [], + "updated_at": "2019-11-13T14:55:10.747Z", + "version": "WzI1NCwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should not update agent metadata if none are provided - delete (2)'] = { + "results": {} +} + +exports['Agent lib checkin should not update agent metadata if none are provided - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "98f71e30-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:13.811Z", + "version": "WzI1NywxXQ==" + } +} + +exports['Agent lib checkin should not update agent metadata if none are provided - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "98f71e30-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:13.811Z", + "version": "WzI1NywxXQ==" + } + ] + } +} + +exports['Agent lib checkin should not update agent metadata if none are provided - update:agents (5)'] = { + "results": { + "id": "98f71e30-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:14.823Z", + "version": "WzI1OCwxXQ==", + "attributes": { + "last_checkin": "2019-11-13T14:55:14.821Z", + "actions": [] + } + } +} + +exports['Agent lib checkin should not update agent metadata if none are provided - get:agents (6)'] = { + "results": { + "id": "98f71e30-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:14.823Z", + "version": "WzI1OCwxXQ==", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "last_checkin": "2019-11-13T14:55:14.821Z" + }, + "references": [] + } +} + +exports['Agent lib checkin should return the full policy for this agent - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "98f71e30-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "last_checkin": "2019-11-13T14:55:14.821Z" + }, + "references": [], + "updated_at": "2019-11-13T14:55:14.823Z", + "version": "WzI1OCwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should return the full policy for this agent - delete (2)'] = { + "results": {} +} + +exports['Agent lib checkin should return the full policy for this agent - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "9ac6d520-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:16.850Z", + "version": "WzI2MCwxXQ==" + } +} + +exports['Agent lib checkin should return the full policy for this agent - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "9ac6d520-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:16.850Z", + "version": "WzI2MCwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should return the full policy for this agent - update:agents (5)'] = { + "results": { + "id": "9ac6d520-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:17.873Z", + "version": "WzI2MSwxXQ==", + "attributes": { + "last_checkin": "2019-11-13T14:55:17.868Z", + "actions": [] + } + } +} + +exports['Agent lib checkin should update agent metadata if provided - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "9ac6d520-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "last_checkin": "2019-11-13T14:55:17.868Z" + }, + "references": [], + "updated_at": "2019-11-13T14:55:17.873Z", + "version": "WzI2MSwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should update agent metadata if provided - delete (2)'] = { + "results": {} +} + +exports['Agent lib checkin should update agent metadata if provided - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "9c979d80-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:19.895Z", + "version": "WzI2MywxXQ==" + } +} + +exports['Agent lib checkin should update agent metadata if provided - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "9c979d80-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:19.895Z", + "version": "WzI2MywxXQ==" + } + ] + } +} + +exports['Agent lib checkin should update agent metadata if provided - update:agents (5)'] = { + "results": { + "id": "9c979d80-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:20.906Z", + "version": "WzI2NCwxXQ==", + "attributes": { + "last_checkin": "2019-11-13T14:55:20.904Z", + "actions": [], + "local_metadata": "{\"key\":\"local2\"}" + } + } +} + +exports['Agent lib checkin should update agent metadata if provided - get:agents (6)'] = { + "results": { + "id": "9c979d80-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:20.906Z", + "version": "WzI2NCwxXQ==", + "attributes": { + "local_metadata": "{\"key\":\"local2\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "last_checkin": "2019-11-13T14:55:20.904Z" + }, + "references": [] + } +} + +exports['Agent lib checkin should return new actions - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "9c979d80-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local2\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "last_checkin": "2019-11-13T14:55:20.904Z" + }, + "references": [], + "updated_at": "2019-11-13T14:55:20.906Z", + "version": "WzI2NCwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should return new actions - delete (2)'] = { + "results": {} +} + +exports['Agent lib checkin should return new actions - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "9e677b80-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "actions": [ + { + "created_at": "2019-09-05T15:43:26+0000", + "type": "PAUSE", + "id": "this-a-unique-id" + }, + { + "created_at": "2019-09-05T15:41:26+0000", + "type": "PAUSE", + "sent_at": "2019-09-05T15:42:26+0000", + "id": "this-a-unique-id-already-sent" + } + ], + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:22.936Z", + "version": "WzI2NiwxXQ==" + } +} + +exports['Agent lib checkin should return new actions - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "9e677b80-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "actions": [ + { + "created_at": "2019-09-05T15:43:26+0000", + "type": "PAUSE", + "id": "this-a-unique-id" + }, + { + "created_at": "2019-09-05T15:41:26+0000", + "type": "PAUSE", + "sent_at": "2019-09-05T15:42:26+0000", + "id": "this-a-unique-id-already-sent" + } + ], + "local_metadata": "{}", + "user_provided_metadata": "{}" + }, + "references": [], + "updated_at": "2019-11-13T14:55:22.936Z", + "version": "WzI2NiwxXQ==" + } + ] + } +} + +exports['Agent lib checkin should return new actions - update:agents (5)'] = { + "results": { + "id": "9e677b80-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:23.960Z", + "version": "WzI2NywxXQ==", + "attributes": { + "last_checkin": "2019-11-13T14:55:23.958Z", + "actions": [ + { + "created_at": "2019-09-05T15:43:26+0000", + "type": "PAUSE", + "id": "this-a-unique-id", + "sent_at": "2019-11-13T14:55:23.958Z" + } + ] + } + } +} + +exports['Agent lib unenroll should set the list of agents as inactive - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "9e677b80-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "active": true, + "policy_id": "policy:1", + "access_api_key_id": "key1", + "actions": [ + { + "sent_at": "2019-11-13T14:55:23.958Z", + "created_at": "2019-09-05T15:43:26+0000", + "id": "this-a-unique-id", + "type": "PAUSE" + } + ], + "local_metadata": "{}", + "user_provided_metadata": "{}", + "last_checkin": "2019-11-13T14:55:23.958Z" + }, + "references": [], + "updated_at": "2019-11-13T14:55:23.960Z", + "version": "WzI2NywxXQ==" + } + ] + } +} + +exports['Agent lib unenroll should set the list of agents as inactive - delete (2)'] = { + "results": {} +} + +exports['Agent lib unenroll should set the list of agents as inactive - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "a0389200-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:25.984Z", + "version": "WzI2OSwxXQ==" + } +} + +exports['Agent lib unenroll should set the list of agents as inactive - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "a0d32450-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:26.997Z", + "version": "WzI3MCwxXQ==" + } +} + +exports['Agent lib unenroll should set the list of agents as inactive - update:agents (5)'] = { + "results": { + "id": "a0389200-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:28.012Z", + "version": "WzI3MSwxXQ==", + "attributes": { + "active": false + } + } +} + +exports['Agent lib unenroll should set the list of agents as inactive - update:agents (6)'] = { + "results": { + "id": "a0d32450-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:29.019Z", + "version": "WzI3MiwxXQ==", + "attributes": { + "active": false + } + } +} + +exports['Agent lib unenroll should set the list of agents as inactive - get:agents (7)'] = { + "results": { + "id": "a0389200-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:28.012Z", + "version": "WzI3MSwxXQ==", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": false, + "policy_id": "policy:1" + }, + "references": [] + } +} + +exports['Agent lib unenroll should set the list of agents as inactive - get:agents (8)'] = { + "results": { + "id": "a0d32450-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:29.019Z", + "version": "WzI3MiwxXQ==", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": false, + "policy_id": "policy:1" + }, + "references": [] + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 2, + "saved_objects": [ + { + "type": "agents", + "id": "a0389200-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": false, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:28.012Z", + "version": "WzI3MSwxXQ==" + }, + { + "type": "agents", + "id": "a0d32450-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": false, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:29.019Z", + "version": "WzI3MiwxXQ==" + } + ] + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - delete (2)'] = { + "results": {} +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - delete (3)'] = { + "results": {} +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "a3d6ee70-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:32.055Z", + "version": "WzI3NSwxXQ==" + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - create:agents (5)'] = { + "results": { + "type": "agents", + "id": "a4743fe0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:33.086Z", + "version": "WzI3NiwxXQ==" + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - find:"agents" (6)'] = { + "results": { + "page": 1, + "per_page": 100, + "total": 2, + "saved_objects": [ + { + "type": "agents", + "id": "a3d6ee70-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:32.055Z", + "version": "WzI3NSwxXQ==" + }, + { + "type": "agents", + "id": "a4743fe0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": true, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:33.086Z", + "version": "WzI3NiwxXQ==" + } + ] + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - update:agents (7)'] = { + "results": { + "id": "a3d6ee70-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:34.128Z", + "version": "WzI3NywxXQ==", + "attributes": { + "active": false + } + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - update:agents (8)'] = { + "results": { + "id": "a4743fe0-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:35.103Z", + "version": "WzI3OCwxXQ==", + "attributes": { + "active": false + } + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - find:"agents" (9)'] = { + "results": { + "page": 2, + "per_page": 100, + "total": 0, + "saved_objects": [] + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - get:agents (10)'] = { + "results": { + "id": "a3d6ee70-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:34.128Z", + "version": "WzI3NywxXQ==", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": false, + "policy_id": "policy:1" + }, + "references": [] + } +} + +exports['Agent lib unenrollForPolicy should set all the of agents for this policy as inactive - get:agents (11)'] = { + "results": { + "id": "a4743fe0-0625-11ea-9674-75a3ee7c8618", + "type": "agents", + "updated_at": "2019-11-13T14:55:35.103Z", + "version": "WzI3OCwxXQ==", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": false, + "policy_id": "policy:1" + }, + "references": [] + } +} + +exports['Agent lib addAction should throw if the agent do not exists - find:"agents" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 2, + "saved_objects": [ + { + "type": "agents", + "id": "a3d6ee70-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": false, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:34.128Z", + "version": "WzI3NywxXQ==" + }, + { + "type": "agents", + "id": "a4743fe0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "local_metadata": "{\"key\":\"local1\"}", + "user_provided_metadata": "{\"key\":\"user1\"}", + "actions": [], + "active": false, + "policy_id": "policy:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:35.103Z", + "version": "WzI3OCwxXQ==" + } + ] + } +} + +exports['Agent lib addAction should throw if the agent do not exists - delete (2)'] = { + "results": {} +} + +exports['Agent lib addAction should throw if the agent do not exists - delete (3)'] = { + "results": {} +} + +exports['Agent lib addAction should throw if the agent do not exists - get:agents (4)'] = { + "results": null +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/__memorize_snapshots__/api_keys.contract.test.slap_snap b/x-pack/legacy/plugins/fleet/server/libs/__memorize_snapshots__/api_keys.contract.test.slap_snap new file mode 100644 index 0000000000000..e7881ded27232 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/__memorize_snapshots__/api_keys.contract.test.slap_snap @@ -0,0 +1,358 @@ + +exports['ApiKeys Lib verifyAccessApiKey should verify a valid api key - find:"enrollment_api_keys" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['ApiKeys Lib verifyAccessApiKey should verify a valid api key - createApiKey (2)'] = { + "results": { + "id": "r7NDZW4B4KwD6w8o_-VN", + "name": "TEST API KEY: 4aae3a09-e9d1-4a12-8a57-0206ba925049", + "api_key": "xO4Ms-OZRWWtE61N8MWqLw" + } +} + +exports['ApiKeys Lib verifyAccessApiKey should verify a valid api key - authenticate (3)'] = { + "results": { + "username": "elastic", + "roles": [], + "full_name": null, + "email": null, + "metadata": { + "_reserved": true + }, + "enabled": true, + "authentication_realm": { + "name": "_es_api_key", + "type": "_es_api_key" + }, + "lookup_realm": { + "name": "_es_api_key", + "type": "_es_api_key" + } + } +} + +exports['ApiKeys Lib verifyAccessApiKey should not verify invalid ApiKey - find:"enrollment_api_keys" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['ApiKeys Lib verifyAccessApiKey should not verify invalid ApiKey - authenticate (2)'] = { + "thrownError": "{\"msg\":\"[security_exception] missing authentication credentials for REST request [/_security/_authenticate], with { header={ WWW-Authenticate={ 0=\\\"ApiKey\\\" & 1=\\\"Basic realm=\\\\\\\"security\\\\\\\" charset=\\\\\\\"UTF-8\\\\\\\"\\\" } } }\",\"path\":\"/_security/_authenticate\",\"statusCode\":401,\"response\":\"{\\\"error\\\":{\\\"root_cause\\\":[{\\\"type\\\":\\\"security_exception\\\",\\\"reason\\\":\\\"missing authentication credentials for REST request [/_security/_authenticate]\\\",\\\"header\\\":{\\\"WWW-Authenticate\\\":[\\\"ApiKey\\\",\\\"Basic realm=\\\\\\\"security\\\\\\\" charset=\\\\\\\"UTF-8\\\\\\\"\\\"]}}],\\\"type\\\":\\\"security_exception\\\",\\\"reason\\\":\\\"missing authentication credentials for REST request [/_security/_authenticate]\\\",\\\"header\\\":{\\\"WWW-Authenticate\\\":[\\\"ApiKey\\\",\\\"Basic realm=\\\\\\\"security\\\\\\\" charset=\\\\\\\"UTF-8\\\\\\\"\\\"]}},\\\"status\\\":401}\",\"wwwAuthenticateDirective\":\"ApiKey, Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\"}", + "results": null +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should verify a valid api key - find:"enrollment_api_keys" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should verify a valid api key - createApiKey (2)'] = { + "results": { + "id": "sLNEZW4B4KwD6w8oAeXf", + "name": "TEST API KEY: cac73ad9-e757-49e2-9bd9-40fbdce6bf99", + "api_key": "77eOdCJnRWOegQ1iIjGnDg" + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should verify a valid api key - create:enrollment_api_keys (3)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "6850373a-bb23-4f02-bb21-c0acbafcd3d8", + "attributes": { + "active": true, + "api_key_id": "sLNEZW4B4KwD6w8oAeXf" + }, + "references": [], + "updated_at": "2019-11-13T14:56:27.037Z", + "version": "WzMxMiwxXQ==" + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should verify a valid api key - authenticate (4)'] = { + "results": { + "username": "elastic", + "roles": [], + "full_name": null, + "email": null, + "metadata": { + "_reserved": true + }, + "enabled": true, + "authentication_realm": { + "name": "_es_api_key", + "type": "_es_api_key" + }, + "lookup_realm": { + "name": "_es_api_key", + "type": "_es_api_key" + } + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should verify a valid api key - find:"enrollment_api_keys" (5)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "6850373a-bb23-4f02-bb21-c0acbafcd3d8", + "attributes": { + "active": true, + "api_key_id": "sLNEZW4B4KwD6w8oAeXf", + "api_key": "y7Zz4tVm3miSfv1W1rd9zAROGpHBVtGKScnQvnDikCWUo1X3DUFTNnOI99B0H4gngrSvq1U8DKofCF7hP0jrGSJqLmuntGss5hES2DvO7/5djsCVf3kva+uTwW18gGsWTP707l7TCMfewDCETNtKBIwxt8w4/j/FfOXxusi1W1PebmiQFspZZTQ30dWKXZ9yzjs6VXqwpIF3Sw==" + }, + "references": [], + "updated_at": "2019-11-13T14:56:27.037Z", + "version": "WzMxMiwxXQ==" + } + ] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should verify a valid api key - getDecryptedAsInternalUser:enrollment_api_keys:6850373a-bb23-4f02-bb21-c0acbafcd3d8 (6)'] = { + "results": { + "id": "6850373a-bb23-4f02-bb21-c0acbafcd3d8", + "type": "enrollment_api_keys", + "updated_at": "2019-11-13T14:56:27.037Z", + "version": "WzMxMiwxXQ==", + "attributes": { + "active": true, + "api_key_id": "sLNEZW4B4KwD6w8oAeXf", + "api_key": "c0xORVpXNEI0S3dENnc4b0FlWGY6NzdlT2RDSm5SV09lZ1ExaUlqR25EZw==" + }, + "references": [] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive enrollemnt api key - find:"enrollment_api_keys" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "6850373a-bb23-4f02-bb21-c0acbafcd3d8", + "attributes": { + "active": true, + "api_key_id": "sLNEZW4B4KwD6w8oAeXf" + }, + "references": [], + "updated_at": "2019-11-13T14:56:27.037Z", + "version": "WzMxMiwxXQ==" + } + ] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive enrollemnt api key - delete (2)'] = { + "results": {} +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive enrollemnt api key - createApiKey (3)'] = { + "results": { + "id": "sbNEZW4B4KwD6w8oDOXF", + "name": "TEST API KEY: c0120d29-ef06-45e8-9649-431939f26e59", + "api_key": "m07xSOsSSk6qroc-hM0gnw" + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive enrollemnt api key - create:enrollment_api_keys (4)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "340f1199-6036-47e0-9b94-a69516fe4629", + "attributes": { + "active": false, + "api_key_id": "sbNEZW4B4KwD6w8oDOXF" + }, + "references": [], + "updated_at": "2019-11-13T14:56:29.059Z", + "version": "WzMxNCwxXQ==" + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive enrollemnt api key - authenticate (5)'] = { + "results": { + "username": "elastic", + "roles": [], + "full_name": null, + "email": null, + "metadata": { + "_reserved": true + }, + "enabled": true, + "authentication_realm": { + "name": "_es_api_key", + "type": "_es_api_key" + }, + "lookup_realm": { + "name": "_es_api_key", + "type": "_es_api_key" + } + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive enrollemnt api key - find:"enrollment_api_keys" (6)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "340f1199-6036-47e0-9b94-a69516fe4629", + "attributes": { + "active": false, + "api_key_id": "sbNEZW4B4KwD6w8oDOXF", + "api_key": "5y+RPHiBwUF0Kt8g/uJXlZ8OzR2oQSju6Btm+yv5px5CrhjA1575pQpSW+2kW/MZdmkev9fY+8VMLaGsM4pGoYQfh0PlbkZQ3XQW+mvFvrhMvFX+gZfvS+0AQE27dhRm6qvj091N/gmDGkfm4JZD8kE9CznyZSEmnmNtTeqt/XnuHTRg609J5EPkGtyw8WpA2DohNtzQUiFGiQ==" + }, + "references": [], + "updated_at": "2019-11-13T14:56:29.059Z", + "version": "WzMxNCwxXQ==" + } + ] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive enrollemnt api key - getDecryptedAsInternalUser:enrollment_api_keys:340f1199-6036-47e0-9b94-a69516fe4629 (7)'] = { + "results": { + "id": "340f1199-6036-47e0-9b94-a69516fe4629", + "type": "enrollment_api_keys", + "updated_at": "2019-11-13T14:56:29.059Z", + "version": "WzMxNCwxXQ==", + "attributes": { + "active": false, + "api_key_id": "sbNEZW4B4KwD6w8oDOXF", + "api_key": "c2JORVpXNEI0S3dENnc4b0RPWEY6bTA3eFNPc1NTazZxcm9jLWhNMGdudw==" + }, + "references": [] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive an enrollemnt api key not persisted - find:"enrollment_api_keys" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "340f1199-6036-47e0-9b94-a69516fe4629", + "attributes": { + "active": false, + "api_key_id": "sbNEZW4B4KwD6w8oDOXF" + }, + "references": [], + "updated_at": "2019-11-13T14:56:29.059Z", + "version": "WzMxNCwxXQ==" + } + ] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive an enrollemnt api key not persisted - delete (2)'] = { + "results": {} +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive an enrollemnt api key not persisted - createApiKey (3)'] = { + "results": { + "id": "srNEZW4B4KwD6w8oFOWo", + "name": "TEST API KEY: d7b015ad-ed9e-4bdc-a4e7-db6449d69f44", + "api_key": "rfo24UgTQ9ecyZZ-erxfkQ" + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive an enrollemnt api key not persisted - authenticate (4)'] = { + "results": { + "username": "elastic", + "roles": [], + "full_name": null, + "email": null, + "metadata": { + "_reserved": true + }, + "enabled": true, + "authentication_realm": { + "name": "_es_api_key", + "type": "_es_api_key" + }, + "lookup_realm": { + "name": "_es_api_key", + "type": "_es_api_key" + } + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify a inactive an enrollemnt api key not persisted - find:"enrollment_api_keys" (5)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 0, + "saved_objects": [] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify invalid ApiKey - find:"enrollment_api_keys" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['ApiKeys Lib verifyEnrollmentApiKey should not verify invalid ApiKey - authenticate (2)'] = { + "thrownError": "{\"msg\":\"[security_exception] missing authentication credentials for REST request [/_security/_authenticate], with { header={ WWW-Authenticate={ 0=\\\"ApiKey\\\" & 1=\\\"Basic realm=\\\\\\\"security\\\\\\\" charset=\\\\\\\"UTF-8\\\\\\\"\\\" } } }\",\"path\":\"/_security/_authenticate\",\"statusCode\":401,\"response\":\"{\\\"error\\\":{\\\"root_cause\\\":[{\\\"type\\\":\\\"security_exception\\\",\\\"reason\\\":\\\"missing authentication credentials for REST request [/_security/_authenticate]\\\",\\\"header\\\":{\\\"WWW-Authenticate\\\":[\\\"ApiKey\\\",\\\"Basic realm=\\\\\\\"security\\\\\\\" charset=\\\\\\\"UTF-8\\\\\\\"\\\"]}}],\\\"type\\\":\\\"security_exception\\\",\\\"reason\\\":\\\"missing authentication credentials for REST request [/_security/_authenticate]\\\",\\\"header\\\":{\\\"WWW-Authenticate\\\":[\\\"ApiKey\\\",\\\"Basic realm=\\\\\\\"security\\\\\\\" charset=\\\\\\\"UTF-8\\\\\\\"\\\"]}},\\\"status\\\":401}\",\"wwwAuthenticateDirective\":\"ApiKey, Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\"}", + "results": null +} + +exports['ApiKeys Lib generateEnrollmentApiKey should generate a valid ApiKey - find:"enrollment_api_keys" (1)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['ApiKeys Lib generateEnrollmentApiKey should generate a valid ApiKey - createApiKey (2)'] = { + "results": { + "id": "s7NEZW4B4KwD6w8oFeVt", + "name": "Fleet:EnrollmentApiKey:294002ed-c668-4970-9fcf-f516341673fa:policy1", + "api_key": "9sWTYpGNTCilNbYkl9lNFg" + } +} + +exports['ApiKeys Lib generateEnrollmentApiKey should generate a valid ApiKey - create:enrollment_api_keys (3)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "dca6bb47-53d6-4317-99e5-30760483bbbe", + "attributes": { + "created_at": "2019-11-13T14:56:32.063Z", + "api_key_id": "s7NEZW4B4KwD6w8oFeVt", + "policy_id": "policy1", + "active": true, + "enrollment_rules": [], + "name": "Fleet:EnrollmentApiKey:294002ed-c668-4970-9fcf-f516341673fa:policy1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:32.078Z", + "version": "WzMxNiwxXQ==" + } +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/__mocks__/api_keys.ts b/x-pack/legacy/plugins/fleet/server/libs/__mocks__/api_keys.ts new file mode 100644 index 0000000000000..8fc1dc6d9abd6 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/__mocks__/api_keys.ts @@ -0,0 +1,141 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + EnrollmentApiKeyVerificationResponse, + AccessApiKeyVerificationResponse, + EnrollmentApiKey, + EnrollmentRuleData, + EnrollmentRule, +} from '../../repositories/enrollment_api_keys/types'; +import { FrameworkUser, internalAuthData } from '../../adapters/framework/adapter_types'; +import { ApiKeyLib as ApiKeyLibType } from '../api_keys'; + +type Interface = { + [P in keyof T]: T[P]; +}; + +export class ApiKeyLib implements Interface { + private accessApiKeyId = 1; + + public listEnrollmentApiKeys( + user: FrameworkUser, + options: { + page?: number | undefined; + perPage?: number | undefined; + kuery?: string | undefined; + showInactive?: boolean | undefined; + } + ): Promise<{ items: any; total: any; page: any; perPage: any }> { + throw new Error('Method not implemented.'); + } + + public async deleteEnrollmentApiKey(user: FrameworkUser, id: string) { + throw new Error('Method not implemented.'); + } + + public async deleteEnrollmentApiKeyForPolicyId(user: FrameworkUser, policyId: string) { + throw new Error('Method not implemented.'); + } + + public async getEnrollmentApiKey( + user: FrameworkUser, + keyId: string + ): Promise { + throw new Error('Method not implemented.'); + } + public async verifyEnrollmentApiKey( + user: FrameworkUser + ): Promise { + if (user.kind === 'authenticated') { + const apiKeyHeader = user[internalAuthData].authorization.split(' ')[1]; + const apiKey = Buffer.from(apiKeyHeader, 'base64') + .toString('utf8') + .split(':')[1]; + if (apiKey === 'VALID_KEY_WITH_POLICY') { + return { + valid: true, + enrollmentApiKey: { + policy_id: 'policyId', + } as EnrollmentApiKey, + }; + } + if (apiKey === 'VALID_KEY') { + return { valid: true, enrollmentApiKey: {} as EnrollmentApiKey }; + } + } + return { + valid: false, + reason: 'Not a valid api key', + }; + } + public async verifyAccessApiKey( + user: FrameworkUser + ): Promise { + if (user.kind === 'authenticated') { + const apiKeyHeader = user[internalAuthData].authorization.split(' ')[1]; + const [apiKeyId, apiKey] = Buffer.from(apiKeyHeader, 'base64') + .toString('utf8') + .split(':'); + + if (apiKey === 'VALID_KEY') { + return { valid: true, accessApiKeyId: apiKeyId }; + } + } + return { + valid: false, + reason: 'Not a valid api key', + }; + } + public async generateAccessApiKey( + agentId: string, + policyId?: string | undefined + ): Promise<{ key: string; id: string }> { + const id = this.accessApiKeyId++; + return { + id: `mock-access-api-key-id-${id}`, + key: `mock-access-api-key-${id}`, + }; + } + public generateEnrollmentApiKey( + user: FrameworkUser, + data: { + name?: string | undefined; + policyId?: string | undefined; + expiration?: string | undefined; + } + ): Promise { + throw new Error('Method not implemented.'); + } + public addEnrollmentRule( + user: FrameworkUser, + enrollmentApiKeyId: string, + ruleData: EnrollmentRuleData + ): Promise { + throw new Error('Method not implemented.'); + } + public updateEnrollmentRuleForPolicy( + user: FrameworkUser, + enrollmentApiKeyId: string, + ruleId: string, + ruleData: EnrollmentRuleData + ): Promise { + throw new Error('Method not implemented.'); + } + public deleteEnrollmentRule( + user: FrameworkUser, + enrollmentApiKeyId: string, + ruleId: string + ): Promise { + throw new Error('Method not implemented.'); + } + public deleteAllEnrollmentRules( + user: FrameworkUser, + enrollmentApiKeyId: string + ): Promise { + throw new Error('Method not implemented.'); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/__mocks__/framework.ts b/x-pack/legacy/plugins/fleet/server/libs/__mocks__/framework.ts new file mode 100644 index 0000000000000..584c62dacbae0 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/__mocks__/framework.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FrameworkUser } from '../../adapters/framework/adapter_types'; + +export class FrameworkLib { + public getSetting(setting: 'encryptionKey'): string { + return 'mockedEncryptionKey'; + } + + public getInternalUser(): FrameworkUser { + return { kind: 'internal' }; + } + + public expose(key: string, method: any) {} +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/__mocks__/policy.ts b/x-pack/legacy/plugins/fleet/server/libs/__mocks__/policy.ts new file mode 100644 index 0000000000000..f4e299b8676e1 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/__mocks__/policy.ts @@ -0,0 +1,25 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FullPolicyFile } from '../../repositories/policies/types'; + +/** + * Mocked policy lib for test purpropse + */ +export class PolicyLib { + public async getFullPolicy(policyId: string): Promise { + return ({ + id: policyId, + data_sources: [], + name: 'Policy 1', + updated_by: 'johndoe', + updated_on: '2019-09-23T20:46:42+0000', + version: 0, + created_by: 'johndoe', + created_on: '2019-09-23T20:46:42+0000', + } as unknown) as FullPolicyFile; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/agent.contract.test.ts b/x-pack/legacy/plugins/fleet/server/libs/agent.contract.test.ts new file mode 100644 index 0000000000000..b2f0cece5be18 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/agent.contract.test.ts @@ -0,0 +1,470 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import { Agent } from '../repositories/agents/types'; +import { FrameworkUser, internalAuthData } from '../adapters/framework/adapter_types'; +import { compose } from './compose/memorized'; +import { FleetServerLib } from './types'; +import { SODatabaseAdapter } from '../adapters/saved_objects_database/default'; +import { MemorizeSODatabaseAdapter } from '../adapters/saved_objects_database/memorize_adapter'; +import { SavedObject } from 'kibana/server'; + +jest.mock('./api_keys'); +jest.mock('./policy'); + +function getUser(apiKey?: string, apiKeyId?: string) { + if (!apiKey) { + return { kind: 'internal' } as FrameworkUser; + } + return ({ + kind: 'authenticated', + [internalAuthData]: { + authorization: `ApiKey ${Buffer.from(`${apiKeyId || 'key_id'}:${apiKey}`).toString( + 'base64' + )}`, + }, + } as unknown) as FrameworkUser; +} + +describe('Agent lib', () => { + let servers: any; + let libs: FleetServerLib; + let soAdapter: MemorizeSODatabaseAdapter; + + async function clearFixtures() { + const { saved_objects: savedObjects } = await soAdapter.find(getUser(), { + type: 'agents', + perPage: 1000, + }); + for (const so of savedObjects) { + await soAdapter.delete(getUser(), 'agents', so.id); + } + } + + async function loadFixtures(agents: Array>) { + const agentIds: string[] = []; + for (const agent of agents) { + agentIds.push( + (await soAdapter.create(getUser(), 'agents', { + ...agent, + local_metadata: JSON.stringify(agent.local_metadata || {}), + user_provided_metadata: JSON.stringify(agent.user_provided_metadata || {}), + })).id + ); + } + return agentIds; + } + + async function getAgentById(agentId: string) { + return await soAdapter.get(getUser(), 'agents', agentId); + } + beforeAll(async () => { + await Slapshot.callWhenOnline(async () => { + const { createKibanaServer } = await import( + '../../../../../test_utils/jest/contract_tests/servers' + ); + servers = await createKibanaServer({ + security: { enabled: false }, + }); + + soAdapter = new MemorizeSODatabaseAdapter( + new SODatabaseAdapter( + servers.kbnServer.savedObjects, + servers.kbnServer.plugins.elasticsearch + ) + ); + }); + + if (!soAdapter) { + soAdapter = new MemorizeSODatabaseAdapter(); + } + }); + + afterAll(async () => { + if (servers) { + await servers.shutdown; + } + }); + + beforeEach(async () => { + await clearFixtures(); + libs = compose(servers ? servers.kbnServer : undefined); + }); + + describe('Enroll', () => { + it('Should throw if the enrollment api key is not valid', async () => { + const { agents } = libs; + let error: Error | null = null; + try { + await agents.enroll(getUser('INVALID_KEY'), 'PERMANENT', undefined, 'agent-1'); + } catch (err) { + error = err; + } + + expect(error).toBeDefined(); + expect((error as Error).message).toBe('Enrollment apiKey is not valid: Not a valid api key'); + }); + + it('Should enroll a new PERMANENT agent', async () => { + const { agents } = libs; + + const agent = await agents.enroll( + getUser('VALID_KEY_WITH_POLICY'), + 'PERMANENT', + undefined, + 'agent-1' + ); + + expect(agent).toBeDefined(); + expect(agent).toMatchObject({ + access_api_key: 'mock-access-api-key-1', + policy_id: 'policyId', + }); + }); + + it('Should allow to enroll a new PERMANENT agent again if this agent is active', async () => { + const { agents } = libs; + + const agent1 = await agents.enroll(getUser('VALID_KEY'), 'PERMANENT', undefined, 'agent-1'); + + // Desactivate this agent + await agents.delete(getUser(), agent1); + + const agent2 = await agents.enroll(getUser('VALID_KEY'), 'PERMANENT', undefined, 'agent-1'); + + expect(agent2).toBeDefined(); + expect(agent2).toMatchObject({ + access_api_key: 'mock-access-api-key-2', + }); + }); + + it('Should not enroll a new PERMANENT agent if this agent is already active', async () => { + const { agents } = libs; + + await agents.enroll(getUser('VALID_KEY'), 'PERMANENT', undefined, 'agent-1'); + let error: Error | null = null; + + try { + await agents.enroll(getUser('VALID_KEY'), 'PERMANENT', undefined, 'agent-1'); + } catch (err) { + error = err; + } + + expect(error).toBeDefined(); + expect((error as Error).message).toBe('Impossible to enroll an already active agent'); + }); + + it('Should enroll a new EPHEMERAL agent', async () => { + const { agents } = libs; + + const agent = await agents.enroll(getUser('VALID_KEY_WITH_POLICY'), 'EPHEMERAL', undefined); + + expect(agent).toBeDefined(); + expect(agent).toMatchObject({ + access_api_key: 'mock-access-api-key-1', + policy_id: 'policyId', + }); + }); + }); + + describe('Delete', () => { + it('should delete ephemeral instances', async () => { + const { agents } = libs; + const [agentId] = await loadFixtures([ + { + type: 'EPHEMERAL', + active: true, + }, + ]); + + await agents.delete(getUser(), { + id: agentId, + type: 'EPHEMERAL', + } as Agent); + + const agent = await getAgentById(agentId); + expect(agent).toBeNull(); + }); + + it('should desactivate other agent', async () => { + const { agents } = libs; + const [agentId] = await loadFixtures([ + { + type: 'PERMANENT', + active: true, + }, + ]); + + await agents.delete(getUser(), { + id: agentId, + type: 'PERMANENT', + } as Agent); + + const agent = await getAgentById(agentId); + expect(agent).toBeDefined(); + expect((agent as SavedObject).attributes.active).toBeFalsy(); + }); + }); + + describe('list', () => { + it('should return all agents', async () => { + const { agents } = libs; + await loadFixtures([ + { + type: 'PERMANENT', + active: true, + }, + { + type: 'PERMANENT', + active: true, + }, + ]); + + const res = await agents.list(getUser()); + + expect(res).toBeDefined(); + expect(res.total).toBe(2); + expect(res.agents).toHaveLength(2); + }); + }); + + describe('checkin', () => { + it('should throw if the agens do not exists', async () => { + const { agents } = libs; + + await expect( + agents.checkin(getUser('VALID_KEY'), [ + { + timestamp: '2019-09-05T15:41:26+0000', + type: 'STATE', + subtype: 'STARTING', + message: 'State changed from PAUSE to STARTING', + }, + ]) + ).rejects.toThrowError(/Agent not found/); + }); + + it('should throw is the agent is not active', async () => { + const { agents } = libs; + await loadFixtures([ + { + actions: [], + active: false, + policy_id: 'policy:1', + access_api_key_id: 'key1', + }, + ]); + + await expect(agents.checkin(getUser('VALID_KEY', 'key1'), [])).rejects.toThrowError( + /Agent inactive/ + ); + }); + + it('should persist new events', async () => { + const { agents } = libs; + const [agentId] = await loadFixtures([ + { + actions: [], + active: true, + policy_id: 'policy:1', + access_api_key_id: 'key1', + }, + ]); + + await agents.checkin(getUser('VALID_KEY', 'key1'), [ + { + timestamp: '2019-09-05T15:41:26+0000', + type: 'STATE', + subtype: 'STARTING', + message: 'State changed from PAUSE to STARTING', + }, + ]); + + const { saved_objects: events } = await soAdapter.find(getUser(), { + type: 'agent_events', + search: agentId, + searchFields: ['agent_id'], + }); + expect(events).toHaveLength(1); + expect(events[0].attributes).toMatchObject({ + timestamp: '2019-09-05T15:41:26+0000', + type: 'STATE', + subtype: 'STARTING', + message: 'State changed from PAUSE to STARTING', + }); + }); + + it('should not update agent metadata if none are provided', async () => { + const { agents } = libs; + const [agentId] = await loadFixtures([ + { + local_metadata: { key: 'local1' }, + user_provided_metadata: { key: 'user1' }, + actions: [], + active: true, + policy_id: 'policy:1', + access_api_key_id: 'key1', + }, + ]); + + await agents.checkin(getUser('VALID_KEY', 'key1'), []); + + const refreshAgent = await getAgentById(agentId); + expect( + JSON.parse((refreshAgent as SavedObject).attributes.local_metadata as string) + ).toMatchObject({ + key: 'local1', + }); + }); + + it('should return the full policy for this agent', async () => { + const { agents } = libs; + await loadFixtures([ + { + local_metadata: { key: 'local1' }, + user_provided_metadata: { key: 'user1' }, + actions: [], + active: true, + policy_id: 'policy:1', + access_api_key_id: 'key1', + }, + ]); + + const { policy } = await agents.checkin(getUser('VALID_KEY', 'key1'), []); + + expect(policy).toMatchObject({ + id: 'policy:1', + }); + }); + + it('should update agent metadata if provided', async () => { + const { agents } = libs; + const [agentId] = await loadFixtures([ + { + local_metadata: { key: 'local1' }, + user_provided_metadata: { key: 'user1' }, + actions: [], + active: true, + policy_id: 'policy:1', + access_api_key_id: 'key1', + }, + ]); + + await agents.checkin(getUser('VALID_KEY', 'key1'), [], { key: 'local2' }); + + const refreshAgent = await getAgentById(agentId); + expect( + JSON.parse((refreshAgent as SavedObject).attributes.local_metadata as string) + ).toMatchObject({ + key: 'local2', + }); + }); + + it('should return new actions', async () => { + const { agents } = libs; + await loadFixtures([ + { + active: true, + policy_id: 'policy:1', + access_api_key_id: 'key1', + actions: [ + { + created_at: '2019-09-05T15:43:26+0000', + type: 'PAUSE', + id: 'this-a-unique-id', + }, + { + created_at: '2019-09-05T15:41:26+0000', + type: 'PAUSE', + sent_at: '2019-09-05T15:42:26+0000', + id: 'this-a-unique-id-already-sent', + }, + ], + }, + ]); + const { actions } = await agents.checkin(getUser('VALID_KEY', 'key1'), []); + + expect(actions).toHaveLength(1); + expect(actions[0]).toMatchObject({ + type: 'PAUSE', + id: 'this-a-unique-id', + }); + }); + }); + + describe('unenroll', () => { + it('should set the list of agents as inactive', async () => { + const { agents } = libs; + const [agent1Id, agent2Id] = await loadFixtures([ + { + local_metadata: { key: 'local1' }, + user_provided_metadata: { key: 'user1' }, + actions: [], + active: true, + policy_id: 'policy:1', + }, + { + local_metadata: { key: 'local1' }, + user_provided_metadata: { key: 'user1' }, + actions: [], + active: true, + policy_id: 'policy:1', + }, + ]); + + await agents.unenroll(getUser(), [agent1Id, agent2Id]); + + const refreshAgent1 = (await getAgentById(agent1Id)) as SavedObject; + const refreshAgent2 = (await getAgentById(agent2Id)) as SavedObject; + + expect(refreshAgent1.attributes.active).toBeFalsy(); + expect(refreshAgent2.attributes.active).toBeFalsy(); + }); + }); + + describe('unenrollForPolicy', () => { + it('should set all the of agents for this policy as inactive', async () => { + const { agents } = libs; + const [agent1Id, agent2Id] = await loadFixtures([ + { + local_metadata: { key: 'local1' }, + user_provided_metadata: { key: 'user1' }, + actions: [], + active: true, + policy_id: 'policy:1', + }, + { + local_metadata: { key: 'local1' }, + user_provided_metadata: { key: 'user1' }, + actions: [], + active: true, + policy_id: 'policy:1', + }, + ]); + + await agents.unenrollForPolicy(getUser(), 'policy:1'); + + const refreshAgent1 = (await getAgentById(agent1Id)) as SavedObject; + const refreshAgent2 = (await getAgentById(agent2Id)) as SavedObject; + + expect(refreshAgent1.attributes.active).toBeFalsy(); + expect(refreshAgent2.attributes.active).toBeFalsy(); + }); + }); + + describe('addAction', () => { + it('should throw if the agent do not exists', async () => { + const { agents } = libs; + + await expect( + agents.addAction(getUser(), 'agent:1', { + type: 'PAUSE', + }) + ).rejects.toThrowError(/Agent not found/); + }); + }); +}); diff --git a/x-pack/legacy/plugins/fleet/server/libs/agent.ts b/x-pack/legacy/plugins/fleet/server/libs/agent.ts new file mode 100644 index 0000000000000..e80e251ff4a88 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/agent.ts @@ -0,0 +1,301 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Boom from 'boom'; +import uuid from 'uuid/v4'; +import { + AgentsRepository, + Agent, + SortOptions, + NewAgent, + AgentType, + AgentAction, + AgentActionType, +} from '../repositories/agents/types'; +import { ApiKeyLib } from './api_keys'; +import { PolicyLib } from './policy'; +import { FullPolicyFile } from '../repositories/policies/types'; +import { FrameworkUser } from '../adapters/framework/adapter_types'; +import { AgentEventsRepository, AgentEvent } from '../repositories/agent_events/types'; + +export class AgentLib { + constructor( + private readonly agentsRepository: AgentsRepository, + private readonly agentEventsRepository: AgentEventsRepository, + private readonly apiKeys: ApiKeyLib, + private readonly policies: PolicyLib + ) {} + + /** + * Enroll a new agent into elastic fleet + */ + public async enroll( + user: FrameworkUser, + type: AgentType, + metadata?: { local: any; userProvided: any }, + sharedId?: string + ): Promise { + const internalUser = this._getInternalUser(); + const verifyResponse = await this.apiKeys.verifyEnrollmentApiKey(user); + + if (!verifyResponse.valid) { + throw Boom.unauthorized(`Enrollment apiKey is not valid: ${verifyResponse.reason}`); + } + const policyId = verifyResponse.enrollmentApiKey.policy_id; + + const existingAgent = sharedId + ? await this.agentsRepository.getBySharedId(internalUser, sharedId) + : null; + + if (existingAgent && existingAgent.active === true) { + throw Boom.badRequest('Impossible to enroll an already active agent'); + } + + const enrolledAt = new Date().toISOString(); + + const agentData: NewAgent = { + shared_id: sharedId, + active: true, + policy_id: policyId, + type, + enrolled_at: enrolledAt, + user_provided_metadata: metadata && metadata.userProvided, + local_metadata: metadata && metadata.local, + }; + + let agent; + if (existingAgent) { + await this.agentsRepository.update(internalUser, existingAgent.id, agentData); + + agent = { + ...existingAgent, + ...agentData, + }; + } else { + agent = await this.agentsRepository.create(internalUser, agentData); + } + + const accessApiKey = await this.apiKeys.generateAccessApiKey(agent.id, policyId); + await this.agentsRepository.update(internalUser, agent.id, { + access_api_key_id: accessApiKey.id, + }); + + return { ...agent, access_api_key: accessApiKey.key }; + } + + public async unenrollForPolicy(user: FrameworkUser, policyId: string) { + let hasMore = true; + let page = 1; + while (hasMore) { + const { agents } = await this.agentsRepository.listForPolicy(user, policyId, { + page: page++, + perPage: 100, + }); + + if (agents.length === 0) { + hasMore = false; + } + await this.unenroll(user, agents.map(a => a.id)); + } + } + + public async update( + user: FrameworkUser, + agentId: string, + data: { + user_provided_metadata?: any; + } + ) { + const agent = await this.getById(user, agentId); + if (!agent) { + throw Boom.notFound('Agent not found'); + } + + if (data.user_provided_metadata) { + const localMetadataKeys = Object.keys(agent.local_metadata || {}); + + const hasConflict = Object.keys(data.user_provided_metadata).find( + k => localMetadataKeys.indexOf(k) >= 0 + ); + + if (hasConflict) { + throw Boom.badRequest(`It's not allowed to update local metadata (${hasConflict}).`); + } + } + + this.agentsRepository.update(user, agentId, data); + } + + public async unenroll( + user: FrameworkUser, + ids: string[] + ): Promise }>> { + const response = []; + for (const id of ids) { + try { + await this.agentsRepository.update(user, id, { + active: false, + }); + response.push({ + id, + success: true, + }); + } catch (error) { + response.push({ + id, + error, + success: false, + }); + } + } + + return response; + } + + /** + * Delete an agent + */ + public async delete(user: FrameworkUser, agent: Agent) { + if (agent.type === 'EPHEMERAL') { + await this.agentEventsRepository.deleteEventsForAgent(user, agent.id); + return await this.agentsRepository.delete(user, agent); + } + + return await this.agentsRepository.update(user, agent.id, { active: false }); + } + + /** + * Get an agent by id + */ + public async getById(user: FrameworkUser, id: string): Promise { + return await this.agentsRepository.getById(user, id); + } + + /** + * Get events for a given agent + */ + public async getEventsById( + user: FrameworkUser, + agentId: string, + search?: string, + page: number = 1, + perPage: number = 25 + ): Promise<{ items: AgentEvent[]; total: number }> { + return await this.agentEventsRepository.getEventsForAgent(user, agentId, { + search, + page, + perPage, + }); + } + + /** + * Agent checkin, update events, get new actions to perfomed. + * @param agent + * @param events + * @param metadata + */ + public async checkin( + user: FrameworkUser, + events: AgentEvent[], + localMetadata?: any + ): Promise<{ actions: AgentAction[]; policy: FullPolicyFile | null }> { + const res = await this.apiKeys.verifyAccessApiKey(user); + if (!res.valid) { + throw Boom.unauthorized('Invalid apiKey'); + } + + const internalUser = this._getInternalUser(); + + const agent = await this.agentsRepository.getByAccessApiKeyId(internalUser, res.accessApiKeyId); + if (!agent) { + throw Boom.notFound('Agent not found or inactive'); + } + if (!agent.active) { + throw Boom.forbidden('Agent inactive'); + } + + const actions = this._filterActionsForCheckin(agent); + + const now = new Date().toISOString(); + const updatedActions = actions.map(a => { + return { ...a, sent_at: now }; + }); + + const updateData: Partial = { + last_checkin: now, + actions: updatedActions, + }; + + if (localMetadata) { + updateData.local_metadata = localMetadata; + } + + const policy = agent.policy_id ? await this.policies.getFullPolicy(agent.policy_id) : null; + await this.agentsRepository.update(internalUser, agent.id, updateData); + if (events.length > 0) { + await this.agentEventsRepository.createEventsForAgent(internalUser, agent.id, events); + } + + return { actions, policy }; + } + + public async addAction( + user: FrameworkUser, + agentId: string, + actionData: { type: AgentActionType } + ) { + const agent = await this.agentsRepository.getById(user, agentId); + + if (!agent || !agent.active) { + throw Boom.notFound('Agent not found or inactive'); + } + + const action: AgentAction = { + ...actionData, + id: uuid(), + created_at: new Date().toISOString(), + }; + + await this.agentsRepository.update(user, agent.id, { + actions: [action].concat(agent.actions), + }); + + return action; + } + + /** + * List agents + * + * @param sortOptions + * @param page + * @param perPage + */ + public async list( + user: FrameworkUser, + options: { + showInactive?: boolean; + sortOptions?: SortOptions; + kuery?: string; + page?: number; + perPage?: number; + } = { + showInactive: false, + sortOptions: SortOptions.EnrolledAtDESC, + } + ): Promise<{ agents: Agent[]; total: number; page: number; perPage: number }> { + return this.agentsRepository.list(user, options); + } + + public _filterActionsForCheckin(agent: Agent): AgentAction[] { + return agent.actions.filter(a => !a.sent_at); + } + + private _getInternalUser(): FrameworkUser { + return { + kind: 'internal', + }; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/api_keys.contract.test.ts b/x-pack/legacy/plugins/fleet/server/libs/api_keys.contract.test.ts new file mode 100644 index 0000000000000..6687ee2d35fd4 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/api_keys.contract.test.ts @@ -0,0 +1,187 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import uuid from 'uuid'; +import { FrameworkUser, internalAuthData } from '../adapters/framework/adapter_types'; +import { MemorizeSODatabaseAdapter } from '../adapters/saved_objects_database/memorize_adapter'; +import { SODatabaseAdapter } from '../adapters/saved_objects_database/default'; +import { FleetServerLib } from './types'; +import { compose } from './compose/memorized'; +import { MemorizedElasticsearchAdapter } from '../adapters/elasticsearch/memorize_adapter'; +import { ElasticsearchAdapter } from '../adapters/elasticsearch/default'; + +jest.mock('./framework'); + +function getUser(): FrameworkUser { + return ({ + kind: 'authenticated', + [internalAuthData]: { + authorization: `Basic ${Buffer.from(`elastic:changeme`).toString('base64')}`, + }, + } as unknown) as FrameworkUser; +} + +function apiKeyToString(apiKey: { id: string; api_key: string }) { + return Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64'); +} + +function getUserForApiKey(apiKey: { id: string; api_key: string }) { + return { + kind: 'authenticated', + [internalAuthData]: { + authorization: `ApiKey ${apiKeyToString(apiKey)}`, + }, + } as FrameworkUser; +} + +describe('ApiKeys Lib', () => { + let servers: any; + let soAdapter: MemorizeSODatabaseAdapter; + let esAdapter: MemorizedElasticsearchAdapter; + let libs: FleetServerLib; + + async function clearFixtures() { + const { saved_objects: savedObjects } = await soAdapter.find(getUser(), { + type: 'enrollment_api_keys', + perPage: 1000, + }); + for (const so of savedObjects) { + await soAdapter.delete(getUser(), 'enrollment_api_keys', so.id); + } + } + + async function createESApiKey() { + return await esAdapter.createApiKey(getUser(), { + name: `TEST API KEY: ${uuid.v4()}`, + }); + } + beforeAll(async () => { + await Slapshot.callWhenOnline(async () => { + const { createKibanaServer } = await import( + '../../../../../test_utils/jest/contract_tests/servers' + ); + servers = await createKibanaServer({ + security: { enabled: false }, + }); + esAdapter = new MemorizedElasticsearchAdapter( + new ElasticsearchAdapter(servers.kbnServer.plugins.elasticsearch) + ); + soAdapter = new MemorizeSODatabaseAdapter( + new SODatabaseAdapter( + servers.kbnServer.savedObjects, + servers.kbnServer.plugins.elasticsearch + ) + ); + }); + + if (!soAdapter) { + soAdapter = new MemorizeSODatabaseAdapter(); + } + if (!esAdapter) { + esAdapter = new MemorizedElasticsearchAdapter(); + } + }); + + afterAll(async () => { + if (servers) { + await servers.shutdown; + } + }); + beforeEach(async () => { + await clearFixtures(); + libs = compose(servers ? servers.kbnServer : undefined); + }); + describe('verifyAccessApiKey', () => { + it('should verify a valid api key', async () => { + const { apiKeys } = libs; + const apiKey = await createESApiKey(); + + const res = await apiKeys.verifyAccessApiKey(getUserForApiKey(apiKey)); + expect(res).toMatchObject({ + valid: true, + }); + }); + it('should not verify invalid ApiKey', async () => { + const { apiKeys } = libs; + const res = await apiKeys.verifyAccessApiKey( + getUserForApiKey({ id: 'invalid', api_key: 'NOT_A_VALID_API_KEY' }) + ); + expect(res).toMatchObject({ + valid: false, + reason: 'ApiKey is not valid', + }); + }); + }); + describe('verifyEnrollmentApiKey', () => { + it('should verify a valid api key', async () => { + const { apiKeys } = libs; + const apiKey = await createESApiKey(); + await soAdapter.create(getUser(), 'enrollment_api_keys', { + active: true, + api_key_id: apiKey.id, + api_key: apiKeyToString(apiKey), + }); + + const res = await apiKeys.verifyEnrollmentApiKey(getUserForApiKey(apiKey)); + + expect(res).toMatchObject({ + valid: true, + }); + }); + + it('should not verify a inactive enrollemnt api key', async () => { + const { apiKeys } = libs; + const apiKey = await createESApiKey(); + await soAdapter.create(getUser(), 'enrollment_api_keys', { + active: false, + api_key_id: apiKey.id, + api_key: apiKeyToString(apiKey), + }); + + const res = await apiKeys.verifyEnrollmentApiKey(getUserForApiKey(apiKey)); + + expect(res).toMatchObject({ + valid: false, + reason: 'Enrollement api key does not exists or is not active', + }); + }); + + it('should not verify a inactive an enrollemnt api key not persisted', async () => { + const { apiKeys } = libs; + const apiKey = await createESApiKey(); + const res = await apiKeys.verifyEnrollmentApiKey(getUserForApiKey(apiKey)); + + expect(res).toMatchObject({ + valid: false, + reason: 'Enrollement api key does not exists or is not active', + }); + }); + + it('should not verify invalid ApiKey', async () => { + const { apiKeys } = libs; + const res = await apiKeys.verifyEnrollmentApiKey( + getUserForApiKey({ id: 'not valid', api_key: 'invalid' }) + ); + expect(res).toMatchObject({ + valid: false, + reason: 'ApiKey is not valid', + }); + }); + }); + + describe('generateEnrollmentApiKey', () => { + it('should generate a valid ApiKey', async () => { + const { apiKeys } = libs; + + const apiKey = await apiKeys.generateEnrollmentApiKey(getUser(), { + policyId: 'policy1', + }); + + expect(apiKey).toBeDefined(); + }); + }); +}); diff --git a/x-pack/legacy/plugins/fleet/server/libs/api_keys.ts b/x-pack/legacy/plugins/fleet/server/libs/api_keys.ts new file mode 100644 index 0000000000000..2b47c2868212e --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/api_keys.ts @@ -0,0 +1,310 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as _ from 'lodash'; +import Boom from 'boom'; +import uuid from 'uuid/v4'; +import { + EnrollmentApiKeyVerificationResponse, + EnrollmentApiKey, + EnrollmentRuleData, + EnrollmentApiKeysRepository, + AccessApiKeyVerificationResponse, + EnrollmentRule, +} from '../repositories/enrollment_api_keys/types'; +import { FrameworkLib } from './framework'; +import { FrameworkUser, internalAuthData } from '../adapters/framework/adapter_types'; +import { ElasticsearchAdapter } from '../adapters/elasticsearch/adapter_types'; +import { DEFAULT_POLICY_ID } from '../../common/constants'; + +export class ApiKeyLib { + constructor( + private readonly enrollmentApiKeysRepository: EnrollmentApiKeysRepository, + private readonly esAdapter: ElasticsearchAdapter, + private readonly frameworkLib: FrameworkLib + ) {} + + public async getEnrollmentApiKey(user: FrameworkUser, keyId: string) { + return await this.enrollmentApiKeysRepository.getById(user, keyId); + } + + public async listEnrollmentApiKeys( + user: FrameworkUser, + options: { page?: number; perPage?: number; kuery?: string; showInactive?: boolean } + ): Promise<{ items: any; total: any; page: any; perPage: any }> { + return await this.enrollmentApiKeysRepository.list(user, options); + } + + /** + * Verify if an an enrollment api key is valid and active + */ + public async verifyEnrollmentApiKey( + user: FrameworkUser + ): Promise { + try { + const { apiKeyId } = this._parseApiKey(user); + + await this.esAdapter.authenticate(user); + const enrollmentApiKey = await this.enrollmentApiKeysRepository.getByApiKeyId( + this.frameworkLib.getInternalUser(), + apiKeyId + ); + if (!enrollmentApiKey || !enrollmentApiKey.active) { + throw new Error('Enrollement api key does not exists or is not active'); + } + + return { + valid: true, + enrollmentApiKey, + }; + } catch (error) { + return { + valid: false, + reason: error.message || 'ApiKey is not valid', + }; + } + } + + /** + * Verify if an an enrollment api key is valid and active + */ + public async verifyAccessApiKey(user: FrameworkUser): Promise { + try { + const { apiKeyId } = this._parseApiKey(user); + + await this.esAdapter.authenticate(user); + + return { + valid: true, + accessApiKeyId: apiKeyId, + }; + } catch (error) { + return { + valid: false, + reason: error.message || 'ApiKey is not valid', + }; + } + } + + public async generateAccessApiKey( + agentId: string, + policyId?: string + ): Promise<{ key: string; id: string }> { + const name = this._getAccesstApiKeyName(agentId); + + const key = await this.esAdapter.createApiKey(this.frameworkLib.getInternalUser(), { + name, + + role_descriptors: { + 'fleet-agent': { + index: [ + { + names: ['logs-*', 'metrics-*'], + privileges: ['write'], + }, + ], + }, + }, + }); + + return { id: key.id, key: Buffer.from(`${key.id}:${key.api_key}`).toString('base64') }; + } + + /** + * Generate a new enrollment api key + */ + public async generateEnrollmentApiKey( + user: FrameworkUser, + data: { + name?: string; + policyId?: string; + expiration?: string; + } + ): Promise { + const id = uuid(); + const { name: providedKeyName, policyId = DEFAULT_POLICY_ID, expiration } = data; + + const name = this._getEnrollmentApiKeyName(id, providedKeyName, policyId); + + const key = await this.esAdapter.createApiKey(this.frameworkLib.getInternalUser(), { + name, + expiration, + }); + + const apiKey = Buffer.from(`${key.id}:${key.api_key}`).toString('base64'); + + return await this.enrollmentApiKeysRepository.create(user, { + active: true, + apiKeyId: key.id, + apiKey, + name, + policyId, + }); + } + + public async deleteEnrollmentApiKeyForPolicyId(user: FrameworkUser, policyId: string) { + let hasMore = true; + let page = 1; + while (hasMore) { + const { items } = await this.enrollmentApiKeysRepository.list(user, { + page: page++, + perPage: 100, + kuery: `enrollment_api_keys.policy_id:${policyId}`, + }); + + if (items.length === 0) { + hasMore = false; + } + + for (const apiKey of items) { + await this.deleteEnrollmentApiKey(user, apiKey.id); + } + } + } + + public async deleteEnrollmentApiKey(user: FrameworkUser, id: string) { + const enrollmentApiKey = await this.enrollmentApiKeysRepository.getById(user, id); + if (!enrollmentApiKey) { + throw Boom.notFound('Enrollment Api Key not found'); + } + + await this.esAdapter.deleteApiKey(this.frameworkLib.getInternalUser(), { + id: enrollmentApiKey.api_key_id, + }); + + await this.enrollmentApiKeysRepository.delete(user, id); + } + + private _parseApiKey(user: FrameworkUser) { + if (user.kind !== 'authenticated') { + throw new Error('Error must provide an authenticated user'); + } + + const authorizationHeader = user[internalAuthData].authorization; + + if (!authorizationHeader) { + throw new Error('Authorization header must be set'); + } + + if (!authorizationHeader.startsWith('ApiKey ')) { + throw new Error('Authorization header is malformed'); + } + + const apiKey = authorizationHeader.split(' ')[1]; + if (!apiKey) { + throw new Error('Authorization header is malformed'); + } + const apiKeyId = Buffer.from(apiKey, 'base64') + .toString('utf8') + .split(':')[0]; + + return { + apiKey, + apiKeyId, + }; + } + + private _getEnrollmentApiKeyName(id: string, name?: string, policyId?: string): string { + const generatedName = `Fleet:EnrollmentApiKey:${id}${policyId ? `:${policyId}` : ''}`; + + return name ? `${name} (${generatedName})` : generatedName; + } + + private _getAccesstApiKeyName(agentId: string): string { + return `Fleet:AccessApiKey:${agentId}`; + } + + public async addEnrollmentRule( + user: FrameworkUser, + enrollmentApiKeyId: string, + ruleData: EnrollmentRuleData + ) { + const enrollmentApiKey = await this.enrollmentApiKeysRepository.getById( + user, + enrollmentApiKeyId + ); + if (!enrollmentApiKey) { + throw Boom.notFound('Enrollment api key not found.'); + } + + const rule = { + ...ruleData, + id: uuid(), + created_at: new Date().toISOString(), + }; + + await this.enrollmentApiKeysRepository.update(user, enrollmentApiKey.id, { + enrollment_rules: enrollmentApiKey.enrollment_rules.concat([rule]), + }); + + return rule; + } + + public async updateEnrollmentRuleForPolicy( + user: FrameworkUser, + enrollmentApiKeyId: string, + ruleId: string, + ruleData: EnrollmentRuleData + ): Promise { + const enrollmentApiKey = await this._getEnrollemntApiKeyByIdOrThrow(user, enrollmentApiKeyId); + + const ruleToUpdate = enrollmentApiKey.enrollment_rules.find(rule => rule.id === ruleId); + if (!ruleToUpdate) { + throw Boom.notFound(`Rule not found: ${ruleId}`); + } + const ruleIndex = enrollmentApiKey.enrollment_rules.indexOf(ruleToUpdate); + + const rule = { + ...ruleToUpdate, + ...ruleData, + updated_at: new Date().toISOString(), + }; + + await this.enrollmentApiKeysRepository.update(user, enrollmentApiKey.id, { + enrollment_rules: [ + ...enrollmentApiKey.enrollment_rules.slice(0, ruleIndex), + rule, + ...enrollmentApiKey.enrollment_rules.slice(ruleIndex + 1), + ], + }); + + return rule; + } + + public async deleteEnrollmentRule( + user: FrameworkUser, + enrollmentApiKeyId: string, + ruleId: string + ) { + const enrollmentApiKey = await this._getEnrollemntApiKeyByIdOrThrow(user, enrollmentApiKeyId); + const ruleIndex = enrollmentApiKey.enrollment_rules.findIndex(rule => rule.id === ruleId); + if (ruleIndex < 0) { + throw Boom.notFound(`Rule not found: ${ruleId}`); + } + + await this.enrollmentApiKeysRepository.update(user, enrollmentApiKey.id, { + enrollment_rules: [ + ...enrollmentApiKey.enrollment_rules.slice(0, ruleIndex), + ...enrollmentApiKey.enrollment_rules.slice(ruleIndex + 1), + ], + }); + } + + public async deleteAllEnrollmentRules(user: FrameworkUser, enrollmentApiKeyId: string) { + const enrollmentApiKey = await this._getEnrollemntApiKeyByIdOrThrow(user, enrollmentApiKeyId); + await this.enrollmentApiKeysRepository.update(user, enrollmentApiKey.id, { + enrollment_rules: [], + }); + } + + private async _getEnrollemntApiKeyByIdOrThrow(user: FrameworkUser, id: string) { + const apiKey = await this.enrollmentApiKeysRepository.getById(user, id); + if (!apiKey) { + throw Boom.notFound(`No enrollment api key found`); + } + return apiKey; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/artifact.test.ts b/x-pack/legacy/plugins/fleet/server/libs/artifact.test.ts new file mode 100644 index 0000000000000..912fe48e38c3c --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/artifact.test.ts @@ -0,0 +1,104 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ArtifactLib } from './artifact'; +import { InMemoryArtifactRepository } from '../repositories/artifacts/in_memory'; +import { InMemoryHttpAdapter } from '../adapters/http_adapter/in_memory'; + +async function readStreamAsString(stream: NodeJS.ReadableStream): Promise { + return new Promise((resolve, reject) => { + let acc: Buffer; + stream.on('data', data => { + if (acc) { + acc = Buffer.concat([acc, data]); + } else { + acc = data; + } + }); + + stream.on('error', err => reject(err)); + + stream.on('end', () => resolve(acc.toString())); + }); +} + +describe('Artifact lib', () => { + describe('download', () => { + it('should download the artifacts and set it in cache if there is no cache', async () => { + const store = new InMemoryArtifactRepository(); + const httpAdapter = new InMemoryHttpAdapter(); + httpAdapter.responses[ + 'https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.2-i386.deb' + ] = Buffer.from('testartifcat'); + httpAdapter.responses[ + 'https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.2-i386.deb.sha512' + ] = `bd59f015861d1191cfa152369abbced5ded37ce1ba549d8ca19106ec99eb694bf1f62ae6f8f7fb8501fc21f58653db82ae11a6198a728bc1a4f5220c93415ff7 filebeat-7.3.2-i386.deb.sha512`; + const artifact = new ArtifactLib(store, httpAdapter); + + const fileStream = await artifact.download('beats/filebeat/filebeat-7.3.2-i386.deb'); + const file = await readStreamAsString(fileStream); + + expect(file).toBe('testartifcat'); + }); + + it('should download the artifacts and not verify it if the user ask for an asc file', async () => { + const store = new InMemoryArtifactRepository(); + const httpAdapter = new InMemoryHttpAdapter(); + httpAdapter.responses[ + 'https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.2-i386.rpm.asc' + ] = `asc file`; + const artifact = new ArtifactLib(store, httpAdapter); + + const fileStream = await artifact.download('beats/filebeat/filebeat-7.3.2-i386.rpm.asc'); + const file = await readStreamAsString(fileStream); + + expect(file).toBe('asc file'); + }); + + it('should allow to download GPG-KEY-elasticsearch', async () => { + const store = new InMemoryArtifactRepository(); + const httpAdapter = new InMemoryHttpAdapter(); + httpAdapter.responses['https://artifacts.elastic.co/GPG-KEY-elasticsearch'] = Buffer.from( + `GPG-KEY-elasticsearch` + ); + const artifact = new ArtifactLib(store, httpAdapter); + + const fileStream = await artifact.download('GPG-KEY-elasticsearch'); + const file = await readStreamAsString(fileStream); + + expect(file).toBe('GPG-KEY-elasticsearch'); + }); + + it('should throw if the sha512 is not valid', async () => { + const store = new InMemoryArtifactRepository(); + const httpAdapter = new InMemoryHttpAdapter(); + httpAdapter.responses[ + 'https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.2-i386.deb' + ] = Buffer.from('testartifcat'); + httpAdapter.responses[ + 'https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.2-i386.deb.sha512' + ] = `invalidsha filebeat-7.3.2-i386.deb.sha512`; + const artifact = new ArtifactLib(store, httpAdapter); + + expect(artifact.download('beats/filebeat/filebeat-7.3.2-i386.deb')).rejects.toThrow( + /Impossible to download beats\/filebeat\/filebeat-7.3.2-i386.deb/ + ); + }); + + it('should use the cache if an entry exists', async () => { + const store = new InMemoryArtifactRepository(); + store.cache['beats/filebeat/filebeat-7.3.2-i386.deb'] = Buffer.from('testartifcat'); + + const httpAdapter = new InMemoryHttpAdapter(); + const artifact = new ArtifactLib(store, httpAdapter); + + const fileStream = await artifact.download('beats/filebeat/filebeat-7.3.2-i386.deb'); + const file = await readStreamAsString(fileStream); + + expect(file).toBe('testartifcat'); + }); + }); +}); diff --git a/x-pack/legacy/plugins/fleet/server/libs/artifact.ts b/x-pack/legacy/plugins/fleet/server/libs/artifact.ts new file mode 100644 index 0000000000000..86790dfb5409b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/artifact.ts @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Writable, pipeline } from 'stream'; +import Boom from 'boom'; +import { promisify } from 'util'; +import { createHash } from 'crypto'; +import path from 'path'; +import { HttpAdapter as HttpAdapterType } from '../adapters/http_adapter/adapter_type'; +import { ArtifactsRepository } from '../repositories/artifacts/types'; + +const pipelineAsync = promisify(pipeline); +const ARTIFACT_BASE_PATH = 'https://artifacts.elastic.co/downloads'; +const ARTIFACT_ROOT_PATH = 'https://artifacts.elastic.co'; +const GCP_KEY_PATH = 'GPG-KEY-elasticsearch'; + +export class ArtifactLib { + constructor( + private readonly store: ArtifactsRepository, + private readonly httpAdapter: HttpAdapterType + ) {} + + public async download(downloadPath: string) { + const hasCacheEntry = await this.store.has(downloadPath); + if (!hasCacheEntry) { + const cacheStream = await this.store.setCacheStream(downloadPath); + try { + const downloadRes = await this.httpAdapter.get({ + baseURL: GCP_KEY_PATH === downloadPath ? ARTIFACT_ROOT_PATH : ARTIFACT_BASE_PATH, + url: downloadPath, + responseType: 'stream', + }); + + await pipelineAsync(downloadRes, cacheStream); + } catch (error) { + if (error.isAxiosError && error.response.status === 404) { + throw Boom.notFound(`File not found ${downloadPath}`); + } + throw error; + } + + if ( + GCP_KEY_PATH !== downloadPath && + ['.sha512', '.asc'].indexOf(path.extname(downloadPath)) < 0 + ) { + await this._verifySHA512(downloadPath); + } + } + return this.store.getCacheStream(downloadPath); + } + + private async _verifySHA512(downloadPath: string) { + const readCacheStream = this.store.getCacheStream(downloadPath); + const [cacheSha512, expectedSha512File] = await Promise.all([ + getSha512(readCacheStream), + await this.httpAdapter.get({ + baseURL: ARTIFACT_BASE_PATH, + url: `${downloadPath}.sha512`, + responseType: 'text', + }), + ]); + const expectedSha512 = expectedSha512File.split(' ')[0]; + if (cacheSha512 !== expectedSha512) { + await this.store.deleteCache(downloadPath); + throw new Error( + `Impossible to download ${downloadPath} invalid checksum.\n Got: ${cacheSha512}\n Expected: ${expectedSha512}` + ); + } + } +} + +async function getSha512(stream: NodeJS.ReadableStream): Promise { + let acc: Buffer = Buffer.from(''); + const accumulatorStream = new Writable({ + write: (chunk, encoding, callback) => { + if (!acc) { + acc = chunk; + } else { + acc = Buffer.concat([acc, chunk]); + } + callback(); + }, + }); + await pipelineAsync(stream, createHash('sha512'), accumulatorStream); + return acc.toString('hex'); +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/compose/kibana.ts b/x-pack/legacy/plugins/fleet/server/libs/compose/kibana.ts new file mode 100644 index 0000000000000..0f42515ab50a6 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/compose/kibana.ts @@ -0,0 +1,63 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import os from 'os'; +import { ApiKeyLib } from '../api_keys'; +import { AgentLib } from '../agent'; +import { FrameworkLib } from '../framework'; +import { AgentsRepository } from '../../repositories/agents/default'; +import { SODatabaseAdapter } from '../../adapters/saved_objects_database/default'; +import { EnrollmentApiKeysRepository } from '../../repositories/enrollment_api_keys/default'; +import { FrameworkAdapter } from '../../adapters/framework/default'; +import { PolicyLib } from '../policy'; +import { EncryptedSavedObjects } from '../../adapters/encrypted_saved_objects/default'; +import { FleetServerLib } from '../types'; +import { PoliciesRepository } from '../../repositories/policies/default'; +import { ArtifactLib } from '../artifact'; +import { FileSystemArtifactRepository } from '../../repositories/artifacts/file_system'; +import { HttpAdapter } from '../../adapters/http_adapter/default'; +import { AgentEventsRepository } from '../../repositories/agent_events/default'; +import { InstallLib } from '../install'; +import { ElasticsearchAdapter } from '../../adapters/elasticsearch/default'; + +export function compose(server: any): FleetServerLib { + const frameworkAdapter = new FrameworkAdapter(server); + const policyAdapter = new PoliciesRepository(server.plugins.ingest.policy); + + const framework = new FrameworkLib(frameworkAdapter); + const soDatabaseAdapter = new SODatabaseAdapter( + server.savedObjects, + server.plugins.elasticsearch + ); + const esAdapter = new ElasticsearchAdapter(server.plugins.elasticsearch); + const encryptedObjectAdapter = new EncryptedSavedObjects( + server.newPlatform.start.plugins.encryptedSavedObjects + ); + const agentsRepository = new AgentsRepository(soDatabaseAdapter); + const agentEventsRepository = new AgentEventsRepository(soDatabaseAdapter); + const enrollmentApiKeysRepository = new EnrollmentApiKeysRepository( + soDatabaseAdapter, + encryptedObjectAdapter + ); + + const policies = new PolicyLib(policyAdapter); + const apiKeys = new ApiKeyLib(enrollmentApiKeysRepository, esAdapter, framework); + const agents = new AgentLib(agentsRepository, agentEventsRepository, apiKeys, policies); + + const artifactRepository = new FileSystemArtifactRepository(os.tmpdir()); + const artifacts = new ArtifactLib(artifactRepository, new HttpAdapter()); + + const install = new InstallLib(framework); + + return { + agents, + apiKeys, + policies, + artifacts, + install, + framework, + }; +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/compose/memorized.ts b/x-pack/legacy/plugins/fleet/server/libs/compose/memorized.ts new file mode 100644 index 0000000000000..2314757afa0f6 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/compose/memorized.ts @@ -0,0 +1,69 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import os from 'os'; +import { ApiKeyLib } from '../api_keys'; +import { AgentLib } from '../agent'; +import { FrameworkLib } from '../framework'; +import { AgentsRepository } from '../../repositories/agents/default'; +import { SODatabaseAdapter } from '../../adapters/saved_objects_database/default'; +import { EnrollmentApiKeysRepository } from '../../repositories/enrollment_api_keys/default'; +import { FrameworkAdapter } from '../../adapters/framework/default'; +import { PolicyLib } from '../policy'; +import { EncryptedSavedObjects } from '../../adapters/encrypted_saved_objects/default'; +import { FleetServerLib } from '../types'; +import { PoliciesRepository } from '../../repositories/policies/default'; +import { ArtifactLib } from '../artifact'; +import { FileSystemArtifactRepository } from '../../repositories/artifacts/file_system'; +import { HttpAdapter } from '../../adapters/http_adapter/default'; +import { AgentEventsRepository } from '../../repositories/agent_events/default'; +import { InstallLib } from '../install'; +import { ElasticsearchAdapter } from '../../adapters/elasticsearch/default'; +import { MemorizeSODatabaseAdapter } from '../../adapters/saved_objects_database/memorize_adapter'; +import { MemorizedElasticsearchAdapter } from '../../adapters/elasticsearch/memorize_adapter'; +import { MemorizeEncryptedSavedObjects } from '../../adapters/encrypted_saved_objects/memorize_adapter'; + +export function compose(server?: any): FleetServerLib { + const frameworkAdapter = new FrameworkAdapter(server); + const policyAdapter = new PoliciesRepository(server ? server.plugins.ingest.policy : undefined); + + const framework = new FrameworkLib(frameworkAdapter); + const soDatabaseAdapter = new MemorizeSODatabaseAdapter( + server ? new SODatabaseAdapter(server.savedObjects, server.plugins.elasticsearch) : undefined + ); + const esAdapter = new MemorizedElasticsearchAdapter( + server ? new ElasticsearchAdapter(server.plugins.elasticsearch) : undefined + ); + const encryptedObjectAdapter = new MemorizeEncryptedSavedObjects( + server + ? new EncryptedSavedObjects(server.newPlatform.start.plugins.encryptedSavedObjects) + : undefined + ); + const agentsRepository = new AgentsRepository(soDatabaseAdapter); + const agentEventsRepository = new AgentEventsRepository(soDatabaseAdapter); + const enrollmentApiKeysRepository = new EnrollmentApiKeysRepository( + soDatabaseAdapter, + encryptedObjectAdapter + ); + + const policies = new PolicyLib(policyAdapter); + const apiKeys = new ApiKeyLib(enrollmentApiKeysRepository, esAdapter, framework); + const agents = new AgentLib(agentsRepository, agentEventsRepository, apiKeys, policies); + + const artifactRepository = new FileSystemArtifactRepository(os.tmpdir()); + const artifacts = new ArtifactLib(artifactRepository, new HttpAdapter()); + + const install = new InstallLib(framework); + + return { + agents, + apiKeys, + policies, + artifacts, + install, + framework, + }; +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/compose/types.ts b/x-pack/legacy/plugins/fleet/server/libs/compose/types.ts new file mode 100644 index 0000000000000..8b86c77899c40 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/compose/types.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FleetServerLib } from '../types'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; + +export type FleetServerLibRequestFactory = (request: FrameworkRequest) => FleetServerLib; diff --git a/x-pack/legacy/plugins/fleet/server/libs/framework.ts b/x-pack/legacy/plugins/fleet/server/libs/framework.ts new file mode 100644 index 0000000000000..4ce246367643d --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/framework.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FrameworkAdapter } from '../adapters/framework/default'; +import { FrameworkUser } from '../adapters/framework/adapter_types'; + +export class FrameworkLib { + constructor(private readonly adapter: FrameworkAdapter) {} + + public getSetting(setting: 'encryptionKey'): string { + return this.adapter.getSetting(`xpack.fleet.${setting}`); + } + + public expose(key: string, method: any) { + this.adapter.expose(key, method); + } + + public getServerConfig() { + return { + host: this.adapter.getSetting('server.host'), + protocol: this.adapter.getServerInfo().protocol, + port: this.adapter.getSetting('server.port'), + basePath: this.adapter.getSetting('server.basePath'), + }; + } + + public getInternalUser(): FrameworkUser { + return { + kind: 'internal', + }; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/install.ts b/x-pack/legacy/plugins/fleet/server/libs/install.ts new file mode 100644 index 0000000000000..935bf7f48cf44 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/install.ts @@ -0,0 +1,35 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import url from 'url'; +import { FrameworkLib } from './framework'; +import { macosInstallTemplate } from './install_templates/macos'; + +export class InstallLib { + constructor(private readonly framework: FrameworkLib) {} + + public getScript(osType: 'macos'): string { + const variables = { kibanaUrl: this.getKibanaUrl() }; + + switch (osType) { + case 'macos': + return macosInstallTemplate(variables); + default: + throw new Error(`${osType} is not supported.`); + } + } + + private getKibanaUrl() { + const { host: hostname, protocol, port, basePath: pathname } = this.framework.getServerConfig(); + + return url.format({ + protocol, + hostname, + port, + pathname, + }); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/install_templates/macos.ts b/x-pack/legacy/plugins/fleet/server/libs/install_templates/macos.ts new file mode 100644 index 0000000000000..ba327b0eaf533 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/install_templates/macos.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { InstallTemplateFunction } from './types'; + +export const macosInstallTemplate: InstallTemplateFunction = variables => `#!/bin/sh + +echo "To install an agent run:\n node scripts/dev_agent --enrollmentToken=$(FLEET_ENROLLMENT_TOKEN)" --kibanaUrl=${variables.kibanaUrl}" +`; diff --git a/x-pack/legacy/plugins/fleet/server/libs/install_templates/types.ts b/x-pack/legacy/plugins/fleet/server/libs/install_templates/types.ts new file mode 100644 index 0000000000000..a478beaa96cfc --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/install_templates/types.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export type InstallTemplateFunction = (variables: { kibanaUrl: string }) => string; diff --git a/x-pack/legacy/plugins/fleet/server/libs/policy.ts b/x-pack/legacy/plugins/fleet/server/libs/policy.ts new file mode 100644 index 0000000000000..c8bd6d01ec625 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/policy.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PoliciesRepository, FullPolicyFile } from '../repositories/policies/types'; + +export class PolicyLib { + constructor(private readonly policyAdapter: PoliciesRepository) {} + + public async getFullPolicy(policyId: string): Promise { + return await this.policyAdapter.getFullPolicy(policyId); + } +} diff --git a/x-pack/legacy/plugins/fleet/server/libs/types.ts b/x-pack/legacy/plugins/fleet/server/libs/types.ts new file mode 100644 index 0000000000000..56e771d96935e --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/libs/types.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { AgentLib } from './agent'; +import { ApiKeyLib } from './api_keys'; +import { PolicyLib } from './policy'; +import { ArtifactLib } from './artifact'; +import { InstallLib } from './install'; +import { FrameworkLib } from './framework'; + +export interface FleetServerLib { + apiKeys: ApiKeyLib; + agents: AgentLib; + policies: PolicyLib; + artifacts: ArtifactLib; + install: InstallLib; + framework: FrameworkLib; +} diff --git a/x-pack/legacy/plugins/fleet/server/mappings.ts b/x-pack/legacy/plugins/fleet/server/mappings.ts new file mode 100644 index 0000000000000..0a4b9c461e7c7 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/mappings.ts @@ -0,0 +1,114 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const mappings = { + agents: { + properties: { + shared_id: { + type: 'keyword', + }, + type: { + type: 'keyword', + }, + active: { + type: 'boolean', + }, + enrolled_at: { + type: 'date', + }, + access_api_key_id: { + type: 'keyword', + }, + version: { + type: 'keyword', + }, + user_provided_metadata: { + type: 'text', + }, + local_metadata: { + type: 'text', + }, + policy_id: { + type: 'keyword', + }, + last_updated: { + type: 'date', + }, + last_checkin: { + type: 'date', + }, + updated_at: { + type: 'date', + }, + actions: { + type: 'nested', + properties: { + id: { type: 'keyword' }, + type: { type: 'keyword' }, + data: { type: 'text' }, + sent_at: { type: 'date' }, + created_at: { type: 'date' }, + }, + }, + }, + }, + enrollment_api_keys: { + properties: { + name: { + type: 'keyword', + }, + api_key: { + type: 'binary', + }, + api_key_id: { + type: 'keyword', + }, + policy_id: { + type: 'keyword', + }, + created_at: { + type: 'date', + }, + updated_at: { + type: 'date', + }, + expire_at: { + type: 'date', + }, + active: { + type: 'boolean', + }, + enrollment_rules: { + type: 'nested', + properties: { + id: { type: 'keyword' }, + ip_ranges: { type: 'keyword' }, + window_duration: { + type: 'nested', + properties: { + from: { type: 'date' }, + to: { type: 'date' }, + }, + }, + types: { type: 'keyword' }, + created_at: { type: 'date' }, + updated_at: { type: 'date' }, + }, + }, + }, + }, + agent_events: { + properties: { + type: { type: 'keyword' }, + agent_id: { type: 'keyword' }, + subtype: { type: 'keyword' }, + timestamp: { type: 'date' }, + message: { type: 'text' }, + payload: { type: 'text' }, + data: { type: 'text' }, + }, + }, +}; diff --git a/x-pack/legacy/plugins/fleet/server/repositories/agent_events/__memorize_snapshots__/default.contract.test.slap_snap b/x-pack/legacy/plugins/fleet/server/repositories/agent_events/__memorize_snapshots__/default.contract.test.slap_snap new file mode 100644 index 0000000000000..f2de3916fb5ad --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/agent_events/__memorize_snapshots__/default.contract.test.slap_snap @@ -0,0 +1,758 @@ + +exports['AgentsEventsRepository createEventsForAgent Create events for an agent - create:agent_events (1)'] = { + "results": { + "type": "agent_events", + "id": "ac97d650-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:46.741Z", + "version": "WzI4MSwxXQ==" + } +} + +exports['AgentsEventsRepository createEventsForAgent Create events for an agent - bulkCreate (2)'] = { + "results": { + "saved_objects": [ + { + "id": "agent_events:acd9e860-0625-11ea-a248-f38bbc6424e4", + "type": "agent_events", + "updated_at": "2019-11-13T14:55:47.174Z", + "version": "WzI4MiwxXQ==", + "attributes": { + "agent_id": "agent:1", + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "..." + }, + "references": [] + }, + { + "id": "agent_events:acd9e861-0625-11ea-a248-f38bbc6424e4", + "type": "agent_events", + "updated_at": "2019-11-13T14:55:47.174Z", + "version": "WzI4MywxXQ==", + "attributes": { + "agent_id": "agent:1", + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "..." + }, + "references": [] + } + ] + } +} + +exports['AgentsEventsRepository createEventsForAgent Create events for an agent - find:"agent_events" (3)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 4, + "saved_objects": [ + { + "type": "agent_events", + "id": "97bd3ea0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "agent_id": "96890460-0625-11ea-9674-75a3ee7c8618", + "timestamp": "2019-09-05T15:41:26+0000", + "type": "STATE", + "subtype": "STARTING", + "message": "State changed from PAUSE to STARTING" + }, + "references": [], + "updated_at": "2019-11-13T14:55:11.754Z", + "version": "WzI1NSwxXQ==" + }, + { + "type": "agent_events", + "id": "ac97d650-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:46.741Z", + "version": "WzI4MSwxXQ==" + }, + { + "type": "agent_events", + "id": "acd9e860-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "agent_id": "agent:1", + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "..." + }, + "references": [], + "updated_at": "2019-11-13T14:55:47.174Z", + "version": "WzI4MiwxXQ==" + }, + { + "type": "agent_events", + "id": "acd9e861-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "agent_id": "agent:1", + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "..." + }, + "references": [], + "updated_at": "2019-11-13T14:55:47.174Z", + "version": "WzI4MywxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository createEventsForAgent Create events for an agent - find:"agent_events" (4)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 4, + "saved_objects": [ + { + "type": "agent_events", + "id": "97bd3ea0-0625-11ea-9674-75a3ee7c8618", + "attributes": { + "agent_id": "96890460-0625-11ea-9674-75a3ee7c8618", + "timestamp": "2019-09-05T15:41:26+0000", + "type": "STATE", + "subtype": "STARTING", + "message": "State changed from PAUSE to STARTING" + }, + "references": [], + "updated_at": "2019-11-13T14:55:11.754Z", + "version": "WzI1NSwxXQ==" + }, + { + "type": "agent_events", + "id": "ac97d650-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:46.741Z", + "version": "WzI4MSwxXQ==" + }, + { + "type": "agent_events", + "id": "acd9e860-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "agent_id": "agent:1", + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "..." + }, + "references": [], + "updated_at": "2019-11-13T14:55:47.174Z", + "version": "WzI4MiwxXQ==" + }, + { + "type": "agent_events", + "id": "acd9e861-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "agent_id": "agent:1", + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "..." + }, + "references": [], + "updated_at": "2019-11-13T14:55:47.174Z", + "version": "WzI4MywxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository createEventsForAgent Create events for an agent - delete (5)'] = { + "results": {} +} + +exports['AgentsEventsRepository createEventsForAgent Create events for an agent - delete (6)'] = { + "results": {} +} + +exports['AgentsEventsRepository createEventsForAgent Create events for an agent - delete (7)'] = { + "results": {} +} + +exports['AgentsEventsRepository createEventsForAgent Create events for an agent - delete (8)'] = { + "results": {} +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - create:agent_events (1)'] = { + "results": { + "type": "agent_events", + "id": "affcd340-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:52.436Z", + "version": "WzI4OCwxXQ==" + } +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - create:agent_events (2)'] = { + "results": { + "type": "agent_events", + "id": "b097dac0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:53.452Z", + "version": "WzI4OSwxXQ==" + } +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - create:agent_events (3)'] = { + "results": { + "type": "agent_events", + "id": "b13468e0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:55:54.478Z", + "version": "WzI5MCwxXQ==" + } +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - create:agent_events (4)'] = { + "results": { + "type": "agent_events", + "id": "b1ce5ef0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:2" + }, + "references": [], + "updated_at": "2019-11-13T14:55:55.487Z", + "version": "WzI5MSwxXQ==" + } +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - find:"agent_events" (5)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 3, + "saved_objects": [ + { + "type": "agent_events", + "id": "affcd340-0625-11ea-a248-f38bbc6424e4", + "references": [], + "updated_at": "2019-11-13T14:55:52.436Z", + "version": "WzI4OCwxXQ==" + }, + { + "type": "agent_events", + "id": "b097dac0-0625-11ea-a248-f38bbc6424e4", + "references": [], + "updated_at": "2019-11-13T14:55:53.452Z", + "version": "WzI4OSwxXQ==" + }, + { + "type": "agent_events", + "id": "b13468e0-0625-11ea-a248-f38bbc6424e4", + "references": [], + "updated_at": "2019-11-13T14:55:54.478Z", + "version": "WzI5MCwxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - delete (6)'] = { + "results": {} +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - delete (7)'] = { + "results": {} +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - delete (8)'] = { + "results": {} +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - find:"agent_events" (9)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - find:"agent_events" (10)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agent_events", + "id": "b1ce5ef0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:2" + }, + "references": [], + "updated_at": "2019-11-13T14:55:55.487Z", + "version": "WzI5MSwxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - find:"agent_events" (11)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agent_events", + "id": "b1ce5ef0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:2" + }, + "references": [], + "updated_at": "2019-11-13T14:55:55.487Z", + "version": "WzI5MSwxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository deleteEventsForAgent Delete correctly all events for the agent - delete (12)'] = { + "results": {} +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - create:agent_events (1)'] = { + "results": { + "type": "agent_events", + "id": "b4d388a0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "payload": "{\"previous_state\": \"STOPPED\"}", + "data": "{serializedDATA}", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:00.554Z", + "version": "WzI5NiwxXQ==" + } +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - create:agent_events (2)'] = { + "results": { + "type": "agent_events", + "id": "b56e6910-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STOPPED", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:01.569Z", + "version": "WzI5NywxXQ==" + } +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - create:agent_events (3)'] = { + "results": { + "type": "agent_events", + "id": "b606d880-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:02.568Z", + "version": "WzI5OCwxXQ==" + } +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - create:agent_events (4)'] = { + "results": { + "type": "agent_events", + "id": "b6a45100-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:2" + }, + "references": [], + "updated_at": "2019-11-13T14:56:03.599Z", + "version": "WzI5OSwxXQ==" + } +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - find:"agent_events" (5)'] = { + "results": { + "page": 1, + "per_page": 25, + "total": 3, + "saved_objects": [ + { + "type": "agent_events", + "id": "b606d880-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:02.568Z", + "version": "WzI5OCwxXQ==" + }, + { + "type": "agent_events", + "id": "b56e6910-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STOPPED", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:01.569Z", + "version": "WzI5NywxXQ==" + }, + { + "type": "agent_events", + "id": "b4d388a0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "payload": "{\"previous_state\": \"STOPPED\"}", + "data": "{serializedDATA}", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:00.554Z", + "version": "WzI5NiwxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - find:"agent_events" (6)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 4, + "saved_objects": [ + { + "type": "agent_events", + "id": "b4d388a0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "payload": "{\"previous_state\": \"STOPPED\"}", + "data": "{serializedDATA}", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:00.554Z", + "version": "WzI5NiwxXQ==" + }, + { + "type": "agent_events", + "id": "b56e6910-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STOPPED", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:01.569Z", + "version": "WzI5NywxXQ==" + }, + { + "type": "agent_events", + "id": "b606d880-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:02.568Z", + "version": "WzI5OCwxXQ==" + }, + { + "type": "agent_events", + "id": "b6a45100-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:2" + }, + "references": [], + "updated_at": "2019-11-13T14:56:03.599Z", + "version": "WzI5OSwxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - delete (7)'] = { + "results": {} +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - delete (8)'] = { + "results": {} +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - delete (9)'] = { + "results": {} +} + +exports['AgentsEventsRepository getEventsForAgent Get events for the agent - delete (10)'] = { + "results": {} +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - create:agent_events (1)'] = { + "results": { + "type": "agent_events", + "id": "b9a9c8d0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "payload": "{\"previous_state\": \"STOPPED\"}", + "data": "{serializedDATA}", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:08.669Z", + "version": "WzMwNCwxXQ==" + } +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - create:agent_events (2)'] = { + "results": { + "type": "agent_events", + "id": "ba44f760-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STOPPED", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:09.686Z", + "version": "WzMwNSwxXQ==" + } +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - create:agent_events (3)'] = { + "results": { + "type": "agent_events", + "id": "badf3b90-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:10.697Z", + "version": "WzMwNiwxXQ==" + } +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - create:agent_events (4)'] = { + "results": { + "type": "agent_events", + "id": "bb7958b0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:2" + }, + "references": [], + "updated_at": "2019-11-13T14:56:11.707Z", + "version": "WzMwNywxXQ==" + } +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - find:"agent_events" (5)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agent_events", + "id": "ba44f760-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STOPPED", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:09.686Z", + "version": "WzMwNSwxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - find:"agent_events" (6)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 4, + "saved_objects": [ + { + "type": "agent_events", + "id": "b9a9c8d0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "payload": "{\"previous_state\": \"STOPPED\"}", + "data": "{serializedDATA}", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:08.669Z", + "version": "WzMwNCwxXQ==" + }, + { + "type": "agent_events", + "id": "ba44f760-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STOPPED", + "timestamp": "2019-09-27T18:50:33+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:09.686Z", + "version": "WzMwNSwxXQ==" + }, + { + "type": "agent_events", + "id": "badf3b90-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:34+0000", + "message": "...", + "agent_id": "agent:1" + }, + "references": [], + "updated_at": "2019-11-13T14:56:10.697Z", + "version": "WzMwNiwxXQ==" + }, + { + "type": "agent_events", + "id": "bb7958b0-0625-11ea-a248-f38bbc6424e4", + "attributes": { + "type": "STATE", + "subtype": "STARTING", + "timestamp": "2019-09-27T18:50:32+0000", + "message": "...", + "agent_id": "agent:2" + }, + "references": [], + "updated_at": "2019-11-13T14:56:11.707Z", + "version": "WzMwNywxXQ==" + } + ] + } +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - delete (7)'] = { + "results": {} +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - delete (8)'] = { + "results": {} +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - delete (9)'] = { + "results": {} +} + +exports['AgentsEventsRepository getEventsForAgent allow to filter using KQL - delete (10)'] = { + "results": {} +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/agent_events/default.contract.test.ts b/x-pack/legacy/plugins/fleet/server/repositories/agent_events/default.contract.test.ts new file mode 100644 index 0000000000000..26f0363bd2475 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/agent_events/default.contract.test.ts @@ -0,0 +1,233 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import { SavedObject } from 'src/core/server'; +import { AgentEventsRepository } from './default'; +import { SODatabaseAdapter as SODatabaseAdapterType } from '../../adapters/saved_objects_database/adapter_types'; +import { SODatabaseAdapter } from '../../adapters/saved_objects_database/default'; +import { MemorizeSODatabaseAdapter } from '../../adapters/saved_objects_database/memorize_adapter'; +import { FrameworkUser, internalAuthData } from '../../adapters/framework/adapter_types'; +import { AgentEvent } from '../agent_events/types'; + +describe('AgentsEventsRepository', () => { + let repository: AgentEventsRepository; + let soAdapter: SODatabaseAdapterType; + let servers: any; + + function getUser(): FrameworkUser { + return ({ + kind: 'authenticated', + [internalAuthData]: { + authorization: `Basic ${Buffer.from(`elastic:changeme`).toString('base64')}`, + }, + } as unknown) as FrameworkUser; + } + + async function loadFixtures(agentId: string, events: AgentEvent[]): Promise { + const res: SavedObject[] = []; + for (const event of events) { + res.push( + await soAdapter.create(getUser(), 'agent_events', { + ...event, + agent_id: agentId, + }) + ); + } + + return res; + } + + async function clearFixtures() { + const request = getUser(); + const { saved_objects: savedObjects } = await soAdapter.find(request, { + type: 'agent_events', + perPage: 1000, + }); + for (const so of savedObjects) { + await soAdapter.delete(request, 'agent_events', so.id); + } + } + + beforeAll(async () => { + await Slapshot.callWhenOnline(async () => { + const { createKibanaServer } = await import( + '../../../../../../test_utils/jest/contract_tests/servers' + ); + servers = await createKibanaServer({ + security: { enabled: false }, + }); + const baseAdapter = new SODatabaseAdapter( + servers.kbnServer.savedObjects, + servers.kbnServer.plugins.elasticsearch + ); + soAdapter = new MemorizeSODatabaseAdapter(baseAdapter); + }); + + if (!soAdapter) { + soAdapter = new MemorizeSODatabaseAdapter(); + } + repository = new AgentEventsRepository(soAdapter); + }); + + afterAll(async () => { + if (servers) { + await servers.shutdown; + } + }); + + afterEach(clearFixtures); + + describe('createEventsForAgent', () => { + beforeEach(async () => { + await loadFixtures('agent:1', [ + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:32+0000', + message: '...', + }, + ]); + }); + + it('Create events for an agent', async () => { + await repository.createEventsForAgent(getUser(), 'agent:1', [ + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:33+0000', + message: '...', + }, + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:34+0000', + message: '...', + }, + ]); + + const events = await soAdapter.find(getUser(), { + type: 'agent_events', + }); + + const agent1Events = events.saved_objects.filter(o => o.attributes.agent_id === 'agent:1'); + expect(agent1Events).toHaveLength(3); + expect( + agent1Events.find(e => e.attributes.timestamp === '2019-09-27T18:50:34+0000') + ).toBeDefined(); + expect( + agent1Events.find(e => e.attributes.timestamp === '2019-09-27T18:50:33+0000') + ).toBeDefined(); + }); + }); + + describe('deleteEventsForAgent', () => { + beforeEach(async () => { + await loadFixtures('agent:1', [ + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:32+0000', + message: '...', + }, + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:33+0000', + message: '...', + }, + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:34+0000', + message: '...', + }, + ]); + await loadFixtures('agent:2', [ + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:32+0000', + message: '...', + }, + ]); + }); + + it('Delete correctly all events for the agent', async () => { + await repository.deleteEventsForAgent(getUser(), 'agent:1'); + + const events = await soAdapter.find(getUser(), { + type: 'agent_events', + }); + + const agent1Events = events.saved_objects.filter(o => o.attributes.agent_id === 'agent:1'); + const agent2Events = events.saved_objects.filter(o => o.attributes.agent_id === 'agent:2'); + + expect(agent1Events).toHaveLength(0); + expect(agent2Events).toHaveLength(1); + }); + }); + + describe('getEventsForAgent', () => { + beforeEach(async () => { + await loadFixtures('agent:1', [ + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:32+0000', + message: '...', + payload: '{"previous_state": "STOPPED"}', + data: '{serializedDATA}', + }, + { + type: 'STATE', + subtype: 'STOPPED', + timestamp: '2019-09-27T18:50:33+0000', + message: '...', + }, + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:34+0000', + message: '...', + }, + ]); + await loadFixtures('agent:2', [ + { + type: 'STATE', + subtype: 'STARTING', + timestamp: '2019-09-27T18:50:32+0000', + message: '...', + }, + ]); + }); + + it('Get events for the agent', async () => { + const { items, total } = await repository.getEventsForAgent(getUser(), 'agent:1'); + + expect(total).toBe(3); + expect(items).toHaveLength(3); + + const itemWithPayload = items.find(i => i.timestamp === '2019-09-27T18:50:32+0000'); + expect(itemWithPayload).toBeDefined(); + + expect((itemWithPayload as AgentEvent).payload).toMatchObject({ + previous_state: 'STOPPED', + }); + }); + + it('allow to filter using KQL', async () => { + const { items, total } = await repository.getEventsForAgent(getUser(), 'agent:1', { + search: 'agent_events.subtype:STOPPED', + }); + + expect(total).toBe(1); + expect(items).toHaveLength(1); + + expect(items[0].subtype).toBe('STOPPED'); + }); + }); +}); diff --git a/x-pack/legacy/plugins/fleet/server/repositories/agent_events/default.ts b/x-pack/legacy/plugins/fleet/server/repositories/agent_events/default.ts new file mode 100644 index 0000000000000..9aadd79c01da5 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/agent_events/default.ts @@ -0,0 +1,97 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { SavedObjectsBulkCreateObject } from 'src/core/server'; +import { SODatabaseAdapter } from '../../adapters/saved_objects_database/adapter_types'; +import { FrameworkUser } from '../../adapters/framework/adapter_types'; +import { + AgentEventsRepository as AgentEventsRepositoryType, + AgentEvent, + AgentEventSOAttributes, +} from './types'; + +const SO_TYPE = 'agent_events'; + +export class AgentEventsRepository implements AgentEventsRepositoryType { + constructor(private readonly soAdapter: SODatabaseAdapter) {} + public async createEventsForAgent( + user: FrameworkUser, + agentId: string, + events: AgentEvent[] + ): Promise { + const objects: Array> = events.map( + eventData => { + return { + attributes: { + agent_id: agentId, + ...eventData, + payload: eventData.payload ? JSON.stringify(eventData.payload) : undefined, + }, + type: SO_TYPE, + }; + } + ); + + await this.soAdapter.bulkCreate(user, objects); + } + public async getEventsForAgent( + user: FrameworkUser, + agentId: string, + options: { + search?: string; + page?: number; + perPage?: number; + } = { + page: 1, + perPage: 25, + } + ) { + const { page, perPage, search } = options; + const { total, saved_objects } = await this.soAdapter.find(user, { + type: SO_TYPE, + search: agentId, + searchFields: ['agent_id'], + filter: + search && search !== '' + ? search.replace(/agent_events\./g, 'agent_events.attributes.') + : undefined, + perPage, + page, + sortField: 'timestamp', + sortOrder: 'DESC', + defaultSearchOperator: 'AND', + }); + + const items: AgentEvent[] = saved_objects.map(so => { + return { + ...so.attributes, + payload: so.attributes.payload ? JSON.parse(so.attributes.payload) : undefined, + }; + }); + + return { items, total }; + } + + public async deleteEventsForAgent(user: FrameworkUser, agentId: string): Promise { + let more = true; + + while (more === true) { + const { saved_objects: events } = await this.soAdapter.find(user, { + type: SO_TYPE, + fields: ['id'], + search: agentId, + searchFields: ['agent_id'], + perPage: 1000, + }); + if (events.length === 0) { + more = false; + } + for (const event of events) { + await this.soAdapter.delete(user, SO_TYPE, event.id); + } + } + } +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/agent_events/types.ts b/x-pack/legacy/plugins/fleet/server/repositories/agent_events/types.ts new file mode 100644 index 0000000000000..2f745f8292bb2 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/agent_events/types.ts @@ -0,0 +1,73 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as t from 'io-ts'; +import { FrameworkUser } from '../../adapters/framework/adapter_types'; + +export const RuntimeAgentEventType = t.union([ + t.literal('STATE'), + t.literal('ERROR'), + t.literal('ACTION_RESULT'), +]); + +export const RuntimeAgentEventSubtype = t.union([ + t.literal('RUNNING'), + t.literal('STARTING'), + t.literal('IN_PROGRESS'), + t.literal('CONFIG'), + t.literal('FAILED'), + t.literal('STOPPED'), + t.literal('DATA_DUMP'), +]); + +export const RuntimeAgentEvent = t.intersection( + [ + t.interface({ + type: RuntimeAgentEventType, + subtype: RuntimeAgentEventSubtype, + timestamp: t.string, + message: t.string, + }), + t.partial({ + payload: t.any, + data: t.string, + }), + ], + 'AgentEvent' +); +export type AgentEvent = t.TypeOf; + +export const RuntimeAgentEventSOAttributes = t.intersection( + [ + t.interface({ + type: RuntimeAgentEventType, + subtype: RuntimeAgentEventSubtype, + timestamp: t.string, + message: t.string, + agent_id: t.string, + }), + t.partial({ + payload: t.string, + data: t.string, + }), + ], + 'AgentEventSOAttribute' +); +export type AgentEventSOAttributes = t.TypeOf; + +export interface AgentEventsRepository { + createEventsForAgent(user: FrameworkUser, agentId: string, events: AgentEvent[]): Promise; + getEventsForAgent( + user: FrameworkUser, + agentId: string, + options?: { + search?: string; + page?: number; + perPage?: number; + } + ): Promise<{ items: AgentEvent[]; total: number }>; + deleteEventsForAgent(user: FrameworkUser, agentId: string): Promise; +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/agents/__memorize_snapshots__/default.contract.test.slap_snap b/x-pack/legacy/plugins/fleet/server/repositories/agents/__memorize_snapshots__/default.contract.test.slap_snap new file mode 100644 index 0000000000000..d78c5d4f9622f --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/agents/__memorize_snapshots__/default.contract.test.slap_snap @@ -0,0 +1,5700 @@ + +exports['AgentsRepository create should create a new agent - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "02796c10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:51:01.329Z", + "version": "WzE3LDFd" + } +} + +exports['AgentsRepository create should create a new agent - find:"agents" (2)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "02796c10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:51:01.329Z", + "version": "WzE3LDFd" + } + ] + } +} + +exports['AgentsRepository create should create a new agent - delete (3)'] = { + "results": {} +} + +exports['AgentsRepository create should create a new agent with the specified id if specified - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "test-agent-id-1", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:51:02.951Z", + "version": "WzE5LDFd" + } +} + +exports['AgentsRepository create should create a new agent with the specified id if specified - find:"agents" (2)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "test-agent-id-1", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:51:02.951Z", + "version": "WzE5LDFd" + } + ] + } +} + +exports['AgentsRepository create should create a new agent with the specified id if specified - delete (3)'] = { + "results": {} +} + +exports['AgentsRepository create should allow to create a new agent with the same id two time if override is true - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "test-agent-id-2", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:51:04.996Z", + "version": "WzIxLDFd" + } +} + +exports['AgentsRepository create should allow to create a new agent with the same id two time if override is true - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "test-agent-id-2", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:51:06.007Z", + "version": "WzIyLDFd" + } +} + +exports['AgentsRepository create should allow to create a new agent with the same id two time if override is true - find:"agents" (3)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "test-agent-id-2", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z", + "actions": [] + }, + "references": [], + "updated_at": "2019-11-13T14:51:06.007Z", + "version": "WzIyLDFd" + } + ] + } +} + +exports['AgentsRepository create should allow to create a new agent with the same id two time if override is true - delete (4)'] = { + "results": {} +} + +exports['AgentsRepository create should allow to create a new agent with the same id two time if override is true - create:agents (5)'] = { + "results": { + "type": "agents", + "id": "067c56b0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:08.058Z", + "version": "WzI0LDFd" + } +} + +exports['AgentsRepository update should allow to update an agent - update:agents (1)'] = { + "results": { + "id": "067c56b0-0625-11ea-bdb3-e10a3f6667b0", + "type": "agents", + "updated_at": "2019-11-13T14:51:09.079Z", + "version": "WzI1LDFd", + "attributes": { + "active": true + } + } +} + +exports['AgentsRepository update should allow to update an agent - get:agents (2)'] = { + "results": { + "id": "067c56b0-0625-11ea-bdb3-e10a3f6667b0", + "type": "agents", + "updated_at": "2019-11-13T14:51:09.079Z", + "version": "WzI1LDFd", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [] + } +} + +exports['AgentsRepository update should allow to update an agent - find:"agents" (3)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "067c56b0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:09.079Z", + "version": "WzI1LDFd" + } + ] + } +} + +exports['AgentsRepository update should allow to update an agent - delete (4)'] = { + "results": {} +} + +exports['AgentsRepository update should allow to update an agent - create:agents (5)'] = { + "results": { + "type": "agents", + "id": "084dbb50-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"localhost\"}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:11.109Z", + "version": "WzI3LDFd" + } +} + +exports['AgentsRepository delete should delete an agent - delete (1)'] = { + "results": {} +} + +exports['AgentsRepository delete should delete an agent - get:agents (2)'] = { + "results": null +} + +exports['AgentsRepository delete should delete an agent - find:"agents" (3)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} + +exports['AgentsRepository list should list all active agents - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "09874cc0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:13.164Z", + "version": "WzI5LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "0a1dc060-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:14.150Z", + "version": "WzMwLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "0abbae10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:15.185Z", + "version": "WzMxLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "0b756120-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:16.402Z", + "version": "WzMyLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (5)'] = { + "results": { + "type": "agents", + "id": "0c11ef40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:17.427Z", + "version": "WzMzLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (6)'] = { + "results": { + "type": "agents", + "id": "0cabbe40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:18.436Z", + "version": "WzM0LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (7)'] = { + "results": { + "type": "agents", + "id": "0d469eb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:19.451Z", + "version": "WzM1LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (8)'] = { + "results": { + "type": "agents", + "id": "0de13100-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:20.464Z", + "version": "WzM2LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (9)'] = { + "results": { + "type": "agents", + "id": "0e7cadb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:21.483Z", + "version": "WzM3LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (10)'] = { + "results": { + "type": "agents", + "id": "0f180350-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:22.500Z", + "version": "WzM4LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (11)'] = { + "results": { + "type": "agents", + "id": "0fb30ad0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:23.517Z", + "version": "WzM5LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (12)'] = { + "results": { + "type": "agents", + "id": "104d4f00-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:24.528Z", + "version": "WzQwLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (13)'] = { + "results": { + "type": "agents", + "id": "10eb3cb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:25.563Z", + "version": "WzQxLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (14)'] = { + "results": { + "type": "agents", + "id": "11888e20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:26.594Z", + "version": "WzQyLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (15)'] = { + "results": { + "type": "agents", + "id": "12240ad0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:27.613Z", + "version": "WzQzLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (16)'] = { + "results": { + "type": "agents", + "id": "12be9d20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:28.626Z", + "version": "WzQ0LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (17)'] = { + "results": { + "type": "agents", + "id": "13595680-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:29.639Z", + "version": "WzQ1LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (18)'] = { + "results": { + "type": "agents", + "id": "13f436f0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:30.655Z", + "version": "WzQ2LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (19)'] = { + "results": { + "type": "agents", + "id": "148e2d00-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:31.664Z", + "version": "WzQ3LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (20)'] = { + "results": { + "type": "agents", + "id": "152b5760-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:32.694Z", + "version": "WzQ4LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (21)'] = { + "results": { + "type": "agents", + "id": "15c4b130-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:33.699Z", + "version": "WzQ5LDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (22)'] = { + "results": { + "type": "agents", + "id": "166202a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:51:13.162Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:34.730Z", + "version": "WzUwLDFd" + } +} + +exports['AgentsRepository list should list all active agents - create:agents (23)'] = { + "results": { + "type": "agents", + "id": "16fc46d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:51:13.161Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:35.741Z", + "version": "WzUxLDFd" + } +} + +exports['AgentsRepository list should list all active agents - find:"agents" (24)'] = { + "results": { + "page": 1, + "per_page": 100, + "total": 21, + "saved_objects": [ + { + "type": "agents", + "id": "152b5760-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:32.694Z", + "version": "WzQ4LDFd" + }, + { + "type": "agents", + "id": "148e2d00-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:31.664Z", + "version": "WzQ3LDFd" + }, + { + "type": "agents", + "id": "13f436f0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:30.655Z", + "version": "WzQ2LDFd" + }, + { + "type": "agents", + "id": "13595680-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:29.639Z", + "version": "WzQ1LDFd" + }, + { + "type": "agents", + "id": "12be9d20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:28.626Z", + "version": "WzQ0LDFd" + }, + { + "type": "agents", + "id": "12240ad0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:27.613Z", + "version": "WzQzLDFd" + }, + { + "type": "agents", + "id": "11888e20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:26.594Z", + "version": "WzQyLDFd" + }, + { + "type": "agents", + "id": "10eb3cb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:25.563Z", + "version": "WzQxLDFd" + }, + { + "type": "agents", + "id": "104d4f00-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:24.528Z", + "version": "WzQwLDFd" + }, + { + "type": "agents", + "id": "0fb30ad0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:23.517Z", + "version": "WzM5LDFd" + }, + { + "type": "agents", + "id": "0f180350-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:22.500Z", + "version": "WzM4LDFd" + }, + { + "type": "agents", + "id": "0e7cadb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:21.483Z", + "version": "WzM3LDFd" + }, + { + "type": "agents", + "id": "0de13100-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:20.464Z", + "version": "WzM2LDFd" + }, + { + "type": "agents", + "id": "0d469eb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:19.451Z", + "version": "WzM1LDFd" + }, + { + "type": "agents", + "id": "0cabbe40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:18.436Z", + "version": "WzM0LDFd" + }, + { + "type": "agents", + "id": "0c11ef40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:17.427Z", + "version": "WzMzLDFd" + }, + { + "type": "agents", + "id": "0b756120-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:16.402Z", + "version": "WzMyLDFd" + }, + { + "type": "agents", + "id": "0abbae10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:15.185Z", + "version": "WzMxLDFd" + }, + { + "type": "agents", + "id": "0a1dc060-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:14.150Z", + "version": "WzMwLDFd" + }, + { + "type": "agents", + "id": "09874cc0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:13.164Z", + "version": "WzI5LDFd" + }, + { + "type": "agents", + "id": "16fc46d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:51:13.161Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:35.741Z", + "version": "WzUxLDFd" + } + ] + } +} + +exports['AgentsRepository list should list all active agents - find:"agents" (25)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 23, + "saved_objects": [ + { + "type": "agents", + "id": "09874cc0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:13.164Z", + "version": "WzI5LDFd" + }, + { + "type": "agents", + "id": "0a1dc060-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:14.150Z", + "version": "WzMwLDFd" + }, + { + "type": "agents", + "id": "0fb30ad0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:23.517Z", + "version": "WzM5LDFd" + }, + { + "type": "agents", + "id": "0de13100-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:20.464Z", + "version": "WzM2LDFd" + }, + { + "type": "agents", + "id": "0e7cadb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:21.483Z", + "version": "WzM3LDFd" + }, + { + "type": "agents", + "id": "0f180350-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:22.500Z", + "version": "WzM4LDFd" + }, + { + "type": "agents", + "id": "0d469eb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:19.451Z", + "version": "WzM1LDFd" + }, + { + "type": "agents", + "id": "0abbae10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:15.185Z", + "version": "WzMxLDFd" + }, + { + "type": "agents", + "id": "0b756120-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:16.402Z", + "version": "WzMyLDFd" + }, + { + "type": "agents", + "id": "0c11ef40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:17.427Z", + "version": "WzMzLDFd" + }, + { + "type": "agents", + "id": "0cabbe40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:18.436Z", + "version": "WzM0LDFd" + }, + { + "type": "agents", + "id": "10eb3cb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:25.563Z", + "version": "WzQxLDFd" + }, + { + "type": "agents", + "id": "11888e20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:26.594Z", + "version": "WzQyLDFd" + }, + { + "type": "agents", + "id": "12240ad0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:27.613Z", + "version": "WzQzLDFd" + }, + { + "type": "agents", + "id": "12be9d20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:28.626Z", + "version": "WzQ0LDFd" + }, + { + "type": "agents", + "id": "13595680-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:29.639Z", + "version": "WzQ1LDFd" + }, + { + "type": "agents", + "id": "13f436f0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:30.655Z", + "version": "WzQ2LDFd" + }, + { + "type": "agents", + "id": "148e2d00-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:31.664Z", + "version": "WzQ3LDFd" + }, + { + "type": "agents", + "id": "152b5760-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:32.694Z", + "version": "WzQ4LDFd" + }, + { + "type": "agents", + "id": "104d4f00-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:24.528Z", + "version": "WzQwLDFd" + }, + { + "type": "agents", + "id": "15c4b130-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:33.699Z", + "version": "WzQ5LDFd" + }, + { + "type": "agents", + "id": "166202a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:51:13.162Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:34.730Z", + "version": "WzUwLDFd" + }, + { + "type": "agents", + "id": "16fc46d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:51:13.161Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:51:35.741Z", + "version": "WzUxLDFd" + } + ] + } +} + +exports['AgentsRepository list should list all active agents - delete (26)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (27)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (28)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (29)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (30)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (31)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (32)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (33)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (34)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (35)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (36)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (37)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (38)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (39)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (40)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (41)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (42)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (43)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (44)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (45)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (46)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (47)'] = { + "results": {} +} + +exports['AgentsRepository list should list all active agents - delete (48)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "25885630-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:00.147Z", + "version": "Wzc1LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "262113c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:01.148Z", + "version": "Wzc2LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "26d91920-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:02.354Z", + "version": "Wzc3LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "27758030-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:03.379Z", + "version": "Wzc4LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (5)'] = { + "results": { + "type": "agents", + "id": "281b5d20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:04.466Z", + "version": "Wzc5LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (6)'] = { + "results": { + "type": "agents", + "id": "28b4b6f0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:05.471Z", + "version": "WzgwLDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (7)'] = { + "results": { + "type": "agents", + "id": "294f9760-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:06.486Z", + "version": "WzgxLDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (8)'] = { + "results": { + "type": "agents", + "id": "29e9b480-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:07.496Z", + "version": "WzgyLDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (9)'] = { + "results": { + "type": "agents", + "id": "2a846de0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:08.510Z", + "version": "WzgzLDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (10)'] = { + "results": { + "type": "agents", + "id": "2b1dc7b0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:09.515Z", + "version": "Wzg0LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (11)'] = { + "results": { + "type": "agents", + "id": "2bb76fa0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:10.522Z", + "version": "Wzg1LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (12)'] = { + "results": { + "type": "agents", + "id": "2c53afa0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:11.546Z", + "version": "Wzg2LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (13)'] = { + "results": { + "type": "agents", + "id": "2ced7ea0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:12.554Z", + "version": "Wzg3LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (14)'] = { + "results": { + "type": "agents", + "id": "2d88d440-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:13.571Z", + "version": "Wzg4LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (15)'] = { + "results": { + "type": "agents", + "id": "2e22f160-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:14.582Z", + "version": "Wzg5LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (16)'] = { + "results": { + "type": "agents", + "id": "2ebce770-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:15.591Z", + "version": "WzkwLDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (17)'] = { + "results": { + "type": "agents", + "id": "2f5779c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:16.604Z", + "version": "WzkxLDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (18)'] = { + "results": { + "type": "agents", + "id": "2ff56770-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:17.639Z", + "version": "WzkyLDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (19)'] = { + "results": { + "type": "agents", + "id": "308faba0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:18.650Z", + "version": "WzkzLDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (20)'] = { + "results": { + "type": "agents", + "id": "312a3df0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:19.663Z", + "version": "Wzk0LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (21)'] = { + "results": { + "type": "agents", + "id": "31c6a500-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:20.688Z", + "version": "Wzk1LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (22)'] = { + "results": { + "type": "agents", + "id": "32609b10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:52:00.144Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:21.697Z", + "version": "Wzk2LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - create:agents (23)'] = { + "results": { + "type": "agents", + "id": "32fc17c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:52:00.144Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:22.716Z", + "version": "Wzk3LDFd" + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - find:"agents" (24)'] = { + "results": { + "page": 1, + "per_page": 100, + "total": 23, + "saved_objects": [ + { + "type": "agents", + "id": "31c6a500-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:20.688Z", + "version": "Wzk1LDFd" + }, + { + "type": "agents", + "id": "312a3df0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:19.663Z", + "version": "Wzk0LDFd" + }, + { + "type": "agents", + "id": "308faba0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:18.650Z", + "version": "WzkzLDFd" + }, + { + "type": "agents", + "id": "2ff56770-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:17.639Z", + "version": "WzkyLDFd" + }, + { + "type": "agents", + "id": "2f5779c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:16.604Z", + "version": "WzkxLDFd" + }, + { + "type": "agents", + "id": "2ebce770-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:15.591Z", + "version": "WzkwLDFd" + }, + { + "type": "agents", + "id": "2e22f160-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:14.582Z", + "version": "Wzg5LDFd" + }, + { + "type": "agents", + "id": "2d88d440-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:13.571Z", + "version": "Wzg4LDFd" + }, + { + "type": "agents", + "id": "2ced7ea0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:12.554Z", + "version": "Wzg3LDFd" + }, + { + "type": "agents", + "id": "2c53afa0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:11.546Z", + "version": "Wzg2LDFd" + }, + { + "type": "agents", + "id": "2bb76fa0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:10.522Z", + "version": "Wzg1LDFd" + }, + { + "type": "agents", + "id": "2b1dc7b0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:09.515Z", + "version": "Wzg0LDFd" + }, + { + "type": "agents", + "id": "2a846de0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:08.510Z", + "version": "WzgzLDFd" + }, + { + "type": "agents", + "id": "29e9b480-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:07.496Z", + "version": "WzgyLDFd" + }, + { + "type": "agents", + "id": "294f9760-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:06.486Z", + "version": "WzgxLDFd" + }, + { + "type": "agents", + "id": "28b4b6f0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:05.471Z", + "version": "WzgwLDFd" + }, + { + "type": "agents", + "id": "281b5d20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:04.466Z", + "version": "Wzc5LDFd" + }, + { + "type": "agents", + "id": "27758030-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:03.379Z", + "version": "Wzc4LDFd" + }, + { + "type": "agents", + "id": "26d91920-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:02.354Z", + "version": "Wzc3LDFd" + }, + { + "type": "agents", + "id": "262113c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:01.148Z", + "version": "Wzc2LDFd" + }, + { + "type": "agents", + "id": "25885630-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:00.147Z", + "version": "Wzc1LDFd" + }, + { + "type": "agents", + "id": "32609b10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:52:00.144Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:21.697Z", + "version": "Wzk2LDFd" + }, + { + "type": "agents", + "id": "32fc17c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:52:00.144Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:22.716Z", + "version": "Wzk3LDFd" + } + ] + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - find:"agents" (25)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 23, + "saved_objects": [ + { + "type": "agents", + "id": "25885630-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:00.147Z", + "version": "Wzc1LDFd" + }, + { + "type": "agents", + "id": "26d91920-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:02.354Z", + "version": "Wzc3LDFd" + }, + { + "type": "agents", + "id": "27758030-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:03.379Z", + "version": "Wzc4LDFd" + }, + { + "type": "agents", + "id": "281b5d20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:04.466Z", + "version": "Wzc5LDFd" + }, + { + "type": "agents", + "id": "28b4b6f0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:05.471Z", + "version": "WzgwLDFd" + }, + { + "type": "agents", + "id": "29e9b480-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:07.496Z", + "version": "WzgyLDFd" + }, + { + "type": "agents", + "id": "2a846de0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:08.510Z", + "version": "WzgzLDFd" + }, + { + "type": "agents", + "id": "2b1dc7b0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:09.515Z", + "version": "Wzg0LDFd" + }, + { + "type": "agents", + "id": "262113c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:01.148Z", + "version": "Wzc2LDFd" + }, + { + "type": "agents", + "id": "294f9760-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:06.486Z", + "version": "WzgxLDFd" + }, + { + "type": "agents", + "id": "2bb76fa0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:10.522Z", + "version": "Wzg1LDFd" + }, + { + "type": "agents", + "id": "2ced7ea0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:12.554Z", + "version": "Wzg3LDFd" + }, + { + "type": "agents", + "id": "2d88d440-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:13.571Z", + "version": "Wzg4LDFd" + }, + { + "type": "agents", + "id": "2ebce770-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:15.591Z", + "version": "WzkwLDFd" + }, + { + "type": "agents", + "id": "2f5779c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:16.604Z", + "version": "WzkxLDFd" + }, + { + "type": "agents", + "id": "2ff56770-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:17.639Z", + "version": "WzkyLDFd" + }, + { + "type": "agents", + "id": "308faba0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:18.650Z", + "version": "WzkzLDFd" + }, + { + "type": "agents", + "id": "2c53afa0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:11.546Z", + "version": "Wzg2LDFd" + }, + { + "type": "agents", + "id": "2e22f160-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:14.582Z", + "version": "Wzg5LDFd" + }, + { + "type": "agents", + "id": "312a3df0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:19.663Z", + "version": "Wzk0LDFd" + }, + { + "type": "agents", + "id": "31c6a500-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:20.688Z", + "version": "Wzk1LDFd" + }, + { + "type": "agents", + "id": "32609b10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:52:00.144Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:21.697Z", + "version": "Wzk2LDFd" + }, + { + "type": "agents", + "id": "32fc17c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:52:00.144Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:22.716Z", + "version": "Wzk3LDFd" + } + ] + } +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (26)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (27)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (28)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (29)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (30)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (31)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (32)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (33)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (34)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (35)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (36)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (37)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (38)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (39)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (40)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (41)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (42)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (43)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (44)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (45)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (46)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (47)'] = { + "results": {} +} + +exports['AgentsRepository list should list all agents with showInactive set to true - delete (48)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "41856800-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:47.104Z", + "version": "WzEyMSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "422132d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:48.125Z", + "version": "WzEyMiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "42bbc520-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:49.137Z", + "version": "WzEyMywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "4356a590-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:50.153Z", + "version": "WzEyNCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (5)'] = { + "results": { + "type": "agents", + "id": "43f22240-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:51.172Z", + "version": "WzEyNSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (6)'] = { + "results": { + "type": "agents", + "id": "44a8ef20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:52.370Z", + "version": "WzEyNiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (7)'] = { + "results": { + "type": "agents", + "id": "45441db0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:53.387Z", + "version": "WzEyNywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (8)'] = { + "results": { + "type": "agents", + "id": "45e76290-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:54.457Z", + "version": "WzEyOCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (9)'] = { + "results": { + "type": "agents", + "id": "46821bf0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:55.471Z", + "version": "WzEyOSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (10)'] = { + "results": { + "type": "agents", + "id": "471f6d60-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:56.502Z", + "version": "WzEzMCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (11)'] = { + "results": { + "type": "agents", + "id": "47baea10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:57.521Z", + "version": "WzEzMSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (12)'] = { + "results": { + "type": "agents", + "id": "48552e40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:58.532Z", + "version": "WzEzMiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (13)'] = { + "results": { + "type": "agents", + "id": "48f16e40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:59.556Z", + "version": "WzEzMywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (14)'] = { + "results": { + "type": "agents", + "id": "498a04c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:00.556Z", + "version": "WzEzNCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (15)'] = { + "results": { + "type": "agents", + "id": "4a249710-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:01.569Z", + "version": "WzEzNSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (16)'] = { + "results": { + "type": "agents", + "id": "4abd54a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:02.570Z", + "version": "WzEzNiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (17)'] = { + "results": { + "type": "agents", + "id": "4b5a09d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:03.597Z", + "version": "WzEzNywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (18)'] = { + "results": { + "type": "agents", + "id": "4bf3ffe0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:04.606Z", + "version": "WzEzOCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (19)'] = { + "results": { + "type": "agents", + "id": "4c8e6b20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:05.618Z", + "version": "WzEzOSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (20)'] = { + "results": { + "type": "agents", + "id": "4d2aab20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:06.642Z", + "version": "WzE0MCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (21)'] = { + "results": { + "type": "agents", + "id": "4dc51660-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:07.654Z", + "version": "WzE0MSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (22)'] = { + "results": { + "type": "agents", + "id": "4e5fcfc0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:52:47.100Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:08.668Z", + "version": "WzE0MiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - create:agents (23)'] = { + "results": { + "type": "agents", + "id": "4efa8920-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:52:47.100Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:09.681Z", + "version": "WzE0MywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - find:"agents" (24)'] = { + "results": { + "page": 1, + "per_page": 3, + "total": 21, + "saved_objects": [ + { + "type": "agents", + "id": "4efa8920-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:52:47.100Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:09.681Z", + "version": "WzE0MywxXQ==" + }, + { + "type": "agents", + "id": "41856800-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:47.104Z", + "version": "WzEyMSwxXQ==" + }, + { + "type": "agents", + "id": "422132d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:48.125Z", + "version": "WzEyMiwxXQ==" + } + ] + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - find:"agents" (25)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 23, + "saved_objects": [ + { + "type": "agents", + "id": "41856800-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:47.104Z", + "version": "WzEyMSwxXQ==" + }, + { + "type": "agents", + "id": "42bbc520-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:49.137Z", + "version": "WzEyMywxXQ==" + }, + { + "type": "agents", + "id": "4356a590-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:50.153Z", + "version": "WzEyNCwxXQ==" + }, + { + "type": "agents", + "id": "43f22240-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:51.172Z", + "version": "WzEyNSwxXQ==" + }, + { + "type": "agents", + "id": "44a8ef20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:52.370Z", + "version": "WzEyNiwxXQ==" + }, + { + "type": "agents", + "id": "45e76290-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:54.457Z", + "version": "WzEyOCwxXQ==" + }, + { + "type": "agents", + "id": "46821bf0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:55.471Z", + "version": "WzEyOSwxXQ==" + }, + { + "type": "agents", + "id": "422132d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:48.125Z", + "version": "WzEyMiwxXQ==" + }, + { + "type": "agents", + "id": "45441db0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:53.387Z", + "version": "WzEyNywxXQ==" + }, + { + "type": "agents", + "id": "47baea10-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:57.521Z", + "version": "WzEzMSwxXQ==" + }, + { + "type": "agents", + "id": "48f16e40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:59.556Z", + "version": "WzEzMywxXQ==" + }, + { + "type": "agents", + "id": "498a04c0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:00.556Z", + "version": "WzEzNCwxXQ==" + }, + { + "type": "agents", + "id": "4a249710-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:01.569Z", + "version": "WzEzNSwxXQ==" + }, + { + "type": "agents", + "id": "4abd54a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:02.570Z", + "version": "WzEzNiwxXQ==" + }, + { + "type": "agents", + "id": "4b5a09d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:03.597Z", + "version": "WzEzNywxXQ==" + }, + { + "type": "agents", + "id": "4bf3ffe0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:04.606Z", + "version": "WzEzOCwxXQ==" + }, + { + "type": "agents", + "id": "48552e40-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:58.532Z", + "version": "WzEzMiwxXQ==" + }, + { + "type": "agents", + "id": "471f6d60-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:52:56.502Z", + "version": "WzEzMCwxXQ==" + }, + { + "type": "agents", + "id": "4c8e6b20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:05.618Z", + "version": "WzEzOSwxXQ==" + }, + { + "type": "agents", + "id": "4d2aab20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:06.642Z", + "version": "WzE0MCwxXQ==" + }, + { + "type": "agents", + "id": "4dc51660-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:07.654Z", + "version": "WzE0MSwxXQ==" + }, + { + "type": "agents", + "id": "4e5fcfc0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:52:47.100Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:08.668Z", + "version": "WzE0MiwxXQ==" + }, + { + "type": "agents", + "id": "4efa8920-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:52:47.100Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:09.681Z", + "version": "WzE0MywxXQ==" + } + ] + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (26)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (27)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (28)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (29)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (30)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (31)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (32)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (33)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (34)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (35)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (36)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (37)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (38)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (39)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (40)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (41)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (42)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (43)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (44)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (45)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (46)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (47)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date ASC - delete (48)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "5d7f4580-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:34.040Z", + "version": "WzE2NywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "5e1a25f0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:35.055Z", + "version": "WzE2OCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "5eb55480-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:36.072Z", + "version": "WzE2OSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (4)'] = { + "results": { + "type": "agents", + "id": "5f4fbfc0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:37.084Z", + "version": "WzE3MCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (5)'] = { + "results": { + "type": "agents", + "id": "5fe9b5d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:38.093Z", + "version": "WzE3MSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (6)'] = { + "results": { + "type": "agents", + "id": "6085a7b0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:39.115Z", + "version": "WzE3MiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (7)'] = { + "results": { + "type": "agents", + "id": "611f2890-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:40.121Z", + "version": "WzE3MywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (8)'] = { + "results": { + "type": "agents", + "id": "61ba0900-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:41.136Z", + "version": "WzE3NCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (9)'] = { + "results": { + "type": "agents", + "id": "625362d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:42.141Z", + "version": "WzE3NSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (10)'] = { + "results": { + "type": "agents", + "id": "62f15080-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:43.176Z", + "version": "WzE3NiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (11)'] = { + "results": { + "type": "agents", + "id": "63a7a830-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:44.371Z", + "version": "WzE3NywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (12)'] = { + "results": { + "type": "agents", + "id": "644288a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:45.386Z", + "version": "WzE3OCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (13)'] = { + "results": { + "type": "agents", + "id": "64e6b7e0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:46.462Z", + "version": "WzE3OSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (14)'] = { + "results": { + "type": "agents", + "id": "6582d0d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:47.485Z", + "version": "WzE4MCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (15)'] = { + "results": { + "type": "agents", + "id": "661d1500-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:48.496Z", + "version": "WzE4MSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (16)'] = { + "results": { + "type": "agents", + "id": "66b7ce60-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:49.510Z", + "version": "WzE4MiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (17)'] = { + "results": { + "type": "agents", + "id": "6752aed0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:50.525Z", + "version": "WzE4MywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (18)'] = { + "results": { + "type": "agents", + "id": "67ed6830-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:51.538Z", + "version": "WzE4NCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (19)'] = { + "results": { + "type": "agents", + "id": "688848a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:52.554Z", + "version": "WzE4NSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (20)'] = { + "results": { + "type": "agents", + "id": "69230200-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:53.568Z", + "version": "WzE4NiwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (21)'] = { + "results": { + "type": "agents", + "id": "69bbbf90-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:54.569Z", + "version": "WzE4NywxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (22)'] = { + "results": { + "type": "agents", + "id": "6a57ff90-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:53:34.035Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:55.593Z", + "version": "WzE4OCwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - create:agents (23)'] = { + "results": { + "type": "agents", + "id": "6af15960-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:53:34.035Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:56.597Z", + "version": "WzE4OSwxXQ==" + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - find:"agents" (24)'] = { + "results": { + "page": 1, + "per_page": 3, + "total": 21, + "saved_objects": [ + { + "type": "agents", + "id": "69230200-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:53.568Z", + "version": "WzE4NiwxXQ==" + }, + { + "type": "agents", + "id": "688848a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:52.554Z", + "version": "WzE4NSwxXQ==" + }, + { + "type": "agents", + "id": "67ed6830-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:51.538Z", + "version": "WzE4NCwxXQ==" + } + ] + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - find:"agents" (25)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 23, + "saved_objects": [ + { + "type": "agents", + "id": "5d7f4580-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent0", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-07T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:34.040Z", + "version": "WzE2NywxXQ==" + }, + { + "type": "agents", + "id": "5eb55480-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-09T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:36.072Z", + "version": "WzE2OSwxXQ==" + }, + { + "type": "agents", + "id": "5f4fbfc0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-10T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:37.084Z", + "version": "WzE3MCwxXQ==" + }, + { + "type": "agents", + "id": "5fe9b5d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent4", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-11T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:38.093Z", + "version": "WzE3MSwxXQ==" + }, + { + "type": "agents", + "id": "6085a7b0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent5", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-12T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:39.115Z", + "version": "WzE3MiwxXQ==" + }, + { + "type": "agents", + "id": "61ba0900-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent7", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-14T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:41.136Z", + "version": "WzE3NCwxXQ==" + }, + { + "type": "agents", + "id": "5e1a25f0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-08T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:35.055Z", + "version": "WzE2OCwxXQ==" + }, + { + "type": "agents", + "id": "611f2890-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent6", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-13T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:40.121Z", + "version": "WzE3MywxXQ==" + }, + { + "type": "agents", + "id": "63a7a830-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent10", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-17T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:44.371Z", + "version": "WzE3NywxXQ==" + }, + { + "type": "agents", + "id": "64e6b7e0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent12", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-19T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:46.462Z", + "version": "WzE3OSwxXQ==" + }, + { + "type": "agents", + "id": "6582d0d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent13", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-20T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:47.485Z", + "version": "WzE4MCwxXQ==" + }, + { + "type": "agents", + "id": "661d1500-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent14", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-21T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:48.496Z", + "version": "WzE4MSwxXQ==" + }, + { + "type": "agents", + "id": "66b7ce60-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent15", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-22T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:49.510Z", + "version": "WzE4MiwxXQ==" + }, + { + "type": "agents", + "id": "6752aed0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent16", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-23T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:50.525Z", + "version": "WzE4MywxXQ==" + }, + { + "type": "agents", + "id": "644288a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent11", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-18T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:45.386Z", + "version": "WzE3OCwxXQ==" + }, + { + "type": "agents", + "id": "625362d0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent8", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-15T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:42.141Z", + "version": "WzE3NSwxXQ==" + }, + { + "type": "agents", + "id": "62f15080-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent9", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-16T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:43.176Z", + "version": "WzE3NiwxXQ==" + }, + { + "type": "agents", + "id": "67ed6830-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent17", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-24T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:51.538Z", + "version": "WzE4NCwxXQ==" + }, + { + "type": "agents", + "id": "688848a0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent18", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-25T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:52.554Z", + "version": "WzE4NSwxXQ==" + }, + { + "type": "agents", + "id": "69230200-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent19", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-26T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:53.568Z", + "version": "WzE4NiwxXQ==" + }, + { + "type": "agents", + "id": "69bbbf90-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-11-13T20:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:54.569Z", + "version": "WzE4NywxXQ==" + }, + { + "type": "agents", + "id": "6a57ff90-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "inactive_agent_2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-11T14:53:34.035Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:55.593Z", + "version": "WzE4OCwxXQ==" + }, + { + "type": "agents", + "id": "6af15960-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "ephemeral1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "last_checkin": "2019-11-13T14:53:34.035Z", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:53:56.597Z", + "version": "WzE4OSwxXQ==" + } + ] + } +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (26)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (27)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (28)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (29)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (30)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (31)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (32)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (33)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (34)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (35)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (36)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (37)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (38)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (39)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (40)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (41)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (42)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (43)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (44)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (45)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (46)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (47)'] = { + "results": {} +} + +exports['AgentsRepository list should support to sort by enrolled_at date DESC - delete (48)'] = { + "results": {} +} + +exports['AgentsRepository list for policy should allow to list agents for a policy - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "79797120-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy-id-1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:20.978Z", + "version": "WzIxMywxXQ==" + } +} + +exports['AgentsRepository list for policy should allow to list agents for a policy - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "7a142a80-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy-id-1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:21.992Z", + "version": "WzIxNCwxXQ==" + } +} + +exports['AgentsRepository list for policy should allow to list agents for a policy - create:agents (3)'] = { + "results": { + "type": "agents", + "id": "7aae6eb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy-id-2", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:23.003Z", + "version": "WzIxNSwxXQ==" + } +} + +exports['AgentsRepository list for policy should allow to list agents for a policy - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 2, + "saved_objects": [ + { + "type": "agents", + "id": "79797120-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy-id-1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:20.978Z", + "version": "WzIxMywxXQ==" + }, + { + "type": "agents", + "id": "7a142a80-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy-id-1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:21.992Z", + "version": "WzIxNCwxXQ==" + } + ] + } +} + +exports['AgentsRepository list for policy should allow to list agents for a policy - find:"agents" (5)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 3, + "saved_objects": [ + { + "type": "agents", + "id": "79797120-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy-id-1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:20.978Z", + "version": "WzIxMywxXQ==" + }, + { + "type": "agents", + "id": "7a142a80-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy-id-1", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:21.992Z", + "version": "WzIxNCwxXQ==" + }, + { + "type": "agents", + "id": "7aae6eb0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent3", + "active": true, + "access_api_key_id": "api_key_1", + "policy_id": "policy-id-2", + "type": "PERMANENT", + "version": "1", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:23.003Z", + "version": "WzIxNSwxXQ==" + } + ] + } +} + +exports['AgentsRepository list for policy should allow to list agents for a policy - delete (6)'] = { + "results": {} +} + +exports['AgentsRepository list for policy should allow to list agents for a policy - delete (7)'] = { + "results": {} +} + +exports['AgentsRepository list for policy should allow to list agents for a policy - delete (8)'] = { + "results": {} +} + +exports['AgentsRepository findByMetadata should allow to find agents by local metadata - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "7d192d20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:27.058Z", + "version": "WzIxOSwxXQ==" + } +} + +exports['AgentsRepository findByMetadata should allow to find agents by local metadata - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "7db1eab0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"elastic.co\"}", + "user_provided_metadata": "{\"color\":\"blue\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:28.059Z", + "version": "WzIyMCwxXQ==" + } +} + +exports['AgentsRepository findByMetadata should allow to find agents by local metadata - find:"agents" (3)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "7db1eab0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"elastic.co\"}", + "user_provided_metadata": "{\"color\":\"blue\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:28.059Z", + "version": "WzIyMCwxXQ==" + } + ] + } +} + +exports['AgentsRepository findByMetadata should allow to find agents by local metadata - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 2, + "saved_objects": [ + { + "type": "agents", + "id": "7d192d20-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:27.058Z", + "version": "WzIxOSwxXQ==" + }, + { + "type": "agents", + "id": "7db1eab0-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"elastic.co\"}", + "user_provided_metadata": "{\"color\":\"blue\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:28.059Z", + "version": "WzIyMCwxXQ==" + } + ] + } +} + +exports['AgentsRepository findByMetadata should allow to find agents by local metadata - delete (5)'] = { + "results": {} +} + +exports['AgentsRepository findByMetadata should allow to find agents by local metadata - delete (6)'] = { + "results": {} +} + +exports['AgentsRepository findByMetadata should allow to find agents by user provided metadata - create:agents (1)'] = { + "results": { + "type": "agents", + "id": "7f857230-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:31.123Z", + "version": "WzIyMywxXQ==" + } +} + +exports['AgentsRepository findByMetadata should allow to find agents by user provided metadata - create:agents (2)'] = { + "results": { + "type": "agents", + "id": "801d9380-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"elastic.co\"}", + "user_provided_metadata": "{\"color\":\"blue\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:32.120Z", + "version": "WzIyNCwxXQ==" + } +} + +exports['AgentsRepository findByMetadata should allow to find agents by user provided metadata - find:"agents" (3)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "agents", + "id": "7f857230-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:31.123Z", + "version": "WzIyMywxXQ==" + } + ] + } +} + +exports['AgentsRepository findByMetadata should allow to find agents by user provided metadata - find:"agents" (4)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 2, + "saved_objects": [ + { + "type": "agents", + "id": "7f857230-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent1", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"test.fr\"}", + "user_provided_metadata": "{\"color\":\"red\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:31.123Z", + "version": "WzIyMywxXQ==" + }, + { + "type": "agents", + "id": "801d9380-0625-11ea-bdb3-e10a3f6667b0", + "attributes": { + "shared_id": "agent2", + "active": false, + "access_api_key_id": "api_key_1", + "policy_id": "policy_id_1", + "type": "EPHEMERAL", + "version": "1", + "local_metadata": "{\"host\":\"elastic.co\"}", + "user_provided_metadata": "{\"color\":\"blue\"}", + "enrolled_at": "2019-08-05T19:35:14.861Z" + }, + "references": [], + "updated_at": "2019-11-13T14:54:32.120Z", + "version": "WzIyNCwxXQ==" + } + ] + } +} + +exports['AgentsRepository findByMetadata should allow to find agents by user provided metadata - delete (5)'] = { + "results": {} +} + +exports['AgentsRepository findByMetadata should allow to find agents by user provided metadata - delete (6)'] = { + "results": {} +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/agents/default.contract.test.ts b/x-pack/legacy/plugins/fleet/server/repositories/agents/default.contract.test.ts new file mode 100644 index 0000000000000..7e58643b60929 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/agents/default.contract.test.ts @@ -0,0 +1,485 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import moment from 'moment'; +import { SavedObject } from 'src/core/server'; +import { AgentsRepository } from './default'; +import { SODatabaseAdapter as SODatabaseAdapterType } from '../../adapters/saved_objects_database/adapter_types'; +import { SODatabaseAdapter } from '../../adapters/saved_objects_database/default'; +import { MemorizeSODatabaseAdapter } from '../../adapters/saved_objects_database/memorize_adapter'; +import { Agent, SortOptions } from './types'; +import { FrameworkUser, internalAuthData } from '../../adapters/framework/adapter_types'; + +describe('AgentsRepository', () => { + let adapter: AgentsRepository; + let soAdapter: SODatabaseAdapterType; + let servers: any; + + function getUser(): FrameworkUser { + return ({ + kind: 'authenticated', + [internalAuthData]: { + authorization: `Basic ${Buffer.from(`elastic:changeme`).toString('base64')}`, + }, + } as unknown) as FrameworkUser; + } + + async function loadFixtures(agents: any[]): Promise { + const res: SavedObject[] = []; + for (const agent of agents) { + res.push( + await soAdapter.create(getUser(), 'agents', { + ...agent, + local_metadata: JSON.stringify(agent.local_metadata || {}), + user_provided_metadata: JSON.stringify(agent.user_provided_metadata || {}), + }) + ); + } + + return res; + } + + async function clearFixtures() { + const request = getUser(); + const { saved_objects: savedObjects } = await soAdapter.find(request, { + type: 'agents', + perPage: 1000, + }); + for (const so of savedObjects) { + await soAdapter.delete(request, 'agents', so.id); + } + } + + beforeAll(async () => { + await Slapshot.callWhenOnline(async () => { + const { createKibanaServer } = await import( + '../../../../../../test_utils/jest/contract_tests/servers' + ); + servers = await createKibanaServer({ + security: { enabled: false }, + }); + const baseAdapter = new SODatabaseAdapter( + servers.kbnServer.savedObjects, + servers.kbnServer.plugins.elasticsearch + ); + soAdapter = new MemorizeSODatabaseAdapter(baseAdapter); + }); + + if (!soAdapter) { + soAdapter = new MemorizeSODatabaseAdapter(); + } + adapter = new AgentsRepository(soAdapter); + }); + + afterAll(async () => { + if (servers) { + await servers.shutdown; + } + }); + + afterEach(clearFixtures); + + describe('create', () => { + it('should create a new agent', async () => { + const agent = await adapter.create(getUser(), { + shared_id: 'agent1', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'localhost', + }, + user_provided_metadata: undefined, + enrolled_at: '2019-08-05T19:35:14.861Z', + }); + + expect(agent).toBeDefined(); + expect(agent.id).toBeDefined(); + expect(agent).toMatchObject({ + shared_id: 'agent1', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'localhost', + }, + }); + }); + + it('should create a new agent with the specified id if specified', async () => { + const agent = await adapter.create( + getUser(), + { + shared_id: 'agent1', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'localhost', + }, + user_provided_metadata: undefined, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + { + id: 'test-agent-id-1', + } + ); + + expect(agent).toBeDefined(); + expect(agent.id).toBe('test-agent-id-1'); + }); + + it('should allow to create a new agent with the same id two time if override is true', async () => { + const agent1 = await adapter.create( + getUser(), + { + shared_id: 'agent1', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'localhost', + }, + user_provided_metadata: undefined, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + { + id: 'test-agent-id-2', + } + ); + const agent2 = await adapter.create( + getUser(), + { + shared_id: 'agent1', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'localhost', + }, + user_provided_metadata: undefined, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + { + id: 'test-agent-id-2', + overwrite: true, + } + ); + + expect(agent1.id).toBe(agent2.id); + }); + }); + + describe('update', () => { + let agentId: string; + beforeAll(async () => { + const agents = await loadFixtures([ + { + shared_id: 'agent1', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'localhost', + }, + user_provided_metadata: undefined, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + ]); + + agentId = agents[0].id; + }); + it('should allow to update an agent', async () => { + await adapter.update(getUser(), agentId, { + active: true, + }); + + const freshAgent = await adapter.getById(getUser(), agentId); + expect(freshAgent).toBeDefined(); + expect(freshAgent).toMatchObject({ + shared_id: 'agent1', + active: true, + }); + }); + }); + + describe('delete', () => { + let agentId: string; + beforeAll(async () => { + const agents = await loadFixtures([ + { + shared_id: 'agent1', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'localhost', + }, + user_provided_metadata: undefined, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + ]); + agentId = agents[0].id; + }); + + it('should delete an agent', async () => { + await adapter.delete(getUser(), { id: agentId } as Agent); + + const freshAgent = await adapter.getById(getUser(), agentId); + + expect(freshAgent).toBeNull(); + }); + }); + + describe('list', () => { + beforeEach(async () => { + const permanentAgents = Array(20) + .fill(null) + .map((_, idx) => { + return { + shared_id: `agent${idx}`, + active: true, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'PERMANENT', + version: '1', + local_metadata: { + host: 'test.fr', + }, + user_provided_metadata: { + color: 'red', + }, + enrolled_at: moment('2019-08-05T19:35:14.861Z') + .add(idx + 2, 'day') + .toISOString(), + }; + }); + const ephemeralAgents = [ + { + shared_id: `ephemeral1`, + active: true, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'test.fr', + }, + user_provided_metadata: { + color: 'red', + }, + last_checkin: moment().toISOString(), + enrolled_at: moment('2019-08-05T19:35:14.861Z').toISOString(), + }, + ]; + + const inactiveAgents = [ + // Inactive besace active:false + { + shared_id: `inactive_agent_1`, + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'PERMANENT', + version: '1', + local_metadata: { + host: 'test.fr', + }, + user_provided_metadata: { + color: 'red', + }, + enrolled_at: moment('2019-08-05T19:35:14.861Z') + .add(100, 'day') + .toISOString(), + }, + // Inactive because ephemeral and last_checkin is after 3 polling times + { + shared_id: `inactive_agent_2`, + active: true, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'test.fr', + }, + user_provided_metadata: { + color: 'red', + }, + last_checkin: moment() + .subtract(2, 'day') + .toISOString(), + enrolled_at: moment('2019-08-05T19:35:14.861Z').toISOString(), + }, + ]; + + await loadFixtures(permanentAgents.concat(inactiveAgents, ephemeralAgents)); + }); + + it('should list all active agents', async () => { + const res = await adapter.list(getUser(), { page: 1, perPage: 100 }); + const agentIds = res.agents.map(a => a.shared_id as string); + expect(res.total).toBe(21); + + expect(agentIds).not.toContain('inactive_agent_1'); + expect(agentIds).not.toContain('inactive_agent_2'); + }); + + it('should list all agents with showInactive set to true', async () => { + const res = await adapter.list(getUser(), { page: 1, perPage: 100, showInactive: true }); + const agentIds = res.agents.map(a => a.shared_id as string); + expect(res.total).toBe(23); + + expect(agentIds).toContain('inactive_agent_1'); + expect(agentIds).toContain('inactive_agent_2'); + }); + + it('should support to sort by enrolled_at date ASC', async () => { + const res = await adapter.list(getUser(), { + sortOptions: SortOptions.EnrolledAtASC, + page: 1, + perPage: 3, + }); + + expect(res.agents.map(a => a.shared_id)).toEqual(['ephemeral1', 'agent0', 'agent1']); + }); + + it('should support to sort by enrolled_at date DESC', async () => { + const res = await adapter.list(getUser(), { + sortOptions: SortOptions.EnrolledAtDESC, + page: 1, + perPage: 3, + }); + + expect(res.agents.map(a => a.shared_id)).toEqual(['agent19', 'agent18', 'agent17']); + }); + }); + + describe('list for policy', () => { + beforeEach(async () => { + await loadFixtures([ + // Policy 1 + { + shared_id: `agent1`, + active: true, + access_api_key_id: 'api_key_1', + policy_id: 'policy-id-1', + type: 'PERMANENT', + version: '1', + local_metadata: {}, + user_provided_metadata: {}, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + { + shared_id: `agent2`, + active: true, + access_api_key_id: 'api_key_1', + policy_id: 'policy-id-1', + type: 'PERMANENT', + version: '1', + local_metadata: {}, + user_provided_metadata: {}, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + // Policy 2 + { + shared_id: `agent3`, + active: true, + access_api_key_id: 'api_key_1', + policy_id: 'policy-id-2', + type: 'PERMANENT', + version: '1', + local_metadata: {}, + user_provided_metadata: {}, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + ]); + }); + + it('should allow to list agents for a policy', async () => { + const { total, agents } = await adapter.listForPolicy(getUser(), 'policy-id-1'); + const agentSharedIds = agents.map(a => a.shared_id); + + expect(total).toBe(2); + expect(agentSharedIds).toContain('agent1'); + expect(agentSharedIds).toContain('agent2'); + }); + }); + + describe('findByMetadata', () => { + beforeEach(async () => { + await loadFixtures([ + { + shared_id: 'agent1', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'test.fr', + }, + user_provided_metadata: { + color: 'red', + }, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + { + shared_id: 'agent2', + active: false, + access_api_key_id: 'api_key_1', + policy_id: 'policy_id_1', + type: 'EPHEMERAL', + version: '1', + local_metadata: { + host: 'elastic.co', + }, + user_provided_metadata: { + color: 'blue', + }, + enrolled_at: '2019-08-05T19:35:14.861Z', + }, + ]); + }); + + it('should allow to find agents by local metadata', async () => { + const agentsFound = await adapter.findByMetadata(getUser(), { + local: { + host: 'elastic.co', + }, + }); + + expect(agentsFound).toHaveLength(1); + expect(agentsFound[0].shared_id).toBe('agent2'); + }); + + it('should allow to find agents by user provided metadata', async () => { + const agentsFound = await adapter.findByMetadata(getUser(), { + userProvided: { + color: 'red', + }, + }); + + expect(agentsFound).toHaveLength(1); + expect(agentsFound[0].shared_id).toBe('agent1'); + }); + }); +}); diff --git a/x-pack/legacy/plugins/fleet/server/repositories/agents/default.ts b/x-pack/legacy/plugins/fleet/server/repositories/agents/default.ts new file mode 100644 index 0000000000000..3d5a75b408951 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/agents/default.ts @@ -0,0 +1,265 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { isEqual } from 'lodash'; +import { SavedObject } from 'src/core/server'; +import { + Agent, + NewAgent, + AgentsRepository as AgentsRepositoryType, + SortOptions, + SavedObjectAgentAttributes, + ListOptions, +} from './types'; +import { + DEFAULT_AGENTS_PAGE_SIZE, + AGENT_POLLING_THRESHOLD_MS, + AGENT_TYPE_EPHEMERAL, +} from '../../../common/constants'; +import { SODatabaseAdapter } from '../../adapters/saved_objects_database/adapter_types'; +import { FrameworkUser } from '../../adapters/framework/adapter_types'; + +export class AgentsRepository implements AgentsRepositoryType { + constructor(private readonly soAdapter: SODatabaseAdapter) {} + + /** + * Create a new saved object agent + * @param agent + */ + public async create( + user: FrameworkUser, + agent: NewAgent, + options?: { id?: string; overwrite?: boolean } + ): Promise { + const so = await this.soAdapter.create( + user, + 'agents', + { + ...agent, + local_metadata: JSON.stringify(agent.local_metadata || {}), + user_provided_metadata: JSON.stringify(agent.user_provided_metadata || {}), + actions: [], + }, + options + ); + + return this._savedObjectToAgent({ + ...so, + attributes: { + id: so.id, + ...so.attributes, + }, + }); + } + + /** + * Delete an agent saved object + * @param agent + */ + public async delete(user: FrameworkUser, agent: Agent) { + await this.soAdapter.delete(user, 'agents', agent.id); + } + + /** + * Get an agent by ES id + * @param agent + */ + public async getById(user: FrameworkUser, id: string): Promise { + const response = await this.soAdapter.get(user, 'agents', id); + if (!response) { + return null; + } + + return this._savedObjectToAgent(response); + } + + public async getByAccessApiKeyId(user: FrameworkUser, apiKeyId: string): Promise { + const response = await this.soAdapter.find(user, { + type: 'agents', + searchFields: ['access_api_key_id'], + search: apiKeyId, + }); + + const agents = response.saved_objects.map(this._savedObjectToAgent); + + if (agents.length > 0) { + return agents[0]; + } + + return null; + } + + /** + * Get an agent by ES shared_id + * @param agent + */ + public async getBySharedId(user: FrameworkUser, sharedId: string): Promise { + const response = await this.soAdapter.find(user, { + type: 'agents', + searchFields: ['shared_id'], + search: sharedId, + }); + + const agents = response.saved_objects.map(this._savedObjectToAgent); + + if (agents.length > 0) { + return agents[0]; + } + + return null; + } + + /** + * Update an agent + * + * @param id + * @param newData + */ + public async update(user: FrameworkUser, id: string, newData: Partial) { + const { local_metadata, user_provided_metadata, ...data } = newData; + const updateData: Partial = { ...data }; + + if (newData.local_metadata) { + updateData.local_metadata = JSON.stringify(newData.local_metadata); + } + if (newData.user_provided_metadata) { + updateData.user_provided_metadata = JSON.stringify(newData.user_provided_metadata); + } + + const { error } = await this.soAdapter.update(user, 'agents', id, updateData); + + if (error) { + throw new Error(error.message); + } + } + + /** + * Find an agent by metadata + * @param metadata + * @param providedMetadata + */ + public async findByMetadata( + user: FrameworkUser, + metadata: { local?: any; userProvided?: any } + ): Promise { + const search = [] + .concat(Object.values(metadata.local || {}), Object.values(metadata.userProvided || {})) + .join(' '); + + // neet to play with saved object to know what it's possible to do here + const res = await this.soAdapter.find(user, { + type: 'agents', + search, + }); + + return res.saved_objects.map(this._savedObjectToAgent).filter(agent => { + return metadata.local + ? isEqual(metadata.local, agent.local_metadata) + : true && metadata.userProvided + ? isEqual(metadata.userProvided, agent.user_provided_metadata) + : true; + }); + } + + /** + * List agents + */ + public async list( + user: FrameworkUser, + options: ListOptions = {} + ): Promise<{ agents: Agent[]; total: number; page: number; perPage: number }> { + const { + page = 1, + perPage = DEFAULT_AGENTS_PAGE_SIZE, + kuery, + showInactive = false, + sortOptions = SortOptions.EnrolledAtDESC, + } = options; + + const filters = []; + + if (kuery && kuery !== '') { + filters.push(kuery.replace(/agents\./g, 'agents.attributes.')); + } + + if (showInactive === false) { + const agentActiveCondition = `agents.attributes.active:true AND not agents.attributes.type:${AGENT_TYPE_EPHEMERAL}`; + const recentlySeenEphemeralAgent = `agents.attributes.active:true AND agents.attributes.type:${AGENT_TYPE_EPHEMERAL} AND agents.attributes.last_checkin > ${Date.now() - + 3 * AGENT_POLLING_THRESHOLD_MS}`; + filters.push(`(${agentActiveCondition}) OR (${recentlySeenEphemeralAgent})`); + } + + const { saved_objects, total } = await this.soAdapter.find(user, { + type: 'agents', + page, + perPage, + filter: _joinFilters(filters), + ...this._getSortFields(sortOptions), + }); + + const agents: Agent[] = saved_objects.map(this._savedObjectToAgent); + + return { + agents, + total, + page, + perPage, + }; + } + + public async listForPolicy( + user: FrameworkUser, + policyId: string, + options: ListOptions = {} + ): Promise<{ agents: Agent[]; total: number; page: number; perPage: number }> { + return await this.list(user, { + ...options, + kuery: `(agents.policy_id:"${policyId}")${ + options.kuery && options.kuery !== '' ? ` AND (${options.kuery})` : '' + }`, + }); + } + + private _savedObjectToAgent(so: SavedObject): Agent { + if (so.error) { + throw new Error(so.error.message); + } + + return { + id: so.id, + ...so.attributes, + local_metadata: JSON.parse(so.attributes.local_metadata), + user_provided_metadata: JSON.parse(so.attributes.user_provided_metadata), + }; + } + + private _getSortFields(sortOption?: SortOptions) { + switch (sortOption) { + case SortOptions.EnrolledAtASC: + return { + sortField: 'enrolled_at', + sortOrder: 'ASC', + }; + case SortOptions.EnrolledAtDESC: + return { + sortField: 'enrolled_at', + sortOrder: 'DESC', + }; + default: + return {}; + } + } +} + +function _joinFilters(filters: string[], operator = 'AND') { + return filters.reduce((acc: string | undefined, filter) => { + if (acc) { + return `${acc} ${operator} (${filter})`; + } + + return `(${filter})`; + }, undefined); +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/agents/types.ts b/x-pack/legacy/plugins/fleet/server/repositories/agents/types.ts new file mode 100644 index 0000000000000..c6541681a50e6 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/agents/types.ts @@ -0,0 +1,159 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as t from 'io-ts'; +import { + AGENT_TYPE_EPHEMERAL, + AGENT_TYPE_PERMANENT, + AGENT_TYPE_TEMPORARY, +} from '../../../common/constants'; +import { FrameworkUser } from '../../adapters/framework/adapter_types'; + +export const RuntimeAgentType = t.union([ + t.literal(AGENT_TYPE_PERMANENT), + t.literal(AGENT_TYPE_EPHEMERAL), + t.literal(AGENT_TYPE_TEMPORARY), +]); + +const RuntimeAgentActionType = t.union([ + t.literal('DATA_DUMP'), + t.literal('RESUME'), + t.literal('PAUSE'), + t.literal('UNENROLL'), +]); + +export type AgentActionType = t.TypeOf; + +export const RuntimeAgentActionData = t.interface( + { + type: RuntimeAgentActionType, + }, + 'AgentActionData' +); + +export const RuntimeAgentAction = t.intersection([ + RuntimeAgentActionData, + t.interface( + { + id: t.string, + created_at: t.string, + }, + 'AgentAction' + ), + t.partial({ + data: t.string, + sent_at: t.string, + }), +]); + +export type AgentType = t.TypeOf; + +const newAgentProperties = { + type: RuntimeAgentType, + active: t.boolean, +}; + +const newAgentOptionalProperties = t.partial({ + parent_id: t.string, + version: t.string, + enrolled_at: t.string, + user_provided_metadata: t.dictionary(t.string, t.string), + local_metadata: t.dictionary(t.string, t.string), + shared_id: t.string, + access_api_key_id: t.string, + access_api_key: t.string, + policy_id: t.string, +}); + +export const NewRuntimeAgent = t.intersection([ + t.interface(newAgentProperties), + newAgentOptionalProperties, +]); + +export const RuntimeAgent = t.intersection([ + t.interface({ + ...newAgentProperties, + id: t.string, + actions: t.array(RuntimeAgentAction), + }), + t.partial({ + last_updated: t.string, + last_checkin: t.string, + }), + newAgentOptionalProperties, +]); + +export const RuntimeSavedObjectAgentAttributes = t.intersection([ + t.partial({ + shared_id: t.string, + access_api_key_id: t.string, + last_updated: t.string, + last_checkin: t.string, + parent_id: t.string, + version: t.string, + enrolled_at: t.string, + }), + t.interface({ + ...newAgentProperties, + id: t.string, + user_provided_metadata: t.string, + local_metadata: t.string, + actions: t.array(RuntimeAgentAction), + }), +]); + +export type SavedObjectAgentAttributes = t.TypeOf; +export type Agent = t.TypeOf; +export type NewAgent = t.TypeOf; + +export type AgentAction = t.TypeOf; + +export enum SortOptions { + EnrolledAtASC, + EnrolledAtDESC, +} + +export interface ListOptions { + showInactive?: boolean; + sortOptions?: SortOptions; + kuery?: string; + page?: number; + perPage?: number; +} + +export interface AgentsRepository { + create( + user: FrameworkUser, + agent: NewAgent, + options?: { id?: string; overwrite?: boolean } + ): Promise; + + delete(user: FrameworkUser, agent: Agent): Promise; + + getByAccessApiKeyId(user: FrameworkUser, apiKeyid: string): Promise; + + getById(user: FrameworkUser, id: string): Promise; + + getBySharedId(user: FrameworkUser, sharedId: string): Promise; + + update(user: FrameworkUser, id: string, newData: Partial): Promise; + + findByMetadata( + user: FrameworkUser, + metadata: { local?: any; userProvided?: any } + ): Promise; + + list( + user: FrameworkUser, + options?: ListOptions + ): Promise<{ agents: Agent[]; total: number; page: number; perPage: number }>; + + listForPolicy( + user: FrameworkUser, + policyId: string, + options?: ListOptions + ): Promise<{ agents: Agent[]; total: number; page: number; perPage: number }>; +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/artifacts/file_system.ts b/x-pack/legacy/plugins/fleet/server/repositories/artifacts/file_system.ts new file mode 100644 index 0000000000000..0ebd2a185031e --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/artifacts/file_system.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import fs from 'fs'; +import { promisify } from 'util'; +import path from 'path'; +import { ArtifactsRepository } from './types'; + +const existsAsync = promisify(fs.exists); +const unlinkAsync = promisify(fs.unlink); +const mkdirAsync = promisify(fs.mkdir); + +/** + * File system artifact store + */ +export class FileSystemArtifactRepository implements ArtifactsRepository { + constructor(private readonly cacheDirectory: string) {} + public async has(key: string): Promise { + return await existsAsync(this.getPathForKey(key)); + } + + public getCacheStream(key: string) { + return fs.createReadStream(this.getPathForKey(key)); + } + + public async setCacheStream(key: string) { + const filePath = this.getPathForKey(key); + await mkdirAsync(path.dirname(filePath), { + recursive: true, + }); + return fs.createWriteStream(filePath); + } + + public async deleteCache(key: string) { + return unlinkAsync(this.getPathForKey(key)); + } + + private getPathForKey(key: string) { + const filePath = path.normalize(path.join(this.cacheDirectory, key)); + if (!filePath.startsWith(this.cacheDirectory)) { + throw new Error('Path for this file is outside cache directory'); + } + return filePath; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/artifacts/in_memory.ts b/x-pack/legacy/plugins/fleet/server/repositories/artifacts/in_memory.ts new file mode 100644 index 0000000000000..e504a86b5bdc5 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/artifacts/in_memory.ts @@ -0,0 +1,48 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Writable, Duplex } from 'stream'; +import { ArtifactsRepository } from './types'; + +/** + * In memory store for artifacts, !For tests purpose only! + */ +export class InMemoryArtifactRepository implements ArtifactsRepository { + public cache: { [k: string]: Buffer } = {}; + + public async has(key: string): Promise { + return !!this.cache[key]; + } + + public getCacheStream(key: string) { + const stream = new Duplex(); + stream.push(this.cache[key]); + stream.push(null); + return stream; + } + + public async setCacheStream(key: string) { + let acc: Buffer; + return new Writable({ + write: (chunk, encoding, callback) => { + if (!acc) { + acc = chunk; + } else { + acc = Buffer.concat([acc, chunk]); + } + callback(); + }, + final: callback => { + this.cache[key] = acc; + callback(); + }, + }); + } + + public async deleteCache(key: string) { + delete this.cache[key]; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/artifacts/types.ts b/x-pack/legacy/plugins/fleet/server/repositories/artifacts/types.ts new file mode 100644 index 0000000000000..6a7c89cdcba0b --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/artifacts/types.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export interface ArtifactsRepository { + has(key: string): Promise; + getCacheStream(key: string): NodeJS.ReadableStream; + setCacheStream(key: string): Promise; + deleteCache(key: string): Promise; +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/__memorize_snapshots__/default.contract.test.slap_snap b/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/__memorize_snapshots__/default.contract.test.slap_snap new file mode 100644 index 0000000000000..c5a3dcd3cd17e --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/__memorize_snapshots__/default.contract.test.slap_snap @@ -0,0 +1,338 @@ + +exports['Enrollment api key Repository create allow to create an enrollment api key - create:enrollment_api_keys (1)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "35ee683c-3364-4727-932f-69cc4c3936b1", + "attributes": { + "created_at": "2019-11-13T14:50:40.104Z", + "api_key_id": "key-id-123", + "policy_id": "policyId", + "active": true, + "enrollment_rules": [] + }, + "references": [], + "updated_at": "2019-11-13T14:50:40.128Z", + "version": "WzIsMV0=" + } +} + +exports['Enrollment api key Repository create allow to create an enrollment api key - get:enrollment_api_keys (2)'] = { + "results": { + "id": "35ee683c-3364-4727-932f-69cc4c3936b1", + "type": "enrollment_api_keys", + "updated_at": "2019-11-13T14:50:40.128Z", + "version": "WzIsMV0=", + "attributes": { + "created_at": "2019-11-13T14:50:40.104Z", + "api_key_id": "key-id-123", + "policy_id": "policyId", + "active": true, + "enrollment_rules": [] + }, + "references": [] + } +} + +exports['Enrollment api key Repository create allow to create an enrollment api key - find:"enrollment_api_keys" (3)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "35ee683c-3364-4727-932f-69cc4c3936b1", + "attributes": { + "created_at": "2019-11-13T14:50:40.104Z", + "api_key_id": "key-id-123", + "policy_id": "policyId", + "active": true, + "enrollment_rules": [] + }, + "references": [], + "updated_at": "2019-11-13T14:50:40.128Z", + "version": "WzIsMV0=" + } + ] + } +} + +exports['Enrollment api key Repository create allow to create an enrollment api key - delete (4)'] = { + "results": {} +} + +exports['Enrollment api key Repository update allow to update a key - create:enrollment_api_keys (1)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "74d24a9f-78f9-49d0-9bfb-fcb235c33469", + "attributes": { + "active": true, + "policy_id": "policyId" + }, + "references": [], + "updated_at": "2019-11-13T14:50:41.723Z", + "version": "WzQsMV0=" + } +} + +exports['Enrollment api key Repository update allow to update a key - update:enrollment_api_keys (2)'] = { + "results": { + "id": "74d24a9f-78f9-49d0-9bfb-fcb235c33469", + "type": "enrollment_api_keys", + "updated_at": "2019-11-13T14:50:42.735Z", + "version": "WzUsMV0=", + "attributes": { + "active": false + } + } +} + +exports['Enrollment api key Repository update allow to update a key - get:enrollment_api_keys (3)'] = { + "results": { + "id": "74d24a9f-78f9-49d0-9bfb-fcb235c33469", + "type": "enrollment_api_keys", + "updated_at": "2019-11-13T14:50:42.735Z", + "version": "WzUsMV0=", + "attributes": { + "active": false, + "policy_id": "policyId" + }, + "references": [] + } +} + +exports['Enrollment api key Repository update allow to update a key - find:"enrollment_api_keys" (4)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 1, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "74d24a9f-78f9-49d0-9bfb-fcb235c33469", + "attributes": { + "active": false, + "policy_id": "policyId" + }, + "references": [], + "updated_at": "2019-11-13T14:50:42.735Z", + "version": "WzUsMV0=" + } + ] + } +} + +exports['Enrollment api key Repository update allow to update a key - delete (5)'] = { + "results": {} +} + +exports['Enrollment api key Repository getByApiKeyId allow to find a key - create:enrollment_api_keys (1)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "14be4e73-de40-4098-8025-242d6c10001d", + "attributes": { + "active": true, + "api_key_id": "api-key-1" + }, + "references": [], + "updated_at": "2019-11-13T14:50:44.764Z", + "version": "WzcsMV0=" + } +} + +exports['Enrollment api key Repository getByApiKeyId allow to find a key - create:enrollment_api_keys (2)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "14df091e-5c35-4522-bceb-da050432ec56", + "attributes": { + "active": true, + "api_key_id": "api-key-2" + }, + "references": [], + "updated_at": "2019-11-13T14:50:44.765Z", + "version": "WzgsMV0=" + } +} + +exports['Enrollment api key Repository getByApiKeyId allow to find a key - find:"enrollment_api_keys" (3)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 1, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "14df091e-5c35-4522-bceb-da050432ec56", + "attributes": { + "active": true, + "api_key_id": "api-key-2" + }, + "references": [], + "updated_at": "2019-11-13T14:50:44.765Z", + "version": "WzgsMV0=" + } + ] + } +} + +exports['Enrollment api key Repository getByApiKeyId allow to find a key - getDecryptedAsInternalUser:enrollment_api_keys:14df091e-5c35-4522-bceb-da050432ec56 (4)'] = { + "results": { + "id": "14df091e-5c35-4522-bceb-da050432ec56", + "type": "enrollment_api_keys", + "updated_at": "2019-11-13T14:50:44.765Z", + "version": "WzgsMV0=", + "attributes": { + "active": true, + "api_key_id": "api-key-2" + }, + "references": [] + } +} + +exports['Enrollment api key Repository getByApiKeyId allow to find a key - find:"enrollment_api_keys" (5)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 2, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "14be4e73-de40-4098-8025-242d6c10001d", + "attributes": { + "active": true, + "api_key_id": "api-key-1" + }, + "references": [], + "updated_at": "2019-11-13T14:50:44.764Z", + "version": "WzcsMV0=" + }, + { + "type": "enrollment_api_keys", + "id": "14df091e-5c35-4522-bceb-da050432ec56", + "attributes": { + "active": true, + "api_key_id": "api-key-2" + }, + "references": [], + "updated_at": "2019-11-13T14:50:44.765Z", + "version": "WzgsMV0=" + } + ] + } +} + +exports['Enrollment api key Repository getByApiKeyId allow to find a key - delete (6)'] = { + "results": {} +} + +exports['Enrollment api key Repository getByApiKeyId allow to find a key - delete (7)'] = { + "results": {} +} + +exports['Enrollment api key Repository getByApiKeyId return null if the key does not exists - create:enrollment_api_keys (1)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "c8ee74f7-f0ec-4086-85e3-db386515a5ee", + "attributes": { + "active": true, + "api_key_id": "api-key-1" + }, + "references": [], + "updated_at": "2019-11-13T14:50:47.813Z", + "version": "WzExLDFd" + } +} + +exports['Enrollment api key Repository getByApiKeyId return null if the key does not exists - create:enrollment_api_keys (2)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "44b848c9-785f-4107-a5fa-1186af23746c", + "attributes": { + "active": true, + "api_key_id": "api-key-2" + }, + "references": [], + "updated_at": "2019-11-13T14:50:47.813Z", + "version": "WzEyLDFd" + } +} + +exports['Enrollment api key Repository getByApiKeyId return null if the key does not exists - find:"enrollment_api_keys" (3)'] = { + "results": { + "page": 1, + "per_page": 20, + "total": 0, + "saved_objects": [] + } +} + +exports['Enrollment api key Repository getByApiKeyId return null if the key does not exists - find:"enrollment_api_keys" (4)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 2, + "saved_objects": [ + { + "type": "enrollment_api_keys", + "id": "c8ee74f7-f0ec-4086-85e3-db386515a5ee", + "attributes": { + "active": true, + "api_key_id": "api-key-1" + }, + "references": [], + "updated_at": "2019-11-13T14:50:47.813Z", + "version": "WzExLDFd" + }, + { + "type": "enrollment_api_keys", + "id": "44b848c9-785f-4107-a5fa-1186af23746c", + "attributes": { + "active": true, + "api_key_id": "api-key-2" + }, + "references": [], + "updated_at": "2019-11-13T14:50:47.813Z", + "version": "WzEyLDFd" + } + ] + } +} + +exports['Enrollment api key Repository getByApiKeyId return null if the key does not exists - delete (5)'] = { + "results": {} +} + +exports['Enrollment api key Repository getByApiKeyId return null if the key does not exists - delete (6)'] = { + "results": {} +} + +exports['Enrollment api key Repository delete allow to delete a enrollmentApiKey - create:enrollment_api_keys (1)'] = { + "results": { + "type": "enrollment_api_keys", + "id": "11206128-6a69-45a2-bc01-4dc2d27a0ca0", + "attributes": { + "active": true, + "api_key_id": "qwerty" + }, + "references": [], + "updated_at": "2019-11-13T14:50:50.881Z", + "version": "WzE1LDFd" + } +} + +exports['Enrollment api key Repository delete allow to delete a enrollmentApiKey - delete (2)'] = { + "results": {} +} + +exports['Enrollment api key Repository delete allow to delete a enrollmentApiKey - get:enrollment_api_keys (3)'] = { + "results": null +} + +exports['Enrollment api key Repository delete allow to delete a enrollmentApiKey - find:"enrollment_api_keys" (4)'] = { + "results": { + "page": 1, + "per_page": 1000, + "total": 0, + "saved_objects": [] + } +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/default.contract.test.ts b/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/default.contract.test.ts new file mode 100644 index 0000000000000..349d18b57b10a --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/default.contract.test.ts @@ -0,0 +1,200 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Slapshot from '@mattapperson/slapshot'; +import { SavedObject } from 'src/core/server'; +import { EnrollmentApiKeysRepository } from './default'; +import { SODatabaseAdapter as SODatabaseAdapterType } from '../../adapters/saved_objects_database/adapter_types'; +import { SODatabaseAdapter } from '../../adapters/saved_objects_database/default'; +import { MemorizeSODatabaseAdapter } from '../../adapters/saved_objects_database/memorize_adapter'; +import { EnrollmentApiKey, SAVED_OBJECT_TYPE } from './types'; +import { EncryptedSavedObjects } from '../../adapters/encrypted_saved_objects/default'; +import { MemorizeEncryptedSavedObjects } from '../../adapters/encrypted_saved_objects/memorize_adapter'; +import { FrameworkUser, internalAuthData } from '../../adapters/framework/adapter_types'; + +describe('Enrollment api key Repository', () => { + let adapter: EnrollmentApiKeysRepository; + let soAdapter: SODatabaseAdapterType; + let encryptedSavedObject: EncryptedSavedObjects; + let servers: any; + + async function loadFixtures(keys: Array>): Promise { + return await Promise.all(keys.map(key => soAdapter.create(getUser(), SAVED_OBJECT_TYPE, key))); + } + + async function clearFixtures() { + const user = getUser(); + const { saved_objects: savedObjects } = await soAdapter.find(user, { + type: SAVED_OBJECT_TYPE, + perPage: 1000, + }); + for (const so of savedObjects) { + await soAdapter.delete(user, SAVED_OBJECT_TYPE, so.id); + } + } + + function getUser(): FrameworkUser { + return ({ + kind: 'authenticated', + [internalAuthData]: { + authorization: `Basic ${Buffer.from(`elastic:changeme`).toString('base64')}`, + }, + } as unknown) as FrameworkUser; + } + + beforeAll(async () => { + await Slapshot.callWhenOnline(async () => { + const { createKibanaServer } = await import( + '../../../../../../test_utils/jest/contract_tests/servers' + ); + servers = await createKibanaServer({ + security: { enabled: false }, + }); + const baseAdapter = new SODatabaseAdapter( + servers.kbnServer.savedObjects, + servers.kbnServer.plugins.elasticsearch + ); + soAdapter = new MemorizeSODatabaseAdapter(baseAdapter); + + const baseEncyrptedSOAdapter = new EncryptedSavedObjects( + servers.kbnServer.newPlatform.start.plugins.encryptedSavedObjects + ); + + encryptedSavedObject = (new MemorizeEncryptedSavedObjects( + baseEncyrptedSOAdapter + ) as unknown) as EncryptedSavedObjects; + }); + + if (!soAdapter) { + soAdapter = new MemorizeSODatabaseAdapter(); + } + if (!encryptedSavedObject) { + encryptedSavedObject = (new MemorizeEncryptedSavedObjects() as unknown) as EncryptedSavedObjects; + } + adapter = new EnrollmentApiKeysRepository(soAdapter, encryptedSavedObject); + }); + + afterAll(async () => { + if (servers) { + await servers.shutdown; + } + }); + + afterEach(clearFixtures); + + describe('create', () => { + it('allow to create an enrollment api key', async () => { + const user = getUser(); + const enrollmentApiKey = await adapter.create(user, { + active: true, + apiKey: 'notencryptedkey', + apiKeyId: 'key-id-123', + policyId: 'policyId', + }); + const savedEnrollmentApiKey = (await soAdapter.get( + user, + SAVED_OBJECT_TYPE, + enrollmentApiKey.id + )) as SavedObject; + expect(savedEnrollmentApiKey).toBeDefined(); + expect(enrollmentApiKey.id).toBeDefined(); + + expect(savedEnrollmentApiKey.attributes.apiKey !== 'notencryptedkey').toBe(true); + + expect(savedEnrollmentApiKey.attributes).toMatchObject({ + active: true, + policy_id: 'policyId', + api_key_id: 'key-id-123', + }); + }); + }); + + describe('update', () => { + let enrollmentApiKeyId: string; + beforeEach(async () => { + const keys = await loadFixtures([ + { + active: true, + api_key: 'qwerty', + policy_id: 'policyId', + }, + ]); + + enrollmentApiKeyId = keys[0].id; + }); + + it('allow to update a key', async () => { + const user = getUser(); + await adapter.update(user, enrollmentApiKeyId, { + active: false, + api_key: 'notencryptedapikey', + }); + + const soEnrollmentKey = (await soAdapter.get( + user, + SAVED_OBJECT_TYPE, + enrollmentApiKeyId + )) as SavedObject; + expect(soEnrollmentKey.attributes.api_key !== 'notencryptedapikey').toBe(true); + expect(soEnrollmentKey.attributes).toMatchObject({ + active: false, + }); + }); + }); + + describe('getByApiKeyId', () => { + beforeEach(async () => { + await loadFixtures([ + { + active: true, + api_key_id: 'api-key-1', + }, + { + active: true, + api_key_id: 'api-key-2', + }, + ]); + }); + + it('allow to find a key', async () => { + const user = getUser(); + const enrollmentApiKey = await adapter.getByApiKeyId(user, 'api-key-2'); + expect(enrollmentApiKey).toBeDefined(); + expect((enrollmentApiKey as EnrollmentApiKey).api_key_id).toBe('api-key-2'); + }); + + it('return null if the key does not exists', async () => { + const user = getUser(); + const enrollmentApiKey = await adapter.getByApiKeyId(user, 'idonotexists'); + expect(enrollmentApiKey).toBeNull(); + }); + }); + + describe('delete', () => { + let enrollmentApiKeyId: string; + beforeEach(async () => { + const keys = await loadFixtures([ + { + active: true, + api_key_id: 'qwerty', + }, + ]); + + enrollmentApiKeyId = keys[0].id; + }); + + it('allow to delete a enrollmentApiKey', async () => { + const user = getUser(); + await adapter.delete(user, enrollmentApiKeyId); + const soEnrollmentApiKey = await soAdapter.get( + user, + SAVED_OBJECT_TYPE, + enrollmentApiKeyId + ); + expect(soEnrollmentApiKey).toBeNull(); + }); + }); +}); diff --git a/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/default.ts b/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/default.ts new file mode 100644 index 0000000000000..7c429c4e7f6f3 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/default.ts @@ -0,0 +1,159 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import moment from 'moment'; +import { SavedObject } from 'src/core/server'; +import { SODatabaseAdapter } from '../../adapters/saved_objects_database/adapter_types'; +import { + EnrollmentApiKey, + EnrollmentApiKeysRepository as EnrollmentApiKeysRepositoryType, + SAVED_OBJECT_TYPE, +} from './types'; +import { EncryptedSavedObjects } from '../../adapters/encrypted_saved_objects/adapter_types'; +import { FrameworkUser } from '../../adapters/framework/adapter_types'; + +function getFirstOrNull(list: T[]): T | null { + return list.length > 0 ? list[0] : null; +} + +/** + * EnrollmentApiKey repository that persist keys using saved objects + */ +export class EnrollmentApiKeysRepository implements EnrollmentApiKeysRepositoryType { + constructor( + private readonly soAdapter: SODatabaseAdapter, + private readonly encryptedSavedObject: EncryptedSavedObjects + ) {} + + public async list( + user: FrameworkUser, + options: { + page?: number; + perPage?: number; + kuery?: string; + showInactive?: boolean; + } + ): Promise<{ items: EnrollmentApiKey[]; total: any; page: any; perPage: any }> { + const { page = 1, perPage = 20, kuery } = options; + + const { saved_objects, total } = await this.soAdapter.find(user, { + type: SAVED_OBJECT_TYPE, + page, + perPage, + filter: + kuery && kuery !== '' + ? kuery.replace(/enrollment_api_keys\./g, 'enrollment_api_keys.attributes.') + : undefined, + }); + + const items = saved_objects.map(this._savedObjectToEnrollmentApiKey); + + return { + items, + total, + page, + perPage, + }; + } + + public async create( + user: FrameworkUser, + { + apiKeyId, + apiKey, + active, + policyId, + expire_at, + name, + }: { + apiKeyId: string; + apiKey: string; + active: boolean; + expire_at?: string; + policyId?: string; + name?: string; + } + ): Promise { + if (user.kind !== 'authenticated') { + throw new Error('Only authenticated user can create enrollment api keys.'); + } + const so = await this.soAdapter.create(user, SAVED_OBJECT_TYPE, { + created_at: moment().toISOString(), + api_key: apiKey, + api_key_id: apiKeyId, + policy_id: policyId, + expire_at, + active, + enrollment_rules: [], + name, + }); + + return { + id: so.id, + ...so.attributes, + api_key: apiKey, + }; + } + + public async getByApiKeyId( + user: FrameworkUser, + apiKeyId: string + ): Promise { + const res = await this.soAdapter.find(user, { + type: SAVED_OBJECT_TYPE, + searchFields: ['api_key_id'], + search: apiKeyId, + }); + + const keys = res.saved_objects.map(this._savedObjectToEnrollmentApiKey); + const key = getFirstOrNull(keys); + return key ? await this._getDecrypted(key.id) : null; + } + + public async getById(user: FrameworkUser, id: string): Promise { + return await this._getDecrypted(id); + } + + public async update( + user: FrameworkUser, + id: string, + newData: Partial + ): Promise { + if (user.kind !== 'authenticated') { + throw new Error('Only authenticated can update enrollment api keys'); + } + const { error } = await this.soAdapter.update(user, SAVED_OBJECT_TYPE, id, newData); + + if (error) { + throw new Error(error.message); + } + } + + public async delete(user: FrameworkUser, id: string): Promise { + await this.soAdapter.delete(user, SAVED_OBJECT_TYPE, id); + } + + private async _getDecrypted(id: string) { + return this._savedObjectToEnrollmentApiKey( + await this.encryptedSavedObject.getDecryptedAsInternalUser(SAVED_OBJECT_TYPE, id) + ); + } + + private _savedObjectToEnrollmentApiKey({ + error, + attributes, + id, + }: SavedObject): EnrollmentApiKey { + if (error) { + throw new Error(error.message); + } + + return { + id, + ...attributes, + }; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/types.ts b/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/types.ts new file mode 100644 index 0000000000000..6564cf064d942 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/enrollment_api_keys/types.ts @@ -0,0 +1,110 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as t from 'io-ts'; +import { FrameworkUser } from '../../adapters/framework/adapter_types'; +import { RuntimeAgentType } from '../agents/types'; + +export const SAVED_OBJECT_TYPE = 'enrollment_api_keys'; + +export const RuntimeEnrollmentRuleData = t.partial( + { + ip_ranges: t.array(t.string), + window_duration: t.interface( + { + from: t.string, + to: t.string, + }, + 'WindowDuration' + ), + types: t.array(RuntimeAgentType), + }, + 'EnrollmentRuleData' +); + +export type EnrollmentRuleData = t.TypeOf; + +export type EnrollmentRule = EnrollmentRuleData & { + id: string; + created_at: string; + updated_at?: string; +}; + +export type EnrollmentApiKeyVerificationResponse = + | { + valid: true; + enrollmentApiKey: EnrollmentApiKey; + } + | { + valid: false; + reason: string; + }; + +export type AccessApiKeyVerificationResponse = + | { + valid: true; + accessApiKeyId: string; + } + | { + valid: false; + reason: string; + }; + +export interface EnrollmentApiKey { + id: string; + api_key_id: string; + api_key: string; + name?: string; + created_at: string; + expire_at?: string; + active: boolean; + enrollment_rules: EnrollmentRule[]; + policy_id?: string; + [k: string]: any; // allow to use it as saved object attributes type +} + +export interface EnrollmentApiKeysRepository { + list( + user: FrameworkUser, + options: { + page?: number; + perPage?: number; + kuery?: string; + showInactive?: boolean; + } + ): Promise<{ items: EnrollmentApiKey[]; total: any; page: any; perPage: any }>; + create( + user: FrameworkUser, + data: { + apiKeyId: string; + apiKey: string; + active: boolean; + expire_at?: string; + policyId?: string; + name?: string; + } + ): Promise; + + /** + * Get a key for a given Id. + */ + getById(user: FrameworkUser, id: string): Promise; + + /** + * Get a key for a given apiKey Id. + */ + getByApiKeyId(user: FrameworkUser, apiKeyId: string): Promise; + + /** + * Update an apiKey + */ + update(user: FrameworkUser, id: string, newData: Partial): Promise; + + /** + * Delete an apiKey + */ + delete(user: FrameworkUser, id: string): Promise; +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/policies/default.ts b/x-pack/legacy/plugins/fleet/server/repositories/policies/default.ts new file mode 100644 index 0000000000000..2d0353ab80770 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/policies/default.ts @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { IngestPlugin, PoliciesRepository as PoliciesRepositoryType } from './types'; + +export class PoliciesRepository implements PoliciesRepositoryType { + constructor(private readonly plugin?: IngestPlugin) {} + + /** + * Return a full policy + * + * @param id + */ + async getFullPolicy(id: string) { + if (this.plugin) { + return await this.plugin.getFull(id); + } + + return null; + } +} diff --git a/x-pack/legacy/plugins/fleet/server/repositories/policies/types.ts b/x-pack/legacy/plugins/fleet/server/repositories/policies/types.ts new file mode 100644 index 0000000000000..01a7e3960101f --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/repositories/policies/types.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { FullPolicyFile as BaseFullPolicyFile } from '../../../../ingest/server/libs/adapters/policy/adapter_types'; + +export type FullPolicyFile = BaseFullPolicyFile; + +export interface IngestPlugin { + getFull(id: string): Promise; +} + +export interface PoliciesRepository { + getFullPolicy(id: string): Promise; +} diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/actions.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/actions.ts new file mode 100644 index 0000000000000..05db16ca1a520 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/actions.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import Boom from 'boom'; +import { isLeft } from 'fp-ts/lib/Either'; +import { PathReporter } from 'io-ts/lib/PathReporter'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeCreate } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; +import { RuntimeAgentActionData } from '../../repositories/agents/types'; +import { AgentAction } from '../../../common/types/domain_data'; + +export const createAgentsAddActionRoute = (libs: FleetServerLib) => ({ + method: 'POST', + path: '/api/fleet/agents/{agentId}/actions', + options: { + tags: ['access:fleet-all'], + validate: { + payload: Joi.object(), + }, + }, + handler: async ( + request: FrameworkRequest<{ params: { agentId: string }; payload: any }> + ): Promise> => { + const result = RuntimeAgentActionData.decode(request.payload); + if (isLeft(result)) { + throw Boom.badRequest( + `Malformed request, action is invalid, (${PathReporter.report(result)})` + ); + } + const action = await libs.agents.addAction(request.user, request.params.agentId, result.right); + + return { item: action, success: true, action: 'created' }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/checkin.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/checkin.ts new file mode 100644 index 0000000000000..4bdb0e2a79974 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/checkin.ts @@ -0,0 +1,73 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import Boom from 'boom'; + +import { PathReporter } from 'io-ts/lib/PathReporter'; +import { isLeft } from 'fp-ts/lib/Either'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeCheckin } from '../../../common/return_types'; +import { RuntimeAgentEvent, AgentEvent } from '../../repositories/agent_events/types'; +import { FleetServerLib } from '../../libs/types'; + +type CheckinRequest = FrameworkRequest<{ + payload: { + events: any[]; + local_metadata: any; + }; + params: { + agentId: string; + }; +}>; + +export const createCheckinAgentsRoute = (libs: FleetServerLib) => ({ + method: 'POST', + path: '/api/fleet/agents/{agentId}/checkin', + config: { + auth: false, + validate: { + payload: { + events: Joi.array().required(), + local_metadata: Joi.object().optional(), + }, + }, + }, + handler: async (request: CheckinRequest): Promise => { + const { events } = await validateAndDecodePayload(request); + const { actions, policy } = await libs.agents.checkin( + request.user, + events, + request.payload.local_metadata + ); + + return { + action: 'checkin', + success: true, + policy, + actions: actions.map(a => ({ + type: a.type, + })), + }; + }, +}); + +async function validateAndDecodePayload( + request: CheckinRequest +): Promise<{ events: AgentEvent[] }> { + const { events: rawEvents } = request.payload; + const events: AgentEvent[] = rawEvents.map((event, idx) => { + const result = RuntimeAgentEvent.decode(event); + if (isLeft(result)) { + throw Boom.badRequest( + `Malformed request, event ${idx} is invalid, (${PathReporter.report(result)})` + ); + } + return result.right; + }); + + return { events }; +} diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/delete.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/delete.ts new file mode 100644 index 0000000000000..0b030df057d5d --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/delete.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + FrameworkRequest, + FrameworkResponseToolkit, + FrameworkResponseObject, +} from '../../adapters/framework/adapter_types'; +import { ReturnTypeDelete, BaseReturnType } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; + +export const createDeleteAgentsRoute = (libs: FleetServerLib) => ({ + method: 'DELETE', + path: '/api/fleet/agents/{id}', + options: { + tags: ['access:fleet-all'], + }, + handler: async ( + request: FrameworkRequest<{ params: { id: string } }>, + h: FrameworkResponseToolkit + ): Promise => { + const { id } = request.params; + const agent = await libs.agents.getById(request.user, id); + if (!agent) { + return h + .response({ error: { message: 'Agent not found', code: 404 }, success: false }) + .code(404); + } + + await libs.agents.delete(request.user, agent); + + return { success: true, action: 'deleted' }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/enroll.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/enroll.ts new file mode 100644 index 0000000000000..22f0a4253d404 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/enroll.ts @@ -0,0 +1,60 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeCreate } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; +import { Agent } from '../../../common/types/domain_data'; + +export const createEnrollAgentsRoute = (libs: FleetServerLib) => ({ + method: 'POST', + path: '/api/fleet/agents/enroll', + options: { + auth: false, + validate: { + payload: { + shared_id: Joi.string().optional(), + type: Joi.string() + .allow('PERMANENT', 'EPHEMERAL', 'TEMPORARY') + .required(), + metadata: Joi.object({ + local: Joi.object(), + user_provided: Joi.object(), + }).required(), + }, + }, + }, + handler: async ( + request: FrameworkRequest<{ + payload: { + shared_id?: string; + type: 'PERMANENT' | 'EPHEMERAL'; + metadata: { local: any; user_provided: any }; + }; + headers: { + authorization: string; + }; + }> + ): Promise> => { + const { shared_id: sharedId, type, metadata } = request.payload; + const agent = await libs.agents.enroll( + request.user, + type, + metadata && { + local: metadata.local, + userProvided: metadata.user_provided, + }, + sharedId + ); + + return { + action: 'created', + success: true, + item: agent, + }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/events.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/events.ts new file mode 100644 index 0000000000000..70824f6cd9800 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/events.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeList } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; +import { AgentEvent } from '../../../common/types/domain_data'; + +export const createGETAgentEventsRoute = (libs: FleetServerLib) => ({ + method: 'GET', + path: '/api/fleet/agents/{agentId}/events', + options: { + tags: ['access:fleet-read'], + validate: { + query: Joi.object({ + kuery: Joi.string() + .trim() + .optional(), + page: Joi.number() + .optional() + .min(1) + .default(1), + per_page: Joi.number() + .optional() + .min(1) + .default(25), + }), + }, + }, + handler: async ( + request: FrameworkRequest<{ + params: { agentId: string }; + query: { page: string; per_page: string; kuery: string }; + }> + ): Promise> => { + const page = parseInt(request.query.page, 10); + const perPage = parseInt(request.query.per_page, 10); + + const { items, total } = await libs.agents.getEventsById( + request.user, + request.params.agentId, + request.query.kuery, + page, + perPage + ); + + return { list: items, total, success: true, page, perPage }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/get.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/get.ts new file mode 100644 index 0000000000000..9f13f315008c8 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/get.ts @@ -0,0 +1,30 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Boom from 'boom'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeGet } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; +import { Agent } from '../../../common/types/domain_data'; + +export const createGETAgentsRoute = (libs: FleetServerLib) => ({ + method: 'GET', + path: '/api/fleet/agents/{agentId}', + options: { + tags: ['access:fleet-read'], + validate: {}, + }, + handler: async ( + request: FrameworkRequest<{ params: { agentId: string } }> + ): Promise> => { + const agent = await libs.agents.getById(request.user, request.params.agentId); + if (!agent) { + throw Boom.notFound('Agent not found'); + } + + return { item: agent, success: true }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/list.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/list.ts new file mode 100644 index 0000000000000..0d4ac5639fa95 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/list.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeList } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; +import { Agent } from '../../../common/types/domain_data'; +import { DEFAULT_AGENTS_PAGE_SIZE } from '../../../common/constants'; + +export const createListAgentsRoute = (libs: FleetServerLib) => ({ + method: 'GET', + path: '/api/fleet/agents', + options: { + tags: ['access:fleet-read'], + validate: { + query: { + page: Joi.number().default(1), + perPage: Joi.number().default(DEFAULT_AGENTS_PAGE_SIZE), + showInactive: Joi.boolean().default(false), + kuery: Joi.string() + .trim() + .optional(), + }, + }, + }, + handler: async ( + request: FrameworkRequest<{ + query: { page: string; perPage: string; kuery: string; showInactive: string }; + }> + ): Promise> => { + const { agents, total, page, perPage } = await libs.agents.list(request.user, { + page: parseInt(request.query.page, 10), + perPage: parseInt(request.query.perPage, 10), + kuery: request.query.kuery, + showInactive: Boolean(request.query.showInactive), + }); + + return { list: agents, success: true, total, page, perPage }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/put.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/put.ts new file mode 100644 index 0000000000000..47a2bdd8afe07 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/put.ts @@ -0,0 +1,40 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeUpdate } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; +import { Agent } from '../../../common/types/domain_data'; + +export const createPUTAgentsRoute = (libs: FleetServerLib) => ({ + method: 'PUT', + path: '/api/fleet/agents/{agentId}', + options: { + tags: ['access:fleet-write'], + validate: { + payload: Joi.object({ + user_provided_metadata: Joi.object().optional(), + }), + }, + }, + handler: async ( + request: FrameworkRequest<{ + params: { agentId: string }; + payload: { + user_provided_metadata: any; + }; + }> + ): Promise> => { + const { user, params, payload } = request; + const { agentId } = params; + + await libs.agents.update(user, agentId, payload); + const agent = (await libs.agents.getById(user, agentId)) as Agent; + + return { item: agent, success: true, action: 'updated' }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/agents/unenroll.ts b/x-pack/legacy/plugins/fleet/server/routes/agents/unenroll.ts new file mode 100644 index 0000000000000..9fd05cbb42752 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/agents/unenroll.ts @@ -0,0 +1,87 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Boom from 'boom'; +import * as Joi from 'joi'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeBulkUnenroll } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; + +export const createPOSTAgentsUnenrollRoute = (libs: FleetServerLib) => ({ + method: 'POST', + path: '/api/fleet/agents/unenroll', + config: { + validate: { + payload: Joi.object({ + ids: Joi.array() + .empty(false) + .items(Joi.string()) + .optional(), + kuery: Joi.string().optional(), + }), + }, + }, + handler: async ( + request: FrameworkRequest<{ + payload: { + ids?: string[]; + kuery?: string; + }; + }> + ): Promise => { + const { ids, kuery } = request.payload; + if ((!ids && !kuery) || (ids && kuery)) { + throw Boom.badRequest('You need to specify ids or kuery'); + } + + let toUnenrollIds: string[] = ids || []; + + if (kuery) { + let hasMore = true; + let page = 1; + while (hasMore) { + const response = await libs.agents.list(request.user, { + page: page++, + perPage: 100, + kuery, + }); + if (response.agents.length === 0) { + hasMore = false; + } + const agentIds = response.agents.filter(a => a.active).map(a => a.id); + toUnenrollIds = toUnenrollIds.concat(agentIds); + } + } + const results = (await libs.agents.unenroll(request.user, toUnenrollIds)).map( + ({ + success, + id, + error, + }): { + success: boolean; + id: string; + action: 'unenrolled'; + error?: { + message: string; + }; + } => { + return { + success, + id, + action: 'unenrolled', + error: error && { + message: error.message, + }, + }; + } + ); + + return { + results, + success: results.every(result => result.success), + }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/artifacts/index.ts b/x-pack/legacy/plugins/fleet/server/routes/artifacts/index.ts new file mode 100644 index 0000000000000..a43d9c66801f6 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/artifacts/index.ts @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import Boom from 'boom'; +import mime from 'mime'; +import { + FrameworkRequest, + FrameworkResponseToolkit, + FrameworkResponseObject, +} from '../../adapters/framework/adapter_types'; +import { FleetServerLib } from '../../libs/types'; + +export const createGETArtifactsRoute = (libs: FleetServerLib) => ({ + method: 'GET', + path: '/api/fleet/artifacts/{path*}', + config: { + auth: false, + validate: { + params: Joi.object({ + path: Joi.string() + .regex(/^(beats\/|GPG-KEY-elasticsearch)/) + .max(100), + }), + }, + }, + handler: async ( + request: FrameworkRequest<{ params: { path: string } }>, + h: FrameworkResponseToolkit + ): Promise => { + const { path } = request.params; + const contentType = + path === 'GPG-KEY-elasticsearch' ? 'application/pgp-keys' : mime.getType(path); + if (!contentType) { + throw Boom.badRequest('Unsuported file type'); + } + const stream = await libs.artifacts.download(request.params.path); + const response = h.response(stream).header('content-type', contentType); + + return response; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/enrollment_api_keys/index.ts b/x-pack/legacy/plugins/fleet/server/routes/enrollment_api_keys/index.ts new file mode 100644 index 0000000000000..3de3a1dccf3d8 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/enrollment_api_keys/index.ts @@ -0,0 +1,119 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import Boom from 'boom'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { FleetServerLib } from '../../libs/types'; +import { DEFAULT_AGENTS_PAGE_SIZE } from '../../../common/constants'; +import { + ReturnTypeList, + ReturnTypeCreate, + ReturnTypeGet, + ReturnTypeDelete, +} from '../../../common/return_types'; +import { EnrollmentApiKey } from '../../../common/types/domain_data'; + +export const createGETEnrollmentApiKeysRoute = (libs: FleetServerLib) => ({ + method: 'GET', + path: '/api/fleet/enrollment-api-keys', + options: { + tags: ['access:fleet-read'], + validate: { + query: { + page: Joi.number().default(1), + perPage: Joi.number().default(DEFAULT_AGENTS_PAGE_SIZE), + showInactive: Joi.boolean().default(false), + kuery: Joi.string() + .trim() + .optional(), + }, + }, + }, + handler: async ( + request: FrameworkRequest<{ + query: { page: string; perPage: string; kuery: string; showInactive: string }; + }> + ): Promise> => { + const { items, total, page, perPage } = await libs.apiKeys.listEnrollmentApiKeys(request.user, { + page: parseInt(request.query.page, 10), + perPage: parseInt(request.query.perPage, 10), + kuery: request.query.kuery, + showInactive: Boolean(request.query.showInactive), + }); + + return { list: items, success: true, total, page, perPage }; + }, +}); + +export const createPOSTEnrollmentApiKeysRoute = (libs: FleetServerLib) => ({ + method: 'POST', + path: '/api/fleet/enrollment-api-keys', + options: { + tags: ['access:fleet-write'], + validate: { + payload: Joi.object({ + name: Joi.string().optional(), + policy_id: Joi.string().optional(), + expiration: Joi.string().optional(), + }), + }, + }, + handler: async ( + request: FrameworkRequest<{ + payload: { policy_id?: string; expiration?: string; name?: string }; + }> + ): Promise> => { + const data = { + name: request.payload.name, + expiration: request.payload.expiration, + policyId: request.payload.policy_id, + }; + const apiKey = await libs.apiKeys.generateEnrollmentApiKey(request.user, data); + + return { item: apiKey, success: true, action: 'created' }; + }, +}); + +export const createGETEnrollmentApiKeyRoute = (libs: FleetServerLib) => ({ + method: 'GET', + path: '/api/fleet/enrollment-api-keys/{keyId}', + options: { + tags: ['access:fleet-read'], + validate: {}, + }, + handler: async ( + request: FrameworkRequest<{ + params: { keyId: string }; + }> + ): Promise> => { + const apiKey = await libs.apiKeys.getEnrollmentApiKey(request.user, request.params.keyId); + + if (!apiKey) { + throw Boom.notFound('Api key not found'); + } + + return { item: apiKey, success: true }; + }, +}); + +export const createDELETEEnrollmentApiKeyRoute = (libs: FleetServerLib) => ({ + method: 'DELETE', + path: '/api/fleet/enrollment-api-keys/{keyId}', + options: { + tags: ['access:fleet-write'], + validate: {}, + }, + handler: async ( + request: FrameworkRequest<{ + params: { keyId: string }; + }> + ): Promise => { + await libs.apiKeys.deleteEnrollmentApiKey(request.user, request.params.keyId); + + return { action: 'deleted', success: true }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/enrollment_api_keys/rules.ts b/x-pack/legacy/plugins/fleet/server/routes/enrollment_api_keys/rules.ts new file mode 100644 index 0000000000000..3addbc9df3970 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/enrollment_api_keys/rules.ts @@ -0,0 +1,75 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import Boom from 'boom'; +import { PathReporter } from 'io-ts/lib/PathReporter'; +import { isLeft } from 'fp-ts/lib/Either'; +import { FrameworkRequest } from '../../adapters/framework/adapter_types'; +import { ReturnTypeList, ReturnTypeCreate, ReturnTypeDelete } from '../../../common/return_types'; +import { FleetServerLib } from '../../libs/types'; +import { RuntimeEnrollmentRuleData } from '../../repositories/enrollment_api_keys/types'; + +export const createPostEnrollmentRulesRoute = (libs: FleetServerLib) => ({ + method: 'POST', + path: '/api/fleet/enrollment-api-keys/{keyId}/enrollment-rules', + config: {}, + handler: async ( + request: FrameworkRequest<{ params: { keyId: string } }> + ): Promise> => { + const { keyId } = request.params; + + const result = RuntimeEnrollmentRuleData.decode(request.payload); + if (isLeft(result)) { + throw Boom.badRequest( + `Malformed request, action is invalid, (${PathReporter.report(result)})` + ); + } + const rule = await libs.apiKeys.addEnrollmentRule(request.user, keyId, result.right); + + return { item: rule, success: true, action: 'created' }; + }, +}); + +export const createGetEnrollmentRulesRoute = (libs: FleetServerLib) => ({ + method: 'GET', + path: '/api/fleet/enrollment-api-keys/{keyId}/enrollment-rules', + config: {}, + handler: async ( + request: FrameworkRequest<{ params: { keyId: string } }> + ): Promise> => { + const { keyId } = request.params; + const apiKey = await libs.apiKeys.getEnrollmentApiKey(request.user, keyId); + + if (!apiKey) { + throw Boom.notFound('Enrollement api key not found'); + } + + return { + list: apiKey.enrollment_rules, + page: 1, + total: apiKey.enrollment_rules.length, + success: true, + perPage: apiKey.enrollment_rules.length, + }; + }, +}); + +export const createDeleteEnrollmentRuleRoute = (libs: FleetServerLib) => ({ + method: 'DELETE', + path: '/api/fleet/enrollment-api-keys/{keyId}/enrollment-rules/{ruleId}', + config: {}, + handler: async ( + request: FrameworkRequest<{ params: { keyId: string; ruleId: string } }> + ): Promise => { + const { keyId, ruleId } = request.params; + await libs.apiKeys.deleteEnrollmentRule(request.user, keyId, ruleId); + + return { + success: true, + action: 'deleted', + }; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/server/routes/init_api.ts b/x-pack/legacy/plugins/fleet/server/routes/init_api.ts new file mode 100644 index 0000000000000..29a4e86fbe0da --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/init_api.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Server } from 'hapi'; +import { createListAgentsRoute } from './agents/list'; +import { createDeleteAgentsRoute } from './agents/delete'; +import { createEnrollAgentsRoute } from './agents/enroll'; +import { createCheckinAgentsRoute } from './agents/checkin'; +import { FleetServerLib } from '../libs/types'; +import { HapiFrameworkAdapter } from '../adapters/framework/hapi_framework_adapter'; +import { createAgentsAddActionRoute } from './agents/actions'; +import { + createDeleteEnrollmentRuleRoute, + createGetEnrollmentRulesRoute, + createPostEnrollmentRulesRoute, +} from './enrollment_api_keys/rules'; +import { createGETArtifactsRoute } from './artifacts'; +import { createGETAgentEventsRoute } from './agents/events'; +import { createGETInstallScript } from './install'; +import { createGETAgentsRoute } from './agents/get'; +import { createPOSTAgentsUnenrollRoute } from './agents/unenroll'; +import { createPUTAgentsRoute } from './agents/put'; +import { + createGETEnrollmentApiKeysRoute, + createPOSTEnrollmentApiKeysRoute, + createDELETEEnrollmentApiKeyRoute, + createGETEnrollmentApiKeyRoute, +} from './enrollment_api_keys'; + +export function initRestApi(server: Server, libs: FleetServerLib) { + const frameworkAdapter = new HapiFrameworkAdapter(server); + + createAgentsRoutes(frameworkAdapter, libs); + createEnrollmentApiKeysRoutes(frameworkAdapter, libs); + + frameworkAdapter.registerRoute(createGETArtifactsRoute(libs)); + frameworkAdapter.registerRoute(createGETInstallScript(libs)); +} + +function createAgentsRoutes(adapter: HapiFrameworkAdapter, libs: FleetServerLib) { + adapter.registerRoute(createListAgentsRoute(libs)); + adapter.registerRoute(createGETAgentsRoute(libs)); + adapter.registerRoute(createPUTAgentsRoute(libs)); + adapter.registerRoute(createDeleteAgentsRoute(libs)); + adapter.registerRoute(createEnrollAgentsRoute(libs)); + adapter.registerRoute(createPOSTAgentsUnenrollRoute(libs)); + adapter.registerRoute(createCheckinAgentsRoute(libs)); + adapter.registerRoute(createAgentsAddActionRoute(libs)); + adapter.registerRoute(createGETAgentEventsRoute(libs)); +} + +function createEnrollmentApiKeysRoutes(adapter: HapiFrameworkAdapter, libs: FleetServerLib) { + adapter.registerRoute(createGETEnrollmentApiKeysRoute(libs)); + adapter.registerRoute(createPOSTEnrollmentApiKeysRoute(libs)); + adapter.registerRoute(createDELETEEnrollmentApiKeyRoute(libs)); + adapter.registerRoute(createGETEnrollmentApiKeyRoute(libs)); + + // enrollment rules + adapter.registerRoute(createDeleteEnrollmentRuleRoute(libs)); + adapter.registerRoute(createGetEnrollmentRulesRoute(libs)); + adapter.registerRoute(createPostEnrollmentRulesRoute(libs)); +} diff --git a/x-pack/legacy/plugins/fleet/server/routes/install/index.ts b/x-pack/legacy/plugins/fleet/server/routes/install/index.ts new file mode 100644 index 0000000000000..024ef98cfb217 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/server/routes/install/index.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import { + FrameworkRequest, + FrameworkResponseToolkit, + FrameworkResponseObject, +} from '../../adapters/framework/adapter_types'; +import { FleetServerLib } from '../../libs/types'; + +export const createGETInstallScript = (libs: FleetServerLib) => ({ + method: 'GET', + path: '/api/fleet/install/{osType}', + config: { + auth: false, + validate: { + params: Joi.object({ + osType: Joi.string().valid(['macos']), + }), + }, + }, + handler: async ( + request: FrameworkRequest<{ + params: { + osType: 'macos'; + }; + }>, + h: FrameworkResponseToolkit + ): Promise => { + const script = libs.install.getScript(request.params.osType); + const response = h.response(script); + + return response; + }, +}); diff --git a/x-pack/legacy/plugins/fleet/tsconfig.json b/x-pack/legacy/plugins/fleet/tsconfig.json new file mode 100644 index 0000000000000..d7e27bbef4122 --- /dev/null +++ b/x-pack/legacy/plugins/fleet/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../tsconfig.json", + "exclude": ["**/node_modules/**"], + "paths": { + "react": ["../../../../node_modules/@types/react"] + } +} diff --git a/x-pack/legacy/plugins/ingest/common/constants/index.ts b/x-pack/legacy/plugins/ingest/common/constants/index.ts new file mode 100644 index 0000000000000..c26e4182e3045 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/constants/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { INDEX_NAMES } from './index_names'; +export { PLUGIN } from './plugin'; +export const BASE_PATH = '/ingest'; +export const DEFAULT_POLICY_ID = 'default'; diff --git a/x-pack/legacy/plugins/ingest/common/constants/index_names.ts b/x-pack/legacy/plugins/ingest/common/constants/index_names.ts new file mode 100644 index 0000000000000..ae2c543b88412 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/constants/index_names.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const INDEX_NAMES = { + INGEST: '.kibana', +}; diff --git a/x-pack/legacy/plugins/ingest/common/constants/plugin.ts b/x-pack/legacy/plugins/ingest/common/constants/plugin.ts new file mode 100644 index 0000000000000..15d0a020ca707 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/constants/plugin.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const PLUGIN = { + ID: 'ingest', +}; +export const CONFIG_PREFIX = 'xpack.ingest'; diff --git a/x-pack/legacy/plugins/ingest/common/constants/security.ts b/x-pack/legacy/plugins/ingest/common/constants/security.ts new file mode 100644 index 0000000000000..89cac2b043f5f --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/constants/security.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const REQUIRED_LICENSES = ['standard', 'gold', 'trial', 'platinum']; +export const LICENSES = ['oss', 'basic', 'standard', 'gold', 'trial', 'platinum']; diff --git a/x-pack/legacy/plugins/ingest/common/types/domain_data.ts b/x-pack/legacy/plugins/ingest/common/types/domain_data.ts new file mode 100644 index 0000000000000..288c4f49d6a8e --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/types/domain_data.ts @@ -0,0 +1,77 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import * as t from 'io-ts'; +import { DateFromString } from './io_ts'; + +// Here we create the runtime check for a generic, unknown beat policy type. +// We can also pass in optional params to create spacific runtime checks that +// can be used to validate blocs on the API and UI +export const createPolicyInterface = (beatPolicyInterface: t.Mixed = t.Dictionary) => + t.interface( + { + id: t.union([t.undefined, t.string]), + name: t.string, + description: t.union([t.undefined, t.string]), + policy: beatPolicyInterface, + last_updated_by: t.union([t.undefined, t.string]), + last_updated: t.union([t.undefined, t.number]), + }, + 'Policy' + ); +const BasePolicy = createPolicyInterface(); +export interface PolicyBlock + extends Pick, Exclude, 'id'>> { + id: string; +} + +export interface Agent { + id: string; + status?: AgentEvent; + enrollment_token: string; + active: boolean; + access_token: string; + verified_on?: string; + type: string; + version?: string; + host_ip: string; + host_name: string; + ephemeral_id?: string; + last_checkin?: Date; + event_rate?: string; + tags: string[]; + metadata?: {}; + name?: string; + last_updated: number; +} + +export const RuntimeAgentEvent = t.interface( + { + type: t.union([t.literal('STATE'), t.literal('ERROR')]), + beat: t.union([t.undefined, t.string]), + timestamp: DateFromString, + event: t.type({ + type: t.union([ + t.literal('RUNNING'), + t.literal('STARTING'), + t.literal('IN_PROGRESS'), + t.literal('CONFIG'), + t.literal('FAILED'), + t.literal('STOPPED'), + ]), + message: t.string, + uuid: t.union([t.undefined, t.string]), + }), + }, + 'AgentEvent' +); +export interface AgentEvent + extends Pick< + t.TypeOf, + Exclude, 'timestamp'> + > { + agent: string; + timestamp: Date; +} diff --git a/x-pack/legacy/plugins/ingest/common/types/helpers.ts b/x-pack/legacy/plugins/ingest/common/types/helpers.ts new file mode 100644 index 0000000000000..4258461310e16 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/types/helpers.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export type FlatObject = { [Key in keyof T]: string }; diff --git a/x-pack/legacy/plugins/ingest/common/types/io_ts.ts b/x-pack/legacy/plugins/ingest/common/types/io_ts.ts new file mode 100644 index 0000000000000..d5533afa79024 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/types/io_ts.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as t from 'io-ts'; +import { either } from 'fp-ts/lib/Either'; +export type DateType = t.Type; + +export const DateFromString: DateType = new t.Type( + 'DateFromString', + (u): u is Date => u instanceof Date, + (u, c) => + either.chain(t.string.validate(u, c), s => { + const d = new Date(s); + return isNaN(d.getTime()) ? t.failure(u, c) : t.success(d); + }), + a => a.toISOString() +); diff --git a/x-pack/legacy/plugins/ingest/common/types/security.ts b/x-pack/legacy/plugins/ingest/common/types/security.ts new file mode 100644 index 0000000000000..691ea82b294d3 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/types/security.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export type LicenseType = 'oss' | 'basic' | 'trial' | 'standard' | 'basic' | 'gold' | 'platinum'; diff --git a/x-pack/legacy/plugins/ingest/common/types/std_return_format.ts b/x-pack/legacy/plugins/ingest/common/types/std_return_format.ts new file mode 100644 index 0000000000000..3e31a785b0499 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/types/std_return_format.ts @@ -0,0 +1,116 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export interface BaseReturnType { + error?: { + message: string; + code?: number; + }; + success: boolean; +} + +export interface ReturnTypeCreate extends BaseReturnType { + item: T; + action: 'created'; +} + +export interface ReturnTypeUpdate extends BaseReturnType { + item: T; + action: 'updated'; +} + +export interface ReturnTypeBulkCreate extends BaseReturnType { + results: Array<{ + item: T; + success: boolean; + action: 'created'; + error?: { + message: string; + code?: number; + }; + }>; +} + +// delete +export interface ReturnTypeDelete extends BaseReturnType { + action: 'deleted'; +} + +export interface ReturnTypeBulkDelete extends BaseReturnType { + results: Array<{ + success: boolean; + action: 'deleted'; + error?: { + message: string; + code?: number; + }; + }>; +} + +// upsert +export interface ReturnTypeUpsert extends BaseReturnType { + item: T; + action: 'created' | 'updated'; +} + +// upsert bulk +export interface ReturnTypeBulkUpsert extends BaseReturnType { + results: Array<{ + success: boolean; + action: 'created' | 'updated'; + error?: { + message: string; + code?: number; + }; + }>; +} + +// list +export interface ReturnTypeList extends BaseReturnType { + list: T[]; + page: number; + total: number; +} + +// get +export interface ReturnTypeGet extends BaseReturnType { + item: T; +} + +export interface ReturnTypeBulkGet extends BaseReturnType { + items: T[]; +} + +// action -- e.g. validate policy block. Like ES simulate endpoint +export interface ReturnTypeAction extends BaseReturnType { + result: { + [key: string]: any; + }; +} +// e.g. +// { +// result: { +// username: { valid: true }, +// password: { valid: false, error: 'something' }, +// hosts: [ +// { valid: false }, { valid: true }, +// ] +// } +// } + +// bulk action +export interface ReturnTypeBulkAction extends BaseReturnType { + results?: Array<{ + success: boolean; + result?: { + [key: string]: any; + }; + error?: { + message: string; + code?: number; + }; + }>; +} diff --git a/x-pack/legacy/plugins/ingest/common/utils/is_version_greater.ts b/x-pack/legacy/plugins/ingest/common/utils/is_version_greater.ts new file mode 100644 index 0000000000000..f1b18b87f16da --- /dev/null +++ b/x-pack/legacy/plugins/ingest/common/utils/is_version_greater.ts @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export function isVersionGreater(v1: string, v2: string): 1 | 0 | -1 { + const v1parts = v1.split('.'); + const v2parts = v2.split('.'); + + function isValidPart(x: string) { + return /^\d+$/.test(x); + } + + if (!v1parts.every(isValidPart) || !v2parts.every(isValidPart)) { + throw new Error('versions are not valid'); + } + + while (v1parts.length < v2parts.length) v1parts.push('0'); + while (v2parts.length < v1parts.length) v2parts.push('0'); + + for (let i = 0; i < v1parts.length; ++i) { + if (v2parts.length === i) { + return 1; + } + + if (v1parts[i] === v2parts[i]) { + continue; + } else if (v1parts[i] > v2parts[i]) { + return 1; + } else { + return -1; + } + } + + if (v1parts.length !== v2parts.length) { + return -1; + } + + return 0; +} diff --git a/x-pack/legacy/plugins/ingest/index.ts b/x-pack/legacy/plugins/ingest/index.ts new file mode 100644 index 0000000000000..a36c86f958280 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/index.ts @@ -0,0 +1,44 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import * as Joi from 'joi'; +import { resolve } from 'path'; +import { PLUGIN } from './common/constants'; +import { CONFIG_PREFIX } from './common/constants/plugin'; +import { initServerWithKibana, postInit } from './server/kibana.index'; +import { mappings } from './server/mappings'; +// TODO https://github.com/elastic/kibana/issues/46373 +// import { INDEX_NAMES } from './common/constants'; + +export const config = Joi.object({ + enabled: Joi.boolean().default(true), +}).default(); + +export function ingest(kibana: any) { + return new kibana.Plugin({ + id: PLUGIN.ID, + require: ['kibana', 'elasticsearch', 'xpack_main'], + publicDir: resolve(__dirname, 'public'), + config: () => config, + configPrefix: CONFIG_PREFIX, + uiExports: { + savedObjectSchemas: { + policies: { + isNamespaceAgnostic: true, + // indexPattern: INDEX_NAMES.INGEST, + }, + inputs: { + isNamespaceAgnostic: true, + // indexPattern: INDEX_NAMES.INGEST, + }, + }, + mappings, + }, + init(server: any) { + initServerWithKibana(server); + }, + postInit, + }); +} diff --git a/x-pack/legacy/plugins/ingest/server/kibana.index.ts b/x-pack/legacy/plugins/ingest/server/kibana.index.ts new file mode 100644 index 0000000000000..d629ffe7c8cae --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/kibana.index.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { compose } from './libs/compose/kibana'; +import { initRestApi } from './rest_api/init_api'; + +export const initServerWithKibana = (hapiServer: any) => { + const libs = compose(hapiServer); + libs.framework.log('Ingest is composed -- debug message'); + + libs.framework.expose('policy', libs.policy); + + initRestApi(hapiServer, libs); +}; + +export function postInit(server: any) { + server.plugins.ingest.policy.ensureDefaultPolicy(); +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/__memorize_snapshots__/policy.contract.test.slap_snap b/x-pack/legacy/plugins/ingest/server/libs/__memorize_snapshots__/policy.contract.test.slap_snap new file mode 100644 index 0000000000000..48d3c25cc7155 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/__memorize_snapshots__/policy.contract.test.slap_snap @@ -0,0 +1,27444 @@ + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "81a28d50-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib create should create a new policy - get - "81a28d50-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "81a28d50-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8253b4e0-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-2", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "82e8f000-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-3", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "83846cb0-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-4", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "8253b4e0-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "82e8f000-db19-11e9-a487-5f6358861e5b", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "83846cb0-db19-11e9-a487-5f6358861e5b", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "84267910-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-5", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - get - "84267910-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "84267910-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "84bd13c0-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-5", + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "85f4d070-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-6", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "86909b40-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-7", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": [ + { + "id": "84bd13c0-db19-11e9-a487-5f6358861e5b", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "85f4d070-db19-11e9-a487-5f6358861e5b", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "86909b40-db19-11e9-a487-5f6358861e5b", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "87360300-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-8", + "version": 0 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "87360300-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "87360300-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "87cb3e20-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-8", + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "87cb3e20-db19-11e9-a487-5f6358861e5b" (6)'] = { + "results": { + "id": "87cb3e20-db19-11e9-a487-5f6358861e5b", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "87360300-db19-11e9-a487-5f6358861e5b" (7)'] = { + "results": { + "id": "87360300-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 16:10:32 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "891a7a70-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-9", + "version": 0 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "891a7a70-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "891a7a70-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "89b3fb50-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-9", + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "89b3fb50-db19-11e9-a487-5f6358861e5b", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "891a7a70-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 16:10:35 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8aef1360-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-10", + "version": 0 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "8aef1360-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "8aef1360-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "8b8734b0-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-10", + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "8aef1360-db19-11e9-a487-5f6358861e5b" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "8b8734b0-db19-11e9-a487-5f6358861e5b", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8d5b5870-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-11", + "version": 0 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "8d5b5870-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "8d5b5870-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "8df48b30-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-11", + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "8df48b30-db19-11e9-a487-5f6358861e5b", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "8d5b5870-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 16:10:42 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "8df48b30-db19-11e9-a487-5f6358861e5b" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "8d5b5870-db19-11e9-a487-5f6358861e5b" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": [] +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "9061e1b0-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-12", + "version": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "9061e1b0-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "9061e1b0-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "90fe48c0-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-12", + "version": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "90fe48c0-db19-11e9-a487-5f6358861e5b", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "9061e1b0-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "90fe48c0-db19-11e9-a487-5f6358861e5b", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson", + "data_sources": [] + } + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "9238c490-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-14", + "version": 0 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "9238c490-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "9238c490-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [{"other":"{}","data_source_id":"uuid-15"},{"other":"{}","data_source_id":"uuid-15"}] (4)'] = { + "results": [ + "92d049a0-db19-11e9-a487-5f6358861e5b", + "9368b910-db19-11e9-a487-5f6358861e5b" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "94074300-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-14", + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "94074300-db19-11e9-a487-5f6358861e5b" (7)'] = { + "results": { + "id": "94074300-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "92d049a0-db19-11e9-a487-5f6358861e5b", + "9368b910-db19-11e9-a487-5f6358861e5b" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "95420cf0-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-16", + "version": 0 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "95420cf0-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "95420cf0-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [{"other":"{}","data_source_id":"uuid-17"},{"other":"{}","data_source_id":"uuid-17"}] (4)'] = { + "results": [ + "95db18a0-db19-11e9-a487-5f6358861e5b", + "9672ebd0-db19-11e9-a487-5f6358861e5b" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "97106450-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-16", + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "97106450-db19-11e9-a487-5f6358861e5b" (7)'] = { + "results": { + "id": "97106450-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "95db18a0-db19-11e9-a487-5f6358861e5b", + "9672ebd0-db19-11e9-a487-5f6358861e5b" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "97106450-db19-11e9-a487-5f6358861e5b" (8)'] = { + "results": { + "id": "97106450-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "95db18a0-db19-11e9-a487-5f6358861e5b", + "9672ebd0-db19-11e9-a487-5f6358861e5b" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "9848bd40-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-16", + "version": 2 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "9848bd40-db19-11e9-a487-5f6358861e5b" (11)'] = { + "results": { + "id": "9848bd40-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571515795215 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "99850dd0-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-18", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "99850dd0-db19-11e9-a487-5f6358861e5b" (3)'] = { + "results": { + "id": "99850dd0-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-19"}] (4)'] = { + "results": [ + "9a1ba880-db19-11e9-a487-5f6358861e5b" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "9abb9200-db19-11e9-a487-5f6358861e5b", + "shared_id": "shared-uuid-18", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "9abb9200-db19-11e9-a487-5f6358861e5b" (7)'] = { + "results": { + "id": "9abb9200-db19-11e9-a487-5f6358861e5b", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "9a1ba880-db19-11e9-a487-5f6358861e5b" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "0fe369c0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib create should create a new policy - get - "0fe369c0-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "0fe369c0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1095c9d0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-2", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "112adde0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-3", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "11c5e560-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-4", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "1095c9d0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "112adde0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "11c5e560-db1c-11e9-b169-e5b8e36f8fed", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "12666b20-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-5", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - get - "12666b20-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "12666b20-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "12fe3e50-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-5", + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "1437a8b0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-6", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "14d2d740-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-7", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": [ + { + "id": "12fe3e50-db1c-11e9-b169-e5b8e36f8fed", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "1437a8b0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "14d2d740-db1c-11e9-b169-e5b8e36f8fed", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "15724b90-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-8", + "version": 0 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "15724b90-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "15724b90-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "160b0920-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-8", + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "160b0920-db1c-11e9-b169-e5b8e36f8fed" (6)'] = { + "results": { + "id": "160b0920-db1c-11e9-b169-e5b8e36f8fed", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "15724b90-db1c-11e9-b169-e5b8e36f8fed" (7)'] = { + "results": { + "id": "15724b90-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 16:28:49 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "17492e70-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-9", + "version": 0 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "17492e70-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "17492e70-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "17e03e50-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-9", + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "17e03e50-db1c-11e9-b169-e5b8e36f8fed", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "17492e70-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 16:28:52 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "191d0410-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-10", + "version": 0 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "191d0410-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "191d0410-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "19b43b00-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-10", + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "191d0410-db1c-11e9-b169-e5b8e36f8fed" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "19b43b00-db1c-11e9-b169-e5b8e36f8fed", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1b8acfc0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-11", + "version": 0 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "1b8acfc0-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "1b8acfc0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "1c216a70-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-11", + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "1c216a70-db1c-11e9-b169-e5b8e36f8fed", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "1b8acfc0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 16:28:59 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "1c216a70-db1c-11e9-b169-e5b8e36f8fed" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "1b8acfc0-db1c-11e9-b169-e5b8e36f8fed" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": [] +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1e924360-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-12", + "version": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "1e924360-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "1e924360-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "1f2fe2f0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-12", + "version": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "1f2fe2f0-db1c-11e9-b169-e5b8e36f8fed", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "1e924360-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "1f2fe2f0-db1c-11e9-b169-e5b8e36f8fed", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson", + "data_sources": [] + } + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "207f4650-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-14", + "version": 0 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "207f4650-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "207f4650-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [{"other":"{}","data_source_id":"uuid-15"},{"other":"{}","data_source_id":"uuid-15"}] (4)'] = { + "results": [ + "21119b40-db1c-11e9-b169-e5b8e36f8fed", + "21b50730-db1c-11e9-b169-e5b8e36f8fed" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "22558cf0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-14", + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "22558cf0-db1c-11e9-b169-e5b8e36f8fed" (7)'] = { + "results": { + "id": "22558cf0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "21119b40-db1c-11e9-b169-e5b8e36f8fed", + "21b50730-db1c-11e9-b169-e5b8e36f8fed" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2393d950-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-16", + "version": 0 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "2393d950-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "2393d950-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [{"other":"{}","data_source_id":"uuid-17"},{"other":"{}","data_source_id":"uuid-17"}] (4)'] = { + "results": [ + "242a4cf0-db1c-11e9-b169-e5b8e36f8fed", + "24c26e40-db1c-11e9-b169-e5b8e36f8fed" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "25608300-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-16", + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "25608300-db1c-11e9-b169-e5b8e36f8fed" (7)'] = { + "results": { + "id": "25608300-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "242a4cf0-db1c-11e9-b169-e5b8e36f8fed", + "24c26e40-db1c-11e9-b169-e5b8e36f8fed" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "25608300-db1c-11e9-b169-e5b8e36f8fed" (8)'] = { + "results": { + "id": "25608300-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "242a4cf0-db1c-11e9-b169-e5b8e36f8fed", + "24c26e40-db1c-11e9-b169-e5b8e36f8fed" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "2698dbf0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-16", + "version": 2 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "2698dbf0-db1c-11e9-b169-e5b8e36f8fed" (11)'] = { + "results": { + "id": "2698dbf0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571516898683 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "27d3f400-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-18", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "27d3f400-db1c-11e9-b169-e5b8e36f8fed" (3)'] = { + "results": { + "id": "27d3f400-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-19"}] (4)'] = { + "results": [ + "286c1550-db1c-11e9-b169-e5b8e36f8fed" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "2906a7a0-db1c-11e9-b169-e5b8e36f8fed", + "shared_id": "shared-uuid-18", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "2906a7a0-db1c-11e9-b169-e5b8e36f8fed" (7)'] = { + "results": { + "id": "2906a7a0-db1c-11e9-b169-e5b8e36f8fed", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "286c1550-db1c-11e9-b169-e5b8e36f8fed" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["286c1550-db1c-11e9-b169-e5b8e36f8fed"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571517038427 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "63035200-db1c-11e9-9963-aba8c56ebf02", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "63035200-db1c-11e9-9963-aba8c56ebf02" (3)'] = { + "results": { + "id": "63035200-db1c-11e9-9963-aba8c56ebf02", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "63c43100-db1c-11e9-9963-aba8c56ebf02" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "646e2ca0-db1c-11e9-9963-aba8c56ebf02", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "646e2ca0-db1c-11e9-9963-aba8c56ebf02" (7)'] = { + "results": { + "id": "646e2ca0-db1c-11e9-9963-aba8c56ebf02", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "63c43100-db1c-11e9-9963-aba8c56ebf02" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["63c43100-db1c-11e9-9963-aba8c56ebf02"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571517155173 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "a805f240-db1c-11e9-bcba-11b2c537a0d1", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "a805f240-db1c-11e9-bcba-11b2c537a0d1" (3)'] = { + "results": { + "id": "a805f240-db1c-11e9-bcba-11b2c537a0d1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "a8bd5b60-db1c-11e9-bcba-11b2c537a0d1" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "a957edb0-db1c-11e9-bcba-11b2c537a0d1", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "a957edb0-db1c-11e9-bcba-11b2c537a0d1" (7)'] = { + "results": { + "id": "a957edb0-db1c-11e9-bcba-11b2c537a0d1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "a8bd5b60-db1c-11e9-bcba-11b2c537a0d1" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["a8bd5b60-db1c-11e9-bcba-11b2c537a0d1"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571517619107 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "bccb5ed0-db1d-11e9-a55e-f7e31b1dad89", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "bccb5ed0-db1d-11e9-a55e-f7e31b1dad89" (3)'] = { + "results": { + "id": "bccb5ed0-db1d-11e9-a55e-f7e31b1dad89", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "bd8befb0-db1d-11e9-a55e-f7e31b1dad89" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "be2f82b0-db1d-11e9-a55e-f7e31b1dad89", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "be2f82b0-db1d-11e9-a55e-f7e31b1dad89" (7)'] = { + "results": { + "id": "be2f82b0-db1d-11e9-a55e-f7e31b1dad89", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "bd8befb0-db1d-11e9-a55e-f7e31b1dad89" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["bd8befb0-db1d-11e9-a55e-f7e31b1dad89"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571517680810 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "e2aaa700-db1d-11e9-8dc0-278f06df2e67", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "e2aaa700-db1d-11e9-8dc0-278f06df2e67" (3)'] = { + "results": { + "id": "e2aaa700-db1d-11e9-8dc0-278f06df2e67", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "e2fb8620-db1d-11e9-8dc0-278f06df2e67" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "e3941ca0-db1d-11e9-8dc0-278f06df2e67", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "e3941ca0-db1d-11e9-8dc0-278f06df2e67" (7)'] = { + "results": { + "id": "e3941ca0-db1d-11e9-8dc0-278f06df2e67", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "e2fb8620-db1d-11e9-8dc0-278f06df2e67" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["e2fb8620-db1d-11e9-8dc0-278f06df2e67"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571517772100 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "18444560-db1e-11e9-a6b0-5fbc67e25f16", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "18444560-db1e-11e9-a6b0-5fbc67e25f16" (3)'] = { + "results": { + "id": "18444560-db1e-11e9-a6b0-5fbc67e25f16", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "18a79b10-db1e-11e9-a6b0-5fbc67e25f16" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "193e5cd0-db1e-11e9-a6b0-5fbc67e25f16", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "193e5cd0-db1e-11e9-a6b0-5fbc67e25f16" (7)'] = { + "results": { + "id": "193e5cd0-db1e-11e9-a6b0-5fbc67e25f16", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "18a79b10-db1e-11e9-a6b0-5fbc67e25f16" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["18a79b10-db1e-11e9-a6b0-5fbc67e25f16"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571517909137 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "69ad2ed0-db1e-11e9-bb16-91b6542ae719", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "69ad2ed0-db1e-11e9-bb16-91b6542ae719" (3)'] = { + "results": { + "id": "69ad2ed0-db1e-11e9-bb16-91b6542ae719", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "6a7a42d0-db1e-11e9-bb16-91b6542ae719" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "6b132770-db1e-11e9-bb16-91b6542ae719", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "6b132770-db1e-11e9-bb16-91b6542ae719" (7)'] = { + "results": { + "id": "6b132770-db1e-11e9-bb16-91b6542ae719", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "6a7a42d0-db1e-11e9-bb16-91b6542ae719" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["6a7a42d0-db1e-11e9-bb16-91b6542ae719"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518113816 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "e44eebb0-db1e-11e9-bfb1-f3f1e5594de9", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "e44eebb0-db1e-11e9-bfb1-f3f1e5594de9" (3)'] = { + "results": { + "id": "e44eebb0-db1e-11e9-bfb1-f3f1e5594de9", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "e52c2c50-db1e-11e9-bfb1-f3f1e5594de9" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "e5d6eb40-db1e-11e9-bfb1-f3f1e5594de9", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "e5d6eb40-db1e-11e9-bfb1-f3f1e5594de9" (7)'] = { + "results": { + "id": "e5d6eb40-db1e-11e9-bfb1-f3f1e5594de9", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "e52c2c50-db1e-11e9-bfb1-f3f1e5594de9" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["e52c2c50-db1e-11e9-bfb1-f3f1e5594de9"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518166651 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "03c5baf0-db1f-11e9-b419-dbcc7077d02e", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "03c5baf0-db1f-11e9-b419-dbcc7077d02e" (3)'] = { + "results": { + "id": "03c5baf0-db1f-11e9-b419-dbcc7077d02e", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "0482c960-db1f-11e9-b419-dbcc7077d02e" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "051c9860-db1f-11e9-b419-dbcc7077d02e", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "051c9860-db1f-11e9-b419-dbcc7077d02e" (7)'] = { + "results": { + "id": "051c9860-db1f-11e9-b419-dbcc7077d02e", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "0482c960-db1f-11e9-b419-dbcc7077d02e" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["0482c960-db1f-11e9-b419-dbcc7077d02e"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518253941 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "3a3546f0-db1f-11e9-aff6-7585e8c01e0f", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "3a3546f0-db1f-11e9-aff6-7585e8c01e0f" (3)'] = { + "results": { + "id": "3a3546f0-db1f-11e9-aff6-7585e8c01e0f", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "3b01beb0-db1f-11e9-aff6-7585e8c01e0f" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "3b9a5530-db1f-11e9-aff6-7585e8c01e0f", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "3b9a5530-db1f-11e9-aff6-7585e8c01e0f" (7)'] = { + "results": { + "id": "3b9a5530-db1f-11e9-aff6-7585e8c01e0f", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "3b01beb0-db1f-11e9-aff6-7585e8c01e0f" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["3b01beb0-db1f-11e9-aff6-7585e8c01e0f"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518374957 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "80866030-db1f-11e9-8a21-ddff8833845d", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "80866030-db1f-11e9-8a21-ddff8833845d" (3)'] = { + "results": { + "id": "80866030-db1f-11e9-8a21-ddff8833845d", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "8165c3b0-db1f-11e9-8a21-ddff8833845d" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "82018e80-db1f-11e9-8a21-ddff8833845d", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "82018e80-db1f-11e9-8a21-ddff8833845d" (7)'] = { + "results": { + "id": "82018e80-db1f-11e9-8a21-ddff8833845d", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "8165c3b0-db1f-11e9-8a21-ddff8833845d" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["8165c3b0-db1f-11e9-8a21-ddff8833845d"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518503365 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "cb5d76c0-db1f-11e9-aed7-d9b0d7ee8233", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "cb5d76c0-db1f-11e9-aed7-d9b0d7ee8233" (3)'] = { + "results": { + "id": "cb5d76c0-db1f-11e9-aed7-d9b0d7ee8233", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "cc218a10-db1f-11e9-aed7-d9b0d7ee8233" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "ccb9f980-db1f-11e9-aed7-d9b0d7ee8233", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "ccb9f980-db1f-11e9-aed7-d9b0d7ee8233" (7)'] = { + "results": { + "id": "ccb9f980-db1f-11e9-aed7-d9b0d7ee8233", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "cc218a10-db1f-11e9-aed7-d9b0d7ee8233" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["cc218a10-db1f-11e9-aed7-d9b0d7ee8233"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518627595 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "15fc1830-db20-11e9-99c6-fdc62d579d97", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "15fc1830-db20-11e9-99c6-fdc62d579d97" (3)'] = { + "results": { + "id": "15fc1830-db20-11e9-99c6-fdc62d579d97", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "16a80fa0-db20-11e9-99c6-fdc62d579d97" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "17411b50-db20-11e9-99c6-fdc62d579d97", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "17411b50-db20-11e9-99c6-fdc62d579d97" (7)'] = { + "results": { + "id": "17411b50-db20-11e9-99c6-fdc62d579d97", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "16a80fa0-db20-11e9-99c6-fdc62d579d97" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["16a80fa0-db20-11e9-99c6-fdc62d579d97"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518738365 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "57e48020-db20-11e9-b6c4-8bc7306be262", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "57e48020-db20-11e9-b6c4-8bc7306be262" (3)'] = { + "results": { + "id": "57e48020-db20-11e9-b6c4-8bc7306be262", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "58af9850-db20-11e9-b6c4-8bc7306be262" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "5949dc80-db20-11e9-b6c4-8bc7306be262", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "5949dc80-db20-11e9-b6c4-8bc7306be262" (7)'] = { + "results": { + "id": "5949dc80-db20-11e9-b6c4-8bc7306be262", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "58af9850-db20-11e9-b6c4-8bc7306be262" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["58af9850-db20-11e9-b6c4-8bc7306be262"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518801206 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "7d2390b0-db20-11e9-90f1-fb8626c8f696", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "7d2390b0-db20-11e9-90f1-fb8626c8f696" (3)'] = { + "results": { + "id": "7d2390b0-db20-11e9-90f1-fb8626c8f696", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "7de002e0-db20-11e9-90f1-fb8626c8f696" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "7e7983c0-db20-11e9-90f1-fb8626c8f696", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "7e7983c0-db20-11e9-90f1-fb8626c8f696" (7)'] = { + "results": { + "id": "7e7983c0-db20-11e9-90f1-fb8626c8f696", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "7de002e0-db20-11e9-90f1-fb8626c8f696" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["7de002e0-db20-11e9-90f1-fb8626c8f696"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571518899471 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "b7917370-db20-11e9-b1ba-53bc48983d95", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "b7917370-db20-11e9-b1ba-53bc48983d95" (3)'] = { + "results": { + "id": "b7917370-db20-11e9-b1ba-53bc48983d95", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "b84b74a0-db20-11e9-b1ba-53bc48983d95" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "b8e98960-db20-11e9-b1ba-53bc48983d95", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "b8e98960-db20-11e9-b1ba-53bc48983d95" (7)'] = { + "results": { + "id": "b8e98960-db20-11e9-b1ba-53bc48983d95", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "b84b74a0-db20-11e9-b1ba-53bc48983d95" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["b84b74a0-db20-11e9-b1ba-53bc48983d95"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571519021419 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "00299680-db21-11e9-b9b9-71a6f55a67dd", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "00299680-db21-11e9-b9b9-71a6f55a67dd" (3)'] = { + "results": { + "id": "00299680-db21-11e9-b9b9-71a6f55a67dd", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "00f068f0-db21-11e9-b9b9-71a6f55a67dd" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "0189c2c0-db21-11e9-b9b9-71a6f55a67dd", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "0189c2c0-db21-11e9-b9b9-71a6f55a67dd" (7)'] = { + "results": { + "id": "0189c2c0-db21-11e9-b9b9-71a6f55a67dd", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "00f068f0-db21-11e9-b9b9-71a6f55a67dd" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["00f068f0-db21-11e9-b9b9-71a6f55a67dd"],"page":1,"perPage":10000} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-2" + } + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571519152001 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "4e70cd90-db21-11e9-a688-934083cc0040", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "4e70cd90-db21-11e9-a688-934083cc0040" (3)'] = { + "results": { + "id": "4e70cd90-db21-11e9-a688-934083cc0040", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "4f388a60-db21-11e9-a688-934083cc0040" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "4fd2f5a0-db21-11e9-a688-934083cc0040", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "4fd2f5a0-db21-11e9-a688-934083cc0040" (7)'] = { + "results": { + "id": "4fd2f5a0-db21-11e9-a688-934083cc0040", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "4f388a60-db21-11e9-a688-934083cc0040" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["4f388a60-db21-11e9-a688-934083cc0040"],"page":1,"perPage":10000} (8)'] = { + "results": [] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571519490587 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "17ee1240-db22-11e9-8ef7-454d4c989b18", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "17ee1240-db22-11e9-8ef7-454d4c989b18" (3)'] = { + "results": { + "id": "17ee1240-db22-11e9-8ef7-454d4c989b18", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "18ab95e0-db22-11e9-8ef7-454d4c989b18" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "1944efb0-db22-11e9-8ef7-454d4c989b18", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "1944efb0-db22-11e9-8ef7-454d4c989b18" (7)'] = { + "results": { + "id": "1944efb0-db22-11e9-8ef7-454d4c989b18", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "18ab95e0-db22-11e9-8ef7-454d4c989b18" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["18ab95e0-db22-11e9-8ef7-454d4c989b18"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-2" + } + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571519682994 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8ab576b0-db22-11e9-9714-03644f1efe82", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "8ab576b0-db22-11e9-9714-03644f1efe82" (3)'] = { + "results": { + "id": "8ab576b0-db22-11e9-9714-03644f1efe82", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [{"other":"{\"foo\":\"bar\"}","data_source_id":"uuid-2"}] (4)'] = { + "results": [ + "8b754440-db22-11e9-9714-03644f1efe82" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "8c0e7700-db22-11e9-9714-03644f1efe82", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "8c0e7700-db22-11e9-9714-03644f1efe82" (7)'] = { + "results": { + "id": "8c0e7700-db22-11e9-9714-03644f1efe82", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "8b754440-db22-11e9-9714-03644f1efe82" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["8b754440-db22-11e9-9714-03644f1efe82"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-2" + } + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571519798557 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d00a7cb0-db22-11e9-bc08-8d46fab4eff1", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "d00a7cb0-db22-11e9-bc08-8d46fab4eff1" (3)'] = { + "results": { + "id": "d00a7cb0-db22-11e9-bc08-8d46fab4eff1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - ["uuid-2"] (4)'] = { + "results": [ + "d0be3c50-db22-11e9-bc08-8d46fab4eff1" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "d16c56a0-db22-11e9-bc08-8d46fab4eff1", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "d16c56a0-db22-11e9-bc08-8d46fab4eff1" (7)'] = { + "results": { + "id": "d16c56a0-db22-11e9-bc08-8d46fab4eff1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "d0be3c50-db22-11e9-bc08-8d46fab4eff1" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["d0be3c50-db22-11e9-bc08-8d46fab4eff1"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-2" + } + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571519934400 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "20ed4630-db23-11e9-8940-29e60274b341", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "20ed4630-db23-11e9-8940-29e60274b341" (3)'] = { + "results": { + "id": "20ed4630-db23-11e9-8940-29e60274b341", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "21b9bdf0-db23-11e9-8940-29e60274b341" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "22542930-db23-11e9-8940-29e60274b341", + "shared_id": "shared-uuid-1", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "22542930-db23-11e9-8940-29e60274b341" (7)'] = { + "results": { + "id": "22542930-db23-11e9-8940-29e60274b341", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-2", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "21b9bdf0-db23-11e9-8940-29e60274b341" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["21b9bdf0-db23-11e9-8940-29e60274b341"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-2" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "cad44cc0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-1", + "version": 0 + } +} + +exports['Policies Lib create should create a new policy - get - "cad44cc0-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "cad44cc0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "cb99e6b0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-2", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "cc31e0f0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-3", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "cccc4c30-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-4", + "version": 0 + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "cb99e6b0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "cc31e0f0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "cccc4c30-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "cd6d2010-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-5", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - get - "cd6d2010-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "cd6d2010-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "ce045700-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-5", + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "cf392d80-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-6", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "cfd3e6e0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-7", + "version": 0 + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": [ + { + "id": "ce045700-db23-11e9-9d24-fb3c1e67cbc1", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "cf392d80-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "cfd3e6e0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d073a950-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-8", + "version": 0 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "d073a950-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "d073a950-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "d10a1cf0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-8", + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "d10a1cf0-db23-11e9-9d24-fb3c1e67cbc1" (6)'] = { + "results": { + "id": "d10a1cf0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "d073a950-db23-11e9-9d24-fb3c1e67cbc1" (7)'] = { + "results": { + "id": "d073a950-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 17:24:09 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d24757e0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-9", + "version": 0 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "d24757e0-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "d24757e0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "d2fac960-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-9", + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "d2fac960-db23-11e9-9d24-fb3c1e67cbc1", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "d24757e0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 17:24:13 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d43d8290-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-10", + "version": 0 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "d43d8290-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "d43d8290-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "d4d57cd0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-10", + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "d43d8290-db23-11e9-9d24-fb3c1e67cbc1" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "d4d57cd0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d6a84100-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-11", + "version": 0 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "d6a84100-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "d6a84100-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "d7406250-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-11", + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "d7406250-db23-11e9-9d24-fb3c1e67cbc1", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "d6a84100-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019 17:24:20 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "d7406250-db23-11e9-9d24-fb3c1e67cbc1" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "d6a84100-db23-11e9-9d24-fb3c1e67cbc1" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": [] +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d9addfe0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-12", + "version": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "d9addfe0-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "d9addfe0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "da467660-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-12", + "version": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "da467660-db23-11e9-9d24-fb3c1e67cbc1", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "d9addfe0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + }, + { + "id": "da467660-db23-11e9-9d24-fb3c1e67cbc1", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson", + "data_sources": [] + } + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "db811940-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-14", + "version": 0 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "db811940-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "db811940-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "dc178ce0-db23-11e9-9d24-fb3c1e67cbc1", + "dcafae30-db23-11e9-9d24-fb3c1e67cbc1" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "dd4e8640-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-14", + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "dd4e8640-db23-11e9-9d24-fb3c1e67cbc1" (7)'] = { + "results": { + "id": "dd4e8640-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "dc178ce0-db23-11e9-9d24-fb3c1e67cbc1", + "dcafae30-db23-11e9-9d24-fb3c1e67cbc1" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "de8bc130-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-16", + "version": 0 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "de8bc130-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "de8bc130-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "df2234d0-db23-11e9-9d24-fb3c1e67cbc1", + "dfba5620-db23-11e9-9d24-fb3c1e67cbc1" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "e057f5b0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-16", + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "e057f5b0-db23-11e9-9d24-fb3c1e67cbc1" (7)'] = { + "results": { + "id": "e057f5b0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "df2234d0-db23-11e9-9d24-fb3c1e67cbc1", + "dfba5620-db23-11e9-9d24-fb3c1e67cbc1" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "e057f5b0-db23-11e9-9d24-fb3c1e67cbc1" (8)'] = { + "results": { + "id": "e057f5b0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "df2234d0-db23-11e9-9d24-fb3c1e67cbc1", + "dfba5620-db23-11e9-9d24-fb3c1e67cbc1" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "e1909cc0-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-16", + "version": 2 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "e1909cc0-db23-11e9-9d24-fb3c1e67cbc1" (11)'] = { + "results": { + "id": "e1909cc0-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571520038171 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "e2ca0720-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-18", + "version": 0 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "e2ca0720-db23-11e9-9d24-fb3c1e67cbc1" (3)'] = { + "results": { + "id": "e2ca0720-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "e3620160-db23-11e9-9d24-fb3c1e67cbc1" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "e3fc4590-db23-11e9-9d24-fb3c1e67cbc1", + "shared_id": "shared-uuid-18", + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "e3fc4590-db23-11e9-9d24-fb3c1e67cbc1" (7)'] = { + "results": { + "id": "e3fc4590-db23-11e9-9d24-fb3c1e67cbc1", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "e3620160-db23-11e9-9d24-fb3c1e67cbc1" + ], + "queue": "\"\"" + } + ], + "created_on": "Thu Sep 19 2019", + "created_by": "mattapperson", + "updated_on": "Thu Sep 19 2019", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["e3620160-db23-11e9-9d24-fb3c1e67cbc1"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8db38b80-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:14:57.839Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:14:57.839Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "8db38b80-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "8db38b80-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:14:57.839Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:14:57.839Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8e6c7b40-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:14:59.054Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:14:59.054Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "8f014130-dbd2-11e9-b79c-9d68546b66f0", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:00.029Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:00.029Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "8f9c6fc0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:01.045Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:01.045Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "8e6c7b40-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:14:59.054Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:14:59.054Z", + "updated_by": "mattapperson" + }, + { + "id": "8f014130-dbd2-11e9-b79c-9d68546b66f0", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:00.029Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:00.029Z", + "updated_by": "mattapperson" + }, + { + "id": "8f9c6fc0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:01.045Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:01.045Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "903eca40-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:02.110Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:02.110Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "903eca40-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "903eca40-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:02.110Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:02.110Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "90d564f0-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:02.110Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:02.110Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "920bc210-dbd2-11e9-b79c-9d68546b66f0", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:05.130Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:05.130Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "92a7db00-dbd2-11e9-b79c-9d68546b66f0", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:06.154Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:06.154Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "90d564f0-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:02.110Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:02.110Z", + "updated_by": "mattapperson" + }, + { + "id": "920bc210-dbd2-11e9-b79c-9d68546b66f0", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:05.130Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:05.130Z", + "updated_by": "mattapperson" + }, + { + "id": "92a7db00-dbd2-11e9-b79c-9d68546b66f0", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:06.154Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:06.154Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "9349e760-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:07.215Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:07.215Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "9349e760-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "9349e760-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:07.215Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:07.215Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "93f6f040-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:07.215Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:07.215Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "93f6f040-dbd2-11e9-b79c-9d68546b66f0" (6)'] = { + "results": { + "id": "93f6f040-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:07.215Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:07.215Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "9349e760-dbd2-11e9-b79c-9d68546b66f0" (7)'] = { + "results": { + "id": "9349e760-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:07.215Z", + "created_by": "mattapperson", + "updated_on": "Fri Sep 20 2019 14:15:09 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "95353ca0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:10.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:10.436Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "95353ca0-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "95353ca0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:10.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:10.436Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "95cb1400-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:10.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:10.436Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "95cb1400-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:10.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:10.436Z", + "updated_by": "mattapperson" + }, + { + "id": "95353ca0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:10.436Z", + "created_by": "mattapperson", + "updated_on": "Fri Sep 20 2019 14:15:12 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "97062c10-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:13.482Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:13.482Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "97062c10-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "97062c10-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:13.482Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:13.482Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "979c2a80-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:13.482Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:13.482Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "97062c10-dbd2-11e9-b79c-9d68546b66f0" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "979c2a80-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:13.482Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:13.482Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "99735b80-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:17.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:17.551Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "99735b80-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "99735b80-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:17.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:17.551Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "9a07ac40-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:17.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:17.551Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "9a07ac40-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:17.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:17.551Z", + "updated_by": "mattapperson" + }, + { + "id": "99735b80-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:17.551Z", + "created_by": "mattapperson", + "updated_on": "Fri Sep 20 2019 14:15:19 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "9a07ac40-dbd2-11e9-b79c-9d68546b66f0" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "99735b80-dbd2-11e9-b79c-9d68546b66f0" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "9c7bb980-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:22.641Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:22.641Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "9c7bb980-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "9c7bb980-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:22.641Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:22.641Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "9d145000-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-20T18:15:22.641Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:22.641Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "9d145000-dbd2-11e9-b79c-9d68546b66f0", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": { + "items": [ + { + "id": "9c7bb980-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:22.641Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:22.641Z", + "updated_by": "mattapperson" + }, + { + "id": "9d145000-dbd2-11e9-b79c-9d68546b66f0", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-20T18:15:22.641Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:22.641Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 2 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "9e518af0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:25.720Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:25.720Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "9e518af0-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "9e518af0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:25.720Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:25.720Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "9ee76250-dbd2-11e9-b79c-9d68546b66f0", + "9f7e4b20-dbd2-11e9-b79c-9d68546b66f0" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "a01dbf70-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "9ee76250-dbd2-11e9-b79c-9d68546b66f0", + "9f7e4b20-dbd2-11e9-b79c-9d68546b66f0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-20T18:15:25.720Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:25.720Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "a01dbf70-dbd2-11e9-b79c-9d68546b66f0" (7)'] = { + "results": { + "id": "a01dbf70-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "9ee76250-dbd2-11e9-b79c-9d68546b66f0", + "9f7e4b20-dbd2-11e9-b79c-9d68546b66f0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-20T18:15:25.720Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:25.720Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "a15a8530-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:30.807Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:30.807Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "a15a8530-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "a15a8530-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:30.807Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:30.807Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "a1f31bb0-dbd2-11e9-b79c-9d68546b66f0", + "a28a0480-dbd2-11e9-b79c-9d68546b66f0" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "a3277d00-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "a1f31bb0-dbd2-11e9-b79c-9d68546b66f0", + "a28a0480-dbd2-11e9-b79c-9d68546b66f0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-20T18:15:30.807Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:30.807Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "a3277d00-dbd2-11e9-b79c-9d68546b66f0" (7)'] = { + "results": { + "id": "a3277d00-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "a1f31bb0-dbd2-11e9-b79c-9d68546b66f0", + "a28a0480-dbd2-11e9-b79c-9d68546b66f0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-20T18:15:30.807Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:30.807Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "a3277d00-dbd2-11e9-b79c-9d68546b66f0" (8)'] = { + "results": { + "id": "a3277d00-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "a1f31bb0-dbd2-11e9-b79c-9d68546b66f0", + "a28a0480-dbd2-11e9-b79c-9d68546b66f0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-20T18:15:30.807Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:30.807Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "a461aab0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:30.807Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:30.807Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "a461aab0-dbd2-11e9-b79c-9d68546b66f0" (11)'] = { + "results": { + "id": "a461aab0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:30.807Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:30.807Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571595264018 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "a59d8610-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:37.962Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:37.963Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "a59d8610-dbd2-11e9-b79c-9d68546b66f0" (3)'] = { + "results": { + "id": "a59d8610-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T18:15:37.962Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:37.963Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "a6346ee0-dbd2-11e9-b79c-9d68546b66f0" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "a6cda1a0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "a6346ee0-dbd2-11e9-b79c-9d68546b66f0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-20T18:15:37.962Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:37.963Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "a6cda1a0-dbd2-11e9-b79c-9d68546b66f0" (7)'] = { + "results": { + "id": "a6cda1a0-dbd2-11e9-b79c-9d68546b66f0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "a6346ee0-dbd2-11e9-b79c-9d68546b66f0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-20T18:15:37.962Z", + "created_by": "mattapperson", + "updated_on": "2019-09-20T18:15:37.963Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["a6346ee0-dbd2-11e9-b79c-9d68546b66f0"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d50fc790-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.346Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:29.346Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "d50fc790-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "d50fc790-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.346Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:29.346Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.296Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:25:29.296Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (2)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.296Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:25:29.296Z", + "updated_by": "kibana" + }, + { + "id": "d50fc790-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.346Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:29.346Z", + "updated_by": "mattapperson" + } + ], + "total": 2 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d5865720-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:30.124Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:30.124Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "d61b1d10-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:31.100Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:31.100Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "d6b699c0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:32.118Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:32.118Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.296Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:25:29.296Z", + "updated_by": "kibana" + }, + { + "id": "d50fc790-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.346Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:29.346Z", + "updated_by": "mattapperson" + }, + { + "id": "d5865720-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:30.124Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:30.124Z", + "updated_by": "mattapperson" + }, + { + "id": "d61b1d10-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:31.100Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:31.100Z", + "updated_by": "mattapperson" + }, + { + "id": "d6b699c0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:32.118Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:32.118Z", + "updated_by": "mattapperson" + } + ], + "total": 5 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "d7560e10-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:33.163Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:33.163Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "d7560e10-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "d7560e10-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:33.163Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:33.163Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "d7f00420-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:33.163Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:33.163Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "d9411530-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:36.382Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:36.382Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "d9dda350-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:37.407Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:37.407Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.296Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:25:29.296Z", + "updated_by": "kibana" + }, + { + "id": "d50fc790-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.346Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:29.346Z", + "updated_by": "mattapperson" + }, + { + "id": "d5865720-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:30.124Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:30.124Z", + "updated_by": "mattapperson" + }, + { + "id": "d61b1d10-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:31.100Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:31.100Z", + "updated_by": "mattapperson" + }, + { + "id": "d6b699c0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:32.118Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:32.118Z", + "updated_by": "mattapperson" + }, + { + "id": "d7f00420-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:33.163Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:33.163Z", + "updated_by": "mattapperson" + }, + { + "id": "d9411530-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:36.382Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:36.382Z", + "updated_by": "mattapperson" + }, + { + "id": "d9dda350-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:37.407Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:37.407Z", + "updated_by": "mattapperson" + } + ], + "total": 9 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "da7a7f90-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:38.430Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:38.430Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "da7a7f90-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "da7a7f90-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:38.430Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:38.430Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "db1279d0-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:38.430Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:38.430Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "db1279d0-df11-11e9-a59e-f7f6643e4dbf" (6)'] = { + "results": { + "id": "db1279d0-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:38.430Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:38.430Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "da7a7f90-df11-11e9-a59e-f7f6643e4dbf" (7)'] = { + "results": { + "id": "da7a7f90-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:38.430Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:25:40 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "dc4c5960-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:41.488Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:41.488Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "dc4c5960-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "dc4c5960-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:41.488Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:41.488Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "dce67680-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:41.488Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:41.488Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "dce67680-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:41.488Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:41.488Z", + "updated_by": "mattapperson" + }, + { + "id": "dc4c5960-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:41.488Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:25:43 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "de39aa70-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:44.721Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:44.721Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "de39aa70-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "de39aa70-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:44.721Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:44.721Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "ded35260-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:44.721Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:44.721Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "de39aa70-df11-11e9-a59e-f7f6643e4dbf" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "ded35260-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:44.721Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:44.721Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "e0a86080-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:48.802Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:48.802Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "e0a86080-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "e0a86080-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:48.802Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:48.802Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "e1425690-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:48.802Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:48.802Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "e1425690-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:48.802Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:48.802Z", + "updated_by": "mattapperson" + }, + { + "id": "e0a86080-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:48.802Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:25:50 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "e1425690-df11-11e9-a59e-f7f6643e4dbf" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "e0a86080-df11-11e9-a59e-f7f6643e4dbf" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [ + { + "id": "d61b1d10-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:31.100Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:31.100Z", + "updated_by": "mattapperson" + }, + { + "id": "d5865720-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:30.124Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:30.124Z", + "updated_by": "mattapperson" + }, + { + "id": "d7f00420-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:33.163Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:33.163Z", + "updated_by": "mattapperson" + }, + { + "id": "d6b699c0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:32.118Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:32.118Z", + "updated_by": "mattapperson" + }, + { + "id": "d9411530-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:36.382Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:36.382Z", + "updated_by": "mattapperson" + }, + { + "id": "d9dda350-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:37.407Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:37.407Z", + "updated_by": "mattapperson" + }, + { + "id": "d50fc790-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.346Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:29.346Z", + "updated_by": "mattapperson" + }, + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.296Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:25:29.296Z", + "updated_by": "kibana" + }, + { + "id": "db1279d0-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:38.430Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:38.430Z", + "updated_by": "mattapperson" + }, + { + "id": "dce67680-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:41.488Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:41.488Z", + "updated_by": "mattapperson" + }, + { + "id": "ded35260-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:44.721Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:44.721Z", + "updated_by": "mattapperson" + } + ], + "total": 14 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "e3b02240-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:53.886Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:53.886Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "e3b02240-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "e3b02240-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:53.886Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:53.886Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "e4492df0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:25:53.886Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:53.886Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "e4492df0-df11-11e9-a59e-f7f6643e4dbf", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": { + "items": [ + { + "id": "d61b1d10-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:31.100Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:31.100Z", + "updated_by": "mattapperson" + }, + { + "id": "d5865720-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:30.124Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:30.124Z", + "updated_by": "mattapperson" + }, + { + "id": "d7f00420-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:33.163Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:33.163Z", + "updated_by": "mattapperson" + }, + { + "id": "d6b699c0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:32.118Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:32.118Z", + "updated_by": "mattapperson" + }, + { + "id": "d9411530-df11-11e9-a59e-f7f6643e4dbf", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:36.382Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:36.382Z", + "updated_by": "mattapperson" + }, + { + "id": "d9dda350-df11-11e9-a59e-f7f6643e4dbf", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:37.407Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:37.407Z", + "updated_by": "mattapperson" + }, + { + "id": "d50fc790-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.346Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:29.346Z", + "updated_by": "mattapperson" + }, + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:29.296Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:25:29.296Z", + "updated_by": "kibana" + }, + { + "id": "db1279d0-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:38.430Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:38.430Z", + "updated_by": "mattapperson" + }, + { + "id": "dce67680-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:41.488Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:41.488Z", + "updated_by": "mattapperson" + }, + { + "id": "ded35260-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:44.721Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:44.721Z", + "updated_by": "mattapperson" + }, + { + "id": "e3b02240-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:53.886Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:53.886Z", + "updated_by": "mattapperson" + }, + { + "id": "e4492df0-df11-11e9-a59e-f7f6643e4dbf", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:25:53.886Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:53.886Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 16 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "e58641d0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:56.967Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:56.967Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "e58641d0-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "e58641d0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:25:56.967Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:56.967Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "e61fc2b0-df11-11e9-a59e-f7f6643e4dbf", + "e6b80b10-df11-11e9-a59e-f7f6643e4dbf" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "e755d1b0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "e61fc2b0-df11-11e9-a59e-f7f6643e4dbf", + "e6b80b10-df11-11e9-a59e-f7f6643e4dbf" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:25:56.967Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:56.967Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "e755d1b0-df11-11e9-a59e-f7f6643e4dbf" (7)'] = { + "results": { + "id": "e755d1b0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "e61fc2b0-df11-11e9-a59e-f7f6643e4dbf", + "e6b80b10-df11-11e9-a59e-f7f6643e4dbf" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:25:56.967Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:25:56.967Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "e88f1500-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:26:02.058Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:02.058Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "e88f1500-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "e88f1500-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:26:02.058Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:02.058Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "e929ce60-df11-11e9-a59e-f7f6643e4dbf", + "e9bfccd0-df11-11e9-a59e-f7f6643e4dbf" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "ea5ef300-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "e929ce60-df11-11e9-a59e-f7f6643e4dbf", + "e9bfccd0-df11-11e9-a59e-f7f6643e4dbf" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:26:02.058Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:02.058Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "ea5ef300-df11-11e9-a59e-f7f6643e4dbf" (7)'] = { + "results": { + "id": "ea5ef300-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "e929ce60-df11-11e9-a59e-f7f6643e4dbf", + "e9bfccd0-df11-11e9-a59e-f7f6643e4dbf" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:26:02.058Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:02.058Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "ea5ef300-df11-11e9-a59e-f7f6643e4dbf" (8)'] = { + "results": { + "id": "ea5ef300-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "e929ce60-df11-11e9-a59e-f7f6643e4dbf", + "e9bfccd0-df11-11e9-a59e-f7f6643e4dbf" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:26:02.058Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:02.058Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "eb963a80-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:26:02.058Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:02.058Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "eb963a80-df11-11e9-a59e-f7f6643e4dbf" (11)'] = { + "results": { + "id": "eb963a80-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:26:02.058Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:02.058Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952305836 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "eccf2fb0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:26:09.188Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:09.188Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "eccf2fb0-df11-11e9-a59e-f7f6643e4dbf" (3)'] = { + "results": { + "id": "eccf2fb0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:26:09.188Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:09.188Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "ed70edf0-df11-11e9-a59e-f7f6643e4dbf" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "ee02cdb0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "ed70edf0-df11-11e9-a59e-f7f6643e4dbf" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:26:09.188Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:09.188Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "ee02cdb0-df11-11e9-a59e-f7f6643e4dbf" (7)'] = { + "results": { + "id": "ee02cdb0-df11-11e9-a59e-f7f6643e4dbf", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "ed70edf0-df11-11e9-a59e-f7f6643e4dbf" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:26:09.188Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:26:09.188Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["ed70edf0-df11-11e9-a59e-f7f6643e4dbf"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "18797850-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:22.442Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:22.442Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "18797850-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "18797850-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:22.442Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:22.442Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:23.994Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:27:23.994Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:23.994Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:27:23.994Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "19fc20b0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:24.981Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:24.981Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "1a93a5c0-df12-11e9-97e5-17bda8500ff2", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:25.968Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:25.968Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "1b2fe5c0-df12-11e9-97e5-17bda8500ff2", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:26.996Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:26.996Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "19fc20b0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:24.981Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:24.981Z", + "updated_by": "mattapperson" + }, + { + "id": "1a93a5c0-df12-11e9-97e5-17bda8500ff2", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:25.968Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:25.968Z", + "updated_by": "mattapperson" + }, + { + "id": "1b2fe5c0-df12-11e9-97e5-17bda8500ff2", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:26.996Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:26.996Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1bd26750-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:28.061Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:28.061Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "1bd26750-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "1bd26750-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:28.061Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:28.061Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "1c699e40-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:28.061Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:28.061Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "1d9ffb60-df12-11e9-97e5-17bda8500ff2", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:31.088Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:31.088Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "1e3adbd0-df12-11e9-97e5-17bda8500ff2", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:32.102Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:32.102Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "1c699e40-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:28.061Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:28.061Z", + "updated_by": "mattapperson" + }, + { + "id": "1d9ffb60-df12-11e9-97e5-17bda8500ff2", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:31.088Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:31.088Z", + "updated_by": "mattapperson" + }, + { + "id": "1e3adbd0-df12-11e9-97e5-17bda8500ff2", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:32.102Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:32.102Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1edff570-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:33.181Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:33.181Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "1edff570-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "1edff570-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:33.181Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:33.181Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "1f7de320-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:33.181Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:33.181Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "1f7de320-df12-11e9-97e5-17bda8500ff2" (6)'] = { + "results": { + "id": "1f7de320-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:33.181Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:33.181Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "1edff570-df12-11e9-97e5-17bda8500ff2" (7)'] = { + "results": { + "id": "1edff570-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:33.181Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:27:35 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "20d1b350-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:36.442Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:36.442Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "20d1b350-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "20d1b350-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:36.442Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:36.442Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "214cd6c0-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:36.442Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:36.442Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "214cd6c0-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:36.442Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:36.442Z", + "updated_by": "mattapperson" + }, + { + "id": "20d1b350-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:36.442Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:27:38 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "229f2050-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:39.470Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:39.470Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "229f2050-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "229f2050-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:39.470Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:39.470Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "23365740-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:39.470Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:39.470Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "229f2050-df12-11e9-97e5-17bda8500ff2" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "23365740-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:39.470Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:39.470Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "250c9de0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:43.541Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:43.541Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "250c9de0-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "250c9de0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:43.541Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:43.541Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "25a693f0-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:43.541Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:43.541Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "25a693f0-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:43.541Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:43.541Z", + "updated_by": "mattapperson" + }, + { + "id": "250c9de0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:43.541Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:27:45 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "25a693f0-df12-11e9-97e5-17bda8500ff2" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "250c9de0-df12-11e9-97e5-17bda8500ff2" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2815bf30-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:48.636Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:48.636Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "2815bf30-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "2815bf30-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:48.636Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:48.636Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "28aecae0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:27:48.636Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:48.636Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "28aecae0-df12-11e9-97e5-17bda8500ff2", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": { + "items": [ + { + "id": "2815bf30-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:48.636Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:48.636Z", + "updated_by": "mattapperson" + }, + { + "id": "28aecae0-df12-11e9-97e5-17bda8500ff2", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:27:48.636Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:48.636Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 2 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "29ec2ce0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:51.719Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:51.719Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "29ec2ce0-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "29ec2ce0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:51.719Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:51.719Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "2a820440-df12-11e9-97e5-17bda8500ff2", + "2b1c2160-df12-11e9-97e5-17bda8500ff2" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "2bba3620-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2a820440-df12-11e9-97e5-17bda8500ff2", + "2b1c2160-df12-11e9-97e5-17bda8500ff2" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:27:51.719Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:51.719Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "2bba3620-df12-11e9-97e5-17bda8500ff2" (7)'] = { + "results": { + "id": "2bba3620-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2a820440-df12-11e9-97e5-17bda8500ff2", + "2b1c2160-df12-11e9-97e5-17bda8500ff2" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:27:51.719Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:51.719Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2cf79820-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:56.827Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:56.827Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "2cf79820-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "2cf79820-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:56.827Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:56.827Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "2d8e80f0-df12-11e9-97e5-17bda8500ff2", + "2e2590d0-df12-11e9-97e5-17bda8500ff2" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "2ec41ac0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2d8e80f0-df12-11e9-97e5-17bda8500ff2", + "2e2590d0-df12-11e9-97e5-17bda8500ff2" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:27:56.827Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:56.827Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "2ec41ac0-df12-11e9-97e5-17bda8500ff2" (7)'] = { + "results": { + "id": "2ec41ac0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2d8e80f0-df12-11e9-97e5-17bda8500ff2", + "2e2590d0-df12-11e9-97e5-17bda8500ff2" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:27:56.827Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:56.827Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "2ec41ac0-df12-11e9-97e5-17bda8500ff2" (8)'] = { + "results": { + "id": "2ec41ac0-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2d8e80f0-df12-11e9-97e5-17bda8500ff2", + "2e2590d0-df12-11e9-97e5-17bda8500ff2" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:27:56.827Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:56.827Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "2ffbfe80-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:56.827Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:56.827Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "2ffbfe80-df12-11e9-97e5-17bda8500ff2" (11)'] = { + "results": { + "id": "2ffbfe80-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:27:56.827Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:27:56.827Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952422627 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "31384f10-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:28:03.961Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:28:03.961Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "31384f10-df12-11e9-97e5-17bda8500ff2" (3)'] = { + "results": { + "id": "31384f10-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:28:03.961Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:28:03.961Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "31cfd420-df12-11e9-97e5-17bda8500ff2" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "326a1850-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "31cfd420-df12-11e9-97e5-17bda8500ff2" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:28:03.961Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:28:03.961Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "326a1850-df12-11e9-97e5-17bda8500ff2" (7)'] = { + "results": { + "id": "326a1850-df12-11e9-97e5-17bda8500ff2", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "31cfd420-df12-11e9-97e5-17bda8500ff2" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:28:03.961Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:28:03.961Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["31cfd420-df12-11e9-97e5-17bda8500ff2"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8668c7d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:26.874Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:26.874Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "8668c7d0-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "8668c7d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:26.874Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:26.874Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:27.668Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:30:27.668Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:27.668Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:30:27.668Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:28.736Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:30:28.736Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:28.736Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:30:28.736Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:28.736Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:30:28.736Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "881406d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:29.686Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:29.686Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "88a83080-df12-11e9-8ad6-0b7b85fefae5", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:30.652Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:30.652Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "8944bea0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:31.681Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:31.681Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "881406d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:29.686Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:29.686Z", + "updated_by": "mattapperson" + }, + { + "id": "88a83080-df12-11e9-8ad6-0b7b85fefae5", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:30.652Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:30.652Z", + "updated_by": "mattapperson" + }, + { + "id": "8944bea0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:31.681Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:31.681Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "89e5e0a0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:32.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:32.739Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "89e5e0a0-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "89e5e0a0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:32.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:32.739Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "8a8a0fe0-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:32.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:32.739Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "8bdc3260-df12-11e9-8ad6-0b7b85fefae5", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:36.030Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:36.030Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "8c7712d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:37.045Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:37.045Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "8a8a0fe0-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:32.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:32.739Z", + "updated_by": "mattapperson" + }, + { + "id": "8bdc3260-df12-11e9-8ad6-0b7b85fefae5", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:36.030Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:36.030Z", + "updated_by": "mattapperson" + }, + { + "id": "8c7712d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:37.045Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:37.045Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8d1faee0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:38.150Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:38.150Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "8d1faee0-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "8d1faee0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:38.150Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:38.150Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "8db7d030-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:38.150Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:38.150Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "8db7d030-df12-11e9-8ad6-0b7b85fefae5" (6)'] = { + "results": { + "id": "8db7d030-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:38.150Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:38.150Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "8d1faee0-df12-11e9-8ad6-0b7b85fefae5" (7)'] = { + "results": { + "id": "8d1faee0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:38.150Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:30:40 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "8ef33660-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:41.214Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:41.214Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "8ef33660-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "8ef33660-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:41.214Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:41.214Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "8f8675b0-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:41.214Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:41.214Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "8f8675b0-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:41.214Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:41.214Z", + "updated_by": "mattapperson" + }, + { + "id": "8ef33660-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:41.214Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:30:43 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "90c49b00-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:44.264Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:44.264Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "90c49b00-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "90c49b00-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:44.264Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:44.264Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "91598800-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:44.264Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:44.264Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "90c49b00-df12-11e9-8ad6-0b7b85fefae5" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "91598800-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:44.264Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:44.264Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "9332b4d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:48.339Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:48.339Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "9332b4d0-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "9332b4d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:48.339Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:48.339Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "93c77ac0-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:48.339Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:48.339Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "93c77ac0-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:48.339Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:48.339Z", + "updated_by": "mattapperson" + }, + { + "id": "9332b4d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:48.339Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:30:50 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "93c77ac0-df12-11e9-8ad6-0b7b85fefae5" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "9332b4d0-df12-11e9-8ad6-0b7b85fefae5" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "9638a1d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:53.413Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.413Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "963c7260-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:53.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.436Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "9638a1d0-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "9638a1d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:53.413Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.413Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "963c7260-df12-11e9-8ad6-0b7b85fefae5" (4)'] = { + "results": { + "id": "963c7260-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:53.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.436Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "96d1d490-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:30:53.413Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.413Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (6)'] = { + "results": [ + "96d35b30-df12-11e9-8ad6-0b7b85fefae5", + "9769ced0-df12-11e9-8ad6-0b7b85fefae5" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"foo","description":"description"} (7)'] = { + "results": { + "id": "96d1d490-df12-11e9-8ad6-0b7b85fefae5", + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [ + { + "id": "9638a1d0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:53.413Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.413Z", + "updated_by": "mattapperson" + }, + { + "id": "963c7260-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:53.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.436Z", + "updated_by": "mattapperson" + }, + { + "id": "96d1d490-df12-11e9-8ad6-0b7b85fefae5", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-15", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:30:53.413Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.413Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 3 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (8)'] = { + "results": { + "id": "980a0670-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "96d35b30-df12-11e9-8ad6-0b7b85fefae5", + "9769ced0-df12-11e9-8ad6-0b7b85fefae5" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:30:53.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.436Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "980a0670-df12-11e9-8ad6-0b7b85fefae5" (11)'] = { + "results": { + "id": "980a0670-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "96d35b30-df12-11e9-8ad6-0b7b85fefae5", + "9769ced0-df12-11e9-8ad6-0b7b85fefae5" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:30:53.436Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:53.436Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "99491620-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:58.554Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:58.554Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "99491620-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "99491620-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:58.554Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:58.554Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "99de9f60-df12-11e9-8ad6-0b7b85fefae5", + "9a749dd0-df12-11e9-8ad6-0b7b85fefae5" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "9b146040-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "99de9f60-df12-11e9-8ad6-0b7b85fefae5", + "9a749dd0-df12-11e9-8ad6-0b7b85fefae5" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:30:58.554Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:58.554Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "9b146040-df12-11e9-8ad6-0b7b85fefae5" (7)'] = { + "results": { + "id": "9b146040-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "99de9f60-df12-11e9-8ad6-0b7b85fefae5", + "9a749dd0-df12-11e9-8ad6-0b7b85fefae5" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:30:58.554Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:58.554Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "9b146040-df12-11e9-8ad6-0b7b85fefae5" (8)'] = { + "results": { + "id": "9b146040-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "99de9f60-df12-11e9-8ad6-0b7b85fefae5", + "9a749dd0-df12-11e9-8ad6-0b7b85fefae5" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:30:58.554Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:58.554Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "9c4b80b0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:58.554Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:58.554Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "9c4b80b0-df12-11e9-8ad6-0b7b85fefae5" (11)'] = { + "results": { + "id": "9c4b80b0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:30:58.554Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:30:58.554Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952607708 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "9d8b53b0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:31:05.699Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:31:05.699Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "9d8b53b0-df12-11e9-8ad6-0b7b85fefae5" (3)'] = { + "results": { + "id": "9d8b53b0-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:31:05.699Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:31:05.699Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "9e1fa470-df12-11e9-8ad6-0b7b85fefae5" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "9eb8fe40-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "9e1fa470-df12-11e9-8ad6-0b7b85fefae5" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:31:05.699Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:31:05.699Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "9eb8fe40-df12-11e9-8ad6-0b7b85fefae5" (7)'] = { + "results": { + "id": "9eb8fe40-df12-11e9-8ad6-0b7b85fefae5", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "9e1fa470-df12-11e9-8ad6-0b7b85fefae5" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:31:05.699Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:31:05.699Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["9e1fa470-df12-11e9-8ad6-0b7b85fefae5"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "27cb0520-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:34:57.637Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:34:57.637Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "27cb0520-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "27cb0520-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:34:57.637Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:34:57.637Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:34:58.404Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:34:58.404Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:34:58.404Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:34:58.404Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:34:59.395Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:34:59.395Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:34:59.395Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:34:59.395Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:34:59.395Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:34:59.395Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "29709ed0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:00.404Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:00.404Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "2a0516a0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:01.377Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:01.377Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "2aa10880-df13-11e9-a2c4-67809dd3e5d4", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:02.399Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:02.399Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "29709ed0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:00.404Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:00.404Z", + "updated_by": "mattapperson" + }, + { + "id": "2a0516a0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:01.377Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:01.377Z", + "updated_by": "mattapperson" + }, + { + "id": "2aa10880-df13-11e9-a2c4-67809dd3e5d4", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:02.399Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:02.399Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2b422a80-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:03.456Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:03.456Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "2b422a80-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "2b422a80-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:03.456Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:03.456Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "2bd7dad0-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:03.456Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:03.456Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "2d0e5f00-df13-11e9-a2c4-67809dd3e5d4", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:06.471Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:06.471Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "2daac610-df13-11e9-a2c4-67809dd3e5d4", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:07.494Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:07.494Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "2bd7dad0-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:03.456Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:03.456Z", + "updated_by": "mattapperson" + }, + { + "id": "2d0e5f00-df13-11e9-a2c4-67809dd3e5d4", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:06.471Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:06.471Z", + "updated_by": "mattapperson" + }, + { + "id": "2daac610-df13-11e9-a2c4-67809dd3e5d4", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:07.494Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:07.494Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2e4a6170-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:08.542Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:08.542Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "2e4a6170-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "2e4a6170-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:08.542Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:08.542Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "2ee20d90-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:08.542Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:08.542Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "2ee20d90-df13-11e9-a2c4-67809dd3e5d4" (6)'] = { + "results": { + "id": "2ee20d90-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:08.542Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:08.542Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "2e4a6170-df13-11e9-a2c4-67809dd3e5d4" (7)'] = { + "results": { + "id": "2e4a6170-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:08.542Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:35:10 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "301e8530-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:11.608Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:11.608Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "301e8530-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "301e8530-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:11.608Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:11.608Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "30b2aee0-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:11.608Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:11.608Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "30b2aee0-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:11.608Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:11.608Z", + "updated_by": "mattapperson" + }, + { + "id": "301e8530-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:11.608Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:35:13 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "31ee8a40-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:14.649Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:14.649Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "31ee8a40-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "31ee8a40-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:14.649Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:14.649Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "32863660-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:14.649Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:14.649Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "31ee8a40-df13-11e9-a2c4-67809dd3e5d4" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "32863660-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:14.649Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:14.649Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "345fb150-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:18.748Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:18.748Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "345fb150-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "345fb150-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:18.748Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:18.748Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "34f3b3f0-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:18.748Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:18.748Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "34f3b3f0-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:18.748Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:18.748Z", + "updated_by": "mattapperson" + }, + { + "id": "345fb150-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:18.748Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:35:20 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "34f3b3f0-df13-11e9-a2c4-67809dd3e5d4" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "345fb150-df13-11e9-a2c4-67809dd3e5d4" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "376417b0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:23.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.810Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "3766fde0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:23.829Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.829Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "376417b0-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "376417b0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:23.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.810Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "3766fde0-df13-11e9-a2c4-67809dd3e5d4" (4)'] = { + "results": { + "id": "3766fde0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:23.829Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.829Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "37fe0dc0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:35:23.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.810Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (6)'] = { + "results": [ + "380030a0-df13-11e9-a2c4-67809dd3e5d4", + "38951da0-df13-11e9-a2c4-67809dd3e5d4" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"foo","description":"description"} (7)'] = { + "results": { + "id": "37fe0dc0-df13-11e9-a2c4-67809dd3e5d4", + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [ + { + "id": "376417b0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:23.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.810Z", + "updated_by": "mattapperson" + }, + { + "id": "3766fde0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:23.829Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.829Z", + "updated_by": "mattapperson" + }, + { + "id": "37fe0dc0-df13-11e9-a2c4-67809dd3e5d4", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-15", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:35:23.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.810Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 3 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (8)'] = { + "results": { + "id": "39313690-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "380030a0-df13-11e9-a2c4-67809dd3e5d4", + "38951da0-df13-11e9-a2c4-67809dd3e5d4" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:35:23.829Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.829Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "39313690-df13-11e9-a2c4-67809dd3e5d4" (11)'] = { + "results": { + "id": "39313690-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "380030a0-df13-11e9-a2c4-67809dd3e5d4", + "38951da0-df13-11e9-a2c4-67809dd3e5d4" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:35:23.829Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:23.829Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "3a701f30-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:28.922Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:28.922Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "3a701f30-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "3a701f30-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:28.922Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:28.922Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "3b0644b0-df13-11e9-a2c4-67809dd3e5d4", + "3b9c1c10-df13-11e9-a2c4-67809dd3e5d4" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "3c3af420-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "3b0644b0-df13-11e9-a2c4-67809dd3e5d4", + "3b9c1c10-df13-11e9-a2c4-67809dd3e5d4" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:35:28.922Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:28.922Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "3c3af420-df13-11e9-a2c4-67809dd3e5d4" (7)'] = { + "results": { + "id": "3c3af420-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "3b0644b0-df13-11e9-a2c4-67809dd3e5d4", + "3b9c1c10-df13-11e9-a2c4-67809dd3e5d4" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:35:28.922Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:28.922Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "3c3af420-df13-11e9-a2c4-67809dd3e5d4" (8)'] = { + "results": { + "id": "3c3af420-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "3b0644b0-df13-11e9-a2c4-67809dd3e5d4", + "3b9c1c10-df13-11e9-a2c4-67809dd3e5d4" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:35:28.922Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:28.922Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "3d741060-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:28.922Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:28.922Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "3d741060-df13-11e9-a2c4-67809dd3e5d4" (11)'] = { + "results": { + "id": "3d741060-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:28.922Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:28.922Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952876464 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "3eaf9da0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:36.050Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:36.050Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "3eaf9da0-df13-11e9-a2c4-67809dd3e5d4" (3)'] = { + "results": { + "id": "3eaf9da0-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:35:36.050Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:36.050Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "3f63f980-df13-11e9-a2c4-67809dd3e5d4" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "3ffd2c40-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "3f63f980-df13-11e9-a2c4-67809dd3e5d4" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:35:36.050Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:36.050Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "3ffd2c40-df13-11e9-a2c4-67809dd3e5d4" (7)'] = { + "results": { + "id": "3ffd2c40-df13-11e9-a2c4-67809dd3e5d4", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "3f63f980-df13-11e9-a2c4-67809dd3e5d4" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:35:36.050Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:35:36.050Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["3f63f980-df13-11e9-a2c4-67809dd3e5d4"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "61db85a0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:35.019Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:35.019Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "61db85a0-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "61db85a0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:35.019Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:35.019Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:36.738Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:36:36.738Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:36.738Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:36:36.738Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:37.742Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:36:37.742Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:37.742Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:36:37.742Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:37.742Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:36:37.742Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "64103ff0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:38.757Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:38.757Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "64a490b0-df13-11e9-9522-67c9a8309146", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:39.729Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:39.729Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "6540f7c0-df13-11e9-9522-67c9a8309146", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:40.750Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:40.750Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "64103ff0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:38.757Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:38.757Z", + "updated_by": "mattapperson" + }, + { + "id": "64a490b0-df13-11e9-9522-67c9a8309146", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:39.729Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:39.729Z", + "updated_by": "mattapperson" + }, + { + "id": "6540f7c0-df13-11e9-9522-67c9a8309146", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:40.750Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:40.750Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "65e240d0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:41.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:41.810Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "65e240d0-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "65e240d0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:41.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:41.810Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "6678b470-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:41.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:41.810Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "67c1d640-df13-11e9-9522-67c9a8309146", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:44.953Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:44.953Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "685cb6b0-df13-11e9-9522-67c9a8309146", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:45.969Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:45.969Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "6678b470-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:41.810Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:41.810Z", + "updated_by": "mattapperson" + }, + { + "id": "67c1d640-df13-11e9-9522-67c9a8309146", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:44.953Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:44.953Z", + "updated_by": "mattapperson" + }, + { + "id": "685cb6b0-df13-11e9-9522-67c9a8309146", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:45.969Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:45.969Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6909e6a0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:47.073Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:47.073Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "6909e6a0-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "6909e6a0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:47.073Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:47.073Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "69973280-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:47.073Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:47.073Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "69973280-df13-11e9-9522-67c9a8309146" (6)'] = { + "results": { + "id": "69973280-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:47.073Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:47.073Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "6909e6a0-df13-11e9-9522-67c9a8309146" (7)'] = { + "results": { + "id": "6909e6a0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:47.073Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:36:49 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6af22ea0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:50.301Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:50.301Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "6af22ea0-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "6af22ea0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:50.301Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:50.301Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "6b8b8870-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:50.301Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:50.301Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "6b8b8870-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:50.301Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:50.301Z", + "updated_by": "mattapperson" + }, + { + "id": "6af22ea0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:50.301Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:36:52 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6cc763d0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:53.377Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:53.377Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "6cc763d0-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "6cc763d0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:53.377Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:53.377Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "6d5d3b30-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:53.377Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:53.377Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "6cc763d0-df13-11e9-9522-67c9a8309146" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "6d5d3b30-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:53.377Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:53.377Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6f36dd30-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:57.464Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:57.464Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "6f36dd30-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "6f36dd30-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:57.464Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:57.464Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "6fcb2df0-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:57.464Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:57.464Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "6fcb2df0-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:57.464Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:36:57.464Z", + "updated_by": "mattapperson" + }, + { + "id": "6f36dd30-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:36:57.464Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:36:59 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "6fcb2df0-df13-11e9-9522-67c9a8309146" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "6f36dd30-df13-11e9-9522-67c9a8309146" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "723bb8c0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:02.529Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.529Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "723eed10-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:02.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.551Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "723bb8c0-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "723bb8c0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:02.529Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.529Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "723eed10-df13-11e9-9522-67c9a8309146" (4)'] = { + "results": { + "id": "723eed10-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:02.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.551Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "72d73570-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:37:02.529Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.529Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (6)'] = { + "results": [ + "72d93140-df13-11e9-9522-67c9a8309146", + "736b1100-df13-11e9-9522-67c9a8309146" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"foo","description":"description"} (7)'] = { + "results": { + "id": "72d73570-df13-11e9-9522-67c9a8309146", + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [ + { + "id": "723bb8c0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:02.529Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.529Z", + "updated_by": "mattapperson" + }, + { + "id": "723eed10-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:02.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.551Z", + "updated_by": "mattapperson" + }, + { + "id": "72d73570-df13-11e9-9522-67c9a8309146", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-15", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:37:02.529Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.529Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 3 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (8)'] = { + "results": { + "id": "7405f170-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "72d93140-df13-11e9-9522-67c9a8309146", + "736b1100-df13-11e9-9522-67c9a8309146" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:37:02.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.551Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "7405f170-df13-11e9-9522-67c9a8309146" (11)'] = { + "results": { + "id": "7405f170-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "72d93140-df13-11e9-9522-67c9a8309146", + "736b1100-df13-11e9-9522-67c9a8309146" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:37:02.551Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:02.551Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "75488390-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:07.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:07.645Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "75488390-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "75488390-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:07.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:07.645Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "75dde5c0-df13-11e9-9522-67c9a8309146", + "7672f9d0-df13-11e9-9522-67c9a8309146" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "77133170-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "75dde5c0-df13-11e9-9522-67c9a8309146", + "7672f9d0-df13-11e9-9522-67c9a8309146" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:37:07.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:07.645Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "77133170-df13-11e9-9522-67c9a8309146" (7)'] = { + "results": { + "id": "77133170-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "75dde5c0-df13-11e9-9522-67c9a8309146", + "7672f9d0-df13-11e9-9522-67c9a8309146" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:37:07.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:07.645Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "77133170-df13-11e9-9522-67c9a8309146" (8)'] = { + "results": { + "id": "77133170-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "75dde5c0-df13-11e9-9522-67c9a8309146", + "7672f9d0-df13-11e9-9522-67c9a8309146" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:37:07.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:07.645Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "784dfb60-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:07.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:07.645Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "784dfb60-df13-11e9-9522-67c9a8309146" (11)'] = { + "results": { + "id": "784dfb60-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:07.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:07.645Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571952973341 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "7989fdd0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:14.786Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:14.786Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "7989fdd0-df13-11e9-9522-67c9a8309146" (3)'] = { + "results": { + "id": "7989fdd0-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:37:14.786Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:14.786Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "7a1e75a0-df13-11e9-9522-67c9a8309146" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "7ab9a430-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "7a1e75a0-df13-11e9-9522-67c9a8309146" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:37:14.786Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:14.786Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "7ab9a430-df13-11e9-9522-67c9a8309146" (7)'] = { + "results": { + "id": "7ab9a430-df13-11e9-9522-67c9a8309146", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "7a1e75a0-df13-11e9-9522-67c9a8309146" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:37:14.786Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:37:14.786Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["7a1e75a0-df13-11e9-9522-67c9a8309146"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1b8a28d0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:46.566Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:46.566Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "1b8a28d0-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "1b8a28d0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:46.566Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:46.566Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:48.333Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:41:48.333Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:48.333Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:41:48.333Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:49.402Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:41:49.402Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:49.402Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:41:49.402Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:49.402Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:41:49.402Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1dd35580-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:50.409Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:50.409Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "1e64e720-df14-11e9-b7f1-0be9fcb846ac", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:51.368Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:51.368Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "1f010010-df14-11e9-b7f1-0be9fcb846ac", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:52.390Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:52.390Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "1dd35580-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:50.409Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:50.409Z", + "updated_by": "mattapperson" + }, + { + "id": "1e64e720-df14-11e9-b7f1-0be9fcb846ac", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:51.368Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:51.368Z", + "updated_by": "mattapperson" + }, + { + "id": "1f010010-df14-11e9-b7f1-0be9fcb846ac", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:52.390Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:52.390Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1fa27030-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:53.448Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:53.448Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "1fa27030-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "1fa27030-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:53.448Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:53.448Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "203a6a70-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:53.448Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:53.448Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "2171b1f0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:56.484Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:56.484Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "220f0360-df14-11e9-b7f1-0be9fcb846ac", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:57.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:57.507Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "203a6a70-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:53.448Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:53.448Z", + "updated_by": "mattapperson" + }, + { + "id": "2171b1f0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:56.484Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:56.484Z", + "updated_by": "mattapperson" + }, + { + "id": "220f0360-df14-11e9-b7f1-0be9fcb846ac", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:57.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:57.507Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "22b184f0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:58.581Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:58.581Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "22b184f0-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "22b184f0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:58.581Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:58.581Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "2346c010-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:58.581Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:58.581Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "2346c010-df14-11e9-b7f1-0be9fcb846ac" (6)'] = { + "results": { + "id": "2346c010-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:58.581Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:41:58.581Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "22b184f0-df14-11e9-b7f1-0be9fcb846ac" (7)'] = { + "results": { + "id": "22b184f0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:41:58.581Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:42:00 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2487a480-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:01.661Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:01.661Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "2487a480-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "2487a480-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:01.661Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:01.661Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "251bce30-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:01.661Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:01.661Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "251bce30-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:01.661Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:01.661Z", + "updated_by": "mattapperson" + }, + { + "id": "2487a480-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:01.661Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:42:03 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "265b2c00-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:04.722Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:04.722Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "265b2c00-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "265b2c00-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:04.722Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:04.722Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "26ee4440-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:04.722Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:04.722Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "265b2c00-df14-11e9-b7f1-0be9fcb846ac" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "26ee4440-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:04.722Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:04.722Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "28c8a990-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:08.798Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:08.798Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "28c8a990-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "28c8a990-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:08.798Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:08.798Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "295fe080-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:08.798Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:08.798Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "295fe080-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:08.798Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:08.798Z", + "updated_by": "mattapperson" + }, + { + "id": "28c8a990-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:08.798Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:42:10 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "295fe080-df14-11e9-b7f1-0be9fcb846ac" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "28c8a990-df14-11e9-b7f1-0be9fcb846ac" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2bd57460-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:13.915Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.915Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2bda7d70-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:13.944Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.944Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "2bd57460-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "2bd57460-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:13.915Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.915Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "2bda7d70-df14-11e9-b7f1-0be9fcb846ac" (4)'] = { + "results": { + "id": "2bda7d70-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:13.944Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.944Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "2c6dbcc0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:42:13.915Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.915Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (6)'] = { + "results": [ + "2c6fb890-df14-11e9-b7f1-0be9fcb846ac", + "2d04f3b0-df14-11e9-b7f1-0be9fcb846ac" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"foo","description":"description"} (7)'] = { + "results": { + "id": "2c6dbcc0-df14-11e9-b7f1-0be9fcb846ac", + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [ + { + "id": "2bd57460-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:13.915Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.915Z", + "updated_by": "mattapperson" + }, + { + "id": "2bda7d70-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:13.944Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.944Z", + "updated_by": "mattapperson" + }, + { + "id": "2c6dbcc0-df14-11e9-b7f1-0be9fcb846ac", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-15", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:42:13.915Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.915Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 3 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (8)'] = { + "results": { + "id": "2da181d0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2c6fb890-df14-11e9-b7f1-0be9fcb846ac", + "2d04f3b0-df14-11e9-b7f1-0be9fcb846ac" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:42:13.944Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.944Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "2da181d0-df14-11e9-b7f1-0be9fcb846ac" (11)'] = { + "results": { + "id": "2da181d0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2c6fb890-df14-11e9-b7f1-0be9fcb846ac", + "2d04f3b0-df14-11e9-b7f1-0be9fcb846ac" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:42:13.944Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:13.944Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "2ef503e0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:19.152Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:19.152Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "2ef503e0-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "2ef503e0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:19.152Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:19.152Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "2f7a1260-df14-11e9-b7f1-0be9fcb846ac", + "30245c20-df14-11e9-b7f1-0be9fcb846ac" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "30c38250-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2f7a1260-df14-11e9-b7f1-0be9fcb846ac", + "30245c20-df14-11e9-b7f1-0be9fcb846ac" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:42:19.152Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:19.152Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "30c38250-df14-11e9-b7f1-0be9fcb846ac" (7)'] = { + "results": { + "id": "30c38250-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2f7a1260-df14-11e9-b7f1-0be9fcb846ac", + "30245c20-df14-11e9-b7f1-0be9fcb846ac" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:42:19.152Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:19.152Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "30c38250-df14-11e9-b7f1-0be9fcb846ac" (8)'] = { + "results": { + "id": "30c38250-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "2f7a1260-df14-11e9-b7f1-0be9fcb846ac", + "30245c20-df14-11e9-b7f1-0be9fcb846ac" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:42:19.152Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:19.152Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "31fdfe20-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:19.152Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:19.152Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "31fdfe20-df14-11e9-b7f1-0be9fcb846ac" (11)'] = { + "results": { + "id": "31fdfe20-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:19.152Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:19.152Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953282633 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "3339d980-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:26.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:26.317Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "3339d980-df14-11e9-b7f1-0be9fcb846ac" (3)'] = { + "results": { + "id": "3339d980-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:42:26.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:26.317Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "33d27000-df14-11e9-b7f1-0be9fcb846ac" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "346b54a0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "33d27000-df14-11e9-b7f1-0be9fcb846ac" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:42:26.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:26.317Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "346b54a0-df14-11e9-b7f1-0be9fcb846ac" (7)'] = { + "results": { + "id": "346b54a0-df14-11e9-b7f1-0be9fcb846ac", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "33d27000-df14-11e9-b7f1-0be9fcb846ac" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:42:26.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:42:26.317Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["33d27000-df14-11e9-b7f1-0be9fcb846ac"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "62c83a20-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:46.099Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:46.099Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "62c83a20-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "62c83a20-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:46.099Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:46.099Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:46.912Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:43:46.912Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:46.912Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:43:46.912Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:47.904Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:43:47.904Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:47.904Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:43:47.904Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:47.904Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:43:47.904Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "64783410-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:48.930Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:48.930Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "650ab010-df14-11e9-80ee-315908b2baff", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:49.893Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:49.893Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "65a653d0-df14-11e9-80ee-315908b2baff", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:50.913Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:50.913Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "64783410-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:48.930Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:48.930Z", + "updated_by": "mattapperson" + }, + { + "id": "650ab010-df14-11e9-80ee-315908b2baff", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:49.893Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:49.893Z", + "updated_by": "mattapperson" + }, + { + "id": "65a653d0-df14-11e9-80ee-315908b2baff", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:50.913Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:50.913Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6648ae50-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:51.977Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:51.977Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "6648ae50-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "6648ae50-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:51.977Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:51.977Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "66df9720-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:51.977Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:51.977Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "6825f9d0-df14-11e9-80ee-315908b2baff", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:55.055Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:55.055Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "68b1bf10-df14-11e9-80ee-315908b2baff", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:56.021Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:56.021Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "66df9720-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:51.977Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:51.977Z", + "updated_by": "mattapperson" + }, + { + "id": "6825f9d0-df14-11e9-80ee-315908b2baff", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:55.055Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:55.055Z", + "updated_by": "mattapperson" + }, + { + "id": "68b1bf10-df14-11e9-80ee-315908b2baff", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:56.021Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:56.021Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6970f060-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:57.274Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:57.274Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "6970f060-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "6970f060-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:57.274Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:57.274Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "6a06eed0-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:57.274Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:57.274Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "6a06eed0-df14-11e9-80ee-315908b2baff" (6)'] = { + "results": { + "id": "6a06eed0-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:57.274Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:43:57.274Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "6970f060-df14-11e9-80ee-315908b2baff" (7)'] = { + "results": { + "id": "6970f060-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:43:57.274Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:43:59 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6b469ac0-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:00.353Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:00.353Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "6b469ac0-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "6b469ac0-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:00.353Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:00.353Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "6bdb1290-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:00.353Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:00.353Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "6bdb1290-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:00.353Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:00.353Z", + "updated_by": "mattapperson" + }, + { + "id": "6b469ac0-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:00.353Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:44:02 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6d1a2240-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:03.417Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:03.417Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "6d1a2240-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "6d1a2240-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:03.417Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:03.417Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "6daf3650-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:03.417Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:03.417Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "6d1a2240-df14-11e9-80ee-315908b2baff" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "6daf3650-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:03.417Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:03.417Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6f88b140-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:07.496Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:07.496Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "6f88b140-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "6f88b140-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:07.496Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:07.496Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "701d9e40-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:07.496Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:07.496Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "701d9e40-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:07.496Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:07.496Z", + "updated_by": "mattapperson" + }, + { + "id": "6f88b140-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:07.496Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:44:09 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "701d9e40-df14-11e9-80ee-315908b2baff" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "6f88b140-df14-11e9-80ee-315908b2baff" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should never delete the default policy - listVersions - {"sharedID":"default","activeOnly":false,"page":1,"perPage":10000} (1)'] = { + "results": [] +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "72910f40-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:12.584Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:12.584Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "72910f40-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "72910f40-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:12.584Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:12.584Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "732c8bf0-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:44:12.584Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:12.584Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "732c8bf0-df14-11e9-80ee-315908b2baff", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": { + "items": [ + { + "id": "72910f40-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:12.584Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:12.584Z", + "updated_by": "mattapperson" + }, + { + "id": "732c8bf0-df14-11e9-80ee-315908b2baff", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:44:12.584Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:12.584Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 2 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "746b2670-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:15.691Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:15.691Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "746b2670-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "746b2670-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:15.691Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:15.691Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "75003a80-df14-11e9-80ee-315908b2baff", + "7596fc40-df14-11e9-80ee-315908b2baff" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "76362270-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "75003a80-df14-11e9-80ee-315908b2baff", + "7596fc40-df14-11e9-80ee-315908b2baff" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:44:15.691Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:15.691Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "76362270-df14-11e9-80ee-315908b2baff" (7)'] = { + "results": { + "id": "76362270-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "75003a80-df14-11e9-80ee-315908b2baff", + "7596fc40-df14-11e9-80ee-315908b2baff" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:44:15.691Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:15.691Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "7775f570-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:20.793Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:20.793Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "7775f570-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "7775f570-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:20.793Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:20.793Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "780d0550-df14-11e9-80ee-315908b2baff", + "78a1a430-df14-11e9-80ee-315908b2baff" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "793fe000-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "780d0550-df14-11e9-80ee-315908b2baff", + "78a1a430-df14-11e9-80ee-315908b2baff" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:44:20.793Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:20.793Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "793fe000-df14-11e9-80ee-315908b2baff" (7)'] = { + "results": { + "id": "793fe000-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "780d0550-df14-11e9-80ee-315908b2baff", + "78a1a430-df14-11e9-80ee-315908b2baff" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:44:20.793Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:20.793Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "793fe000-df14-11e9-80ee-315908b2baff" (8)'] = { + "results": { + "id": "793fe000-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "780d0550-df14-11e9-80ee-315908b2baff", + "78a1a430-df14-11e9-80ee-315908b2baff" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:44:20.793Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:20.793Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "7a7db730-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:20.793Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:20.793Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "7a7db730-df14-11e9-80ee-315908b2baff" (11)'] = { + "results": { + "id": "7a7db730-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:20.793Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:20.793Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953403055 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "7bb96b80-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:27.947Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:27.947Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "7bb96b80-df14-11e9-80ee-315908b2baff" (3)'] = { + "results": { + "id": "7bb96b80-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:44:27.947Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:27.947Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "7c4e3170-df14-11e9-80ee-315908b2baff" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "7ce875a0-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "7c4e3170-df14-11e9-80ee-315908b2baff" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:44:27.947Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:27.947Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "7ce875a0-df14-11e9-80ee-315908b2baff" (7)'] = { + "results": { + "id": "7ce875a0-df14-11e9-80ee-315908b2baff", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "7c4e3170-df14-11e9-80ee-315908b2baff" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:44:27.947Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:44:27.947Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["7c4e3170-df14-11e9-80ee-315908b2baff"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "b4116690-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:02.467Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:02.467Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "b4116690-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "b4116690-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:02.467Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:02.467Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:04.184Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:46:04.184Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:04.184Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:46:04.184Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:05.304Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:46:05.304Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:05.304Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:46:05.304Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:05.304Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:46:05.304Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "b65eb1f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:06.338Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:06.338Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "b6f1a320-df14-11e9-8e7f-231f13bcb3a0", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:07.301Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:07.301Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "b78f1ba0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:08.333Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:08.333Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "b65eb1f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:06.338Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:06.338Z", + "updated_by": "mattapperson" + }, + { + "id": "b6f1a320-df14-11e9-8e7f-231f13bcb3a0", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:07.301Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:07.301Z", + "updated_by": "mattapperson" + }, + { + "id": "b78f1ba0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:08.333Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:08.333Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "b83371f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:09.409Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:09.409Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "b83371f0-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "b83371f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:09.409Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:09.409Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "b8cc7da0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:09.409Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:09.409Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "ba0524b0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:12.463Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:12.463Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "baa24f10-df14-11e9-8e7f-231f13bcb3a0", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:13.492Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:13.492Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "b8cc7da0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:09.409Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:09.409Z", + "updated_by": "mattapperson" + }, + { + "id": "ba0524b0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:12.463Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:12.463Z", + "updated_by": "mattapperson" + }, + { + "id": "baa24f10-df14-11e9-8e7f-231f13bcb3a0", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:13.492Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:13.492Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "bb4593f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:14.563Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:14.563Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "bb4593f0-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "bb4593f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:14.563Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:14.563Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "bbdfb110-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:14.563Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:14.563Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "bbdfb110-df14-11e9-8e7f-231f13bcb3a0" (6)'] = { + "results": { + "id": "bbdfb110-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:14.563Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:14.563Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "bb4593f0-df14-11e9-8e7f-231f13bcb3a0" (7)'] = { + "results": { + "id": "bb4593f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:14.563Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:46:16 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "bd246610-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:17.701Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:17.701Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "bd246610-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "bd246610-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:17.701Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:17.701Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "bdbb4ee0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:17.701Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:17.701Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "bdbb4ee0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:17.701Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:17.701Z", + "updated_by": "mattapperson" + }, + { + "id": "bd246610-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:17.701Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:46:19 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "befad3c0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:20.780Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:20.780Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "befad3c0-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "befad3c0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:20.780Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:20.780Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "bf91e3a0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:20.780Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:20.780Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "befad3c0-df14-11e9-8e7f-231f13bcb3a0" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "bf91e3a0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:20.780Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:20.780Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "c1734dd0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:24.926Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:24.926Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "c1734dd0-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "c1734dd0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:24.926Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:24.926Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "c20aabd0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:24.926Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:24.926Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "c20aabd0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:24.926Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:24.926Z", + "updated_by": "mattapperson" + }, + { + "id": "c1734dd0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:24.926Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:46:26 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "c20aabd0-df14-11e9-8e7f-231f13bcb3a0" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "c1734dd0-df14-11e9-8e7f-231f13bcb3a0" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "c482fed0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:30.064Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.064Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "c487b9c0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:30.095Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.095Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "c482fed0-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "c482fed0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:30.064Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.064Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "c487b9c0-df14-11e9-8e7f-231f13bcb3a0" (4)'] = { + "results": { + "id": "c487b9c0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:30.095Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.095Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "c534c2a0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:46:30.064Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.064Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (6)'] = { + "results": [ + "c536e580-df14-11e9-8e7f-231f13bcb3a0", + "c5cbab70-df14-11e9-8e7f-231f13bcb3a0" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"foo","description":"description"} (7)'] = { + "results": { + "id": "c534c2a0-df14-11e9-8e7f-231f13bcb3a0", + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [ + { + "id": "c482fed0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:30.064Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.064Z", + "updated_by": "mattapperson" + }, + { + "id": "c487b9c0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:30.095Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.095Z", + "updated_by": "mattapperson" + }, + { + "id": "c534c2a0-df14-11e9-8e7f-231f13bcb3a0", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-15", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:46:30.064Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.064Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 3 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (8)'] = { + "results": { + "id": "c66af8b0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "c536e580-df14-11e9-8e7f-231f13bcb3a0", + "c5cbab70-df14-11e9-8e7f-231f13bcb3a0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:46:30.095Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.095Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "c66af8b0-df14-11e9-8e7f-231f13bcb3a0" (11)'] = { + "results": { + "id": "c66af8b0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-14", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "c536e580-df14-11e9-8e7f-231f13bcb3a0", + "c5cbab70-df14-11e9-8e7f-231f13bcb3a0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:46:30.095Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:30.095Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "c7b13450-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:35.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:35.400Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "c7b13450-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "c7b13450-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:35.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:35.400Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "c849cad0-df14-11e9-8e7f-231f13bcb3a0", + "c8df5410-df14-11e9-8e7f-231f13bcb3a0" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "c98027f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "c849cad0-df14-11e9-8e7f-231f13bcb3a0", + "c8df5410-df14-11e9-8e7f-231f13bcb3a0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:46:35.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:35.400Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "c98027f0-df14-11e9-8e7f-231f13bcb3a0" (7)'] = { + "results": { + "id": "c98027f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "c849cad0-df14-11e9-8e7f-231f13bcb3a0", + "c8df5410-df14-11e9-8e7f-231f13bcb3a0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:46:35.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:35.400Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "c98027f0-df14-11e9-8e7f-231f13bcb3a0" (8)'] = { + "results": { + "id": "c98027f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "c849cad0-df14-11e9-8e7f-231f13bcb3a0", + "c8df5410-df14-11e9-8e7f-231f13bcb3a0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:46:35.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:35.400Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "cabd89f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:35.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:35.400Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "cabd89f0-df14-11e9-8e7f-231f13bcb3a0" (11)'] = { + "results": { + "id": "cabd89f0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:35.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:35.400Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953538187 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "cbff58c0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:42.618Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:42.618Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "cbff58c0-df14-11e9-8e7f-231f13bcb3a0" (3)'] = { + "results": { + "id": "cbff58c0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:46:42.618Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:42.618Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "cc95f370-df14-11e9-8e7f-231f13bcb3a0" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "cd305eb0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "cc95f370-df14-11e9-8e7f-231f13bcb3a0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:46:42.618Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:42.618Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "cd305eb0-df14-11e9-8e7f-231f13bcb3a0" (7)'] = { + "results": { + "id": "cd305eb0-df14-11e9-8e7f-231f13bcb3a0", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "cc95f370-df14-11e9-8e7f-231f13bcb3a0" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:46:42.618Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:46:42.618Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["cc95f370-df14-11e9-8e7f-231f13bcb3a0"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "599c8d10-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:40.208Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:40.208Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "599c8d10-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "599c8d10-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:40.208Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:40.208Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:41.062Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:50:41.063Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:41.062Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:50:41.063Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:41.995Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:50:41.995Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:41.995Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:50:41.995Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:41.995Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:50:41.995Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "5b57f8b0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:43.071Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:43.071Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "5bdb8090-df15-11e9-8440-557596cb8d08", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:43.978Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:43.978Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "5c7aa6c0-df15-11e9-8440-557596cb8d08", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:44.989Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:44.989Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "5b57f8b0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:43.071Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:43.071Z", + "updated_by": "mattapperson" + }, + { + "id": "5bdb8090-df15-11e9-8440-557596cb8d08", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:43.978Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:43.978Z", + "updated_by": "mattapperson" + }, + { + "id": "5c7aa6c0-df15-11e9-8440-557596cb8d08", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:44.989Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:44.989Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "5d1a1b10-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:46.066Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:46.066Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "5d1a1b10-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "5d1a1b10-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:46.066Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:46.066Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "5dc91fc0-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:46.066Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:46.066Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "5f001920-df15-11e9-8440-557596cb8d08", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:49.251Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:49.251Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "5f9b47b0-df15-11e9-8440-557596cb8d08", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:50.269Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:50.269Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "5dc91fc0-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:46.066Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:46.066Z", + "updated_by": "mattapperson" + }, + { + "id": "5f001920-df15-11e9-8440-557596cb8d08", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:49.251Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:49.251Z", + "updated_by": "mattapperson" + }, + { + "id": "5f9b47b0-df15-11e9-8440-557596cb8d08", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:50.269Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:50.269Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "603cdee0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:51.328Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:51.328Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "603cdee0-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "603cdee0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:51.328Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:51.328Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "60d4b210-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:51.328Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:51.328Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "60d4b210-df15-11e9-8440-557596cb8d08" (6)'] = { + "results": { + "id": "60d4b210-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:51.328Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:51.328Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "603cdee0-df15-11e9-8440-557596cb8d08" (7)'] = { + "results": { + "id": "603cdee0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:51.328Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:50:53 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "621aedb0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:54.460Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:54.460Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "621aedb0-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "621aedb0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:54.460Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:54.460Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "62ae05f0-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:54.460Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:54.460Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "62ae05f0-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:54.460Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:54.460Z", + "updated_by": "mattapperson" + }, + { + "id": "621aedb0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:54.460Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:50:56 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "63ed15a0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:57.513Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:57.513Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "63ed15a0-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "63ed15a0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:57.513Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:57.513Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "648054f0-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:57.513Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:57.513Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "63ed15a0-df15-11e9-8440-557596cb8d08" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "648054f0-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:50:57.513Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:50:57.513Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "665b2f70-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:01.589Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:01.589Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "665b2f70-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "665b2f70-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:01.589Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:01.589Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "66eee3f0-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:01.589Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:01.589Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "66eee3f0-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:01.589Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:01.589Z", + "updated_by": "mattapperson" + }, + { + "id": "665b2f70-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:01.589Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:51:03 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "66eee3f0-df15-11e9-8440-557596cb8d08" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "665b2f70-df15-11e9-8440-557596cb8d08" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6960ce50-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:06.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:06.663Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "6960ce50-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "6960ce50-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:06.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:06.663Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "69f76900-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:51:06.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:06.663Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "69f76900-df15-11e9-8440-557596cb8d08", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": { + "items": [ + { + "id": "6960ce50-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:06.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:06.663Z", + "updated_by": "mattapperson" + }, + { + "id": "69f76900-df15-11e9-8440-557596cb8d08", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:51:06.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:06.663Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 2 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6b33b990-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:09.715Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:09.715Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "6b33b990-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "6b33b990-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:09.715Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:09.715Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "6bc7e340-df15-11e9-8440-557596cb8d08", + "6c5de1b0-df15-11e9-8440-557596cb8d08" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "6cfd2ef0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "6bc7e340-df15-11e9-8440-557596cb8d08", + "6c5de1b0-df15-11e9-8440-557596cb8d08" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:51:09.715Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:09.715Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "6cfd2ef0-df15-11e9-8440-557596cb8d08" (7)'] = { + "results": { + "id": "6cfd2ef0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "6bc7e340-df15-11e9-8440-557596cb8d08", + "6c5de1b0-df15-11e9-8440-557596cb8d08" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:51:09.715Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:09.715Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "6e3e6180-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:14.826Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:14.826Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "6e3e6180-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "6e3e6180-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:14.826Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:14.826Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "6ed2d950-df15-11e9-8440-557596cb8d08", + "6f683b80-df15-11e9-8440-557596cb8d08" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "7009aba0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "6ed2d950-df15-11e9-8440-557596cb8d08", + "6f683b80-df15-11e9-8440-557596cb8d08" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:51:14.826Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:14.826Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "7009aba0-df15-11e9-8440-557596cb8d08" (7)'] = { + "results": { + "id": "7009aba0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "6ed2d950-df15-11e9-8440-557596cb8d08", + "6f683b80-df15-11e9-8440-557596cb8d08" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:51:14.826Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:14.826Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "7009aba0-df15-11e9-8440-557596cb8d08" (8)'] = { + "results": { + "id": "7009aba0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "6ed2d950-df15-11e9-8440-557596cb8d08", + "6f683b80-df15-11e9-8440-557596cb8d08" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:51:14.826Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:14.826Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "714782d0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:14.826Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:14.826Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "714782d0-df15-11e9-8440-557596cb8d08" (11)'] = { + "results": { + "id": "714782d0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:14.826Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:14.826Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953816638 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "7281fea0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:21.979Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:21.979Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "7281fea0-df15-11e9-8440-557596cb8d08" (3)'] = { + "results": { + "id": "7281fea0-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:51:21.979Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:21.979Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "73193590-df15-11e9-8440-557596cb8d08" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "73b21a30-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "73193590-df15-11e9-8440-557596cb8d08" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:51:21.979Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:21.979Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "73b21a30-df15-11e9-8440-557596cb8d08" (7)'] = { + "results": { + "id": "73b21a30-df15-11e9-8440-557596cb8d08", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "73193590-df15-11e9-8440-557596cb8d08" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:51:21.979Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:51:21.979Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["73193590-df15-11e9-8440-557596cb8d08"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "a2195ff0-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:41.821Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:41.821Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "a2195ff0-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "a2195ff0-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:41.821Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:41.821Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:42.607Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:52:42.607Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:42.607Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:52:42.607Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:43.616Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:52:43.616Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:43.616Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:52:43.616Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:43.616Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:52:43.616Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "a3c4c600-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:44.625Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:44.625Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "a4574200-df15-11e9-925c-dbb99b7eb4ae", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:45.584Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:45.584Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "a4f11100-df15-11e9-925c-dbb99b7eb4ae", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:46.594Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:46.594Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "a3c4c600-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:44.625Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:44.625Z", + "updated_by": "mattapperson" + }, + { + "id": "a4574200-df15-11e9-925c-dbb99b7eb4ae", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:45.584Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:45.584Z", + "updated_by": "mattapperson" + }, + { + "id": "a4f11100-df15-11e9-925c-dbb99b7eb4ae", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:46.594Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:46.594Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "a594cb10-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:47.666Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:47.666Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "a594cb10-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "a594cb10-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:47.666Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:47.666Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "a6291bd0-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:47.666Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:47.666Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "a7606350-df15-11e9-925c-dbb99b7eb4ae", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:50.678Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:50.678Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "a7fbe000-df15-11e9-925c-dbb99b7eb4ae", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:51.698Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:51.698Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "a6291bd0-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:47.666Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:47.666Z", + "updated_by": "mattapperson" + }, + { + "id": "a7606350-df15-11e9-925c-dbb99b7eb4ae", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:50.678Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:50.678Z", + "updated_by": "mattapperson" + }, + { + "id": "a7fbe000-df15-11e9-925c-dbb99b7eb4ae", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:51.698Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:51.698Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "a89dc550-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:52.759Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:52.759Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "a89dc550-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "a89dc550-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:52.759Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:52.759Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "a9435420-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:52.759Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:52.759Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "a9435420-df15-11e9-925c-dbb99b7eb4ae" (6)'] = { + "results": { + "id": "a9435420-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:52.759Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:52.759Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "a89dc550-df15-11e9-925c-dbb99b7eb4ae" (7)'] = { + "results": { + "id": "a89dc550-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:52.759Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:52:54 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "aa832720-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:55.938Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:55.938Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "aa832720-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "aa832720-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:55.938Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:55.938Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "ab126ed0-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:55.938Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:55.938Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "ab126ed0-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:55.938Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:55.938Z", + "updated_by": "mattapperson" + }, + { + "id": "aa832720-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:55.938Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:52:57 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "ac58aa70-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:58.983Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:58.983Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "ac58aa70-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "ac58aa70-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:58.983Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:58.983Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "ace88e60-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:58.983Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:58.983Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "ac58aa70-df15-11e9-925c-dbb99b7eb4ae" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "ace88e60-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:52:58.983Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:52:58.983Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "aed9d710-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:03.214Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:03.214Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "aed9d710-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "aed9d710-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:03.214Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:03.214Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "af552190-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:03.214Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:03.214Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "af552190-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:03.214Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:03.214Z", + "updated_by": "mattapperson" + }, + { + "id": "aed9d710-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:03.214Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:53:05 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "af552190-df15-11e9-925c-dbb99b7eb4ae" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "aed9d710-df15-11e9-925c-dbb99b7eb4ae" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "b1ec4730-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:08.372Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:08.372Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "b1ec4730-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "b1ec4730-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:08.372Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:08.372Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "b28070e0-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:53:08.372Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:08.372Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "b28070e0-df15-11e9-925c-dbb99b7eb4ae", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": { + "items": [ + { + "id": "b1ec4730-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:08.372Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:08.372Z", + "updated_by": "mattapperson" + }, + { + "id": "b28070e0-df15-11e9-925c-dbb99b7eb4ae", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:53:08.372Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:08.372Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 2 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "b3bc7350-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:11.415Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:11.415Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "b3bc7350-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "b3bc7350-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:11.415Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:11.415Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "b44f8b90-df15-11e9-925c-dbb99b7eb4ae", + "b4e53be0-df15-11e9-925c-dbb99b7eb4ae" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "b5848920-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "b44f8b90-df15-11e9-925c-dbb99b7eb4ae", + "b4e53be0-df15-11e9-925c-dbb99b7eb4ae" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:53:11.415Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:11.415Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "b5848920-df15-11e9-925c-dbb99b7eb4ae" (7)'] = { + "results": { + "id": "b5848920-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "b44f8b90-df15-11e9-925c-dbb99b7eb4ae", + "b4e53be0-df15-11e9-925c-dbb99b7eb4ae" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:53:11.415Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:11.415Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "b6c5bbb0-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:16.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:16.507Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "b6c5bbb0-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "b6c5bbb0-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:16.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:16.507Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "b756ff30-df15-11e9-925c-dbb99b7eb4ae", + "b7ebc520-df15-11e9-925c-dbb99b7eb4ae" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "b88a7620-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "b756ff30-df15-11e9-925c-dbb99b7eb4ae", + "b7ebc520-df15-11e9-925c-dbb99b7eb4ae" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:53:16.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:16.507Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "b88a7620-df15-11e9-925c-dbb99b7eb4ae" (7)'] = { + "results": { + "id": "b88a7620-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "b756ff30-df15-11e9-925c-dbb99b7eb4ae", + "b7ebc520-df15-11e9-925c-dbb99b7eb4ae" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:53:16.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:16.507Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "b88a7620-df15-11e9-925c-dbb99b7eb4ae" (8)'] = { + "results": { + "id": "b88a7620-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "b756ff30-df15-11e9-925c-dbb99b7eb4ae", + "b7ebc520-df15-11e9-925c-dbb99b7eb4ae" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:53:16.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:16.507Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "b9c5b540-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:16.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:16.507Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "b9c5b540-df15-11e9-925c-dbb99b7eb4ae" (11)'] = { + "results": { + "id": "b9c5b540-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:16.507Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:16.507Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571953937314 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "bb005820-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:23.601Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:23.601Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "bb005820-df15-11e9-925c-dbb99b7eb4ae" (3)'] = { + "results": { + "id": "bb005820-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:53:23.601Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:23.601Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "bb937060-df15-11e9-925c-dbb99b7eb4ae" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "bc2b1c80-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "bb937060-df15-11e9-925c-dbb99b7eb4ae" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:53:23.601Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:23.601Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "bc2b1c80-df15-11e9-925c-dbb99b7eb4ae" (7)'] = { + "results": { + "id": "bc2b1c80-df15-11e9-925c-dbb99b7eb4ae", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "bb937060-df15-11e9-925c-dbb99b7eb4ae" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:53:23.601Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:53:23.601Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["bb937060-df15-11e9-925c-dbb99b7eb4ae"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "f8e31650-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:07.424Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:07.424Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "f8e31650-df15-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "f8e31650-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:07.424Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:07.424Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:08.156Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:55:08.156Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:08.156Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:55:08.156Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default Policy","description":"default policy create by kibana (not possible to delete)"} (3)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:09.274Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:55:09.274Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:09.274Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:55:09.274Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default Policy", + "description": "default policy create by kibana (not possible to delete)", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:09.274Z", + "created_by": "kibana", + "updated_on": "2019-09-24T21:55:09.274Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "fa98b590-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:10.299Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:10.299Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "fb2fec80-df15-11e9-9c0c-7fd75b06fb22", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:11.288Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:11.288Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "fbcc7aa0-df15-11e9-9c0c-7fd75b06fb22", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:12.313Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:12.313Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "fa98b590-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:10.299Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:10.299Z", + "updated_by": "mattapperson" + }, + { + "id": "fb2fec80-df15-11e9-9c0c-7fd75b06fb22", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:11.288Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:11.288Z", + "updated_by": "mattapperson" + }, + { + "id": "fbcc7aa0-df15-11e9-9c0c-7fd75b06fb22", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:12.313Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:12.313Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "fc6dc3b0-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:13.370Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:13.370Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "fc6dc3b0-df15-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "fc6dc3b0-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:13.370Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:13.370Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "fd03c220-df15-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:13.370Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:13.370Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "fe3c1b10-df15-11e9-9c0c-7fd75b06fb22", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:16.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:16.400Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "fed4d8a0-df15-11e9-9c0c-7fd75b06fb22", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:17.401Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:17.401Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "fd03c220-df15-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:13.370Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:13.370Z", + "updated_by": "mattapperson" + }, + { + "id": "fe3c1b10-df15-11e9-9c0c-7fd75b06fb22", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:16.400Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:16.400Z", + "updated_by": "mattapperson" + }, + { + "id": "fed4d8a0-df15-11e9-9c0c-7fd75b06fb22", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:17.401Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:17.401Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "ff79cb30-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:18.483Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:18.483Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "ff79cb30-df15-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "ff79cb30-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:18.483Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:18.483Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "000d0a80-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:18.483Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:18.483Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "000d0a80-df16-11e9-9c0c-7fd75b06fb22" (6)'] = { + "results": { + "id": "000d0a80-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:18.483Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:18.483Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "ff79cb30-df15-11e9-9c0c-7fd75b06fb22" (7)'] = { + "results": { + "id": "ff79cb30-df15-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:18.483Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:55:20 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "014c1a30-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:21.540Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:21.540Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "014c1a30-df16-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "014c1a30-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:21.540Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:21.540Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "01dfa7a0-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:21.540Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:21.540Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "01dfa7a0-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:21.540Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:21.540Z", + "updated_by": "mattapperson" + }, + { + "id": "014c1a30-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:21.540Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:55:23 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "0320b320-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:24.608Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:24.608Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "0320b320-df16-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "0320b320-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:24.608Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:24.608Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "03b2e100-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:24.608Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:24.608Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "0320b320-df16-11e9-9c0c-7fd75b06fb22" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "03b2e100-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:24.608Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:24.608Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "058b2370-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:28.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:28.663Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "058b2370-df16-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "058b2370-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:28.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:28.663Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "06223350-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:28.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:28.663Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "06223350-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:28.663Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:28.663Z", + "updated_by": "mattapperson" + }, + { + "id": "058b2370-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:28.663Z", + "created_by": "mattapperson", + "updated_on": "Tue Sep 24 2019 17:55:30 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "06223350-df16-11e9-9c0c-7fd75b06fb22" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "058b2370-df16-11e9-9c0c-7fd75b06fb22" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "0891acb0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:33.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:33.739Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "0891acb0-df16-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "0891acb0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:33.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:33.739Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "092735f0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:55:33.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:33.739Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "092735f0-df16-11e9-9c0c-7fd75b06fb22", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": { + "items": [ + { + "id": "0891acb0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:33.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:33.739Z", + "updated_by": "mattapperson" + }, + { + "id": "092735f0-df16-11e9-9c0c-7fd75b06fb22", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-24T21:55:33.739Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:33.739Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 2 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "0a66e1e0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:36.808Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:36.808Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "0a66e1e0-df16-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "0a66e1e0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:36.808Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:36.808Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "0af69ec0-df16-11e9-9c0c-7fd75b06fb22", + "0b8c4f10-df16-11e9-9c0c-7fd75b06fb22" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "0c2b9c50-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "0af69ec0-df16-11e9-9c0c-7fd75b06fb22", + "0b8c4f10-df16-11e9-9c0c-7fd75b06fb22" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:55:36.808Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:36.808Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "0c2b9c50-df16-11e9-9c0c-7fd75b06fb22" (7)'] = { + "results": { + "id": "0c2b9c50-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "0af69ec0-df16-11e9-9c0c-7fd75b06fb22", + "0b8c4f10-df16-11e9-9c0c-7fd75b06fb22" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:55:36.808Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:36.808Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "0d6c0b90-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:41.882Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:41.882Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "0d6c0b90-df16-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "0d6c0b90-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:41.882Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:41.882Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "0e023110-df16-11e9-9c0c-7fd75b06fb22", + "0e9437e0-df16-11e9-9c0c-7fd75b06fb22" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "0f3273b0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "0e023110-df16-11e9-9c0c-7fd75b06fb22", + "0e9437e0-df16-11e9-9c0c-7fd75b06fb22" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:55:41.882Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:41.882Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "0f3273b0-df16-11e9-9c0c-7fd75b06fb22" (7)'] = { + "results": { + "id": "0f3273b0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "0e023110-df16-11e9-9c0c-7fd75b06fb22", + "0e9437e0-df16-11e9-9c0c-7fd75b06fb22" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:55:41.882Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:41.882Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "0f3273b0-df16-11e9-9c0c-7fd75b06fb22" (8)'] = { + "results": { + "id": "0f3273b0-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "0e023110-df16-11e9-9c0c-7fd75b06fb22", + "0e9437e0-df16-11e9-9c0c-7fd75b06fb22" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:55:41.882Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:41.882Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "106f6080-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:41.882Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:41.882Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "106f6080-df16-11e9-9c0c-7fd75b06fb22" (11)'] = { + "results": { + "id": "106f6080-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:41.882Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:41.882Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1571954083697 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "11ba7e20-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:49.035Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:49.035Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "11ba7e20-df16-11e9-9c0c-7fd75b06fb22" (3)'] = { + "results": { + "id": "11ba7e20-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-24T21:55:49.035Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:49.035Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "12407700-df16-11e9-9c0c-7fd75b06fb22" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "12d5d930-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "12407700-df16-11e9-9c0c-7fd75b06fb22" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:55:49.035Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:49.035Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "12d5d930-df16-11e9-9c0c-7fd75b06fb22" (7)'] = { + "results": { + "id": "12d5d930-df16-11e9-9c0c-7fd75b06fb22", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "12407700-df16-11e9-9c0c-7fd75b06fb22" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-24T21:55:49.035Z", + "created_by": "mattapperson", + "updated_on": "2019-09-24T21:55:49.035Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["12407700-df16-11e9-9c0c-7fd75b06fb22"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} + +exports['Policies Lib create should create a new policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib create should create a new policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "012efa60-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:31.758Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:31.758Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib create should create a new policy - get - "012efa60-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "012efa60-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:31.758Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:31.758Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - create - {"name":"Default policy","description":"Default policy created by Kibana"} (3)'] = { + "results": { + "id": "default", + "name": "Default policy", + "description": "Default policy created by Kibana", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:32.682Z", + "created_by": "kibana", + "updated_on": "2019-09-25T19:09:32.682Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should create a new default policy if none exists - list - {"page":1,"perPage":25} (4)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default policy", + "description": "Default policy created by Kibana", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:32.682Z", + "created_by": "kibana", + "updated_on": "2019-09-25T19:09:32.682Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (1)'] = { + "thrownError": "{\"type\":\"Error\",\"message\":\"Saved object [policies/default] not found\",\"name\":\"Error\",\"stack\":\"Error: Saved object [policies/default] not found\\n at Function.notFound [as createGenericNotFoundError] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/errors.ts:142:28)\\n at SavedObjectsRepository.createGenericNotFoundError [as get] (/Users/nicolas/Workspace/kibana/src/core/server/saved_objects/service/lib/repository.ts:580:38)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\",\"data\":null,\"isBoom\":true,\"isServer\":false,\"output\":{\"statusCode\":404,\"payload\":{\"statusCode\":404,\"error\":\"Not Found\",\"message\":\"Saved object [policies/default] not found\"},\"headers\":{}}}", + "results": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get info (2)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - create - {"name":"Default policy","description":"Default policy created by Kibana"} (3)'] = { + "results": { + "id": "default", + "name": "Default policy", + "description": "Default policy created by Kibana", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:33.682Z", + "created_by": "kibana", + "updated_on": "2019-09-25T19:09:33.682Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - get - "default" (4)'] = { + "results": { + "id": "default", + "name": "Default policy", + "description": "Default policy created by Kibana", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:33.682Z", + "created_by": "kibana", + "updated_on": "2019-09-25T19:09:33.682Z", + "updated_by": "kibana" + } +} + +exports['Policies Lib ensureDefaultPolicy should not create the new default policy more than once - list - {"page":1,"perPage":25} (5)'] = { + "results": { + "items": [ + { + "id": "default", + "name": "Default policy", + "description": "Default policy created by Kibana", + "status": "active", + "monitoring_enabled": true, + "shared_id": "default", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:33.682Z", + "created_by": "kibana", + "updated_on": "2019-09-25T19:09:33.682Z", + "updated_by": "kibana" + } + ], + "total": 1 + } +} + +exports['Policies Lib list should list all active policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "02f11cc0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:34.714Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:34.714Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (3)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test2","description":"test description"} (4)'] = { + "results": { + "id": "037fc830-dfc8-11e9-8532-fbebb427011c", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:35.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:35.645Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - get info (5)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should list all active policies - create - {"name":"test3","description":"test description"} (6)'] = { + "results": { + "id": "041b9300-dfc8-11e9-8532-fbebb427011c", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:36.671Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:36.671Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should list all active policies - list - {"page":1,"perPage":25} (7)'] = { + "results": { + "items": [ + { + "id": "02f11cc0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-2", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:34.714Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:34.714Z", + "updated_by": "mattapperson" + }, + { + "id": "037fc830-dfc8-11e9-8532-fbebb427011c", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:35.645Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:35.645Z", + "updated_by": "mattapperson" + }, + { + "id": "041b9300-dfc8-11e9-8532-fbebb427011c", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-4", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:36.671Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:36.671Z", + "updated_by": "mattapperson" + } + ], + "total": 3 + } +} + +exports['Policies Lib list should not list inactive policies - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "04c01060-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:37.748Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:37.748Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get - "04c01060-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "04c01060-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:37.748Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:37.748Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "05539dd0-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:37.748Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:37.748Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list should not list inactive policies - get info (6)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test2","description":"test description"} (7)'] = { + "results": { + "id": "068e19a0-dfc8-11e9-8532-fbebb427011c", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:40.768Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:40.768Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - get info (8)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list should not list inactive policies - create - {"name":"test3","description":"test description"} (9)'] = { + "results": { + "id": "07272550-dfc8-11e9-8532-fbebb427011c", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:41.780Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:41.780Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list should not list inactive policies - list - {"page":1,"perPage":25} (10)'] = { + "results": { + "items": [ + { + "id": "05539dd0-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-5", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:37.748Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:37.748Z", + "updated_by": "mattapperson" + }, + { + "id": "068e19a0-dfc8-11e9-8532-fbebb427011c", + "name": "test2", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-6", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:40.768Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:40.768Z", + "updated_by": "mattapperson" + }, + { + "id": "07272550-dfc8-11e9-8532-fbebb427011c", + "name": "test3", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-7", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:41.780Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:41.780Z", + "updated_by": "mattapperson" + } + ], + "total": 4 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "07cb0670-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:42.854Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:42.854Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "07cb0670-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "07cb0670-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:42.854Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:42.854Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "0860b6c0-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:42.854Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:42.854Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "0860b6c0-dfc8-11e9-8532-fbebb427011c" (6)'] = { + "results": { + "id": "0860b6c0-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:42.854Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:42.854Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib update should update a policy and invalidate the origional - get - "07cb0670-dfc8-11e9-8532-fbebb427011c" (7)'] = { + "results": { + "id": "07cb0670-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-8", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:42.854Z", + "created_by": "mattapperson", + "updated_on": "Wed Sep 25 2019 15:09:44 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "09a0b0d0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:45.932Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:45.932Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - get - "09a0b0d0-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "09a0b0d0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:45.932Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:45.932Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "0a32deb0-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:45.932Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:45.932Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib list versions Should list past locked versions of a policy - listVersions - {"sharedID":"shared-uuid-9","activeOnly":false,"page":1,"perPage":25} (6)'] = { + "results": [ + { + "id": "0a32deb0-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:45.932Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:45.932Z", + "updated_by": "mattapperson" + }, + { + "id": "09a0b0d0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-9", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:45.932Z", + "created_by": "mattapperson", + "updated_on": "Wed Sep 25 2019 15:09:47 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the version by the versions ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "0b7326e0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:48.985Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:48.985Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - get - "0b7326e0-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "0b7326e0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:48.985Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:48.985Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "0c063f20-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:48.985Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:48.985Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - deleteVersion - "0b7326e0-dfc8-11e9-8532-fbebb427011c" (6)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the version by the versions ID - listVersions - {"sharedID":"shared-uuid-10","activeOnly":false,"page":1,"perPage":25} (7)'] = { + "results": [ + { + "id": "0c063f20-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-10", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:48.985Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:48.985Z", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "0de2a040-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:53.071Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:53.071Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - get - "0de2a040-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "0de2a040-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:53.071Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:53.071Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - create - {"name":"foo","description":"test description"} (4)'] = { + "results": { + "id": "0e7606a0-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:53.071Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:53.071Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - update - {"name":"test","description":"test description"} (5)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - listVersions - {"sharedID":"shared-uuid-11","activeOnly":false,"page":1,"perPage":10000} (6)'] = { + "results": [ + { + "id": "0e7606a0-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:53.071Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:53.071Z", + "updated_by": "mattapperson" + }, + { + "id": "0de2a040-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-uuid-11", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:53.071Z", + "created_by": "mattapperson", + "updated_on": "Wed Sep 25 2019 15:09:55 GMT-0400 (GMT-04:00)", + "updated_by": "mattapperson" + } + ] +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "0e7606a0-dfc8-11e9-8532-fbebb427011c" (7)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - deleteVersion - "0de2a040-dfc8-11e9-8532-fbebb427011c" (8)'] = { + "results": { + "success": true + } +} + +exports['Policies Lib delete Should delete the all versions when deleting the shared ID - list - {"page":1,"perPage":25} (9)'] = { + "results": { + "items": [], + "total": 0 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "11034130-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:58.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:58.318Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - get - "11034130-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "11034130-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:58.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:58.318Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - create - {"name":"test","description":"test description"} (4)'] = { + "results": { + "id": "119a2a00-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-25T19:09:58.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:58.318Z", + "updated_by": "mattapperson", + "data_sources": [] + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - update - {"name":"foo","description":"description"} (5)'] = { + "results": { + "id": "119a2a00-dfc8-11e9-8532-fbebb427011c", + "version": 1 + } +} + +exports['Policies Lib createNewPolicyFrom Should duplicate policy but with a new shared_id - list - {"page":1,"perPage":25} (6)'] = { + "results": { + "items": [ + { + "id": "11034130-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-12", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:09:58.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:58.318Z", + "updated_by": "mattapperson" + }, + { + "id": "119a2a00-dfc8-11e9-8532-fbebb427011c", + "name": "foo", + "description": "description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-13", + "version": 0, + "agent_version": "8.0.0", + "created_on": "2019-09-25T19:09:58.317Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:09:58.318Z", + "updated_by": "mattapperson", + "data_sources": [] + } + ], + "total": 2 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "12d9fd00-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:10:01.407Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:01.407Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "12d9fd00-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "12d9fd00-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:10:01.407Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:01.407Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - addInputs - [null,null] (4)'] = { + "results": [ + "13721e50-dfc8-11e9-8532-fbebb427011c", + "14053690-dfc8-11e9-8532-fbebb427011c" + ] +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "14a59540-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "13721e50-dfc8-11e9-8532-fbebb427011c", + "14053690-dfc8-11e9-8532-fbebb427011c" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-25T19:10:01.407Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:01.407Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestAddDataSource Should add data sources and inputs to the policy - get - "14a59540-dfc8-11e9-8532-fbebb427011c" (7)'] = { + "results": { + "id": "14a59540-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-14", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-15", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "13721e50-dfc8-11e9-8532-fbebb427011c", + "14053690-dfc8-11e9-8532-fbebb427011c" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-25T19:10:01.407Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:01.407Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "15e652a0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:10:06.521Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:06.521Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "15e652a0-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "15e652a0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:10:06.521Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:06.521Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - addInputs - [null,null] (4)'] = { + "results": [ + "167e4ce0-dfc8-11e9-8532-fbebb427011c", + "17122870-dfc8-11e9-8532-fbebb427011c" + ] +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "17b19cc0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "167e4ce0-dfc8-11e9-8532-fbebb427011c", + "17122870-dfc8-11e9-8532-fbebb427011c" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-25T19:10:06.521Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:06.521Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "17b19cc0-dfc8-11e9-8532-fbebb427011c" (7)'] = { + "results": { + "id": "17b19cc0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "167e4ce0-dfc8-11e9-8532-fbebb427011c", + "17122870-dfc8-11e9-8532-fbebb427011c" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-25T19:10:06.521Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:06.521Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "17b19cc0-dfc8-11e9-8532-fbebb427011c" (8)'] = { + "results": { + "id": "17b19cc0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-17", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "167e4ce0-dfc8-11e9-8532-fbebb427011c", + "17122870-dfc8-11e9-8532-fbebb427011c" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-25T19:10:06.521Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:06.521Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - create - {"name":"test","description":"test description"} (9)'] = { + "results": { + "id": "18f121a0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:10:06.521Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:06.521Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - update - {"name":"test","description":"test description"} (10)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib requestDeleteDataSource Should delete data sources - get - "18f121a0-dfc8-11e9-8532-fbebb427011c" (11)'] = { + "results": { + "id": "18f121a0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-16", + "version": 2, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:10:06.521Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:06.521Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get info (1)'] = { + "results": { + "kibana": { + "version": "8.0.0" + }, + "license": { + "type": "trial", + "expired": false, + "expiry_date_in_millis": 1572030549255 + }, + "security": { + "enabled": true, + "available": true + }, + "watcher": { + "enabled": true, + "available": true + } + }, + "thrownError": null +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (2)'] = { + "results": { + "id": "1a2a16d0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:10:13.676Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:13.676Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "1a2a16d0-dfc8-11e9-8532-fbebb427011c" (3)'] = { + "results": { + "id": "1a2a16d0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-25T19:10:13.676Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:13.676Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - addInputs - [null] (4)'] = { + "results": [ + "1addaf60-dfc8-11e9-8532-fbebb427011c" + ] +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - create - {"name":"test","description":"test description"} (5)'] = { + "results": { + "id": "1b6c0cb0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "1addaf60-dfc8-11e9-8532-fbebb427011c" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-25T19:10:13.676Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:13.676Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - update - {"name":"test","description":"test description"} (6)'] = { + "results": { + "version": 1 + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - get - "1b6c0cb0-dfc8-11e9-8532-fbebb427011c" (7)'] = { + "results": { + "id": "1b6c0cb0-dfc8-11e9-8532-fbebb427011c", + "name": "test", + "description": "test description", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-uuid-18", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [ + { + "uuid": "uuid-19", + "output": "43hi34hi5y3i53o4", + "inputs": [ + "1addaf60-dfc8-11e9-8532-fbebb427011c" + ], + "queue": "\"\"" + } + ], + "created_on": "2019-09-25T19:10:13.676Z", + "created_by": "mattapperson", + "updated_on": "2019-09-25T19:10:13.676Z", + "updated_by": "mattapperson" + } +} + +exports['Policies Lib getFull Should return a policy with all inputs, not just refs to the inputs - getInputsById - {"ids":["1addaf60-dfc8-11e9-8532-fbebb427011c"]} (8)'] = { + "results": [ + { + "other": "{\"foo\":\"bar\"}", + "data_source_id": "uuid-19" + } + ] +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/es_database/adapter_types.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/es_database/adapter_types.ts new file mode 100644 index 0000000000000..835c75bdb04ce --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/es_database/adapter_types.ts @@ -0,0 +1,275 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { FrameworkRequest } from '../framework/adapter_types'; + +export interface DatabaseKbnESCluster { + callWithInternalUser(esMethod: string, options: {}): Promise; + callWithRequest(req: FrameworkRequest, esMethod: string, options: {}): Promise; +} + +export interface DatabaseKbnESPlugin { + getCluster(clusterName: string): DatabaseKbnESCluster; +} + +export interface DatabaseSearchParams extends DatabaseGenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + explain?: boolean; + storedFields?: DatabaseNameList; + docvalueFields?: DatabaseNameList; + fielddataFields?: DatabaseNameList; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + preference?: string; + q?: string; + routing?: DatabaseNameList; + scroll?: string; + searchType?: 'query_then_fetch' | 'dfs_query_then_fetch'; + size?: number; + sort?: DatabaseNameList; + _source?: DatabaseNameList; + _sourceExclude?: DatabaseNameList; + _source_includes?: DatabaseNameList; + terminateAfter?: number; + stats?: DatabaseNameList; + suggestField?: string; + suggestMode?: 'missing' | 'popular' | 'always'; + suggestSize?: number; + suggestText?: string; + timeout?: string; + trackScores?: boolean; + version?: boolean; + requestCache?: boolean; + index?: DatabaseNameList; + type?: DatabaseNameList; +} + +export interface DatabaseSearchResponse { + took: number; + timed_out: boolean; + _scroll_id?: string; + _shards: DatabaseShardsResponse; + hits: { + total: number; + max_score: number; + hits: Array<{ + _index: string; + _id: string; + _score: number; + _source: T; + _seq_no?: number; + _primary_term?: number; + _explanation?: DatabaseExplanation; + fields?: any; + highlight?: any; + inner_hits?: any; + sort?: string[]; + }>; + }; + aggregations?: any; +} + +export interface DatabaseExplanation { + value: number; + description: string; + details: DatabaseExplanation[]; +} + +export interface DatabaseShardsResponse { + total: number; + successful: number; + failed: number; + skipped: number; +} + +export interface DatabaseGetDocumentResponse { + _index: string; + _id: string; + _seq_no: number; + _primary_term: number; + found: boolean; + _source: Source; +} + +export interface DatabaseBulkResponse { + took: number; + errors: boolean; + items: Array< + DatabaseDeleteDocumentResponse | DatabaseIndexDocumentResponse | DatabaseUpdateDocumentResponse + >; +} + +export interface DatabaseBulkIndexDocumentsParams extends DatabaseGenericParams { + waitForActiveShards?: string; + refresh?: DatabaseRefresh; + routing?: string; + timeout?: string; + fields?: DatabaseNameList; + _source?: DatabaseNameList; + _sourceExclude?: DatabaseNameList; + _source_includes?: DatabaseNameList; + pipeline?: string; + index?: string; +} + +export interface DatabaseMGetParams extends DatabaseGenericParams { + storedFields?: DatabaseNameList; + preference?: string; + realtime?: boolean; + refresh?: boolean; + _source?: DatabaseNameList; + _sourceExclude?: DatabaseNameList; + _source_includes?: DatabaseNameList; + index: string; +} + +export interface DatabaseMGetResponse { + docs?: Array>; +} + +export interface DatabasePutTemplateParams extends DatabaseGenericParams { + name: string; + body: any; +} + +export interface DatabaseDeleteDocumentParams extends DatabaseGenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: DatabaseRefresh; + routing?: string; + timeout?: string; + ifSeqNo?: number; + ifPrimaryTerm?: number; + index: string; + id: string; +} + +export interface DatabaseIndexDocumentResponse { + found: boolean; + _index: string; + _id: string; + _seq_no: number; + _primary_term: number; + result: string; +} + +export interface DatabaseUpdateDocumentResponse { + found: boolean; + _index: string; + _id: string; + _seq_no: number; + _primary_term: number; + result: string; +} + +export interface DatabaseDeleteDocumentResponse { + found: boolean; + _index: string; + _id: string; + _seq_no: number; + _primary_term: number; + result: string; +} + +export interface DatabaseIndexDocumentParams extends DatabaseGenericParams { + waitForActiveShards?: string; + opType?: 'index' | 'create'; + parent?: string; + refresh?: string; + routing?: string; + timeout?: string; + timestamp?: Date | number; + ttl?: string; + ifSeqNo?: number; + ifPrimaryTerm?: number; + pipeline?: string; + id?: string; + index: string; + body: T; +} + +export interface DatabaseGetResponse { + found: boolean; + _source: T; +} +export interface DatabaseCreateDocumentParams extends DatabaseGenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: DatabaseRefresh; + routing?: string; + timeout?: string; + timestamp?: Date | number; + ttl?: string; + ifSeqNo?: number; + ifPrimaryTerm?: number; + pipeline?: string; + id?: string; + index: string; +} + +export interface DatabaseCreateDocumentResponse { + created: boolean; + result: string; +} + +export interface DatabaseDeleteDocumentParams extends DatabaseGenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: DatabaseRefresh; + routing?: string; + timeout?: string; + ifSeqNo?: number; + ifPrimaryTerm?: number; + index: string; + id: string; +} + +export interface DatabaseGetParams extends DatabaseGenericParams { + storedFields?: DatabaseNameList; + parent?: string; + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + _source?: DatabaseNameList; + _sourceExclude?: DatabaseNameList; + _source_includes?: DatabaseNameList; + ifSeqNo?: number; + ifPrimaryTerm?: number; + id: string; + index: string; +} + +export type DatabaseNameList = string | string[] | boolean; +export type DatabaseRefresh = boolean | 'true' | 'false' | 'wait_for' | ''; +export type ExpandWildcards = 'open' | 'closed' | 'none' | 'all'; +export type DefaultOperator = 'AND' | 'OR'; +export type DatabaseConflicts = 'abort' | 'proceed'; + +export interface DatabaseGenericParams { + requestTimeout?: number; + maxRetries?: number; + method?: string; + body?: any; + ignore?: number | number[]; + filterPath?: string | string[]; +} + +export interface DatabaseDeleteDocumentResponse { + found: boolean; + _index: string; + _type: string; + _id: string; + _seq_no: number; + _primary_term: number; + result: string; +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/es_database/default.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/es_database/default.ts new file mode 100644 index 0000000000000..8779d43bc73d0 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/es_database/default.ts @@ -0,0 +1,129 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { FrameworkUser } from '../framework/adapter_types'; +import { internalAuthData } from '../framework/adapter_types'; +import { + DatabaseBulkIndexDocumentsParams, + DatabaseCreateDocumentParams, + DatabaseCreateDocumentResponse, + DatabaseDeleteDocumentParams, + DatabaseDeleteDocumentResponse, + DatabaseGetDocumentResponse, + DatabaseGetParams, + DatabaseIndexDocumentParams, + DatabaseKbnESCluster, + DatabaseKbnESPlugin, + DatabaseMGetParams, + DatabaseMGetResponse, + DatabaseSearchParams, + DatabaseSearchResponse, +} from './adapter_types'; + +export class ESDatabaseAdapter { + private es: DatabaseKbnESCluster; + + constructor(kbnElasticSearch: DatabaseKbnESPlugin) { + this.es = kbnElasticSearch.getCluster('admin'); + } + + public async get( + user: FrameworkUser, + params: DatabaseGetParams + ): Promise> { + const result = await this.callWithUser(user, 'get', params); + return result; + // todo + } + + public async mget( + user: FrameworkUser, + params: DatabaseMGetParams + ): Promise> { + const result = await this.callWithUser(user, 'mget', params); + return result; + // todo + } + + public async bulk(user: FrameworkUser, params: DatabaseBulkIndexDocumentsParams): Promise { + const result = await this.callWithUser(user, 'bulk', params); + return result; + } + + public async create( + user: FrameworkUser, + params: DatabaseCreateDocumentParams + ): Promise { + const result = await this.callWithUser(user, 'create', params); + return result; + } + public async index(user: FrameworkUser, params: DatabaseIndexDocumentParams): Promise { + const result = await this.callWithUser(user, 'index', params); + return result; + } + public async delete( + user: FrameworkUser, + params: DatabaseDeleteDocumentParams + ): Promise { + const result = await this.callWithUser(user, 'delete', params); + return result; + } + + public async deleteByQuery( + user: FrameworkUser, + params: DatabaseSearchParams + ): Promise { + const result = await this.callWithUser(user, 'deleteByQuery', params); + return result; + } + + public async search( + user: FrameworkUser, + params: DatabaseSearchParams + ): Promise> { + const result = await this.callWithUser(user, 'search', params); + return result; + } + + public async searchAll( + user: FrameworkUser, + params: DatabaseSearchParams + ): Promise> { + const result = await this.callWithUser(user, 'search', { + scroll: '1m', + ...params, + body: { + size: 1000, + ...params.body, + }, + }); + return result; + } + + public async putTemplate(name: string, template: any): Promise { + const result = await this.callWithUser({ kind: 'internal' }, 'indices.putTemplate', { + name, + body: template, + }); + + return result; + } + + private callWithUser(user: FrameworkUser, esMethod: string, options: any = {}): any { + if (user.kind === 'authenticated') { + return this.es.callWithRequest( + { + headers: user[internalAuthData], + } as any, + esMethod, + options + ); + } else if (user.kind === 'internal') { + return this.es.callWithInternalUser(esMethod, options); + } else { + throw new Error('Invalid user type'); + } + } +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/adapter_types.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/adapter_types.ts new file mode 100644 index 0000000000000..87399dbec4d76 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/adapter_types.ts @@ -0,0 +1,168 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +/* eslint-disable @typescript-eslint/no-empty-interface */ + +import { Lifecycle, ResponseToolkit } from 'hapi'; +import * as t from 'io-ts'; +import { Cluster, ClusterConfig } from 'src/legacy/core_plugins/elasticsearch'; +import { ApmOssPlugin } from 'src/legacy/core_plugins/apm_oss'; +import { Request, Server } from 'src/legacy/server/kbn_server'; +import { XPackInfo } from '../../../../../xpack_main/server/lib/xpack_info'; +import { + Feature, + FeatureWithAllOrReadPrivileges, +} from '../../../../../../../plugins/features/server'; +import { SecurityPlugin } from '../../../../../security'; + +export const internalAuthData = Symbol('internalAuthData'); +export const internalUser: FrameworkInternalUser = { + kind: 'internal', +}; + +export interface KibanaLegacyServer extends Server { + plugins: { + xpack_main: { + status: { + on: (status: 'green' | 'yellow' | 'red', callback: () => void) => void; + }; + info: XPackInfo; + createXPackInfo(options: any): any; + getFeatures(): Feature[]; + registerFeature(feature: FeatureWithAllOrReadPrivileges): void; + }; + kibana: { + status: { + plugin: { + version: string; + }; + }; + }; + security: SecurityPlugin; + elasticsearch: { + status: { + on: (status: 'green' | 'yellow' | 'red', callback: () => void) => void; + }; + getCluster(name: string): Cluster; + createCluster(name: string, config: ClusterConfig): Cluster; + waitUntilReady(): Promise; + }; + spaces: any; + apm_oss: ApmOssPlugin; + ingest: any; + }; + expose: { (key: string, value: any): void; (obj: object): void }; + policy: () => any; + route: (routePolicy: any) => void; + log: (message: string) => void; +} + +export const RuntimeFrameworkInfo = t.interface( + { + kibana: t.type({ + version: t.string, + }), + license: t.type({ + type: t.union([ + t.literal('oss'), + t.literal('trial'), + t.literal('standard'), + t.literal('basic'), + t.literal('gold'), + t.literal('platinum'), + ]), + expired: t.boolean, + expiry_date_in_millis: t.number, + }), + security: t.type({ + enabled: t.boolean, + available: t.boolean, + }), + watcher: t.type({ + enabled: t.boolean, + available: t.boolean, + }), + }, + 'FrameworkInfo' +); +export interface FrameworkInfo extends t.TypeOf {} + +export const RuntimeKibanaServerRequest = t.interface( + { + params: t.object, + payload: t.object, + query: t.object, + headers: t.type({ + authorization: t.union([t.string, t.null]), + }), + info: t.type({ + remoteAddress: t.string, + }), + }, + 'KibanaServerRequest' +); + +export const RuntimeKibanaUser = t.interface( + { + username: t.string, + roles: t.array(t.string), + full_name: t.union([t.null, t.string]), + email: t.union([t.null, t.string]), + enabled: t.boolean, + }, + 'KibanaUser' +); +export interface KibanaUser extends t.TypeOf {} + +export interface FrameworkAuthenticatedUser { + kind: 'authenticated'; + [internalAuthData]?: AuthDataType; + username: string; + roles: string[]; + full_name: string | null; + email: string | null; + enabled: boolean; +} + +export interface FrameworkUnAuthenticatedUser { + kind: 'unauthenticated'; +} + +export interface FrameworkInternalUser { + kind: 'internal'; +} + +export type FrameworkUser = + | FrameworkAuthenticatedUser + | FrameworkUnAuthenticatedUser + | FrameworkInternalUser; +export interface FrameworkRequest = Request> { + user: FrameworkUser; + headers: KibanaServerRequestGenaric['headers']; + info: Request['info']; + payload: KibanaServerRequestGenaric['payload']; + params: KibanaServerRequestGenaric['params']; + query: KibanaServerRequestGenaric['query']; +} + +export interface FrameworkRoute { + path: string; + method: string | string[]; + vhost?: string; + licenseRequired?: string[]; + requiredRoles?: string[]; + handler: FrameworkRouteHandler; + policy?: {}; +} + +export type FrameworkResponseToolkit = ResponseToolkit; + +export type FrameworkRouteHandler< + RouteRequest extends Request = any, + RouteResponse extends FrameworkResponse = any +> = (request: FrameworkRequest, h: ResponseToolkit) => Promise; + +export type FrameworkResponse = Lifecycle.ReturnValue; diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/default.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/default.ts new file mode 100644 index 0000000000000..25b5678cd3106 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/default.ts @@ -0,0 +1,157 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PathReporter } from 'io-ts/lib/PathReporter'; +import { isLeft } from 'fp-ts/lib/Either'; +import { get } from 'lodash'; +import { Request } from 'src/legacy/server/kbn_server'; +import { AuthenticatedUser } from '../../../../../../../plugins/security/common/model'; +import { XPackInfo } from '../../../../../xpack_main/server/lib/xpack_info'; +// @ts-ignore +import { mirrorPluginStatus } from '../../../../../../server/lib/mirror_plugin_status'; +import { + FrameworkInfo, + internalUser, + KibanaLegacyServer, + KibanaUser, + RuntimeFrameworkInfo, + RuntimeKibanaUser, +} from './adapter_types'; + +export class BackendFrameworkAdapter { + public readonly internalUser = internalUser; + public info: null | FrameworkInfo = null; + + constructor( + private readonly PLUGIN_ID: string, + private readonly server: KibanaLegacyServer, + private readonly CONFIG_PREFIX?: string + ) { + const xpackMainPlugin = this.server.plugins.xpack_main; + const thisPlugin = (this.server.plugins as any)[this.PLUGIN_ID]; + + if (thisPlugin) { + mirrorPluginStatus(xpackMainPlugin, thisPlugin); + } else { + throw new Error('Plugin is not initalized in Kibana'); + } + + xpackMainPlugin.status.on('green', () => { + this.xpackInfoWasUpdatedHandler(xpackMainPlugin.info); + // Register a function that is called whenever the xpack info changes, + // to re-compute the license check results for this plugin + xpackMainPlugin.info + .feature(this.PLUGIN_ID) + .registerLicenseCheckResultsGenerator(this.xpackInfoWasUpdatedHandler); + }); + } + + public on(event: 'xpack.status.green' | 'elasticsearch.status.green', cb: () => void) { + switch (event) { + case 'xpack.status.green': + this.server.plugins.xpack_main.status.on('green', cb); + case 'elasticsearch.status.green': + this.server.plugins.elasticsearch.status.on('green', cb); + } + } + + public async waitForStack() { + return new Promise(resolve => { + this.on('xpack.status.green', () => { + resolve(); + }); + }); + } + + public getSetting(settingPath: string) { + return this.server.config().get(settingPath); + } + + public log(text: string) { + if (this.server) { + this.server.log(text); + } else { + console.log(text); // eslint-disable-line + } + } + + public expose(name: string, thing: any) { + this.server.expose(name, thing); + } + + public async getUser(request: Request): Promise { + let user: AuthenticatedUser; + try { + user = await this.server.plugins.security.getUser(request); + } catch (e) { + return null; + } + if (user === null) { + return null; + } + const assertKibanaUser = RuntimeKibanaUser.decode(user); + if (isLeft(assertKibanaUser)) { + throw new Error( + `Error parsing user info in ${this.PLUGIN_ID}, ${ + PathReporter.report(assertKibanaUser)[0] + }` + ); + } + + return user; + } + + private xpackInfoWasUpdatedHandler = (xpackInfo: XPackInfo) => { + let xpackInfoUnpacked: FrameworkInfo; + + // If, for some reason, we cannot get the license information + // from Elasticsearch, assume worst case and disable + if (!xpackInfo) { + this.info = null; + return; + } + + try { + xpackInfoUnpacked = { + kibana: { + version: get(this.server, 'plugins.kibana.status.plugin.version', 'unknown'), + }, + license: { + type: xpackInfo.license.getType() || 'oss', + expired: !xpackInfo.license.isActive(), + expiry_date_in_millis: (xpackInfo.license.getExpiryDateInMillis() !== undefined + ? xpackInfo.license.getExpiryDateInMillis() + : -1) as number, + }, + security: { + enabled: !!xpackInfo.feature('security') && xpackInfo.feature('security').isEnabled(), + available: !!xpackInfo.feature('security'), + }, + watcher: { + enabled: !!xpackInfo.feature('watcher') && xpackInfo.feature('watcher').isEnabled(), + available: !!xpackInfo.feature('watcher'), + }, + }; + } catch (e) { + this.log(`Error accessing required xPackInfo in ${this.PLUGIN_ID} Kibana adapter`); + throw e; + } + + const assertData = RuntimeFrameworkInfo.decode(xpackInfoUnpacked); + if (isLeft(assertData)) { + throw new Error( + `Error parsing xpack info in ${this.PLUGIN_ID}, ${PathReporter.report(assertData)[0]}` + ); + } + + this.info = xpackInfoUnpacked; + + return { + security: xpackInfoUnpacked.security, + settings: this.getSetting(this.CONFIG_PREFIX || this.PLUGIN_ID), + }; + }; +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/hapi_framework_adapter.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/hapi_framework_adapter.ts new file mode 100644 index 0000000000000..f127280167f47 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/hapi_framework_adapter.ts @@ -0,0 +1,58 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Server, Request, ResponseToolkit } from 'hapi'; +import { + FrameworkRoute, + FrameworkRequest, + FrameworkUser, + internalAuthData, + FrameworkResponseToolkit, +} from './adapter_types'; + +export class HapiFrameworkAdapter { + constructor(private readonly server: Server) {} + + public registerRoute(route: FrameworkRoute) { + this.server.route({ + ...route, + handler: async function frameworkRouteHandler(request: Request, h: ResponseToolkit) { + const frameworkRequest = HapiFrameworkAdapter.getFrameworkRequestFromRequest(request); + + return await route.handler(frameworkRequest, h as FrameworkResponseToolkit); + }, + }); + } + + public static getFrameworkRequestFromRequest(request: Request): FrameworkRequest { + const { params, payload, query, headers, info } = request; + return { + params, + payload, + query, + headers, + info, + user: HapiFrameworkAdapter.getUserFromRequest(request), + }; + } + public static getUserFromRequest(request: Request): FrameworkUser { + const isAuthenticated = request.headers.authorization != null; + + return isAuthenticated + ? { + kind: 'authenticated', + [internalAuthData]: request.headers, + username: 'elastic', + roles: ['superuser'], + full_name: null, + email: null, + enabled: true, + } + : { + kind: 'unauthenticated', + }; + } +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/memorized.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/memorized.ts new file mode 100644 index 0000000000000..54284ba501031 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/framework/memorized.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Request } from 'src/legacy/server/kbn_server'; +import Slapshot from '@mattapperson/slapshot'; +// @ts-ignore +import { mirrorPluginStatus } from '../../../../../../server/lib/mirror_plugin_status'; +import { internalUser, KibanaUser, FrameworkInfo } from './adapter_types'; +import { BackendFrameworkAdapter } from './default'; + +export class MemorizedBackendFrameworkAdapter { + public readonly internalUser = internalUser; + + public get info() { + return Slapshot.memorize( + `get info`, + () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.adapter.info; + }, + { + pure: false, + } + ) as FrameworkInfo | null; + } + + constructor(private readonly adapter?: BackendFrameworkAdapter) {} + + public on(event: 'xpack.status.green' | 'elasticsearch.status.green', cb: () => void) { + setTimeout(() => { + cb(); + }, 5); + } + + public getSetting(settingPath: string) { + return Slapshot.memorize(`getSetting - ${JSON.stringify(settingPath)}`, () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return this.adapter.getSetting(settingPath); + }); + } + + public log(text: string) {} + + public expose(name: string, thing: any) {} + + public async getUser(request: Request): Promise { + return await Slapshot.memorize(`getUser - ${JSON.stringify(request)}`, async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.getUser(request); + }); + } + + public async waitForStack() { + if (this.adapter) { + await this.adapter.waitForStack(); + } + } +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/adapter_types.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/adapter_types.ts new file mode 100644 index 0000000000000..9548d0533b28c --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/adapter_types.ts @@ -0,0 +1,111 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as t from 'io-ts'; + +export const RuntimeDatasourceInput = t.intersection([ + t.interface( + { + data_source_id: t.string, + }, + 'DatasourceInput' + ), + t.partial({ + meta: t.string, + }), + t.UnknownRecord, +]); + +const RuntimeDatasource = t.interface( + { + uuid: t.string, + ref_source: t.union([t.undefined, t.string]), + ref: t.union([t.undefined, t.string]), + output: t.string, + queue: t.union([t.undefined, t.string]), + inputs: t.array(t.string), + }, + 'Datasource' +); + +const NewRuntimeDatasource = t.interface( + { + ref_source: t.union([t.undefined, t.string]), + ref: t.union([t.undefined, t.string]), + output: t.string, + queue: t.union([t.undefined, t.object]), + inputs: t.array(t.object), + }, + 'NewDatasource' +); + +export const NewRuntimePolicyFile = t.interface( + { + name: t.string, + description: t.string, + monitoring_enabled: t.boolean, + shared_id: t.string, + version: t.number, + status: t.keyof({ + active: null, + locked: null, + inactive: null, + }), + agent_version: t.string, + data_sources: t.array(RuntimeDatasource), + created_on: t.string, + created_by: t.union([t.undefined, t.string]), + updated_on: t.string, + updated_by: t.union([t.undefined, t.string]), + }, + 'PolicyFile' +); + +export const NewRuntimeBackupPolicyFile = t.interface( + { + name: t.string, + description: t.string, + monitoring_enabled: t.boolean, + agent_version: t.string, + flat_data_sources: t.string, + }, + 'BackupPolicyFile' +); + +const ExistingDocument = t.interface({ + id: t.string, + updated_on: t.string, + updated_by: t.union([t.undefined, t.string]), +}); + +export const RuntimeBackupPolicyFile = t.intersection([ + NewRuntimeBackupPolicyFile, + ExistingDocument, +]); + +export const RuntimePolicyFile = t.intersection([NewRuntimePolicyFile, ExistingDocument]); +export const FullRuntimePolicyFile = t.intersection([ + RuntimePolicyFile, + t.type({ + data_sources: t.array( + t.intersection([ + RuntimeDatasource, + t.type({ + inputs: t.array(RuntimeDatasourceInput), + }), + ]) + ), + }), +]); + +export type NewBackupPolicyFile = t.TypeOf; +export type BackupPolicyFile = t.TypeOf; +export type PolicyFile = t.TypeOf; +export type NewPolicyFile = t.TypeOf; +export type NewDatasource = t.TypeOf; +export type Datasource = t.TypeOf; +export type DatasourceInput = t.TypeOf; +export type FullPolicyFile = t.TypeOf; diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/default.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/default.ts new file mode 100644 index 0000000000000..02dec7201ea41 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/default.ts @@ -0,0 +1,228 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PathReporter } from 'io-ts/lib/PathReporter'; +import { isRight } from 'fp-ts/lib/Either'; +import { SavedObjectsBulkGetObject } from 'src/core/server'; +import { SODatabaseAdapter } from '../so_database/default'; +import { RuntimePolicyFile, NewPolicyFile } from './adapter_types'; +import { PolicyFile, DatasourceInput, BackupPolicyFile } from './adapter_types'; + +export class PolicyAdapter { + constructor(private readonly so: SODatabaseAdapter) {} + + public async create(policy: NewPolicyFile, options?: { id?: string }): Promise { + const newSo = await this.so.create( + 'policies', + (policy as any) as PolicyFile, + options + ); + + return { + id: newSo.id, + ...newSo.attributes, + }; + } + + public async get(id: string): Promise { + const policySO = await this.so.get('policies', id); + + if (policySO.error) { + throw new Error(policySO.error.message); + } + + const policy = { + id: policySO.id, + ...policySO.attributes, + }; + + const decoded = RuntimePolicyFile.decode(policy); + + if (isRight(decoded)) { + return decoded.right; + } else { + throw new Error( + `Invalid PolicyFile data. == ${JSON.stringify(policy)} -- ${PathReporter.report(decoded)}` + ); + } + } + + public async list( + page: number = 1, + perPage: number = 25 + ): Promise<{ items: PolicyFile[]; total: number }> { + const policys = await this.so.find({ + type: 'policies', + search: '*', + searchFields: ['shared_id'], + page, + perPage, + }); + + const uniqPolicyFile = policys.saved_objects + .map(policySO => { + const policy = { + id: policySO.id, + ...policySO.attributes, + }; + const decoded = RuntimePolicyFile.decode(policy); + + if (isRight(decoded)) { + return decoded.right; + } else { + throw new Error( + `Invalid PolicyFile data. == ${JSON.stringify(policy)} -- ${PathReporter.report( + decoded + )}` + ); + } + }) + .reduce((acc, policy: PolicyFile) => { + if (!acc.has(policy.shared_id)) { + acc.set(policy.shared_id, policy); + } + const prevPolicy = acc.get(policy.shared_id); + if (prevPolicy && prevPolicy.version < policy.version) { + acc.set(policy.shared_id, policy); + } + + return acc; + }, new Map()); + + return { items: [...uniqPolicyFile.values()], total: policys.total }; + } + + public async listVersions( + sharedID: string, + activeOnly = true, + page: number = 1, + perPage: number = 25 + ): Promise { + const policys = (await this.so.find({ + type: 'policies', + search: sharedID, + searchFields: ['shared_id'], + page, + perPage, + })).saved_objects; + + if (!activeOnly) { + const backupPolicies = await this.so.find({ + type: 'backup_policies', + search: sharedID, + searchFields: ['shared_id'], + }); + policys.concat(backupPolicies.saved_objects); + } + + return policys.map(policySO => { + const policy = { + id: policySO.id, + ...policySO.attributes, + }; + const decoded = RuntimePolicyFile.decode(policy); + if (isRight(decoded)) { + return decoded.right; + } else { + throw new Error(`Invalid PolicyFile data. == ${policy}`); + } + }); + } + + public async update(id: string, policy: PolicyFile): Promise<{ id: string; version: number }> { + const updatedPolicy = await this.so.update('policies', id, policy); + + return { + id: policy.id, + version: updatedPolicy.attributes.version || 1, + }; + } + + public async deleteVersion(id: string): Promise<{ success: boolean }> { + await this.so.delete('policies', id); + return { + success: true, + }; + } + + public async createBackup( + policy: BackupPolicyFile + ): Promise<{ success: boolean; id?: string; error?: string }> { + const newSo = await this.so.create('policies', (policy as any) as PolicyFile); + + return { + success: newSo.error ? false : true, + id: newSo.id, + error: newSo.error ? newSo.error.message : undefined, + }; + } + + public async getBackup(id: string): Promise { + const policy = await this.so.get('backup_policies', id); + + if (policy.error) { + throw new Error(policy.error.message); + } + + if (!policy.attributes) { + throw new Error(`No backup policy found with ID of ${id}`); + } + if (isRight(RuntimePolicyFile.decode(policy.attributes))) { + return policy.attributes as BackupPolicyFile; + } else { + throw new Error(`Invalid BackupPolicyFile data. == ${policy.attributes}`); + } + } + + /** + * Inputs sub-domain type + */ + public async getInputsById(ids: string[]): Promise { + const inputs = await this.so.bulkGet( + ids.map( + (id): SavedObjectsBulkGetObject => ({ + id, + type: 'inputs', + }) + ) + ); + + return inputs.saved_objects.map(input => input.attributes); + } + + public async listInputsforPolicy( + policyId: string, + page: number = 1, + perPage: number = 25 + ): Promise { + const inputs = await this.so.find({ + type: 'inputs', + search: policyId, + searchFields: ['policy_id'], + perPage, + page, + }); + + return inputs.saved_objects.map(input => input.attributes); + } + + public async addInputs(inputs: DatasourceInput[]): Promise { + const newInputs = []; + for (const input of inputs) { + newInputs.push(await this.so.create('inputs', input)); + } + return newInputs.map(input => input.id); + } + + public async deleteInputs(inputIDs: string[]): Promise<{ success: boolean }> { + for (const id of inputIDs) { + await this.so.delete('inputs', id); + } + return { + success: true, + }; + } +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/memorized.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/memorized.ts new file mode 100644 index 0000000000000..83fa70e69a892 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/policy/memorized.ts @@ -0,0 +1,212 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { memorize } from '@mattapperson/slapshot/lib/memorize'; +import { NewPolicyFile } from './adapter_types'; +import { PolicyFile, DatasourceInput, BackupPolicyFile } from './adapter_types'; +import { PolicyAdapter } from './default'; + +export class MemorizedPolicyAdapter { + constructor(private readonly adapter?: PolicyAdapter) {} + + public async create(newPolicy: NewPolicyFile, options?: { id?: string }): Promise { + const { shared_id, ...policy } = newPolicy; + return await memorize( + `create - ${JSON.stringify({ name: policy.name, description: policy.description })}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.create(newPolicy, options); + }, + { + pure: false, + } + ); + } + + public async get(id: string): Promise { + return await memorize( + `get - ${JSON.stringify(id)}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.get(id); + }, + { + pure: false, + } + ); + } + + public async list( + page: number = 1, + perPage: number = 25 + ): Promise<{ items: PolicyFile[]; total: number }> { + return await memorize( + `list - ${JSON.stringify({ page, perPage })}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.list(page, perPage); + }, + { + pure: false, + } + ); + } + + public async listVersions( + sharedID: string, + activeOnly = true, + page: number = 1, + perPage: number = 25 + ): Promise { + return await memorize( + `listVersions - ${JSON.stringify({ sharedID, activeOnly, page, perPage })}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.listVersions(sharedID, activeOnly, page, perPage); + }, + { + pure: false, + } + ); + } + + public async update(id: string, policy: PolicyFile): Promise<{ id: string; version: number }> { + return await memorize( + `update - ${JSON.stringify({ name: policy.name, description: policy.description })}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.update(id, policy); + }, + { + pure: false, + } + ); + } + + public async deleteVersion(sharedId: string): Promise<{ success: boolean }> { + return await memorize( + `deleteVersion - ${JSON.stringify(sharedId)}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.deleteVersion(sharedId); + }, + { + pure: false, + } + ); + } + + public async createBackup( + policy: BackupPolicyFile + ): Promise<{ success: boolean; id?: string; error?: string }> { + return await memorize( + `createBackup - ${JSON.stringify(policy)}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.createBackup(policy); + }, + { + pure: false, + } + ); + } + + public async getBackup(id: string): Promise { + return await memorize( + `getBackup - ${JSON.stringify(id)}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.getBackup(id); + }, + { + pure: false, + } + ); + } + + /** + * Inputs sub-domain type + */ + public async getInputsById(ids: string[]): Promise { + return await memorize( + `getInputsById - ${JSON.stringify({ ids })}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.getInputsById(ids); + }, + { + pure: false, + } + ); + } + + public async listInputsforPolicy( + policyId: string, + page: number = 1, + perPage: number = 25 + ): Promise { + return await memorize( + `listInputsforPolicy - ${JSON.stringify({ policyId, page, perPage })}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.listInputsforPolicy(policyId, page, perPage); + }, + { + pure: false, + } + ); + } + + public async addInputs(inputs: DatasourceInput[]): Promise { + return await memorize( + `addInputs - ${JSON.stringify(inputs.map(i => i.id))}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.addInputs(inputs); + }, + { + pure: false, + } + ); + } + + public async deleteInputs(inputIDs: string[]): Promise<{ success: boolean }> { + return await memorize( + `deleteInputs - ${JSON.stringify(inputIDs)}`, + async () => { + if (!this.adapter) { + throw new Error('An adapter must be provided when running tests online'); + } + return await this.adapter.deleteInputs(inputIDs); + }, + { + pure: false, + } + ); + } +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/so_database/adapter_types.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/so_database/adapter_types.ts new file mode 100644 index 0000000000000..41bc2aa258807 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/so_database/adapter_types.ts @@ -0,0 +1,5 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ diff --git a/x-pack/legacy/plugins/ingest/server/libs/adapters/so_database/default.ts b/x-pack/legacy/plugins/ingest/server/libs/adapters/so_database/default.ts new file mode 100644 index 0000000000000..f933644eab6f6 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/adapters/so_database/default.ts @@ -0,0 +1,132 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { + SavedObjectsLegacyService, + SavedObjectsClient as SavedObjectsClientType, + SavedObjectAttributes, + SavedObjectsBulkCreateObject, + SavedObjectsBaseOptions, + SavedObjectsFindOptions, + SavedObjectsFindResponse, + SavedObjectsBulkResponse, + SavedObject, + SavedObjectsUpdateOptions, + SavedObjectsCreateOptions, + SavedObjectsBulkGetObject, + SavedObjectsUpdateResponse, +} from 'src/core/server'; +import { ElasticsearchPlugin } from 'src/legacy/core_plugins/elasticsearch'; + +export class SODatabaseAdapter { + private client: SavedObjectsClientType; + constructor(savedObjects: SavedObjectsLegacyService, elasticsearch: ElasticsearchPlugin) { + const { SavedObjectsClient, getSavedObjectsRepository } = savedObjects; + const { callWithInternalUser } = elasticsearch.getCluster('admin'); + const internalRepository = getSavedObjectsRepository(callWithInternalUser); + + this.client = new SavedObjectsClient(internalRepository); + } + + /** + * Persists a SavedObject + * + * @param type + * @param attributes + * @param options + */ + async create( + type: string, + data: T, + options?: SavedObjectsCreateOptions + ) { + return await this.client.create(type, data, options); + } + + /** + * Persists multiple documents batched together as a single request + * + * @param objects + * @param options + */ + async bulkCreate( + objects: Array>, + options?: SavedObjectsCreateOptions + ) { + return await this.client.bulkCreate(objects, options); + } + + /** + * Deletes a SavedObject + * + * @param type + * @param id + * @param options + */ + async delete(type: string, id: string, options: SavedObjectsBaseOptions = {}) { + return await this.client.delete(type, id, options); + } + + /** + * Find all SavedObjects matching the search query + * + * @param options + */ + async find( + options: SavedObjectsFindOptions + ): Promise> { + return await this.client.find(options); + } + + /** + * Returns an array of objects by id + * + * @param objects - an array of ids, or an array of objects containing id, type and optionally fields + * @example + * + * bulkGet([ + * { id: 'one', type: 'policy' }, + * { id: 'foo', type: 'index-pattern' } + * ]) + */ + async bulkGet( + objects: SavedObjectsBulkGetObject[] = [], + options: SavedObjectsBaseOptions = {} + ): Promise> { + return await this.client.bulkGet(objects, options); + } + + /** + * Retrieves a single object + * + * @param type - The type of SavedObject to retrieve + * @param id - The ID of the SavedObject to retrieve + * @param options + */ + async get( + type: string, + id: string, + options: SavedObjectsBaseOptions = {} + ): Promise> { + return await this.client.get(type, id, options); + } + + /** + * Updates an SavedObject + * + * @param type + * @param id + * @param options + */ + async update( + type: string, + id: string, + attributes: Partial, + options: SavedObjectsUpdateOptions = {} + ): Promise> { + return await this.client.update(type, id, attributes, options); + } +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/compose/kibana.ts b/x-pack/legacy/plugins/ingest/server/libs/compose/kibana.ts new file mode 100644 index 0000000000000..6f4117dfe8eb5 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/compose/kibana.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { camelCase } from 'lodash'; +import { PLUGIN } from '../../../common/constants'; +import { CONFIG_PREFIX } from '../../../common/constants/plugin'; +import { DatabaseKbnESPlugin } from '../adapters/es_database/adapter_types'; +import { ESDatabaseAdapter } from '../adapters/es_database/default'; +import { BackendFrameworkAdapter } from '../adapters/framework/default'; +import { ServerLibs } from '../types'; +import { BackendFrameworkLib } from './../framework'; +import { PolicyLib } from '../policy'; +import { PolicyAdapter } from '../adapters/policy/default'; +import { SODatabaseAdapter } from '../adapters/so_database/default'; +import { KibanaLegacyServer } from '../adapters/framework/adapter_types'; + +export function compose(server: KibanaLegacyServer): ServerLibs { + const framework = new BackendFrameworkLib( + new BackendFrameworkAdapter(camelCase(PLUGIN.ID), server, CONFIG_PREFIX) + ); + const database = new ESDatabaseAdapter(server.plugins.elasticsearch as DatabaseKbnESPlugin); + const soDatabase = new SODatabaseAdapter(server.savedObjects, server.plugins.elasticsearch); + + const policyAdapter = new PolicyAdapter(soDatabase); + const policy = new PolicyLib(policyAdapter, { framework }); + + const libs: ServerLibs = { + policy, + framework, + database, + }; + + return libs; +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/compose/memorized.ts b/x-pack/legacy/plugins/ingest/server/libs/compose/memorized.ts new file mode 100644 index 0000000000000..617c35a7265cc --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/compose/memorized.ts @@ -0,0 +1,72 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { camelCase } from 'lodash'; +import { callWhenOnline } from '@mattapperson/slapshot/lib/call_when_online'; +import { PLUGIN } from '../../../common/constants'; +import { CONFIG_PREFIX } from '../../../common/constants/plugin'; +import { ESDatabaseAdapter } from '../adapters/es_database/default'; +import { BackendFrameworkAdapter } from '../adapters/framework/default'; +import { ServerLibs } from '../types'; +import { BackendFrameworkLib } from './../framework'; +import { PolicyLib } from '../policy'; +import { PolicyAdapter } from '../adapters/policy/default'; +import { SODatabaseAdapter } from '../adapters/so_database/default'; +import { KibanaLegacyServer } from '../adapters/framework/adapter_types'; +import { MemorizedPolicyAdapter } from '../adapters/policy/memorized'; +import { MemorizedBackendFrameworkAdapter } from '../adapters/framework/memorized'; + +export function compose(servers?: { + shutdown: () => Promise; + kbnServer: KibanaLegacyServer; + root: any; +}): ServerLibs { + let realPolicyAdapter: PolicyAdapter; + let realFrameworkAdapter: BackendFrameworkAdapter; + + callWhenOnline(() => { + if (!servers) { + throw new Error( + 'servers must be passed into compose when called using online contract tests' + ); + } + const soAdapter = new SODatabaseAdapter( + servers.kbnServer.savedObjects, + servers.kbnServer.plugins.elasticsearch + ); + realPolicyAdapter = new PolicyAdapter(soAdapter); + realFrameworkAdapter = new BackendFrameworkAdapter( + camelCase(PLUGIN.ID), + servers.kbnServer, + CONFIG_PREFIX + ); + }); + + const memorizedFrameworkAdapter = new MemorizedBackendFrameworkAdapter( + realFrameworkAdapter! + ) as BackendFrameworkAdapter; + const framework = new BackendFrameworkLib(memorizedFrameworkAdapter); + + const memorizedPolicyAdapter = new MemorizedPolicyAdapter(realPolicyAdapter!) as PolicyAdapter; + const policy = new PolicyLib(memorizedPolicyAdapter, { framework }); + + const libs: ServerLibs = { + policy, + framework, + database: new Proxy( + {}, + { + get() { + throw new Error( + 'The database lib is not implamented in the momorized composition of libs yet' + ); + }, + } + ) as ESDatabaseAdapter, + }; + + return libs; +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/framework.ts b/x-pack/legacy/plugins/ingest/server/libs/framework.ts new file mode 100644 index 0000000000000..15bd491ad5f81 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/framework.ts @@ -0,0 +1,50 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Request } from 'src/legacy/server/kbn_server'; +import { get } from 'lodash'; +import { BackendFrameworkAdapter } from './adapters/framework/default'; +import { LicenseType } from '../../common/types/security'; + +export class BackendFrameworkLib { + /** + * Expired `null` happens when we have no xpack info + */ + public get license() { + return { + type: get(this.adapter, 'info.license.type', 'oss'), + expired: get(this.adapter, 'info.license.expired', null), + }; + } + public get info() { + return this.adapter.info; + } + public get version() { + return get(this.adapter, 'info.kibana.version', null) as string | null; + } + public get securityIsEnabled() { + return get(this.adapter, 'info.security.enabled', false); + } + + public log = this.adapter.log; + public on = this.adapter.on.bind(this.adapter); + public internalUser = this.adapter.internalUser; + constructor(private readonly adapter: BackendFrameworkAdapter) {} + + public getCurrentUser(request: Request) { + return this.adapter.getUser(request); + } + public getSetting(setting: 'defaultUserRoles'): string[]; + public getSetting(setting: 'defaultUserRoles') { + return this.adapter.getSetting(`xpack.ingest-do-not-disable.${setting}`); + } + public expose(name: string, thing: any) { + return this.adapter.expose(name, thing); + } + public async waitForStack() { + return await this.adapter.waitForStack(); + } +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/policy.contract.test.ts b/x-pack/legacy/plugins/ingest/server/libs/policy.contract.test.ts new file mode 100644 index 0000000000000..1aeb3284a9811 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/policy.contract.test.ts @@ -0,0 +1,299 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { callWhenOnline } from '@mattapperson/slapshot/lib/call_when_online'; +import { compose } from './compose/memorized'; +import { ServerLibs } from './types'; +import * as elasticsearch from 'elasticsearch'; +import { FrameworkAuthenticatedUser } from './adapters/framework/adapter_types'; +import { INDEX_NAMES } from '../../common/constants/index_names'; + +jest.mock('uuid/v4', () => { + let uuid = 1; + return () => `uuid-${uuid++}`; +}); + +describe('Policies Lib', () => { + let servers: any; + let libs: ServerLibs; + let es: elasticsearch.Client; + const TestUser: FrameworkAuthenticatedUser = { + kind: 'authenticated', + username: 'mattapperson', + roles: ['fleet_admin'], + full_name: null, + email: null, + enabled: true, + }; + + beforeAll(async () => { + await callWhenOnline(async () => { + jest.setTimeout(300000); + const { createKibanaServer } = await import( + '../../../../../test_utils/jest/contract_tests/servers' + ); + + servers = await createKibanaServer({ + security: { enabled: true }, + }); + const esPolicy = JSON.parse(process.env.__JEST__ESServer || ''); + es = new elasticsearch.Client({ + hosts: esPolicy.hosts, + httpAuth: esPolicy.username ? `${esPolicy.username}:${esPolicy.password}` : undefined, + }); + }); + + libs = compose(servers); + await libs.framework.waitForStack(); + }); + + afterAll(async () => { + if (servers) { + await servers.shutdown(); + } + }); + + beforeEach(async () => { + if (es) { + jest.setTimeout(300000); + await es.deleteByQuery({ + index: INDEX_NAMES.INGEST, + body: { + conflicts: 'proceed', + query: { match_all: {} }, + }, + }); + } + }); + + describe('create', () => { + it('should create a new policy', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + + expect(typeof newPolicy.id).toBe('string'); + expect(typeof newPolicy.shared_id).toBe('string'); + expect(typeof newPolicy.version).toBe('number'); + + const gottenPolicy = await libs.policy.get(newPolicy.id); + expect(gottenPolicy.name).toBe('test'); + }); + }); + + describe('ensureDefaultPolicy', () => { + it('should create a new default policy if none exists', async () => { + await libs.policy.ensureDefaultPolicy(); + + const { items: policies } = await libs.policy.list(); + expect(policies).toHaveLength(1); + expect(policies[0].id).toBe('default'); + }); + + it('should not create the new default policy more than once', async () => { + await libs.policy.ensureDefaultPolicy(); + await libs.policy.ensureDefaultPolicy(); + + const { items: policies } = await libs.policy.list(); + expect(policies).toHaveLength(1); + expect(policies[0].id).toBe('default'); + }); + }); + + describe('list', () => { + it('should list all active policies', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + const newPolicy2 = await libs.policy.create(TestUser, 'test2', 'test description'); + const newPolicy3 = await libs.policy.create(TestUser, 'test3', 'test description'); + + expect(typeof newPolicy.id).toBe('string'); + expect(typeof newPolicy.shared_id).toBe('string'); + expect(typeof newPolicy.version).toBe('number'); + + const { items: gottenPolicies } = await libs.policy.list(); + expect(gottenPolicies.length).toBe(3); + expect(gottenPolicies.find(c => c.id === newPolicy.id) !== undefined).toBe(true); + expect(gottenPolicies.find(c => c.id === newPolicy2.id) !== undefined).toBe(true); + expect(gottenPolicies.find(c => c.id === newPolicy3.id) !== undefined).toBe(true); + }); + + it('should not list inactive policies', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + const updated = await libs.policy.update(newPolicy.id, { + name: 'foo', + }); + const newPolicy2 = await libs.policy.create(TestUser, 'test2', 'test description'); + const newPolicy3 = await libs.policy.create(TestUser, 'test3', 'test description'); + + expect(typeof newPolicy.id).toBe('string'); + expect(typeof newPolicy.shared_id).toBe('string'); + expect(typeof newPolicy.version).toBe('number'); + + const { items: gottenPolicies } = await libs.policy.list(); + expect(gottenPolicies.length).toBe(3); + expect(gottenPolicies.find(c => c.id === updated.id) !== undefined).toBe(true); + expect(gottenPolicies.find(c => c.id === newPolicy2.id) !== undefined).toBe(true); + expect(gottenPolicies.find(c => c.id === newPolicy3.id) !== undefined).toBe(true); + }); + }); + + describe('update', () => { + it('should update a policy and invalidate the origional', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + const updated = await libs.policy.update(newPolicy.id, { + name: 'foo', + }); + expect(updated.id).not.toBe(newPolicy.id); + expect(updated.version).toBe(newPolicy.version + 1); + expect(updated.shared_id).toBe(newPolicy.shared_id); + + const gottenPolicy = await libs.policy.get(updated.id); + expect(gottenPolicy.name).toBe('foo'); + + const origPolicy = await libs.policy.get(newPolicy.id); + expect(origPolicy.status).toBe('locked'); + }); + }); + + describe.skip('finish update', () => {}); + + describe('list versions', () => { + it('Should list past locked versions of a policy', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + await libs.policy.update(newPolicy.id, { + name: 'foo', + }); + + const gottenPolicies = await libs.policy.listVersions(newPolicy.shared_id, false); + expect(gottenPolicies.length).toBe(2); + expect(gottenPolicies.filter(c => c.status === 'active').length).toBe(1); + expect(gottenPolicies.filter(c => c.status === 'locked').length).toBe(1); + }); + }); + + describe('delete', () => { + it('Should delete the version by the versions ID', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + + await libs.policy.update(newPolicy.id, { + name: 'foo', + }); + + try { + await libs.policy.deleteVersion(newPolicy.id); + } catch (e) { + expect(e).toBe(undefined); + } + const gottenPolicies = await libs.policy.listVersions(newPolicy.shared_id, false); + expect(gottenPolicies.length).toBe(1); + }); + + it('Should delete the all versions when deleting the shared ID', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + + await libs.policy.update(newPolicy.id, { + name: 'foo', + }); + + try { + await libs.policy.delete(newPolicy.shared_id); + } catch (e) { + expect(e).toBe(undefined); + } + + const { items: gottenPolicies } = await libs.policy.list(); + expect(gottenPolicies.length).toBe(0); + }); + + it('Should never delete the default policy', async () => { + expect(libs.policy.delete('default')).rejects.toThrowError(/Not allowed/); + }); + }); + + describe('createNewPolicyFrom', () => { + it('Should duplicate policy but with a new shared_id', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + + await libs.policy.createNewPolicyFrom(newPolicy.id, 'foo', 'description'); + + const { items: gottenPolicies } = await libs.policy.list(); + expect(gottenPolicies.length).toBe(2); + expect(gottenPolicies.find(c => c.name === 'foo') !== undefined).toBe(true); + expect(gottenPolicies.find(c => c.name === 'foo')!.shared_id).not.toBe( + gottenPolicies.find(c => c.name === 'test')!.shared_id + ); + }); + }); + describe.skip('rollForward', () => {}); + + describe('requestAddDataSource', () => { + it('Should add data sources and inputs to the policy', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + + const updatedPolicyInfo = await libs.policy.requestAddDataSource(newPolicy.id, { + ref_source: undefined, + ref: undefined, + output: '43hi34hi5y3i53o4', + inputs: [{}, {}], + queue: undefined, + }); + const fullPolicy = await libs.policy.get(updatedPolicyInfo.id); + expect(fullPolicy.name).toBe('test'); + expect(fullPolicy.data_sources.length).toBe(1); + expect(fullPolicy.data_sources[0].uuid.length > 0).toBe(true); + expect(fullPolicy.data_sources[0].inputs.length).toBe(2); + expect(typeof fullPolicy.data_sources[0].inputs[0]).toBe('string'); + }); + }); + describe('requestDeleteDataSource', () => { + it('Should delete data sources', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + + const updatedPolicyInfo = await libs.policy.requestAddDataSource(newPolicy.id, { + ref_source: undefined, + ref: undefined, + output: '43hi34hi5y3i53o4', + inputs: [{}, {}], + queue: undefined, + }); + const fullPolicy = await libs.policy.get(updatedPolicyInfo.id); + expect(fullPolicy.data_sources.length).toBe(1); + expect(fullPolicy.data_sources[0].uuid.length > 0).toBe(true); + + const finalPolicyInfo = await libs.policy.requestDeleteDataSource( + updatedPolicyInfo.id, + fullPolicy.data_sources[0].uuid + ); + expect(finalPolicyInfo.id).not.toBe(updatedPolicyInfo.id); + const fullPolicy2 = await libs.policy.get(finalPolicyInfo.id); + expect(fullPolicy2.version).toBe(fullPolicy.version + 1); + + expect(fullPolicy2.data_sources.length).toBe(0); + }); + }); + describe('getFull', () => { + it('Should return a policy with all inputs, not just refs to the inputs', async () => { + const newPolicy = await libs.policy.create(TestUser, 'test', 'test description'); + + const updatedPolicyInfo = await libs.policy.requestAddDataSource(newPolicy.id, { + ref_source: undefined, + ref: undefined, + output: '43hi34hi5y3i53o4', + inputs: [{ foo: 'bar' }], + queue: undefined, + }); + const fullPolicy = await libs.policy.getFull(updatedPolicyInfo.id); + + expect(fullPolicy.name).toBe('test'); + expect(fullPolicy.data_sources.length).toBe(1); + expect(fullPolicy.data_sources[0].uuid.length > 0).toBe(true); + expect(fullPolicy.data_sources[0].inputs.length).toBe(1); + expect(typeof fullPolicy.data_sources[0].inputs[0]).not.toBe('string'); + expect((fullPolicy.data_sources[0].inputs[0] as any).other).toBe(undefined); + expect(fullPolicy.data_sources[0].inputs[0].foo).toBe('bar'); + }); + }); + + describe.skip('update / change hooks', () => {}); +}); diff --git a/x-pack/legacy/plugins/ingest/server/libs/policy.ts b/x-pack/legacy/plugins/ingest/server/libs/policy.ts new file mode 100644 index 0000000000000..32cfba075a191 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/policy.ts @@ -0,0 +1,342 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { assign, omit } from 'lodash'; +import uuidv4 from 'uuid/v4'; +import { PolicyAdapter } from './adapters/policy/default'; +import { BackendFrameworkLib } from './framework'; +import { + PolicyFile, + NewPolicyFile, + FullPolicyFile, + Datasource, +} from './adapters/policy/adapter_types'; +import { FrameworkAuthenticatedUser } from './adapters/framework/adapter_types'; +import { NewDatasource } from './adapters/policy/adapter_types'; +import { DEFAULT_POLICY_ID } from '../../common/constants'; + +export class PolicyLib { + constructor( + private readonly adapter: PolicyAdapter, + private readonly libs: { + framework: BackendFrameworkLib; + } + ) {} + public async create(withUser: FrameworkAuthenticatedUser, name: string, description?: string) { + const info = this.libs.framework.info; + if (info === null) { + throw new Error('Could not get version information about Kibana from xpack'); + } + + const newPolicy: NewPolicyFile = { + name, + description: description || '', + status: 'active', + monitoring_enabled: true, + shared_id: `shared-${uuidv4()}`, + version: 0, + agent_version: info.kibana.version, + data_sources: [], + created_on: new Date().toISOString(), + created_by: withUser.username, + updated_on: new Date().toISOString(), + updated_by: withUser.username, + }; + + return await this.adapter.create(newPolicy); + } + + public async getFullActive(sharedId: string): Promise { + const activePolicies = await this.adapter.listVersions(sharedId); + + const mostRecentDate = new Date( + Math.max.apply( + null, + activePolicies.map(policy => { + return new Date(policy.updated_on).getTime(); + }) + ) + ); + + return activePolicies.filter(policy => { + const d = new Date(policy.updated_on); + return d.getTime() >= mostRecentDate.getTime(); + })[0]; + } + + public async get(id: string): Promise { + const policy = await this.adapter.get(id); + return policy; + } + + public async getFull(id: string): Promise { + const policy = await this.adapter.get(id); + for (let i = 0; i < policy.data_sources.length; i++) { + if (policy.data_sources[i]) { + const fullInputs = await this.adapter.getInputsById(policy.data_sources[i].inputs); + (policy.data_sources[i] as any).inputs = fullInputs.map(input => { + return JSON.parse(((input as unknown) as { other: string }).other); + }); + } + } + + return policy as FullPolicyFile; + } + + public async list( + page: number = 1, + perPage: number = 25 + ): Promise<{ items: PolicyFile[]; total: number }> { + return await this.adapter.list(page, perPage); + } + + public async listVersions( + sharedID: string, + activeOnly = true, + page: number = 1, + perPage: number = 25 + ): Promise { + const policys = await this.adapter.listVersions(sharedID, activeOnly, page, perPage); + return policys; + } + + public async update( + id: string, + policy: Partial<{ + name: string; + description: string; + monitoring_enabled: boolean; + }> + ): Promise<{ id: string; version: number; shared_id: string }> { + const invalidKeys = Object.keys(policy).filter( + key => !['name', 'description', 'monitoring_enabled'].includes(key) + ); + + if (invalidKeys.length !== 0) { + throw new Error( + `Update was called with policy paramaters that are not allowed: ${invalidKeys}` + ); + } + const oldPolicy = await this.adapter.get(id); + + if (oldPolicy.status !== 'active') { + throw new Error( + `Policy ${oldPolicy.id} can not be updated becuase it is ${oldPolicy.status}` + ); + } + + const newPolicy = await this._update(oldPolicy, policy); + return newPolicy; + } + + public async delete(sharedId: string): Promise<{ success: boolean }> { + if (sharedId === DEFAULT_POLICY_ID) { + throw new Error('Not allowed (impossible to delete default policy)'); + } + // TODO Low priority - page through vs one large query as this will break if there are more then 10k past versions + const versions = await this.listVersions(sharedId, false, 1, 10000); + + // TODO bulk delete + for (const version of versions) { + await this.adapter.deleteVersion(version.id); + } + + return { + success: true, + }; + } + + public async deleteVersion(id: string): Promise<{ success: boolean }> { + return await this.adapter.deleteVersion(id); + } + + public async createNewPolicyFrom(policyId: string, name: string, description: string = '') { + const { id, data_sources: dataSources, ...oldPolicy } = await this.adapter.get(policyId); + const newPolicy = await this.adapter.create({ + ...oldPolicy, + data_sources: [], + }); + + const newDSs: PolicyFile['data_sources'] = []; + for (const ds of dataSources) { + const oldInputs = await this.adapter.getInputsById(ds.inputs); + const newInputs = await this.adapter.addInputs( + oldInputs.map(input => ({ + ...input, + id: uuidv4(), + policy_id: newPolicy.id, + })) + ); + + newDSs.push({ ...ds, uuid: uuidv4(), inputs: newInputs }); + } + + await this.adapter.update(newPolicy.id, { + ...oldPolicy, + id: newPolicy.id, + data_sources: newDSs, + shared_id: `shared-${uuidv4()}`, + name, + description, + }); + // TODO fire events for fleet that update was made + } + + public async upgrade(policyId: string, version: string) { + const { id, agent_version: agentVersion, ...oldPolicy } = await this.adapter.get(policyId); + const newPolicy = await this.adapter.create({ ...oldPolicy, agent_version: agentVersion }); + + // TODO: ensure new version is greater then old + // TODO: Ensure new version is a valid version number for agent + // TODO: ensure new version works with current ES version + // TODO: trigger and merge in policy changes from intigrations + + await this.adapter.update(newPolicy.id, { + id: newPolicy.id, + ...oldPolicy, + agent_version: version, + }); + // TODO fire events for fleet that update was made + } + + public async finishUpdateFrom(policyId: string) { + const oldPolicy = await this.adapter.get(policyId); + await this.adapter.update(policyId, { + ...oldPolicy, + status: 'inactive', + }); + } + + public async rollForward( + id: string + ): Promise<{ id: string; version: number; shared_id: string }> { + const oldPolicy = await this.adapter.get(id); + + const newPolicyInfo = await this._update(oldPolicy, {}); + return { + id: newPolicyInfo.id, + version: newPolicyInfo.version, + shared_id: newPolicyInfo.shared_id, + }; + } + + /** + * request* because in the future with an approval flow it will not directly make the change + */ + public async requestAddDataSource(policyId: string, datasource: NewDatasource) { + const oldPolicy = await this.adapter.get(policyId); + + if (oldPolicy.status !== 'active') { + throw new Error( + `Policy ${oldPolicy.id} can not be updated becuase it is ${oldPolicy.status}` + ); + } + const uuid = uuidv4(); + + // TODO: these types are really messed up... idk why... + const editedDS: NewDatasource & { + inputs: string[]; + queue?: string; + } = { + ...datasource, + queue: JSON.stringify(datasource.queue || ''), + inputs: (await this.adapter.addInputs( + datasource.inputs.map(input => { + return { + other: JSON.stringify(input), + data_source_id: uuid, + }; + }) + )) as any[], + } as any; + + const newPolicyInfo = await this._update(oldPolicy, { + data_sources: [...oldPolicy.data_sources, { uuid, ...editedDS } as Datasource], + }); + + return { + id: newPolicyInfo.id, + version: newPolicyInfo.version, + shared_id: newPolicyInfo.shared_id, + }; + } + public async ensureDefaultPolicy() { + try { + await this.adapter.get(DEFAULT_POLICY_ID); + } catch (err) { + if (!err.isBoom || err.output.statusCode !== 404) { + throw err; + } + const info = this.libs.framework.info; + if (info === null) { + throw new Error('Could not get version information about Kibana from xpack'); + } + const newDefaultPolicy: NewPolicyFile = { + name: 'Default policy', + description: 'Default policy created by Kibana', + status: 'active', + monitoring_enabled: true, + shared_id: DEFAULT_POLICY_ID, + version: 0, + agent_version: info.kibana.version, + data_sources: [], + created_on: new Date().toISOString(), + created_by: 'kibana', + updated_on: new Date().toISOString(), + updated_by: 'kibana', + }; + await this.adapter.create(newDefaultPolicy, { + id: DEFAULT_POLICY_ID, + }); + } + } + /** + * request* because in the future with an approval flow it will not directly make the change + */ + public async requestDeleteDataSource(policyId: string, datasourceUUID: string) { + const oldPolicy = await this.adapter.get(policyId); + + if (oldPolicy.status !== 'active') { + throw new Error( + `Policy ${oldPolicy.id} can not be updated becuase it is ${oldPolicy.status}` + ); + } + + if (!oldPolicy.data_sources.find(ds => ds.uuid === datasourceUUID)) { + throw new Error( + `Policy ${oldPolicy.id} does not contain a datasource with a uuid of ${datasourceUUID}` + ); + } + + const newPolicyInfo = await this._update(oldPolicy, { + data_sources: oldPolicy.data_sources.filter(ds => ds.uuid !== datasourceUUID), + }); + return { + id: newPolicyInfo.id, + version: newPolicyInfo.version, + shared_id: newPolicyInfo.shared_id, + }; + } + + private async _update(oldPolicy: PolicyFile, policy: Partial) { + const policyData = { + // @ts-ignore because types seem fine, but failing saying only 1 arg, however it works perfectly + ...assign({}, omit(oldPolicy, ['id']), policy), + version: oldPolicy.version + 1, + }; + + const newPolicy = await this.adapter.create(policyData); + + await this.adapter.update(oldPolicy.id, { + ...omit(oldPolicy, ['id']), + status: 'locked', + updated_on: new Date().toString(), + }); + // TODO fire events for fleet that update was made + + return newPolicy; + } +} diff --git a/x-pack/legacy/plugins/ingest/server/libs/types.ts b/x-pack/legacy/plugins/ingest/server/libs/types.ts new file mode 100644 index 0000000000000..6138a7c5e5faa --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/libs/types.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { BackendFrameworkLib } from './framework'; +import { PolicyLib } from './policy'; +import { ESDatabaseAdapter } from './adapters/es_database/default'; +export interface ServerLibs { + policy: PolicyLib; + framework: BackendFrameworkLib; + database?: ESDatabaseAdapter; +} diff --git a/x-pack/legacy/plugins/ingest/server/mappings.ts b/x-pack/legacy/plugins/ingest/server/mappings.ts new file mode 100644 index 0000000000000..968bafa66c4db --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/mappings.ts @@ -0,0 +1,83 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export const mappings = { + policies: { + properties: { + name: { + type: 'text', + }, + description: { + type: 'text', + }, + monitoring_enabled: { + type: 'boolean', + }, + agent_version: { + type: 'keyword', + }, + data_sources: { + properties: { + uuid: { + type: 'keyword', + }, + meta: { + type: 'keyword', + }, + output: { + type: 'keyword', + }, + queue: { + type: 'keyword', + }, + policy_id: { + type: 'keyword', + }, + policy: { + type: 'keyword', + }, + inputs: { + type: 'keyword', + }, + }, + }, + id: { + type: 'keyword', + }, + shared_id: { + type: 'keyword', + }, + version: { + type: 'integer', + }, + status: { + type: 'keyword', + }, + created_on: { + type: 'keyword', + }, + created_by: { + type: 'keyword', + }, + updated_on: { + type: 'keyword', + }, + updated_by: { + type: 'keyword', + }, + }, + }, + inputs: { + properties: { + other: { + type: 'text', + }, + data_source_id: { + type: 'keyword', + }, + }, + }, +}; diff --git a/x-pack/legacy/plugins/ingest/server/rest_api/init_api.ts b/x-pack/legacy/plugins/ingest/server/rest_api/init_api.ts new file mode 100644 index 0000000000000..800cfaaacdf75 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/rest_api/init_api.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { Server } from 'hapi'; +import { ServerLibs } from '../libs/types'; +import { HapiFrameworkAdapter } from '../libs/adapters/framework/hapi_framework_adapter'; +import { createGETPoliciesRoute, createPOSTPoliciesRoute, createGETPoliciyRoute } from './policy'; + +export function initRestApi(server: Server, libs: ServerLibs) { + const frameworkAdapter = new HapiFrameworkAdapter(server); + + // Policies route + frameworkAdapter.registerRoute(createGETPoliciyRoute(libs)); + frameworkAdapter.registerRoute(createGETPoliciesRoute(libs)); + frameworkAdapter.registerRoute(createPOSTPoliciesRoute(libs)); +} diff --git a/x-pack/legacy/plugins/ingest/server/rest_api/policy/index.ts b/x-pack/legacy/plugins/ingest/server/rest_api/policy/index.ts new file mode 100644 index 0000000000000..b757e46300ef8 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/server/rest_api/policy/index.ts @@ -0,0 +1,78 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import * as Joi from 'joi'; +import Boom from 'boom'; +import { + FrameworkRequest, + FrameworkRouteHandler, +} from '../../libs/adapters/framework/adapter_types'; +import { + ReturnTypeList, + ReturnTypeCreate, + ReturnTypeGet, +} from '../../../common/types/std_return_format'; +import { ServerLibs } from '../../libs/types'; + +export const createGETPoliciyRoute = (libs: ServerLibs) => ({ + method: 'GET', + path: '/api/ingest/policies/{policyId}', + config: {}, + handler: (async ( + request: FrameworkRequest<{ params: { policyId: string } }> + ): Promise> => { + const policy = await libs.policy.get(request.params.policyId); + + return { item: policy, success: true }; + }) as FrameworkRouteHandler, +}); + +export const createGETPoliciesRoute = (libs: ServerLibs) => ({ + method: 'GET', + path: '/api/ingest/policies', + config: { + validate: { + query: { + page: Joi.number().default(1), + }, + }, + }, + handler: (async ( + request: FrameworkRequest<{ query: { page: string } }> + ): Promise> => { + const page = parseInt(request.query.page, 10); + const { items, total } = await libs.policy.list(page, 100); + + return { list: items, success: true, page, total }; + }) as FrameworkRouteHandler, +}); + +export const createPOSTPoliciesRoute = (libs: ServerLibs) => ({ + method: 'POST', + path: '/api/ingest/policies', + config: { + validate: { + payload: { + name: Joi.string().required(), + description: Joi.string().optional(), + }, + }, + }, + handler: (async ( + request: FrameworkRequest<{ payload: { name: string; description?: string } }> + ): Promise> => { + if (!request.user || request.user.kind !== 'authenticated') { + throw Boom.unauthorized('Only authenticated users can create a policy'); + } + const policy = await libs.policy.create( + request.user, + request.payload.name, + request.payload.description + ); + + return { item: policy, success: true, action: 'created' }; + }) as FrameworkRouteHandler, +}); diff --git a/x-pack/legacy/plugins/ingest/tsconfig.json b/x-pack/legacy/plugins/ingest/tsconfig.json new file mode 100644 index 0000000000000..d7e27bbef4122 --- /dev/null +++ b/x-pack/legacy/plugins/ingest/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../tsconfig.json", + "exclude": ["**/node_modules/**"], + "paths": { + "react": ["../../../../node_modules/@types/react"] + } +} diff --git a/x-pack/package.json b/x-pack/package.json index fabfce7a60c3b..89484acf0623c 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -35,7 +35,7 @@ "@kbn/pm": "1.0.0", "@kbn/test": "1.0.0", "@kbn/utility-types": "1.0.0", - "@mattapperson/slapshot": "1.4.0", + "@mattapperson/slapshot": "1.4.3", "@storybook/addon-actions": "^5.1.11", "@storybook/addon-console": "^1.2.1", "@storybook/addon-info": "^5.1.11", diff --git a/x-pack/test/api_integration/apis/features/features/features.ts b/x-pack/test/api_integration/apis/features/features/features.ts index ef0f0451ee058..7939edd8faf5f 100644 --- a/x-pack/test/api_integration/apis/features/features/features.ts +++ b/x-pack/test/api_integration/apis/features/features/features.ts @@ -98,6 +98,7 @@ export default function({ getService }: FtrProviderContext) { expect(featureIds.sort()).to.eql( [ 'discover', + 'fleet', 'visualize', 'dashboard', 'dev_tools', diff --git a/x-pack/test/api_integration/apis/fleet/agents/actions.ts b/x-pack/test/api_integration/apis/fleet/agents/actions.ts new file mode 100644 index 0000000000000..ab03c2755e74f --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/agents/actions.ts @@ -0,0 +1,125 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { SecurityService } from '../../../../common/services'; + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertestWithoutAuth'); + const security: SecurityService = getService('security'); + const users: { [rollName: string]: { username: string; password: string; permissions?: any } } = { + fleet_user: { + permissions: { + feature: { + fleet: ['read'], + }, + spaces: ['*'], + }, + username: 'fleet_user', + password: 'changeme', + }, + fleet_admin: { + permissions: { + feature: { + fleet: ['all'], + }, + spaces: ['*'], + }, + username: 'fleet_admin', + password: 'changeme', + }, + }; + describe('fleet_agents_actions', () => { + before(async () => { + for (const roleName in users) { + if (users.hasOwnProperty(roleName)) { + const user = users[roleName]; + + if (user.permissions) { + await security.role.create(roleName, { + kibana: [user.permissions], + }); + } + + // Import a repository first + await security.user.create(user.username, { + password: user.password, + roles: [roleName], + full_name: user.username, + }); + } + } + + await esArchiver.loadIfNeeded('fleet/agents'); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + + it('should return a 404 if the agent do not exists', async () => { + await supertest + .post(`/api/fleet/agents/i-do-not-exist/actions`) + .auth(users.fleet_admin.username, users.fleet_admin.password) + + .send({ + type: 'PAUSE', + }) + .set('kbn-xsrf', 'xx') + .expect(404); + }); + + it('should return a 400 if the action is not invalid', async () => { + await supertest + .post(`/api/fleet/agents/agent1/actions`) + .auth(users.fleet_admin.username, users.fleet_admin.password) + + .send({ + type: 'INVALID_ACTION', + }) + .set('kbn-xsrf', 'xx') + .expect(400); + }); + + it('should return a 200 if the action is not invalid', async () => { + const { body: apiResponse } = await supertest + .post(`/api/fleet/agents/agent1/actions`) + .auth(users.fleet_admin.username, users.fleet_admin.password) + + .send({ + type: 'PAUSE', + }) + .set('kbn-xsrf', 'xx') + .expect(200); + expect(apiResponse.success).to.be(true); + expect(apiResponse.item).to.have.keys(['id', 'type', 'created_at']); + }); + + it('should return a 404 if called by a user without permissions', async () => { + await supertest + .post(`/api/fleet/agents/agent1/actions`) + .auth(users.fleet_user.username, users.fleet_user.password) + .send({ + type: 'PAUSE', + }) + .set('kbn-xsrf', 'xx') + .expect(404); + }); + + // it('should return a 200 after deleting an agent', async () => { + // const { body: apiResponse } = await supertest + // .delete(`/api/fleet/agents/agent1`) + // .set('kbn-xsrf', 'xx') + // .expect(200); + // expect(apiResponse).to.eql({ + // success: true, + // action: 'deleted', + // }); + // }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/agents/checkin.ts b/x-pack/test/api_integration/apis/fleet/agents/checkin.ts new file mode 100644 index 0000000000000..578f5dcec2a12 --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/agents/checkin.ts @@ -0,0 +1,109 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import uuid from 'uuid'; + +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { getSupertestWithoutAuth } from './services'; + +export default function(providerContext: FtrProviderContext) { + const { getService } = providerContext; + const esArchiver = getService('esArchiver'); + const esClient = getService('es'); + + const supertest = getSupertestWithoutAuth(providerContext); + let apiKey: { id: string; api_key: string }; + + describe('fleet_agents_checkin', () => { + before(async () => { + await esArchiver.loadIfNeeded('fleet/agents'); + const options = { + method: 'POST', + path: '/_security/api_key', + body: { + name: `test access api key: ${uuid.v4()}`, + }, + }; + + // @ts-ignore + apiKey = await esClient.transport.request(options); + const { _source: agentDoc } = await esClient.get({ + index: '.kibana', + id: 'agents:agent1', + type: '_doc', + }); + // @ts-ignore + agentDoc.agents.access_api_key_id = apiKey.id; + await esClient.update({ + index: '.kibana', + id: 'agents:agent1', + type: '_doc', + body: { + doc: agentDoc, + }, + refresh: true, + }); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + + it('should return a 401 if this a not a valid checkin access', async () => { + await supertest + .post(`/api/fleet/agents/agent1/checkin`) + .set('kbn-xsrf', 'xx') + .set('Authorization', 'ApiKey NOT_A_VALID_TOKEN') + .send({ + events: [], + }) + .expect(401); + }); + + it('should return a 400 if for a malformed request payload', async () => { + await supertest + .post(`/api/fleet/agents/agent1/checkin`) + .set('kbn-xsrf', 'xx') + .set( + 'Authorization', + `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` + ) + .send({ + events: ['i-am-not-valid-event'], + metadata: {}, + }) + .expect(400); + }); + + it('should return a 200 if this a valid checkin access', async () => { + const { body: apiResponse } = await supertest + .post(`/api/fleet/agents/agent1/checkin`) + .set('kbn-xsrf', 'xx') + .set( + 'Authorization', + `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` + ) + .send({ + events: [ + { + type: 'STATE', + timestamp: '2019-01-04T14:32:03.36764-05:00', + subtype: 'STARTING', + message: 'State change: STARTING', + }, + ], + local_metadata: { + cpu: 12, + }, + }) + .expect(200); + expect(apiResponse.action).to.be('checkin'); + expect(apiResponse.success).to.be(true); + expect(apiResponse.actions).to.have.length(1); + expect(apiResponse.policy).to.have.keys(['name', 'data_sources']); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/agents/enroll.ts b/x-pack/test/api_integration/apis/fleet/agents/enroll.ts new file mode 100644 index 0000000000000..9493805eb81da --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/agents/enroll.ts @@ -0,0 +1,115 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import uuid from 'uuid'; +import * as legacyElasticsearch from 'elasticsearch'; + +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { getSupertestWithoutAuth } from './services'; + +export default function(providerContext: FtrProviderContext) { + const { getService } = providerContext; + + const esArchiver = getService('esArchiver'); + const esClient = getService('es') as legacyElasticsearch.Client; + + const supertest = getSupertestWithoutAuth(providerContext); + let apiKey: { id: string; api_key: string }; + + describe('fleet_agents_enroll', () => { + before(async () => { + await esArchiver.loadIfNeeded('fleet/agents'); + + const options = { + method: 'POST', + path: '/_security/api_key', + body: { + name: `test enrollment api key: ${uuid.v4()}`, + }, + }; + + // @ts-ignore + apiKey = await esClient.transport.request(options); + const { _source: enrollmentApiKeyDoc } = await esClient.get({ + index: '.kibana', + id: 'enrollment_api_keys:ed22ca17-e178-4cfe-8b02-54ea29fbd6d0', + type: '_doc', + }); + // @ts-ignore + enrollmentApiKeyDoc.enrollment_api_keys.api_key_id = apiKey.id; + await esClient.update({ + index: '.kibana', + id: 'enrollment_api_keys:ed22ca17-e178-4cfe-8b02-54ea29fbd6d0', + type: '_doc', + body: { + doc: enrollmentApiKeyDoc, + }, + refresh: true, + }); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + + it('should not allow to enroll an agent with a invalid enrollment', async () => { + const { body: apiResponse } = await supertest + .post(`/api/fleet/agents/enroll`) + .set('kbn-xsrf', 'xxx') + .set('Authorization', 'ApiKey NOTAVALIDKEY') + .send({ + type: 'PERMANENT', + metadata: { + local: {}, + user_provided: {}, + }, + }) + .expect(401); + + expect(apiResponse.message).to.match(/Enrollment apiKey is not valid:/); + }); + + it('should not allow to enroll an agent with a shared id if it already exists ', async () => { + const { body: apiResponse } = await supertest + .post(`/api/fleet/agents/enroll`) + .set('kbn-xsrf', 'xxx') + .set( + 'authorization', + `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` + ) + .send({ + shared_id: 'agent2_filebeat', + type: 'PERMANENT', + metadata: { + local: {}, + user_provided: {}, + }, + }) + .expect(400); + expect(apiResponse.message).to.match(/Impossible to enroll an already active agent/); + }); + + it('should allow to enroll an agent with a valid enrollment token', async () => { + const { body: apiResponse } = await supertest + .post(`/api/fleet/agents/enroll`) + .set('kbn-xsrf', 'xxx') + .set( + 'Authorization', + `ApiKey ${Buffer.from(`${apiKey.id}:${apiKey.api_key}`).toString('base64')}` + ) + .send({ + type: 'PERMANENT', + metadata: { + local: {}, + user_provided: {}, + }, + }) + .expect(200); + expect(apiResponse.success).to.eql(true); + expect(apiResponse.item).to.have.keys('id', 'active', 'access_api_key', 'type', 'policy_id'); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/agents/events.ts b/x-pack/test/api_integration/apis/fleet/agents/events.ts new file mode 100644 index 0000000000000..f386afdb6b03d --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/agents/events.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../../ftr_provider_context'; + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertest'); + + describe('fleet_agents_events', () => { + before(async () => { + await esArchiver.loadIfNeeded('fleet/agents'); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + + it('should return a 200 and the events for a given agent', async () => { + const { body: apiResponse } = await supertest + .get(`/api/fleet/agents/agent1/events`) + .expect(200); + expect(apiResponse).to.have.keys(['list', 'total', 'page']); + expect(apiResponse.total).to.be(2); + expect(apiResponse.page).to.be(1); + + const event = apiResponse.list[0]; + expect(event).to.have.keys('type', 'subtype', 'message', 'payload'); + expect(event.payload).to.have.keys('previous_state'); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/agents/services.ts b/x-pack/test/api_integration/apis/fleet/agents/services.ts new file mode 100644 index 0000000000000..76f663c572c6c --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/agents/services.ts @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import supertestAsPromised from 'supertest-as-promised'; +import url from 'url'; + +import { FtrProviderContext } from '../../../ftr_provider_context'; + +export function getSupertestWithoutAuth({ getService }: FtrProviderContext) { + const config = getService('config'); + const kibanaUrl = config.get('servers.kibana'); + kibanaUrl.auth = null; + kibanaUrl.password = null; + + return supertestAsPromised(url.format(kibanaUrl)); +} diff --git a/x-pack/test/api_integration/apis/fleet/artifacts.ts b/x-pack/test/api_integration/apis/fleet/artifacts.ts new file mode 100644 index 0000000000000..6d704e613e3ed --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/artifacts.ts @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import { createHash } from 'crypto'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +function binaryParser(res: any, callback: any) { + res.setEncoding('binary'); + res.data = ''; + res.on('data', function(chunk: any) { + res.data += chunk; + }); + res.on('end', function() { + callback(null, Buffer.from(res.data, 'binary')); + }); +} +export default function({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + + describe('fleet_artifacts', () => { + it('should return a 400 we try download anything else than a beat', async () => { + await supertest.get(`/api/fleet/artifacts/kibana/test`).expect(400); + }); + + it('should return the artifact 200 if this is a valid request', async () => { + const { body: apiResponse } = await supertest + .get(`/api/fleet/artifacts/beats/filebeat/filebeat-7.3.2-i386.deb`) + .buffer() + .parse(binaryParser) + .expect(200); + + const hash = createHash('sha512', apiResponse) + .update(apiResponse) + .digest('hex'); + + expect(hash).to.be( + 'efb7e39ffbb943534ef77d4ecd9ef75ab9a2764368a966999f8a0e7b0e9f23600a48e85d7e25ca801cc830f45d3676586ff321d083c334ccd1414b67652ad5b4' + ); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/delete_agent.ts b/x-pack/test/api_integration/apis/fleet/delete_agent.ts new file mode 100644 index 0000000000000..13581d8327a7c --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/delete_agent.ts @@ -0,0 +1,97 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { SecurityService } from '../../../common/services'; + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertestWithoutAuth'); + const security: SecurityService = getService('security'); + const users: { [rollName: string]: { username: string; password: string; permissions?: any } } = { + fleet_user: { + permissions: { + feature: { + fleet: ['read'], + }, + spaces: ['*'], + }, + username: 'fleet_user', + password: 'changeme', + }, + fleet_admin: { + permissions: { + feature: { + fleet: ['all'], + }, + spaces: ['*'], + }, + username: 'fleet_admin', + password: 'changeme', + }, + }; + describe('fleet_delete_agent', () => { + before(async () => { + for (const roleName in users) { + if (users.hasOwnProperty(roleName)) { + const user = users[roleName]; + + if (user.permissions) { + await security.role.create(roleName, { + kibana: [user.permissions], + }); + } + + // Import a repository first + await security.user.create(user.username, { + password: user.password, + roles: [roleName], + full_name: user.username, + }); + } + } + + await esArchiver.loadIfNeeded('fleet/agents'); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + + it('should return a 404 if user lacks fleet-write permissions', async () => { + const { body: apiResponse } = await supertest + .delete(`/api/fleet/agents/agent1`) + .auth(users.fleet_user.username, users.fleet_user.password) + .set('kbn-xsrf', 'xx') + .expect(404); + + expect(apiResponse).not.to.eql({ + success: true, + action: 'deleted', + }); + }); + + it('should return a 404 if there is no agent to delete', async () => { + await supertest + .delete(`/api/fleet/agents/i-do-not-exist`) + .auth(users.fleet_admin.username, users.fleet_admin.password) + .set('kbn-xsrf', 'xx') + .expect(404); + }); + + it('should return a 200 after deleting an agent', async () => { + const { body: apiResponse } = await supertest + .delete(`/api/fleet/agents/agent1`) + .auth(users.fleet_admin.username, users.fleet_admin.password) + .set('kbn-xsrf', 'xx') + .expect(200); + expect(apiResponse).to.eql({ + success: true, + action: 'deleted', + }); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/enrollment_api_keys/crud.ts b/x-pack/test/api_integration/apis/fleet/enrollment_api_keys/crud.ts new file mode 100644 index 0000000000000..9f6cee1a84a15 --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/enrollment_api_keys/crud.ts @@ -0,0 +1,81 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../../ftr_provider_context'; + +const ENROLLMENT_KEY_ID = 'ed22ca17-e178-4cfe-8b02-54ea29fbd6d0'; + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertest'); + + describe('fleet_enrollment_api_keys_crud', () => { + before(async () => { + await esArchiver.loadIfNeeded('fleet/agents'); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + describe('GET /fleet/enrollment-api-keys', async () => { + it('should list existing api keys', async () => { + const { body: apiResponse } = await supertest + .get(`/api/fleet/enrollment-api-keys`) + .expect(200); + + expect(apiResponse.total).to.be(1); + expect(apiResponse.list[0]).to.have.keys('id', 'api_key_id', 'name'); + }); + }); + + describe('GET /fleet/enrollment-api-keys/{id}', async () => { + it('should allow to retrieve existing api keys', async () => { + const { body: apiResponse } = await supertest + .get(`/api/fleet/enrollment-api-keys/${ENROLLMENT_KEY_ID}`) + .expect(200); + + expect(apiResponse.item).to.have.keys('id', 'api_key_id', 'name'); + }); + }); + + describe('GET /fleet/enrollment-api-keys/{id}', async () => { + it('should allow to retrieve existing api keys', async () => { + const { body: apiResponse } = await supertest + .delete(`/api/fleet/enrollment-api-keys/${ENROLLMENT_KEY_ID}`) + .set('kbn-xsrf', 'xxx') + .expect(200); + + expect(apiResponse.success).to.eql(true); + }); + }); + + describe('POST /fleet/enrollment-api-keys', () => { + it('should not accept bad parameters', async () => { + await supertest + .post(`/api/fleet/enrollment-api-keys`) + .set('kbn-xsrf', 'xxx') + .send({ + raoul: 'raoul', + }) + .expect(400); + }); + + it('should allow to create an enrollment api key with a policy', async () => { + const { body: apiResponse } = await supertest + .post(`/api/fleet/enrollment-api-keys`) + .set('kbn-xsrf', 'xxx') + .send({ + policy_id: 'policy1', + }) + .expect(200); + + expect(apiResponse.success).to.eql(true); + expect(apiResponse.item).to.have.keys('id', 'api_key', 'api_key_id', 'name', 'policy_id'); + }); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/enrollment_api_keys/rules.ts b/x-pack/test/api_integration/apis/fleet/enrollment_api_keys/rules.ts new file mode 100644 index 0000000000000..98b8de7ae9ce3 --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/enrollment_api_keys/rules.ts @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../../ftr_provider_context'; + +const ENROLLMENT_KEY_ID = 'ed22ca17-e178-4cfe-8b02-54ea29fbd6d0'; + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertest'); + + describe('fleet_enrollment_api_keys_rules', () => { + before(async () => { + await esArchiver.loadIfNeeded('fleet/agents'); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + + it('should return enrollment rules for an api key', async () => { + const { body: apiResponse } = await supertest + .get(`/api/fleet/enrollment-api-keys/${ENROLLMENT_KEY_ID}/enrollment-rules`) + .expect(200); + + expect(apiResponse.success).to.be(true); + expect(apiResponse.total).to.be(1); + expect(apiResponse.list.length).to.be(1); + }); + + it('should add enrollment rules for an api key', async () => { + const { body: apiResponse } = await supertest + .post(`/api/fleet/enrollment-api-keys/${ENROLLMENT_KEY_ID}/enrollment-rules`) + .set('kbn-xsrf', 'xxx') + .send({ + types: ['PERMANENT'], + }) + .expect(200); + expect(apiResponse.success).to.be(true); + expect(apiResponse.item).to.have.key(['id', 'created_at', 'types']); + }); + + it('should delete an enrollment rules for an api key', async () => { + const { body: apiResponse } = await supertest + .delete(`/api/fleet/enrollment-api-keys/${ENROLLMENT_KEY_ID}/enrollment-rules/rule:1`) + .set('kbn-xsrf', 'xxx') + .expect(200); + + expect(apiResponse.success).to.be(true); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/index.js b/x-pack/test/api_integration/apis/fleet/index.js new file mode 100644 index 0000000000000..b46375f297c3c --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/index.js @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export default function loadTests({ loadTestFile }) { + describe('Fleet Endpoints', () => { + loadTestFile(require.resolve('./delete_agent')); + loadTestFile(require.resolve('./list_agent')); + loadTestFile(require.resolve('./agents/enroll')); + loadTestFile(require.resolve('./agents/checkin')); + loadTestFile(require.resolve('./agents/actions')); + loadTestFile(require.resolve('./agents/events')); + loadTestFile(require.resolve('./enrollment_api_keys/crud')); + loadTestFile(require.resolve('./enrollment_api_keys/rules')); + loadTestFile(require.resolve('./artifacts')); + loadTestFile(require.resolve('./install')); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/install.ts b/x-pack/test/api_integration/apis/fleet/install.ts new file mode 100644 index 0000000000000..348b9a62b2f41 --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/install.ts @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + + describe('fleet_install', () => { + it('should return a 400 if we try download an install script for a not supported OS', async () => { + await supertest.get(`/api/fleet/install/gameboy`).expect(400); + }); + + it('should return an install script for a supported OS', async () => { + const { text: apiResponse } = await supertest.get(`/api/fleet/install/macos`).expect(200); + expect(apiResponse).match(/^#!\/bin\/sh/); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/list_agent.ts b/x-pack/test/api_integration/apis/fleet/list_agent.ts new file mode 100644 index 0000000000000..4c3e85b2924ad --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/list_agent.ts @@ -0,0 +1,101 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../ftr_provider_context'; +import { SecurityService } from '../../../common/services'; + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertestWithoutAuth'); + const security: SecurityService = getService('security'); + const users: { [rollName: string]: { username: string; password: string; permissions?: any } } = { + kibana_basic_user: { + permissions: { + feature: { + dashboards: ['read'], + }, + spaces: ['*'], + }, + username: 'kibana_basic_user', + password: 'changeme', + }, + fleet_user: { + permissions: { + feature: { + fleet: ['read'], + }, + spaces: ['*'], + }, + username: 'fleet_user', + password: 'changeme', + }, + fleet_admin: { + permissions: { + feature: { + fleet: ['all'], + }, + spaces: ['*'], + }, + username: 'fleet_admin', + password: 'changeme', + }, + }; + + describe('fleet_list_agent', () => { + before(async () => { + for (const roleName in users) { + if (users.hasOwnProperty(roleName)) { + const user = users[roleName]; + + if (user.permissions) { + await security.role.create(roleName, { + kibana: [user.permissions], + }); + } + + // Import a repository first + await security.user.create(user.username, { + password: user.password, + roles: [roleName], + full_name: user.username, + }); + } + } + + await esArchiver.loadIfNeeded('fleet/agents'); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + + it('should return the list of agents when requesting as a user with fleet write permissions', async () => { + const { body: apiResponse } = await supertest + .get(`/api/fleet/agents`) + .auth(users.fleet_admin.username, users.fleet_admin.password) + .expect(200); + expect(apiResponse).to.have.keys('success', 'page', 'total', 'list'); + expect(apiResponse.success).to.eql(true); + expect(apiResponse.total).to.eql(4); + }); + it('should return the list of agents when requesting as a user with fleet read permissions', async () => { + const { body: apiResponse } = await supertest + .get(`/api/fleet/agents`) + .auth(users.fleet_user.username, users.fleet_user.password) + .expect(200); + expect(apiResponse).to.have.keys('success', 'page', 'total', 'list'); + expect(apiResponse.success).to.eql(true); + expect(apiResponse.total).to.eql(4); + }); + it('should not return the list of agents when requesting as a user without fleet permissions', async () => { + await supertest + .get(`/api/fleet/agents`) + .auth(users.kibana_basic_user.username, users.kibana_basic_user.password) + .expect(404); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/fleet/unenroll_agent.ts b/x-pack/test/api_integration/apis/fleet/unenroll_agent.ts new file mode 100644 index 0000000000000..e2b6c2072ee4a --- /dev/null +++ b/x-pack/test/api_integration/apis/fleet/unenroll_agent.ts @@ -0,0 +1,77 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertest'); + + describe('fleet_unenroll_agent', () => { + before(async () => { + await esArchiver.loadIfNeeded('fleet/agents'); + }); + after(async () => { + await esArchiver.unload('fleet/agents'); + }); + + it('should not allow both ids and kuery in the payload', async () => { + await supertest + .post(`/api/fleet/agents/unenroll`) + .set('kbn-xsrf', 'xxx') + .send({ + ids: ['agent:1'], + kuery: ['agents.id:1'], + }) + .expect(400); + }); + + it('should not allow no ids or kuery in the payload', async () => { + await supertest + .post(`/api/fleet/agents/unenroll`) + .set('kbn-xsrf', 'xxx') + .send({}) + .expect(400); + }); + + it('allow to unenroll using a list of ids', async () => { + const { body } = await supertest + .post(`/api/fleet/agents/unenroll`) + .set('kbn-xsrf', 'xxx') + .send({ + ids: ['agent1'], + }) + .expect(200); + + expect(body).to.have.keys('results', 'success'); + expect(body.success).to.be(true); + expect(body.results).to.have.length(1); + expect(body.results[0].success).to.be(true); + }); + + it('allow to unenroll using a kibana query', async () => { + const { body } = await supertest + .post(`/api/fleet/agents/unenroll`) + .set('kbn-xsrf', 'xxx') + .send({ + kuery: 'agents.shared_id:agent2_filebeat OR agents.shared_id:agent3_metricbeat', + }) + .expect(200); + + expect(body).to.have.keys('results', 'success'); + expect(body.success).to.be(true); + expect(body.results).to.have.length(2); + expect(body.results[0].success).to.be(true); + + const agentsUnenrolledIds = body.results.map((r: { id: string }) => r.id); + + expect(agentsUnenrolledIds).to.contain('agent2'); + expect(agentsUnenrolledIds).to.contain('agent3'); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/index.js b/x-pack/test/api_integration/apis/index.js index 86ef445899039..f1ddfc43eb358 100644 --- a/x-pack/test/api_integration/apis/index.js +++ b/x-pack/test/api_integration/apis/index.js @@ -27,5 +27,7 @@ export default function ({ loadTestFile }) { loadTestFile(require.resolve('./siem')); loadTestFile(require.resolve('./short_urls')); loadTestFile(require.resolve('./lens')); + loadTestFile(require.resolve('./fleet')); + loadTestFile(require.resolve('./ingest')); }); } diff --git a/x-pack/test/api_integration/apis/ingest/index.js b/x-pack/test/api_integration/apis/ingest/index.js new file mode 100644 index 0000000000000..5dac999a86167 --- /dev/null +++ b/x-pack/test/api_integration/apis/ingest/index.js @@ -0,0 +1,11 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export default function loadTests({ loadTestFile }) { + describe('Ingest Endpoints', () => { + loadTestFile(require.resolve('./policies')); + }); +} diff --git a/x-pack/test/api_integration/apis/ingest/policies.ts b/x-pack/test/api_integration/apis/ingest/policies.ts new file mode 100644 index 0000000000000..2005fe351b96d --- /dev/null +++ b/x-pack/test/api_integration/apis/ingest/policies.ts @@ -0,0 +1,70 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../ftr_provider_context'; + +export default function({ getService }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertest'); + function useFixtures() { + before(async () => { + await esArchiver.loadIfNeeded('ingest/policies'); + }); + after(async () => { + await esArchiver.unload('ingest/policies'); + }); + } + + describe('ingest_policies', () => { + describe('POST /api/ingest/policies', () => { + useFixtures(); + + it('should return a 400 if the request is not valid', async () => { + await supertest + .post(`/api/ingest/policies`) + .set('kbn-xsrf', 'xxx') + .send({}) + .expect(400); + }); + + it('should allow to create a new policy', async () => { + const { body: apiResponse } = await supertest + .post(`/api/ingest/policies`) + .set('kbn-xsrf', 'xxx') + .send({ + name: 'Policy from test 1', + description: 'I am a policy', + }) + .expect(200); + + expect(apiResponse.success).to.eql(true); + expect(apiResponse).to.have.keys('success', 'item', 'action'); + expect(apiResponse.item).to.have.keys( + 'id', + 'shared_id', + 'version', + 'name', + 'status', + 'description' + ); + }); + }); + describe('GET /api/ingest/policies', () => { + useFixtures(); + it('should return the list of policies grouped by shared id', async () => { + const { body: apiResponse } = await supertest.get(`/api/ingest/policies`).expect(200); + expect(apiResponse).to.have.keys('success', 'page', 'total', 'list'); + expect(apiResponse.success).to.eql(true); + const policiesIds = (apiResponse.list as Array<{ id: string }>).map(i => i.id); + expect(policiesIds.length).to.eql(2); + expect(policiesIds).to.contain('1'); + expect(policiesIds).to.contain('3'); + }); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/security/privileges.ts b/x-pack/test/api_integration/apis/security/privileges.ts index d4c8a3e68c50e..d463c992ddda8 100644 --- a/x-pack/test/api_integration/apis/security/privileges.ts +++ b/x-pack/test/api_integration/apis/security/privileges.ts @@ -37,6 +37,7 @@ export default function({ getService }: FtrProviderContext) { uptime: ['all', 'read'], apm: ['all', 'read'], siem: ['all', 'read'], + fleet: ['all', 'read'], }, global: ['all', 'read'], space: ['all', 'read'], diff --git a/x-pack/test/api_integration/config.js b/x-pack/test/api_integration/config.js index 64a9cafca406a..ba7e0a601034f 100644 --- a/x-pack/test/api_integration/config.js +++ b/x-pack/test/api_integration/config.js @@ -7,7 +7,9 @@ import { services } from './services'; export async function getApiIntegrationConfig({ readConfigFile }) { - const xPackFunctionalTestsConfig = await readConfigFile(require.resolve('../functional/config.js')); + const xPackFunctionalTestsConfig = await readConfigFile( + require.resolve('../functional/config.js') + ); return { testFiles: [require.resolve('./apis')], @@ -28,7 +30,8 @@ export async function getApiIntegrationConfig({ readConfigFile }) { ...xPackFunctionalTestsConfig.get('esTestCluster'), serverArgs: [ ...xPackFunctionalTestsConfig.get('esTestCluster.serverArgs'), - 'node.attr.name=apiIntegrationTestNode' + 'node.attr.name=apiIntegrationTestNode', + 'xpack.security.authc.api_key.enabled=true', ], }, }; diff --git a/x-pack/test/functional/es_archives/fleet/agents/data.json b/x-pack/test/functional/es_archives/fleet/agents/data.json new file mode 100644 index 0000000000000..ea6fca6e6c5e5 --- /dev/null +++ b/x-pack/test/functional/es_archives/fleet/agents/data.json @@ -0,0 +1,179 @@ +{ + "type": "doc", + "value": { + "id": "agents:agent1", + "index": ".kibana", + "source": { + "type": "agents", + "agents": { + "access_api_key_id": "api-key-2", + "active": true, + "shared_id": "agent1_filebeat", + "policy_id": "1", + "type": "PERMANENT", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "actions": [{ + "id": "37ed51ff-e80f-4f2a-a62d-f4fa975e7d85", + "created_at": "2019-09-04T15:04:07+0000", + "type": "RESUME" + }, + { + "id": "b400439c-bbbf-43d5-83cb-cf8b7e32506f", + "type": "PAUSE", + "created_at": "2019-09-04T15:01:07+0000", + "sent_at": "2019-09-04T15:03:07+0000" + }] + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "agents:agent2", + "index": ".kibana", + "source": { + "type": "agents", + "agents": { + "access_api_key_id": "api-key-2", + "active": true, + "shared_id": "agent2_filebeat", + "type": "PERMANENT", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "actions": [] + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "agents:agent3", + "index": ".kibana", + "source": { + "type": "agents", + "agents": { + "access_api_key_id": "api-key-3", + "active": true, + "shared_id": "agent3_metricbeat", + "type": "PERMANENT", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "actions": [] + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "agents:agent4", + "index": ".kibana", + "source": { + "type": "agents", + "agents": { + "access_api_key_id": "api-key-4", + "active": true, + "shared_id": "agent4_metricbeat", + "type": "PERMANENT", + "local_metadata": "{}", + "user_provided_metadata": "{}", + "actions": [] + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "enrollment_api_keys:ed22ca17-e178-4cfe-8b02-54ea29fbd6d0", + "index": ".kibana", + "source": { + "enrollment_api_keys" : { + "created_at" : "2019-10-10T16:31:12.518Z", + "name": "FleetEnrollmentKey:1", + "api_key_id" : "key", + "policy_id" : "policy:1", + "active" : true, + "enrollment_rules" : [{ + "id": "rule:1", + "ip_ranges": ["0.0.0.0/0"], + "created_at" : "2019-09-20T01:57:50.986Z" + }] + }, + "type" : "enrollment_api_keys", + "references": [] + } + } +} + +{ + "type": "doc", + "value": { + "index": ".kibana", + "id": "policies:1", + "source": { + "policies": { + "name": "Policy 1", + "description": "Amazing policy", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-policy-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T17:35:09+0000", + "created_by": "nchaulet", + "updated_on": "2019-09-20T17:35:09+0000", + "updated_by": "nchaulet" + }, + "type": "policies", + "references": [], + "updated_at": "2019-09-20T17:30:22.950Z" + } + } +} + +{ + "type": "doc", + "value": { + "id": "events:event1", + "index": ".kibana", + "source": { + "type": "agent_events", + "agent_events": { + "agent_id": "agent1", + "type": "STATE", + "subtype": "STARTED", + "message": "State changed from STOPPED to STARTED", + "payload": "{\"previous_state\": \"STOPPED\"}", + "timestamp": "2019-09-20T17:30:22.950Z" + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "events:event2", + "index": ".kibana", + "source": { + "type": "agent_events", + "agent_events": { + "agent_id": "agent1", + "type": "STATE", + "subtype": "STOPPED", + "message": "State changed from RUNNING to STOPPED", + "payload": "{\"previous_state\": \"RUNNING\"}", + "timestamp": "2019-09-20T17:30:25.950Z" + } + } + } +} diff --git a/x-pack/test/functional/es_archives/fleet/agents/mappings.json b/x-pack/test/functional/es_archives/fleet/agents/mappings.json new file mode 100644 index 0000000000000..65afe106fb313 --- /dev/null +++ b/x-pack/test/functional/es_archives/fleet/agents/mappings.json @@ -0,0 +1,1396 @@ +{ + "type": "index", + "value": { + "aliases": { + ".kibana": {} + }, + "index": ".kibana_1", + "mappings": { + "dynamic": "strict", + "_meta": { + "migrationMappingPropertyHashes": { + "ml-telemetry": "257fd1d4b4fdbb9cb4b8a3b27da201e9", + "server": "ec97f1c5da1a19609a60874e5af1100c", + "visualization": "52d7a13ad68a150c4525b292d23e12cc", + "code-repo": "d9191830f108c2687e809ad6817383c2", + "references": "7997cf5a56cc02bdc9c93361bde732b0", + "graph-workspace": "cd7ba1330e6682e9cc00b78850874be1", + "siem-ui-timeline-note": "8874706eedc49059d4cf0f5094559084", + "inputs": "996d4a57458106ecefe8072027c0020c", + "policies": "9eea0f300ed714bb4b25737aa26fa053", + "type": "2f4316de49999235636386fe51dc06c1", + "lens": "21c3ea0763beb1ecb0162529706b88c5", + "space": "c5ca8acafa0beaa4d08d014a97b6bc6b", + "infrastructure-ui-source": "ddc0ecb18383f6b26101a2fadb2dab0c", + "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", + "search": "181661168bbadd1eff5902361e2a0d5c", + "updated_at": "00da57df13e94e9d98437d13ace4bfe0", + "canvas-workpad": "b0a1706d356228dbdcb4a17e6b9eb231", + "map": "23d7aa4a720d4938ccde3983f87bd58d", + "dashboard": "d00f614b29a80360e1190193fd333bab", + "metrics-explorer-view": "53c5365793677328df0ccb6138bf3cdd", + "apm-telemetry": "07ee1939fa4302c62ddc052ec03fed90", + "siem-ui-timeline": "1f6f0860ad7bc0dba3e42467ca40470d", + "agent_events": "8060c5567d33f6697164e1fd5c81b8ed", + "file-upload-telemetry": "0ed4d3e1983d1217a30982630897092e", + "query": "11aaeb7f5f7fa5bb43f25e18ce26e7d9", + "kql-telemetry": "d12a98a6f19a2d273696597547e064ee", + "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", + "url": "c7f66a0df8b1b52f17c28c4adb111105", + "agents": "1c8e942384219bd899f381fd40e407d7", + "migrationVersion": "4a1746014a75ade3a714e1db5763276f", + "inventory-view": "84b320fd67209906333ffce261128462", + "enrollment_api_keys": "ed5d54fb0e7003d445f62c46820a7d25", + "upgrade-assistant-reindex-operation": "a53a20fe086b72c9a86da3cc12dad8a6", + "index-pattern": "66eccb05066c5a89924f48a9e9736499", + "canvas-element": "7390014e1091044523666d97247392fc", + "maps-telemetry": "a4229f8b16a6820c6d724b7e0c1f729d", + "namespace": "2f4316de49999235636386fe51dc06c1", + "telemetry": "e1c8bc94e443aefd9458932cc0697a4d", + "siem-ui-timeline-pinned-event": "20638091112f0e14f0e443d512301c29", + "timelion-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", + "config": "87aca8fdb053154f11383fce3dbf3edf", + "upgrade-assistant-telemetry": "56702cec857e0a9dacfb696655b4ff7b", + "lens-ui-telemetry": "509bfa5978586998e05f9e303c07a327" + } + }, + "properties": { + "agent_events": { + "properties": { + "agent_id": { + "type": "keyword" + }, + "data": { + "type": "text" + }, + "message": { + "type": "text" + }, + "payload": { + "type": "text" + }, + "subtype": { + "type": "keyword" + }, + "timestamp": { + "type": "date" + }, + "type": { + "type": "keyword" + } + } + }, + "agents": { + "properties": { + "access_api_key_id": { + "type": "keyword" + }, + "actions": { + "type": "nested", + "properties": { + "created_at": { + "type": "date" + }, + "data": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "sent_at": { + "type": "date" + }, + "type": { + "type": "keyword" + } + } + }, + "active": { + "type": "boolean" + }, + "enrolled_at": { + "type": "date" + }, + "last_checkin": { + "type": "date" + }, + "last_updated": { + "type": "date" + }, + "local_metadata": { + "type": "text" + }, + "policy_id": { + "type": "keyword" + }, + "shared_id": { + "type": "keyword" + }, + "type": { + "type": "keyword" + }, + "updated_at": { + "type": "date" + }, + "user_provided_metadata": { + "type": "text" + }, + "version": { + "type": "keyword" + } + } + }, + "apm-telemetry": { + "properties": { + "has_any_services": { + "type": "boolean" + }, + "services_per_agent": { + "properties": { + "dotnet": { + "type": "long", + "null_value": 0 + }, + "go": { + "type": "long", + "null_value": 0 + }, + "java": { + "type": "long", + "null_value": 0 + }, + "js-base": { + "type": "long", + "null_value": 0 + }, + "nodejs": { + "type": "long", + "null_value": 0 + }, + "python": { + "type": "long", + "null_value": 0 + }, + "ruby": { + "type": "long", + "null_value": 0 + }, + "rum-js": { + "type": "long", + "null_value": 0 + } + } + } + } + }, + "canvas-element": { + "dynamic": "false", + "properties": { + "@created": { + "type": "date" + }, + "@timestamp": { + "type": "date" + }, + "content": { + "type": "text" + }, + "help": { + "type": "text" + }, + "image": { + "type": "text" + }, + "name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword" + } + } + } + } + }, + "canvas-workpad": { + "dynamic": "false", + "properties": { + "@created": { + "type": "date" + }, + "@timestamp": { + "type": "date" + }, + "name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword" + } + } + } + } + }, + "code-repo": { + "properties": { + "uri": { + "type": "keyword" + } + } + }, + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } + }, + "dashboard": { + "properties": { + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "optionsJSON": { + "type": "text" + }, + "panelsJSON": { + "type": "text" + }, + "refreshInterval": { + "properties": { + "display": { + "type": "keyword" + }, + "pause": { + "type": "boolean" + }, + "section": { + "type": "integer" + }, + "value": { + "type": "integer" + } + } + }, + "timeFrom": { + "type": "keyword" + }, + "timeRestore": { + "type": "boolean" + }, + "timeTo": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "enrollment_api_keys": { + "properties": { + "active": { + "type": "boolean" + }, + "api_key": { + "type": "binary" + }, + "api_key_id": { + "type": "keyword" + }, + "created_at": { + "type": "date" + }, + "enrollment_rules": { + "type": "nested", + "properties": { + "created_at": { + "type": "date" + }, + "id": { + "type": "keyword" + }, + "ip_ranges": { + "type": "keyword" + }, + "types": { + "type": "keyword" + }, + "updated_at": { + "type": "date" + }, + "window_duration": { + "type": "nested", + "properties": { + "from": { + "type": "date" + }, + "to": { + "type": "date" + } + } + } + } + }, + "expire_at": { + "type": "date" + }, + "name": { + "type": "keyword" + }, + "policy_id": { + "type": "keyword" + }, + "updated_at": { + "type": "date" + } + } + }, + "file-upload-telemetry": { + "properties": { + "filesUploadedTotalCount": { + "type": "long" + } + } + }, + "graph-workspace": { + "properties": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "numLinks": { + "type": "integer" + }, + "numVertices": { + "type": "integer" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "wsState": { + "type": "text" + } + } + }, + "index-pattern": { + "properties": { + "fieldFormatMap": { + "type": "text" + }, + "fields": { + "type": "text" + }, + "intervalName": { + "type": "keyword" + }, + "notExpandable": { + "type": "boolean" + }, + "sourceFilters": { + "type": "text" + }, + "timeFieldName": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "type": { + "type": "keyword" + }, + "typeMeta": { + "type": "keyword" + } + } + }, + "infrastructure-ui-source": { + "properties": { + "description": { + "type": "text" + }, + "fields": { + "properties": { + "container": { + "type": "keyword" + }, + "host": { + "type": "keyword" + }, + "pod": { + "type": "keyword" + }, + "tiebreaker": { + "type": "keyword" + }, + "timestamp": { + "type": "keyword" + } + } + }, + "logAlias": { + "type": "keyword" + }, + "logColumns": { + "type": "nested", + "properties": { + "fieldColumn": { + "properties": { + "field": { + "type": "keyword" + }, + "id": { + "type": "keyword" + } + } + }, + "messageColumn": { + "properties": { + "id": { + "type": "keyword" + } + } + }, + "timestampColumn": { + "properties": { + "id": { + "type": "keyword" + } + } + } + } + }, + "metricAlias": { + "type": "keyword" + }, + "name": { + "type": "text" + } + } + }, + "inputs": { + "properties": { + "data_source_id": { + "type": "keyword" + }, + "other": { + "type": "text" + } + } + }, + "inventory-view": { + "properties": { + "autoBounds": { + "type": "boolean" + }, + "autoReload": { + "type": "boolean" + }, + "boundsOverride": { + "properties": { + "max": { + "type": "integer" + }, + "min": { + "type": "integer" + } + } + }, + "customOptions": { + "type": "nested", + "properties": { + "field": { + "type": "keyword" + }, + "text": { + "type": "keyword" + } + } + }, + "filterQuery": { + "properties": { + "expression": { + "type": "keyword" + }, + "kind": { + "type": "keyword" + } + } + }, + "groupBy": { + "type": "nested", + "properties": { + "field": { + "type": "keyword" + }, + "label": { + "type": "keyword" + } + } + }, + "metric": { + "properties": { + "type": { + "type": "keyword" + } + } + }, + "name": { + "type": "keyword" + }, + "nodeType": { + "type": "keyword" + }, + "time": { + "type": "integer" + }, + "view": { + "type": "keyword" + } + } + }, + "kql-telemetry": { + "properties": { + "optInCount": { + "type": "long" + }, + "optOutCount": { + "type": "long" + } + } + }, + "lens": { + "properties": { + "expression": { + "type": "keyword", + "index": false + }, + "state": { + "type": "flattened" + }, + "title": { + "type": "text" + }, + "visualizationType": { + "type": "keyword" + } + } + }, + "lens-ui-telemetry": { + "properties": { + "count": { + "type": "integer" + }, + "date": { + "type": "date" + }, + "name": { + "type": "keyword" + }, + "type": { + "type": "keyword" + } + } + }, + "map": { + "properties": { + "bounds": { + "type": "geo_shape" + }, + "description": { + "type": "text" + }, + "layerListJSON": { + "type": "text" + }, + "mapStateJSON": { + "type": "text" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "maps-telemetry": { + "properties": { + "attributesPerMap": { + "properties": { + "dataSourcesCount": { + "properties": { + "avg": { + "type": "long" + }, + "max": { + "type": "long" + }, + "min": { + "type": "long" + } + } + }, + "emsVectorLayersCount": { + "type": "object", + "dynamic": "true" + }, + "layerTypesCount": { + "type": "object", + "dynamic": "true" + }, + "layersCount": { + "properties": { + "avg": { + "type": "long" + }, + "max": { + "type": "long" + }, + "min": { + "type": "long" + } + } + } + } + }, + "mapsTotalCount": { + "type": "long" + }, + "timeCaptured": { + "type": "date" + } + } + }, + "metrics-explorer-view": { + "properties": { + "chartOptions": { + "properties": { + "stack": { + "type": "boolean" + }, + "type": { + "type": "keyword" + }, + "yAxisMode": { + "type": "keyword" + } + } + }, + "currentTimerange": { + "properties": { + "from": { + "type": "keyword" + }, + "interval": { + "type": "keyword" + }, + "to": { + "type": "keyword" + } + } + }, + "name": { + "type": "keyword" + }, + "options": { + "properties": { + "aggregation": { + "type": "keyword" + }, + "filterQuery": { + "type": "keyword" + }, + "groupBy": { + "type": "keyword" + }, + "limit": { + "type": "integer" + }, + "metrics": { + "type": "nested", + "properties": { + "aggregation": { + "type": "keyword" + }, + "color": { + "type": "keyword" + }, + "field": { + "type": "keyword" + }, + "label": { + "type": "keyword" + } + } + } + } + } + } + }, + "migrationVersion": { + "dynamic": "true", + "properties": { + "space": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 256 + } + } + } + } + }, + "ml-telemetry": { + "properties": { + "file_data_visualizer": { + "properties": { + "index_creation_count": { + "type": "long" + } + } + } + } + }, + "namespace": { + "type": "keyword" + }, + "policies": { + "properties": { + "agent_version": { + "type": "keyword" + }, + "created_by": { + "type": "keyword" + }, + "created_on": { + "type": "keyword" + }, + "data_sources": { + "properties": { + "inputs": { + "type": "keyword" + }, + "meta": { + "type": "keyword" + }, + "output": { + "type": "keyword" + }, + "policy": { + "type": "keyword" + }, + "policy_id": { + "type": "keyword" + }, + "queue": { + "type": "keyword" + }, + "uuid": { + "type": "keyword" + } + } + }, + "description": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "monitoring_enabled": { + "type": "boolean" + }, + "name": { + "type": "text" + }, + "shared_id": { + "type": "keyword" + }, + "status": { + "type": "keyword" + }, + "updated_by": { + "type": "keyword" + }, + "updated_on": { + "type": "keyword" + }, + "version": { + "type": "integer" + } + } + }, + "query": { + "properties": { + "description": { + "type": "text" + }, + "filters": { + "type": "object", + "enabled": false + }, + "query": { + "properties": { + "language": { + "type": "keyword" + }, + "query": { + "type": "keyword", + "index": false + } + } + }, + "timefilter": { + "type": "object", + "enabled": false + }, + "title": { + "type": "text" + } + } + }, + "references": { + "type": "nested", + "properties": { + "id": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "type": { + "type": "keyword" + } + } + }, + "sample-data-telemetry": { + "properties": { + "installCount": { + "type": "long" + }, + "unInstallCount": { + "type": "long" + } + } + }, + "search": { + "properties": { + "columns": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "sort": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "server": { + "properties": { + "uuid": { + "type": "keyword" + } + } + }, + "siem-ui-timeline": { + "properties": { + "columns": { + "properties": { + "aggregatable": { + "type": "boolean" + }, + "category": { + "type": "keyword" + }, + "columnHeaderType": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "example": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "indexes": { + "type": "keyword" + }, + "name": { + "type": "text" + }, + "placeholder": { + "type": "text" + }, + "searchable": { + "type": "boolean" + }, + "type": { + "type": "keyword" + } + } + }, + "created": { + "type": "date" + }, + "createdBy": { + "type": "text" + }, + "dataProviders": { + "properties": { + "and": { + "properties": { + "enabled": { + "type": "boolean" + }, + "excluded": { + "type": "boolean" + }, + "id": { + "type": "keyword" + }, + "kqlQuery": { + "type": "text" + }, + "name": { + "type": "text" + }, + "queryMatch": { + "properties": { + "displayField": { + "type": "text" + }, + "displayValue": { + "type": "text" + }, + "field": { + "type": "text" + }, + "operator": { + "type": "text" + }, + "value": { + "type": "text" + } + } + } + } + }, + "enabled": { + "type": "boolean" + }, + "excluded": { + "type": "boolean" + }, + "id": { + "type": "keyword" + }, + "kqlQuery": { + "type": "text" + }, + "name": { + "type": "text" + }, + "queryMatch": { + "properties": { + "displayField": { + "type": "text" + }, + "displayValue": { + "type": "text" + }, + "field": { + "type": "text" + }, + "operator": { + "type": "text" + }, + "value": { + "type": "text" + } + } + } + } + }, + "dateRange": { + "properties": { + "end": { + "type": "date" + }, + "start": { + "type": "date" + } + } + }, + "description": { + "type": "text" + }, + "favorite": { + "properties": { + "favoriteDate": { + "type": "date" + }, + "fullName": { + "type": "text" + }, + "keySearch": { + "type": "text" + }, + "userName": { + "type": "text" + } + } + }, + "kqlMode": { + "type": "keyword" + }, + "kqlQuery": { + "properties": { + "filterQuery": { + "properties": { + "kuery": { + "properties": { + "expression": { + "type": "text" + }, + "kind": { + "type": "keyword" + } + } + }, + "serializedQuery": { + "type": "text" + } + } + } + } + }, + "sort": { + "properties": { + "columnId": { + "type": "keyword" + }, + "sortDirection": { + "type": "keyword" + } + } + }, + "title": { + "type": "text" + }, + "updated": { + "type": "date" + }, + "updatedBy": { + "type": "text" + } + } + }, + "siem-ui-timeline-note": { + "properties": { + "created": { + "type": "date" + }, + "createdBy": { + "type": "text" + }, + "eventId": { + "type": "keyword" + }, + "note": { + "type": "text" + }, + "timelineId": { + "type": "keyword" + }, + "updated": { + "type": "date" + }, + "updatedBy": { + "type": "text" + } + } + }, + "siem-ui-timeline-pinned-event": { + "properties": { + "created": { + "type": "date" + }, + "createdBy": { + "type": "text" + }, + "eventId": { + "type": "keyword" + }, + "timelineId": { + "type": "keyword" + }, + "updated": { + "type": "date" + }, + "updatedBy": { + "type": "text" + } + } + }, + "space": { + "properties": { + "_reserved": { + "type": "boolean" + }, + "color": { + "type": "keyword" + }, + "description": { + "type": "text" + }, + "disabledFeatures": { + "type": "keyword" + }, + "imageUrl": { + "type": "text", + "index": false + }, + "initials": { + "type": "keyword" + }, + "name": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } + } + } + }, + "telemetry": { + "properties": { + "enabled": { + "type": "boolean" + } + } + }, + "timelion-sheet": { + "properties": { + "description": { + "type": "text" + }, + "hits": { + "type": "integer" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "timelion_chart_height": { + "type": "integer" + }, + "timelion_columns": { + "type": "integer" + }, + "timelion_interval": { + "type": "keyword" + }, + "timelion_other_interval": { + "type": "keyword" + }, + "timelion_rows": { + "type": "integer" + }, + "timelion_sheet": { + "type": "text" + }, + "title": { + "type": "text" + }, + "version": { + "type": "integer" + } + } + }, + "type": { + "type": "keyword" + }, + "ui-metric": { + "properties": { + "count": { + "type": "integer" + } + } + }, + "updated_at": { + "type": "date" + }, + "upgrade-assistant-reindex-operation": { + "dynamic": "true", + "properties": { + "indexName": { + "type": "keyword" + }, + "status": { + "type": "integer" + } + } + }, + "upgrade-assistant-telemetry": { + "properties": { + "features": { + "properties": { + "deprecation_logging": { + "properties": { + "enabled": { + "type": "boolean", + "null_value": true + } + } + } + } + }, + "ui_open": { + "properties": { + "cluster": { + "type": "long", + "null_value": 0 + }, + "indices": { + "type": "long", + "null_value": 0 + }, + "overview": { + "type": "long", + "null_value": 0 + } + } + }, + "ui_reindex": { + "properties": { + "close": { + "type": "long", + "null_value": 0 + }, + "open": { + "type": "long", + "null_value": 0 + }, + "start": { + "type": "long", + "null_value": 0 + }, + "stop": { + "type": "long", + "null_value": 0 + } + } + } + } + }, + "url": { + "properties": { + "accessCount": { + "type": "long" + }, + "accessDate": { + "type": "date" + }, + "createDate": { + "type": "date" + }, + "url": { + "type": "text", + "fields": { + "keyword": { + "type": "keyword", + "ignore_above": 2048 + } + } + } + } + }, + "visualization": { + "properties": { + "description": { + "type": "text" + }, + "kibanaSavedObjectMeta": { + "properties": { + "searchSourceJSON": { + "type": "text" + } + } + }, + "savedSearchRefName": { + "type": "keyword" + }, + "title": { + "type": "text" + }, + "uiStateJSON": { + "type": "text" + }, + "version": { + "type": "integer" + }, + "visState": { + "type": "text" + } + } + } + } + }, + "settings": { + "index": { + "auto_expand_replicas": "0-1", + "number_of_replicas": "0", + "number_of_shards": "1" + } + } + } +} diff --git a/x-pack/test/functional/es_archives/ingest/policies/data.json b/x-pack/test/functional/es_archives/ingest/policies/data.json new file mode 100644 index 0000000000000..f4c43689239b4 --- /dev/null +++ b/x-pack/test/functional/es_archives/ingest/policies/data.json @@ -0,0 +1,80 @@ +{ + "type": "doc", + "value": { + "index": ".kibana", + "id": "policies:1", + "source": { + "policies": { + "name": "Policy 1", + "description": "Amazing policy", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-policy-1", + "version": 1, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T17:35:09+0000", + "created_by": "nchaulet", + "updated_on": "2019-09-20T17:35:09+0000", + "updated_by": "nchaulet" + }, + "type": "policies", + "references": [], + "updated_at": "2019-09-20T17:30:22.950Z" + } + } +} + +{ + "type": "doc", + "value": { + "index": ".kibana", + "id": "policies:2", + "source": { + "policies": { + "name": "Policy", + "description": "Amazing policy", + "status": "locked", + "monitoring_enabled": true, + "shared_id": "shared-policy-1", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T17:35:09+0000", + "created_by": "nchaulet", + "updated_on": "2019-09-20T17:35:09+0000", + "updated_by": "nchaulet" + }, + "type": "policies", + "references": [], + "updated_at": "2019-09-20T17:30:22.950Z" + } + } +} + +{ + "type": "doc", + "value": { + "index": ".kibana", + "id": "policies:3", + "source": { + "policies": { + "name": "Policy 3", + "description": "Amazing policy", + "status": "active", + "monitoring_enabled": true, + "shared_id": "shared-policy-3", + "version": 0, + "agent_version": "8.0.0", + "data_sources": [], + "created_on": "2019-09-20T17:35:09+0000", + "created_by": "nchaulet", + "updated_on": "2019-09-20T17:35:09+0000", + "updated_by": "nchaulet" + }, + "type": "policies", + "references": [], + "updated_at": "2019-09-20T17:30:22.950Z" + } + } +} diff --git a/x-pack/test/functional/es_archives/ingest/policies/mappings.json b/x-pack/test/functional/es_archives/ingest/policies/mappings.json new file mode 100644 index 0000000000000..6817133718e02 --- /dev/null +++ b/x-pack/test/functional/es_archives/ingest/policies/mappings.json @@ -0,0 +1,130 @@ +{ + "type": "index", + "value": { + "aliases": { + ".kibana": {} + }, + "index": ".kibana_1", + "mappings": { + "dynamic": "strict", + "properties": { + "config": { + "dynamic": "true", + "properties": { + "buildNum": { + "type": "keyword" + } + } + }, + "inputs": { + "properties": { + "data_source_id": { + "type": "keyword" + }, + "other": { + "type": "text" + } + } + }, + "migrationVersion": { + "type": "object", + "dynamic": "true" + }, + "namespace": { + "type": "keyword" + }, + "policies": { + "properties": { + "agent_version": { + "type": "keyword" + }, + "created_by": { + "type": "keyword" + }, + "created_on": { + "type": "keyword" + }, + "data_sources": { + "properties": { + "inputs": { + "type": "keyword" + }, + "meta": { + "type": "keyword" + }, + "output": { + "type": "keyword" + }, + "policy": { + "type": "keyword" + }, + "policy_id": { + "type": "keyword" + }, + "queue": { + "type": "keyword" + }, + "uuid": { + "type": "keyword" + } + } + }, + "description": { + "type": "text" + }, + "id": { + "type": "keyword" + }, + "monitoring_enabled": { + "type": "boolean" + }, + "name": { + "type": "text" + }, + "shared_id": { + "type": "keyword" + }, + "status": { + "type": "keyword" + }, + "updated_by": { + "type": "keyword" + }, + "updated_on": { + "type": "keyword" + }, + "version": { + "type": "integer" + } + } + }, + "references": { + "type": "nested", + "properties": { + "id": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "type": { + "type": "keyword" + } + } + }, + "type": { + "type": "keyword" + }, + "updated_at": { + "type": "date" + } + } + }, + "settings": { + "index": { + "number_of_replicas": "0", + "number_of_shards": "1" + } + } + } +} diff --git a/x-pack/test_utils/jest/contract_tests/__memorize_snapshots__/example.contract.test.ts.snap b/x-pack/test_utils/jest/contract_tests/__memorize_snapshots__/example.contract.test.ts.snap index 547fe640b6951..9a48e4d2889f7 100644 --- a/x-pack/test_utils/jest/contract_tests/__memorize_snapshots__/example.contract.test.ts.snap +++ b/x-pack/test_utils/jest/contract_tests/__memorize_snapshots__/example.contract.test.ts.snap @@ -103,3 +103,108 @@ exports['Example contract tests should run online or offline - example_test_snap "serverExists": true } } + +exports['Example contract tests should run online or offline - example_test_snapshot'] = { + "results": { + "serverExists": true + } +} + +exports['Example contract tests should have loaded sample data use esArchive - sample_data'] = { + "results": { + "took": 2, + "timed_out": false, + "_shards": { + "total": 1, + "successful": 1, + "skipped": 0, + "failed": 0 + }, + "hits": { + "total": { + "value": 4, + "relation": "eq" + }, + "max_score": 0.90445626, + "hits": [ + { + "_index": ".management-beats", + "_type": "_doc", + "_id": "beat:qux", + "_score": 0.90445626, + "_source": { + "beat": { + "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdGVkIjoiMjAxOC0wNi0zMFQwMzo0MjoxNS4yMzBaIiwiaWF0IjoxNTMwMzMwMTM1fQ.SSsX2Byyo1B1bGxV8C3G4QldhE5iH87EY_1r21-bwbI", + "active": true, + "host_ip": "1.2.3.4", + "host_name": "foo.bar.com", + "id": "qux", + "name": "qux_filebeat", + "type": "filebeat" + }, + "type": "beat" + } + }, + { + "_index": ".management-beats", + "_type": "_doc", + "_id": "beat:baz", + "_score": 0.90445626, + "_source": { + "beat": { + "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdGVkIjoiMjAxOC0wNi0zMFQwMzo0MjoxNS4yMzBaIiwiaWF0IjoxNTMwMzMwMTM1fQ.SSsX2Byyo1B1bGxV8C3G4QldhE5iH87EY_1r21-bwbI", + "active": true, + "host_ip": "22.33.11.44", + "host_name": "baz.bar.com", + "id": "baz", + "name": "baz_metricbeat", + "type": "metricbeat" + }, + "type": "beat" + } + }, + { + "_index": ".management-beats", + "_type": "_doc", + "_id": "beat:foo", + "_score": 0.90445626, + "_source": { + "beat": { + "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdGVkIjoiMjAxOC0wNi0zMFQwMzo0MjoxNS4yMzBaIiwiaWF0IjoxNTMwMzMwMTM1fQ.SSsX2Byyo1B1bGxV8C3G4QldhE5iH87EY_1r21-bwbI", + "active": true, + "host_ip": "1.2.3.4", + "host_name": "foo.bar.com", + "id": "foo", + "name": "foo_metricbeat", + "tags": [ + "production", + "qa" + ], + "type": "metricbeat", + "verified_on": "2018-05-15T16:25:38.924Z" + }, + "type": "beat" + } + }, + { + "_index": ".management-beats", + "_type": "_doc", + "_id": "beat:bar", + "_score": 0.90445626, + "_source": { + "beat": { + "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdGVkIjoiMjAxOC0wNi0zMFQwMzo0MjoxNS4yMzBaIiwiaWF0IjoxNTMwMzMwMTM1fQ.SSsX2Byyo1B1bGxV8C3G4QldhE5iH87EY_1r21-bwbI", + "active": true, + "host_ip": "11.22.33.44", + "host_name": "foo.com", + "id": "bar", + "name": "bar_filebeat", + "type": "filebeat" + }, + "type": "beat" + } + } + ] + } + } +} diff --git a/x-pack/test_utils/jest/contract_tests/servers.ts b/x-pack/test_utils/jest/contract_tests/servers.ts index c458d65b6a11d..734f51ba57f68 100644 --- a/x-pack/test_utils/jest/contract_tests/servers.ts +++ b/x-pack/test_utils/jest/contract_tests/servers.ts @@ -64,7 +64,13 @@ export async function _createSharedServer() { const servers = await kbnTestServer.createTestServers({ // adjustTimeout function is required by createTestServers fn adjustTimeout: (t: number) => {}, - settings: TestKbnServerConfig, + settings: { + ...TestKbnServerConfig, + es: { + ...TestKbnServerConfig.es, + esArgs: ['xpack.security.authc.api_key.enabled=true'], + }, + }, }); ESServer = await servers.startES(); const { hosts, username, password } = ESServer; @@ -103,6 +109,7 @@ export async function createKibanaServer(xpackOption = {}) { // Allow kibana to start jest.setTimeout(120000); } + const root = kbnTestServer.createRootWithCorePlugins( { elasticsearch: { ...getSharedESServer() }, @@ -118,7 +125,7 @@ export async function createKibanaServer(xpackOption = {}) { const { server } = (root as any).server.legacy.kbnServer; return { - shutdown: () => root.shutdown(), + shutdown: async () => await root.shutdown(), kbnServer: server, root, }; diff --git a/yarn.lock b/yarn.lock index 5f06b18f5be9c..2c37591ceb740 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2090,10 +2090,10 @@ resolved "https://registry.yarnpkg.com/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz#497c67a1cef50d1a2459ba60f315e448d2ad87fe" integrity sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q== -"@mattapperson/slapshot@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@mattapperson/slapshot/-/slapshot-1.4.0.tgz#d1ba04ad23ca139601fcf7a74ef43ec3dd184d5e" - integrity sha512-P73fBpfevcMKAtDFsq2Z2VVW+tUZ2yNeNje3du5kb+ZH9RJUYFmpo+lCQpTJGyq9lzyhKlF3JIhfoGhz5RzgWg== +"@mattapperson/slapshot@1.4.3": + version "1.4.3" + resolved "https://registry.yarnpkg.com/@mattapperson/slapshot/-/slapshot-1.4.3.tgz#f5b81b297a3708f43f7d9242b46b37c60c1dd9ed" + integrity sha512-5BgwWHAzpethrotEFErzYtWhWyZSq6y+Yek3wzgOquCIqH+/2QoCQT3ru2ina+oIqdtSp3+4BDUMMkCKIa2uhg== dependencies: caller-callsite "^4.0.0" get-caller-file "^2.0.5" @@ -2453,6 +2453,130 @@ "@types/node" ">=8.9.0" axios "^0.18.0" +"@stoplight/http-spec@^2.2.2": + version "2.2.7" + resolved "https://registry.yarnpkg.com/@stoplight/http-spec/-/http-spec-2.2.7.tgz#5be3e8105b8b9eaf936467504bc8f59b8b238028" + integrity sha512-3MQymbhQ4k1ryilaVTLhsB6P3dwJ94xkngYVBXwRdYWfm9BA6zNvU2UEZ+/MXJncAjOtM/F5i8nDaDTWIn4/kQ== + dependencies: + "@stoplight/json" "^3.1.1" + "@stoplight/types" "^11.1.0" + "@types/swagger-schema-official" "~2.0.18" + "@types/urijs" "~1.19.1" + lodash "^4.17.15" + openapi-schema-to-json-schema stoplightio/openapi-schema-to-json-schema#c8b5f0c74270d505fc39635edef28e09df89601f + openapi3-ts "~1.3.0" + urijs "~1.19.1" + +"@stoplight/json-ref-resolver@^2.2.0": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@stoplight/json-ref-resolver/-/json-ref-resolver-2.4.1.tgz#db54b0771226611e1beb2e908493903139f2a4a8" + integrity sha512-y9G0BybShiJ/1NaPPG1BPelL2zI8/0rKXRtUpD2JBHEb72L9n4Bin85+MfrHYoHeJxojDpewsJA3FVRnUVL1dw== + dependencies: + "@stoplight/json" "^3.1.2" + "@stoplight/path" "^1.3.0" + "@stoplight/types" "^11.0.0" + "@types/urijs" "1.x.x" + dependency-graph "~0.8.0" + fast-memoize "^2.5.1" + immer "^3.2.0" + lodash "^4.17.15" + tslib "^1.10.0" + urijs "~1.19.1" + +"@stoplight/json@^3.1.1", "@stoplight/json@^3.1.2": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@stoplight/json/-/json-3.1.2.tgz#ae89d1974f0b6f8bc5778f792aeed4664c95ec62" + integrity sha512-7zt0zCN94m90X1sL7FrD7jXhPtkIup07MyG/00sELVrCvzb2wgNaiE+x2N7WSbk3Z0wS08e8B6kow81GQY+Isw== + dependencies: + "@stoplight/types" "^11.0.0" + jsonc-parser "~2.1.1" + lodash "^4.17.15" + safe-stable-stringify "^1.1" + +"@stoplight/path@^1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@stoplight/path/-/path-1.3.0.tgz#da2282352a4eb23c09d5106b9d1650d30a9ca2ad" + integrity sha512-t74/MHMgmFVMQhdQ/2Q766GryNTIW8McH8+vB25oeoBhYKTOrJ/wPDt+OCxIWHPUlcSi2fTWa4FKQ8qgmP2jVA== + +"@stoplight/prism-cli@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@stoplight/prism-cli/-/prism-cli-3.1.1.tgz#4cd44e548ae8adbbfb31ec1e6bba86492db396e6" + integrity sha512-q4Fsn4Bhyp05cLDlnGECA04fj4ZoyY1MfjlIlpYPxC2jB+zRYQc49NO2KDmeTsEqHtTSK4b0b+OBIzuRAhax4A== + dependencies: + "@stoplight/http-spec" "^2.2.2" + "@stoplight/json-ref-resolver" "^2.2.0" + "@stoplight/prism-core" "^3.1.1" + "@stoplight/prism-http-server" "^3.1.1" + "@stoplight/yaml" "^3.0.2" + axios "^0.18.0" + signale "^1.4.0" + split2 "^3.1.1" + tslib "^1.10.0" + urijs "^1.19.1" + yargs "^14.0.0" + +"@stoplight/prism-core@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@stoplight/prism-core/-/prism-core-3.1.1.tgz#7dfc0bd54763ba66c8733c2e8e2736c52f28aabc" + integrity sha512-rRKTKgFzj/uGeDvhm+hQhDYtsRngrtQoW6VqBG3kzpZ7xywASeE1Vr6xuEfcMkzt4fs5wS3towSgMyDrGv8kHg== + dependencies: + lodash "^4.17.15" + pino "^5.13.2" + tslib "^1.10.0" + +"@stoplight/prism-http-server@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@stoplight/prism-http-server/-/prism-http-server-3.1.1.tgz#0fd70dd8d2457adfa0b8840c6b00e1220576790c" + integrity sha512-XhH3vq6r0k3ZfauI/HV8/9yEcTvf/brnSILcQ01rTsPD3rE/MrqR3E6gswInMu3WIy6Clxe63Qio+V3NQn0Ckw== + dependencies: + "@stoplight/prism-core" "^3.1.1" + "@stoplight/prism-http" "^3.1.1" + fast-xml-parser "^3.12.20" + fastify "^2.7.1" + fastify-cors "^2.1.3" + fastify-formbody "^3.1.0" + tslib "^1.10.0" + type-is "^1.6.18" + +"@stoplight/prism-http@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@stoplight/prism-http/-/prism-http-3.1.1.tgz#f1f1fabd8892c81f6d9ca3def454903bb7de8619" + integrity sha512-ncJgQgbVgaXMQt0/J0aAvi655noZmXF2VSx72l6R1I7VU5yQA3oGexID+u/iYOzJE3urx5Ul/PGmvUvdAHxS7A== + dependencies: + "@stoplight/prism-core" "^3.1.1" + accepts "^1.3.7" + ajv "^6.10.2" + ajv-oai "^1.0.0" + axios "^0.18.0" + caseless "^0.12.0" + faker "^4.1.0" + fp-ts "^2.0.5" + json-schema-faker "0.5.0-rc20" + openapi-sampler "^1.0.0-beta.15" + pino "^5.13.2" + tslib "^1.10.0" + +"@stoplight/types@^11.0.0", "@stoplight/types@^11.1.0", "@stoplight/types@^11.1.1": + version "11.1.1" + resolved "https://registry.yarnpkg.com/@stoplight/types/-/types-11.1.1.tgz#a92d1833adb580a72439f42ba73de8f560fd68b4" + integrity sha512-IU8U9y/uO548z15DX/Jl053u9VQG8gCwNtypuD4RtskUA7pvHZl4+zzGK3klgIcO6Ql3Jk4/fcrFaN9vjmdEWg== + dependencies: + "@types/json-schema" "^7.0.3" + +"@stoplight/yaml-ast-parser@0.0.44": + version "0.0.44" + resolved "https://registry.yarnpkg.com/@stoplight/yaml-ast-parser/-/yaml-ast-parser-0.0.44.tgz#ed3c962564283e9983f7895a6effc3994286df5e" + integrity sha512-PdY8p2Ufgtorf4d2DbKMfknILMa8KwuyyMMR/2lgK1mLaU8F5PKWYc+h9hIzC+ar0bh7m9h2rINo32m7ADfVyA== + +"@stoplight/yaml@^3.0.2": + version "3.3.2" + resolved "https://registry.yarnpkg.com/@stoplight/yaml/-/yaml-3.3.2.tgz#001049ed4a8733fca43cc60efe6bcd046abef210" + integrity sha512-KfrEsl3bA8mtoIklVvS4Hg8OrOYYtqi+K0IsQ7lJbZLVaUA4wMwDGwz85a6YWeo1OuVe8tumM6OynrFIjFutNA== + dependencies: + "@stoplight/types" "^11.1.1" + "@stoplight/yaml-ast-parser" "0.0.44" + lodash "^4.17.15" + "@storybook/addon-actions@^5.1.11": version "5.1.11" resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.1.11.tgz#ebc299b9dfe476b5c65eb5d148c4b064f682ca08" @@ -4065,6 +4189,11 @@ dependencies: "@types/superagent" "*" +"@types/swagger-schema-official@~2.0.18": + version "2.0.19" + resolved "https://registry.yarnpkg.com/@types/swagger-schema-official/-/swagger-schema-official-2.0.19.tgz#8e890e5b146b31c6fa9052616ca28229b11eb883" + integrity sha512-jxL2fC4PNNz1T7C5GLqcvYBX38W9VkQS/e0QM/8ljnyLrGakdzo27WX1PkGcim+GXwiQR0DaoMKjQOx398JeAA== + "@types/tar-fs@^1.16.1": version "1.16.1" resolved "https://registry.yarnpkg.com/@types/tar-fs/-/tar-fs-1.16.1.tgz#6e3fba276c173e365ae91e55f7b797a0e64298e5" @@ -4114,6 +4243,11 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e" integrity sha512-FvUupuM3rlRsRtCN+fDudtmytGO6iHJuuRKS1Ss0pG5z8oX0diNEw94UEL7hgDbpN94rgaK5R7sWm6RrSkZuAQ== +"@types/urijs@1.x.x", "@types/urijs@~1.19.1": + version "1.19.4" + resolved "https://registry.yarnpkg.com/@types/urijs/-/urijs-1.19.4.tgz#29c4a694d4842d7f95e359a26223fc1865f1ab13" + integrity sha512-uHUvuLfy4YkRHL4UH8J8oRsINhdEHd9ymag7KJZVT94CjAmY1njoUzhazJsZjwfy+IpWKQKGVyXCwzhZvg73Fg== + "@types/uuid@^3.4.4": version "3.4.4" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-3.4.4.tgz#7af69360fa65ef0decb41fd150bf4ca5c0cefdf5" @@ -4288,6 +4422,11 @@ lodash.unescape "4.0.1" semver "5.5.0" +"@use-it/interval@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@use-it/interval/-/interval-0.1.3.tgz#5d1096b2295d7a5dda8e8022f3abb5f9d9ef27f8" + integrity sha512-chshdtDZTFoWA9aszBz1Cc04Ca9NBD2JTi/GMjdJ+HGm4q7Vy1v71+2mm22r7Kfb2nYW+lTRsPcEHdB/VFVHsQ== + "@webassemblyjs/ast@1.8.5": version "1.8.5" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" @@ -4516,6 +4655,11 @@ abortcontroller-polyfill@^1.3.0: resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.3.0.tgz#de69af32ae926c210b7efbcc29bf644ee4838b00" integrity sha512-lbWQgf+eRvku3va8poBlDBO12FigTQr9Zb7NIjXrePrhxWVKdCP2wbDl1tLDaYa18PWTom3UEWwdH13S46I+yA== +abstract-logging@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/abstract-logging/-/abstract-logging-1.0.0.tgz#8b7deafd310559bc28f77724dd1bb30177278c1b" + integrity sha1-i33q/TEFWbwo93ck3RuzAXcnjBs= + accept@3.x.x: version "3.0.2" resolved "https://registry.yarnpkg.com/accept/-/accept-3.0.2.tgz#83e41cec7e1149f3fd474880423873db6c6cc9ac" @@ -4524,6 +4668,14 @@ accept@3.x.x: boom "7.x.x" hoek "5.x.x" +accepts@^1.3.7, accepts@~1.3.7: + version "1.3.7" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" + integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== + dependencies: + mime-types "~2.1.24" + negotiator "0.6.2" + accepts@~1.3.4, accepts@~1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2" @@ -4532,14 +4684,6 @@ accepts@~1.3.4, accepts@~1.3.5: mime-types "~2.1.18" negotiator "0.6.1" -accepts@~1.3.7: - version "1.3.7" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" - integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== - dependencies: - mime-types "~2.1.24" - negotiator "0.6.2" - acorn-dynamic-import@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948" @@ -4770,6 +4914,14 @@ ajv-keywords@^3.4.1: resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== +ajv-oai@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ajv-oai/-/ajv-oai-1.1.1.tgz#5f3c19ebc6b1628465bc75436c1ade9031b3cab3" + integrity sha1-XzwZ68axYoRlvHVDbBrekDGzyrM= + dependencies: + ajv "^6.1.1" + decimal.js "^9.0.1" + ajv@^4.7.0, ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" @@ -4798,7 +4950,7 @@ ajv@^6.1.0, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^6.10.0, ajv@^6.10.2: +ajv@^6.1.1, ajv@^6.10.0, ajv@^6.10.2: version "6.10.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== @@ -5809,6 +5961,15 @@ autoprefixer@9.6.1, autoprefixer@^9.4.9: postcss "^7.0.17" postcss-value-parser "^4.0.0" +avvio@^6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/avvio/-/avvio-6.2.2.tgz#af6ded59bde361fded817a6841a748142c659873" + integrity sha512-7+yznbJOMoHQ8Z8VH+1meyRjtxUW8za6gqnHBl8DqlX5qPtaclNIgWrKrTLuIbfn2+1/EGkcr+rQXI8DYVU4RA== + dependencies: + archy "^1.0.0" + debug "^4.0.0" + fastq "^1.6.0" + aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" @@ -7435,7 +7596,7 @@ case-sensitive-paths-webpack-plugin@^2.2.0: resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.2.0.tgz#3371ef6365ef9c25fa4b81c16ace0e9c7dc58c3e" integrity sha512-u5ElzokS8A1pm9vM3/iDgTcI3xqHxuCao94Oz8etI3cf0Tio0p8izkDYbTIn09uP3yUUr6+veaE6IkjnTYS46g== -caseless@~0.12.0: +caseless@^0.12.0, caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= @@ -9666,6 +9827,11 @@ decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, deca resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= +decimal.js@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-9.0.1.tgz#1cc8b228177da7ab6498c1cc06eb130a290e6e1e" + integrity sha512-2h0iKbJwnImBk4TGk7CG1xadoA0g3LDPlQhQzbZ221zvG0p2YVUedbKIPsOZXKZGx6YmZMJKYOalpCMxSdDqTQ== + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -9947,6 +10113,11 @@ depd@~1.1.1, depd@~1.1.2: resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= +dependency-graph@~0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.8.0.tgz#2da2d35ed852ecc24a5d6c17788ba57c3708755b" + integrity sha512-DCvzSq2UiMsuLnj/9AL484ummEgLtZIcRS7YvtO38QnpX3vqh9nJ8P+zhu8Ja+SmLrBHO2iDbva20jq38qvBkQ== + dependency-tree@^7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/dependency-tree/-/dependency-tree-7.0.2.tgz#01df8bbdc51e41438f5bb93f4a53e1a9cf8301a1" @@ -10450,6 +10621,11 @@ dragselect@1.13.1: resolved "https://registry.yarnpkg.com/dragselect/-/dragselect-1.13.1.tgz#aa4166e1164b51ed5ee0cd89e0c5310a9c35be6a" integrity sha512-spfUz6/sNnlY4fF/OxPBwaKLa5hVz6V+fq5XhVuD+h47RAkA75TMkfvr4AoWUh5Ufq3V1oIAbfu+sjc9QbewoA== +drange@^1.0.2: + version "1.1.1" + resolved "https://registry.yarnpkg.com/drange/-/drange-1.1.1.tgz#b2aecec2aab82fcef11dbbd7b9e32b83f8f6c0b8" + integrity sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA== + duplexer2@^0.1.4, duplexer2@~0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" @@ -12043,6 +12219,11 @@ faker@1.1.0: resolved "https://registry.yarnpkg.com/faker/-/faker-1.1.0.tgz#230738ebd37edad9de4a421de12922bd8206a872" integrity sha1-Iwc469N+2tneSkId4SkivYIGqHI= +faker@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/faker/-/faker-4.1.0.tgz#1e45bbbecc6774b3c195fad2835109c6d748cc3f" + integrity sha1-HkW7vsxndLPBlfrSg1EJxtdIzD8= + falafel@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/falafel/-/falafel-2.1.0.tgz#96bb17761daba94f46d001738b3cedf3a67fe06c" @@ -12062,6 +12243,11 @@ fancy-log@^1.3.2: color-support "^1.1.3" time-stamp "^1.0.0" +fast-decode-uri-component@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz#46f8b6c22b30ff7a81357d4f59abfae938202543" + integrity sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg== + fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" @@ -12123,16 +12309,87 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= +fast-json-stringify@^1.15.5: + version "1.15.6" + resolved "https://registry.yarnpkg.com/fast-json-stringify/-/fast-json-stringify-1.15.6.tgz#47864aa15bc4be40ed959089a53a02c4fa7f5140" + integrity sha512-UKypbA85Qc53b8xdcXWI3g7TBnOV34+cYJczHJZv4KQ4mF3H9Mk3547FjX3lvUJO4Wf5kK0IhSO0eUTJKKcmEw== + dependencies: + ajv "^6.10.2" + deepmerge "^4.0.0" + fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-memoize@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/fast-memoize/-/fast-memoize-2.5.1.tgz#c3519241e80552ce395e1a32dcdde8d1fd680f5d" + integrity sha512-xdmw296PCL01tMOXx9mdJSmWY29jQgxyuZdq0rEHMu+Tpe1eOEtCycoG6chzlcrWsNgpZP7oL8RiQr7+G6Bl6g== + +fast-redact@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-2.0.0.tgz#17bb8f5e1f56ecf4a38c8455985e5eab4c478431" + integrity sha512-zxpkULI9W9MNTK2sJ3BpPQrTEXFNESd2X6O1tXMFpK/XM0G5c5Rll2EVYZH2TqI3xRGK/VaJ+eEOt7pnENJpeA== + fast-safe-stringify@^2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz#04b26106cc56681f51a044cfc0d76cf0008ac2c2" integrity sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg== +fast-safe-stringify@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" + integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== + +fast-xml-parser@^3.12.20: + version "3.13.0" + resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-3.13.0.tgz#3d46f517c0ac6c87393c6b6946808e9c799bb368" + integrity sha512-XYXC39VjE9dH6jpp5Gm5gsuR8Z4bMz44qMpT1PmqR+iyOJMhC0LcsN81asYkHP4OkEX8TTR8d6V/caCmy8Q8jQ== + +fastify-cors@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/fastify-cors/-/fastify-cors-2.1.3.tgz#5ae8fcc620a47270cd68d46acc3b8dd7919b538b" + integrity sha512-ZHFzKn1DddymsxzvdtjEQfkuMfGgwcp++FKuTTMmAN2KFB7hJRmOINffjfRdmUcgXdE4LoSy5XJROWKx/b+CPQ== + dependencies: + fastify-plugin "^1.5.0" + vary "^1.1.2" + +fastify-formbody@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/fastify-formbody/-/fastify-formbody-3.1.0.tgz#604cdafdb9e3af6068e6d9940985baf692d6e922" + integrity sha512-GQQtRmI8w07SMcnXiWrk9H8GAMJwheKAkQS4q0FbJ56Qu8bV39GOffiZ8GLHQmvcJ2B65S+4IAtNjsG6vtMEig== + dependencies: + fastify-plugin "^1.0.0" + qs "^6.5.1" + +fastify-plugin@^1.0.0, fastify-plugin@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/fastify-plugin/-/fastify-plugin-1.6.0.tgz#c8198b08608f20c502b5dad26b36e9ae27206d7c" + integrity sha512-lFa9txg8LZx4tljj33oG53nUXhVg0baZxtP9Pxi0dJmI0NQxzkDk5DS9kr3D7iMalUAp3mvIq16OQumc7eIvLA== + dependencies: + semver "^6.0.0" + +fastify@^2.7.1: + version "2.10.0" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-2.10.0.tgz#f5a83e6b8e801f3e80a9f81d0538977402cdf470" + integrity sha512-ieWwtPZPpcurQlRBmWer6rSq/2WAKAI3yPkh2oBbQ98U5BnWjhcLXYYgBRTS1TDu2evwbXwnRVdLpILVC2O5XA== + dependencies: + abstract-logging "^1.0.0" + ajv "^6.10.2" + avvio "^6.2.2" + fast-json-stringify "^1.15.5" + find-my-way "^2.0.0" + flatstr "^1.0.12" + light-my-request "^3.4.1" + middie "^4.0.1" + pino "^5.13.2" + proxy-addr "^2.0.4" + readable-stream "^3.1.1" + rfdc "^1.1.2" + secure-json-parse "^1.0.0" + tiny-lru "^7.0.0" + fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" @@ -12462,6 +12719,15 @@ find-cache-dir@^3.0.0: make-dir "^3.0.0" pkg-dir "^4.1.0" +find-my-way@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/find-my-way/-/find-my-way-2.2.1.tgz#248e939243af1b9df368bcc9b8c8286306caae7d" + integrity sha512-pzZA9/PlhDGG5PRzmd4vH4AbKW7FO68RE7q2I3NzjJHcVPukYbDA7bPdArg7ySKfS6pKki+qhrawFoN6aNZfjA== + dependencies: + fast-decode-uri-component "^1.0.0" + safe-regex2 "^2.0.0" + semver-store "^0.3.0" + find-root@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" @@ -12588,6 +12854,11 @@ flat@^4.1.0: dependencies: is-buffer "~2.0.3" +flatstr@^1.0.12, flatstr@^1.0.9: + version "1.0.12" + resolved "https://registry.yarnpkg.com/flatstr/-/flatstr-1.0.12.tgz#c2ba6a08173edbb6c9640e3055b95e287ceb5931" + integrity sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw== + flatted@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" @@ -12723,7 +12994,7 @@ for-own@^1.0.0: dependencies: for-in "^1.0.1" -foreach@^2.0.5: +foreach@^2.0.4, foreach@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= @@ -12792,6 +13063,11 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" +format-util@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/format-util/-/format-util-1.0.3.tgz#032dca4a116262a12c43f4c3ec8566416c5b2d95" + integrity sha1-Ay3KShFiYqEsQ/TD7IVmQWxbLZU= + formidable@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.1.1.tgz#96b8886f7c3c3508b932d6bd70c4d3a88f35f1a9" @@ -15146,6 +15422,11 @@ immer@^1.5.0: resolved "https://registry.yarnpkg.com/immer/-/immer-1.12.1.tgz#40c6e5b292c00560836c2993bda3a24379d466f5" integrity sha512-3fmKM6ovaqDt0CdC9daXpNi5x/YCYS3i4cwLdTVkhJdk5jrDXoPs7lCm3IqM3yhfSnz4tjjxbRG2CziQ7m8ztg== +immer@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/immer/-/immer-3.3.0.tgz#ee7cf3a248d5dd2d4eedfbe7dfc1e9be8c72041d" + integrity sha512-vlWRjnZqoTHuEjadquVHK3GxsXe1gNoATffLEA8Qbrdd++Xb+wHEFiWtwAKTscMBoi1AsvEMXhYRzAXA8Ex9FQ== + import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" @@ -16996,7 +17277,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.13.1, js-yaml@3.x, js-yaml@^3.10.0, js-yaml@^3.13.1, js-yaml@^3.4.6, js-yaml@^3.5.1, js-yaml@^3.5.4, js-yaml@^3.9.0, js-yaml@~3.13.0, js-yaml@~3.13.1: +js-yaml@3.13.1, js-yaml@3.x, js-yaml@^3.10.0, js-yaml@^3.12.1, js-yaml@^3.13.1, js-yaml@^3.4.6, js-yaml@^3.5.1, js-yaml@^3.5.4, js-yaml@^3.9.0, js-yaml@~3.13.0, js-yaml@~3.13.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -17100,6 +17381,31 @@ json-parse-better-errors@^1.0.2: resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== +json-pointer@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/json-pointer/-/json-pointer-0.6.0.tgz#8e500550a6aac5464a473377da57aa6cc22828d7" + integrity sha1-jlAFUKaqxUZKRzN32leqbMIoKNc= + dependencies: + foreach "^2.0.4" + +json-schema-faker@0.5.0-rc20: + version "0.5.0-rc20" + resolved "https://registry.yarnpkg.com/json-schema-faker/-/json-schema-faker-0.5.0-rc20.tgz#7e1c588185a16da8b7797409456467190818c03e" + integrity sha512-pmGqRvkU6xtJqJN0Py9yYtWaWfsb2DXvCXHwouxLiD18XNe3Ah96atf39kia1eaHGX9fPlinSRgsxZd+k2LVpw== + dependencies: + json-schema-ref-parser "^6.1.0" + jsonpath-plus "^1.0.0" + randexp "^0.5.3" + +json-schema-ref-parser@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/json-schema-ref-parser/-/json-schema-ref-parser-6.1.0.tgz#30af34aeab5bee0431da805dac0eb21b574bf63d" + integrity sha512-pXe9H1m6IgIpXmE5JSb8epilNTGsmTb2iPohAXpOdhqGFbQjNeHHsZxU+C8w6T81GZxSPFLeUoqDJmzxx5IGuw== + dependencies: + call-me-maybe "^1.0.1" + js-yaml "^3.12.1" + ono "^4.0.11" + json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" @@ -17176,6 +17482,11 @@ json5@^2.1.0: dependencies: minimist "^1.2.0" +jsonc-parser@~2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.1.1.tgz#83dc3d7a6e7186346b889b1280eefa04446c6d3e" + integrity sha512-VC0CjnWJylKB1iov4u76/W/5Ef0ydDkjtYWxoZ9t3HdWlSnZQwZL5MgFikaB/EtQ4RmMEw3tmQzuYnZA2/Ja1g== + jsonfile@^2.1.0: version "2.4.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" @@ -17215,6 +17526,11 @@ jsonparse@^1.2.0: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= +jsonpath-plus@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/jsonpath-plus/-/jsonpath-plus-1.1.0.tgz#7caaea4db88b761a0a3b55d715cb01eaa469dfa5" + integrity sha512-ydqTBOuLcFCUr9e7AxJlKCFgxzEQ03HjnIim0hJSdk2NxD8MOsaMOrRgP6XWEm5q3VuDY5+cRT1DM9vLlGo/qA== + jsonpointer@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" @@ -17739,6 +18055,14 @@ liftoff@^3.1.0: rechoir "^0.6.2" resolve "^1.1.7" +light-my-request@^3.4.1: + version "3.5.0" + resolved "https://registry.yarnpkg.com/light-my-request/-/light-my-request-3.5.0.tgz#7310b06b64a6aef37735d9ebc95c03a24d01a513" + integrity sha512-40pGbzDCoTqJIojGWOvOR4H3S4rm372FcXP6LgfVNaFdAPErKpqPsLJOHpbGMqgVpr5+QHquZimAKIe9SS6xvw== + dependencies: + ajv "^6.10.2" + readable-stream "^3.4.0" + line-column@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/line-column/-/line-column-1.0.2.tgz#d25af2936b6f4849172b312e4792d1d987bc34a2" @@ -19026,6 +19350,14 @@ micromatch@^4.0.0, micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" +middie@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/middie/-/middie-4.0.1.tgz#24b4333034926ebd7831ed58766d050c1ce6300a" + integrity sha512-eYK6EEHZiYpQMYPmeCb/vC9ZzJg1HCqi1ot/fQs1sPZKt/XREgXouQ7g6c9J5XvDV5203JjbpovCYNkHcHgTpQ== + dependencies: + path-to-regexp "^3.0.0" + reusify "^1.0.2" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -20576,6 +20908,13 @@ onetime@^5.1.0: dependencies: mimic-fn "^2.1.0" +ono@^4.0.11: + version "4.0.11" + resolved "https://registry.yarnpkg.com/ono/-/ono-4.0.11.tgz#c7f4209b3e396e8a44ef43b9cedc7f5d791d221d" + integrity sha512-jQ31cORBFE6td25deYeD80wxKBMj+zBmHTrVxnc6CKhx8gho6ipmWM5zj/oeoqioZ99yqBls9Z/9Nss7J26G2g== + dependencies: + format-util "^1.0.3" + open@^6.1.0, open@^6.3.0: version "6.4.0" resolved "https://registry.yarnpkg.com/open/-/open-6.4.0.tgz#5c13e96d0dc894686164f18965ecfe889ecfc8a9" @@ -20583,6 +20922,24 @@ open@^6.1.0, open@^6.3.0: dependencies: is-wsl "^1.1.0" +openapi-sampler@^1.0.0-beta.15: + version "1.0.0-beta.15" + resolved "https://registry.yarnpkg.com/openapi-sampler/-/openapi-sampler-1.0.0-beta.15.tgz#c087143826962fa07a0c7bda9ce5c36d732f45de" + integrity sha512-wUD/vD3iBHKik/sME3uwUu4X3HFA53rDrPcVvLzgEELjHLbnTpSYfm4Jo9qZT1dPfBRowAnrF/VRQfOjL5QRAw== + dependencies: + json-pointer "^0.6.0" + +openapi-schema-to-json-schema@stoplightio/openapi-schema-to-json-schema#c8b5f0c74270d505fc39635edef28e09df89601f: + version "2.2.0" + resolved "https://codeload.github.com/stoplightio/openapi-schema-to-json-schema/tar.gz/c8b5f0c74270d505fc39635edef28e09df89601f" + dependencies: + deep-equal "^1.0.1" + +openapi3-ts@~1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/openapi3-ts/-/openapi3-ts-1.3.0.tgz#a6b4a6dda1d037cb826f3230426ce5243c75edb3" + integrity sha512-Xk3hsB0PzB4dzr/r/FdmK+VfQbZH7lQQ2iipMS1/1eoz1wUvh5R7rmOakYvw0bQJJE6PYrOLx8UHsYmzgTr+YQ== + opener@^1.4.2: version "1.5.1" resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed" @@ -21356,6 +21713,11 @@ path-to-regexp@^2.2.1: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-2.4.0.tgz#35ce7f333d5616f1c1e1bfe266c3aba2e5b2e704" integrity sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w== +path-to-regexp@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-3.1.0.tgz#f45a9cc4dc6331ae8f131e0ce4fde8607f802367" + integrity sha512-PtHLisEvUOepjc+sStXxJ/pDV/s5UBTOKWJY2SOz3e6E/iN/jLknY9WL72kTwRrwXDUbZTEAtSnJbz2fF127DA== + path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" @@ -21531,6 +21893,23 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= +pino-std-serializers@^2.3.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-2.4.2.tgz#cb5e3e58c358b26f88969d7e619ae54bdfcc1ae1" + integrity sha512-WaL504dO8eGs+vrK+j4BuQQq6GLKeCCcHaMB2ItygzVURcL1CycwNEUHTD/lHFHs/NL5qAz2UKrjYWXKSf4aMQ== + +pino@^5.13.2: + version "5.13.5" + resolved "https://registry.yarnpkg.com/pino/-/pino-5.13.5.tgz#3bfd03c9e7d247adf806960a25c139572ce3cd4f" + integrity sha512-NSArDZnjIXgzTLsYA5EhYwLiMe2OmGJ73760Wt5Vj44kUcuPJk4ub29BKtWXGAMwVmW1cQ7Q8jQaLjY/5Gxqcw== + dependencies: + fast-redact "^2.0.0" + fast-safe-stringify "^2.0.7" + flatstr "^1.0.9" + pino-std-serializers "^2.3.0" + quick-format-unescaped "^3.0.3" + sonic-boom "^0.7.5" + pirates@^4.0.0, pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" @@ -21545,6 +21924,14 @@ pixelmatch@4.0.2, pixelmatch@^4.0.2: dependencies: pngjs "^3.0.0" +pkg-conf@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-2.1.0.tgz#2126514ca6f2abfebd168596df18ba57867f0058" + integrity sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg= + dependencies: + find-up "^2.0.0" + load-json-file "^4.0.0" + pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" @@ -22049,6 +22436,14 @@ protocols@^1.1.0, protocols@^1.4.0: resolved "https://registry.yarnpkg.com/protocols/-/protocols-1.4.7.tgz#95f788a4f0e979b291ffefcf5636ad113d037d32" integrity sha512-Fx65lf9/YDn3hUX08XUc0J8rSux36rEsyiv21ZGUC1mOyeM3lTRpZLcrm8aAolzS4itwVfm7TAPyxC2E5zd6xg== +proxy-addr@^2.0.4, proxy-addr@~2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" + integrity sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ== + dependencies: + forwarded "~0.1.2" + ipaddr.js "1.9.0" + proxy-addr@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93" @@ -22057,14 +22452,6 @@ proxy-addr@~2.0.4: forwarded "~0.1.2" ipaddr.js "1.8.0" -proxy-addr@~2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" - integrity sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ== - dependencies: - forwarded "~0.1.2" - ipaddr.js "1.9.0" - proxy-from-env@1.0.0, proxy-from-env@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" @@ -22381,6 +22768,11 @@ querystringify@^2.0.0: resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.0.tgz#7ded8dfbf7879dcc60d0a644ac6754b283ad17ef" integrity sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg== +quick-format-unescaped@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/quick-format-unescaped/-/quick-format-unescaped-3.0.3.tgz#fb3e468ac64c01d22305806c39f121ddac0d1fb9" + integrity sha512-dy1yjycmn9blucmJLXOfZDx1ikZJUi6E8bBZLnhPG5gBrVhHXx2xVyqqgKBubVNEXmx51dBACMHpoMQK/N/AXQ== + quick-lru@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" @@ -22455,6 +22847,14 @@ randexp@0.4.6: discontinuous-range "1.0.0" ret "~0.1.10" +randexp@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/randexp/-/randexp-0.5.3.tgz#f31c2de3148b30bdeb84b7c3f59b0ebb9fec3738" + integrity sha512-U+5l2KrcMNOUPYvazA3h5ekF80FHTUG+87SEAmHZmolh1M+i/WyTCxVzmi+tidIa1tM4BSe8g2Y/D3loWDjj+w== + dependencies: + drange "^1.0.2" + ret "^0.2.0" + randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: version "2.0.6" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" @@ -23480,7 +23880,7 @@ readable-stream@1.0, readable-stream@~1.0.17, readable-stream@~1.0.27-1: isarray "0.0.1" string_decoder "~0.10.x" -"readable-stream@2 || 3", readable-stream@^3.0.1, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0: +"readable-stream@2 || 3", readable-stream@^3.0.0, readable-stream@^3.0.1, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== @@ -24413,6 +24813,11 @@ resumer@~0.0.0: dependencies: through "~2.3.4" +ret@^0.2.0, ret@~0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.2.2.tgz#b6861782a1f4762dce43402a71eb7a283f44573c" + integrity sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ== + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -24428,7 +24833,7 @@ retry@0.12.0, retry@^0.12.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= -reusify@^1.0.0: +reusify@^1.0.0, reusify@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== @@ -24643,6 +25048,13 @@ safe-json-parse@~1.0.1: resolved "https://registry.yarnpkg.com/safe-json-parse/-/safe-json-parse-1.0.1.tgz#3e76723e38dfdda13c9b1d29a1e07ffee4b30b57" integrity sha1-PnZyPjjf3aE8mx0poeB//uSzC1c= +safe-regex2@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/safe-regex2/-/safe-regex2-2.0.0.tgz#b287524c397c7a2994470367e0185e1916b1f5b9" + integrity sha512-PaUSFsUaNNuKwkBijoAPHAK6/eM6VirvyPWlZ7BAQy4D+hCvh4B6lIG+nPdhbFfIbP+gTGBcrdsOaUs0F+ZBOQ== + dependencies: + ret "~0.2.0" + safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" @@ -24650,6 +25062,11 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-stable-stringify@^1.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-1.1.0.tgz#f712b600f8f775444ccc66e8f31d250e43fdfe01" + integrity sha512-8h+96qSufNQrydRPzbHms38VftQQSRGbqUkaIMWUBWN4/N8sLNALIALa8KmFcQ8P/a9uzMkA+KY04Rj5WQiXPA== + safefs@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/safefs/-/safefs-4.1.0.tgz#f82aeb4bdd7ae51f653eb20f6728b3058c8d6445" @@ -24855,6 +25272,11 @@ scss-tokenizer@^0.2.3: js-base64 "^2.1.8" source-map "^0.4.2" +secure-json-parse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/secure-json-parse/-/secure-json-parse-1.0.0.tgz#fa32c6778166b783cf6315db967944e63f7747d0" + integrity sha512-kMg4jXttRQzVyLebIDc+MRxCueJ/zsmHpCn59BRd0mZUCd+V02wNd7/Pds8Nyhv7jfLHo1KkUOzdIF7cRMU4LQ== + seek-bzip@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/seek-bzip/-/seek-bzip-1.0.5.tgz#cfe917cb3d274bcffac792758af53173eb1fabdc" @@ -24913,6 +25335,11 @@ semver-regex@^1.0.0: resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-1.0.0.tgz#92a4969065f9c70c694753d55248fc68f8f652c9" integrity sha1-kqSWkGX5xwxpR1PVUkj8aPj2Usk= +semver-store@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/semver-store/-/semver-store-0.3.0.tgz#ce602ff07df37080ec9f4fb40b29576547befbe9" + integrity sha512-TcZvGMMy9vodEFSse30lWinkj+JgOBvPn8wRItpQRSayhc+4ssDs335uklkfvQQJgL/WvmHLVj4Ycv2s7QCQMg== + semver-truncate@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/semver-truncate/-/semver-truncate-1.1.2.tgz#57f41de69707a62709a7e0104ba2117109ea47e8" @@ -25239,6 +25666,15 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= +signale@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/signale/-/signale-1.4.0.tgz#c4be58302fb0262ac00fc3d886a7c113759042f1" + integrity sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w== + dependencies: + chalk "^2.3.2" + figures "^2.0.0" + pkg-conf "^2.1.0" + simple-git@1.116.0: version "1.116.0" resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.116.0.tgz#ea6e533466f1e0152186e306e004d4eefa6e3e00" @@ -25474,6 +25910,13 @@ sockjs@0.3.19: faye-websocket "^0.10.0" uuid "^3.0.1" +sonic-boom@^0.7.5: + version "0.7.6" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-0.7.6.tgz#c42df6df884a6a3d54fa7a45b11e4e2196818d45" + integrity sha512-k9E2QQ4zxuVRLDW+ZW6ISzJs3wlEorVdmM7ApDgor7wsGKSDG5YGHsGmgLY4XYh4DMlr/2ap2BWAE7yTFJtWnQ== + dependencies: + flatstr "^1.0.12" + sort-keys@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" @@ -25738,6 +26181,13 @@ split-string@^3.0.1, split-string@^3.0.2: dependencies: extend-shallow "^3.0.0" +split2@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/split2/-/split2-3.1.1.tgz#c51f18f3e06a8c4469aaab487687d8d956160bb6" + integrity sha512-emNzr1s7ruq4N+1993yht631/JH+jaj0NYBosuKmLcq+JkGQ9MmTw1RB1fGaTCzUuseRIClrlSLHRNYGwWQ58Q== + dependencies: + readable-stream "^3.0.0" + split@~0.2.10: version "0.2.10" resolved "https://registry.yarnpkg.com/split/-/split-0.2.10.tgz#67097c601d697ce1368f418f06cd201cf0521a57" @@ -27011,6 +27461,11 @@ tiny-lr@^1.1.1: object-assign "^4.1.0" qs "^6.4.0" +tiny-lru@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/tiny-lru/-/tiny-lru-7.0.1.tgz#a5401035c317ea36ba86f91ce68b1b87e86c7630" + integrity sha512-BImmnAPNkaN7XjrvmOr4JAT2U6ubLmxiD9iDBMMow3/026OZ+yiuWzM1F0TgECLfq1KO2YkXEIJ2h6sPjXv9XA== + tiny-warning@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.2.tgz#1dfae771ee1a04396bdfde27a3adcebc6b648b28" @@ -27353,7 +27808,7 @@ tsd@^0.7.4: typescript "^3.0.1" update-notifier "^2.5.0" -tslib@^1: +tslib@^1, tslib@^1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== @@ -27887,6 +28342,14 @@ type-fest@^0.6.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== +type-is@^1.6.18, type-is@~1.6.17, type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + type-is@~1.6.15, type-is@~1.6.16: version "1.6.16" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" @@ -27895,14 +28358,6 @@ type-is@~1.6.15, type-is@~1.6.16: media-typer "0.3.0" mime-types "~2.1.18" -type-is@~1.6.17, type-is@~1.6.18: - version "1.6.18" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" - integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== - dependencies: - media-typer "0.3.0" - mime-types "~2.1.24" - type-name@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/type-name/-/type-name-2.0.2.tgz#efe7d4123d8ac52afff7f40c7e4dec5266008fb4" @@ -28354,6 +28809,11 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" +urijs@^1.19.1, urijs@~1.19.1: + version "1.19.2" + resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.2.tgz#f9be09f00c4c5134b7cb3cf475c1dd394526265a" + integrity sha512-s/UIq9ap4JPZ7H1EB5ULo/aOUbWqfDi7FKzMC2Nz+0Si8GiT1rIEaprt8hy3Vy2Ex2aJPpOQv4P4DuOZ+K1c6w== + urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" @@ -28689,7 +29149,7 @@ value-or-function@^3.0.0: resolved "https://registry.yarnpkg.com/value-or-function/-/value-or-function-3.0.0.tgz#1c243a50b595c1be54a754bfece8563b9ff8d813" integrity sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM= -vary@^1, vary@~1.1.2: +vary@^1, vary@^1.1.2, vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= @@ -30274,7 +30734,7 @@ yargs@^11.0.0: y18n "^3.2.1" yargs-parser "^9.0.2" -yargs@^14.2.0: +yargs@^14.0.0, yargs@^14.2.0: version "14.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.0.tgz#f116a9242c4ed8668790b40759b4906c276e76c3" integrity sha512-/is78VKbKs70bVZH7w4YaZea6xcJWOAwkhbR0CFuZBmYtfTYF0xjGJF43AYd8g2Uii1yJwmS5GR2vBmrc32sbg==