Skip to content

Commit

Permalink
[Ingest] Data source APIs (#52448)
Browse files Browse the repository at this point in the history
* Clean up ingest imports and remove unneeded mock_spec files

* Initial pass at datasources lib and API endpoints

* Add add/remove datasource to/from policy API endpoints

* Add datasource contract tests and related policy contract tests; update snapshots

* Fix tests

* Fix tests again

* Fix tests 3

* Adjust routes, PR feedback
  • Loading branch information
jen-huang authored Dec 11, 2019
1 parent 9b0ba9b commit 47b8818
Show file tree
Hide file tree
Showing 33 changed files with 1,772 additions and 33,052 deletions.
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/fleet/common/types/domain_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import * as t from 'io-ts';
export { Policy, Datasource } from '../../../ingest/server/libs/types';
export { Policy, Datasource, Status, Output } from '../../../ingest/server/libs/types';
import { RuntimeAgent, RuntimeAgentAction } from '../../server/repositories/agents/types';
import { RuntimeAgentEvent } from '../../server/repositories/agent_events/types';
export { EnrollmentApiKey } from '../../server/repositories/enrollment_api_keys/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class RestPolicyAdapter extends PolicyAdapter {

public async get(id: string): Promise<Policy | null> {
try {
return (await this.REST.get<ReturnTypeGet<Policy>>(`/api/ingest/policy/${id}`)).item;
return (await this.REST.get<ReturnTypeGet<Policy>>(`/api/ingest/policies/${id}`)).item;
} catch (e) {
return null;
}
Expand Down Expand Up @@ -51,7 +51,7 @@ export class RestPolicyAdapter extends PolicyAdapter {
}

public async update(id: string, policy: Partial<Policy>) {
return await this.REST.put<ReturnTypeUpdate<Policy>>(`/api/ingest/policy/${id}`, policy);
return await this.REST.put<ReturnTypeUpdate<Policy>>(`/api/ingest/policies/${id}`, policy);
}

public async getAgentStatus(policyId: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import React, { Fragment, useState } from 'react';
import { Policy } from '../../../../common/types/domain_data';
import { useLibs } from '../../../hooks/use_libs';
import { EnrollmentApiKeysTable } from './enrollment_api_keys';
import { useEnrollmentApiKey, useEnrollmentApiKeys } from './enrollment_api_keys/hooks';
Expand All @@ -31,7 +32,6 @@ import {
ShellEnrollmentInstructions,
ToolsEnrollmentInstructions,
} from './enrollment_instructions';
import { Policy } from '../../../../../ingest/server/libs/types';

interface RouterProps {
onClose: () => void;
Expand Down
8 changes: 0 additions & 8 deletions x-pack/legacy/plugins/fleet/scripts/mock_spec/index.js

This file was deleted.

16 changes: 0 additions & 16 deletions x-pack/legacy/plugins/fleet/scripts/mock_spec/models/asset.v1.json

This file was deleted.

This file was deleted.

This file was deleted.

50 changes: 0 additions & 50 deletions x-pack/legacy/plugins/fleet/scripts/mock_spec/models/input.v1.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 47b8818

Please sign in to comment.