mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
- Adds schema definitions to transform API endpoints and adds API integration tests. - The type definitions based on the schema definitions can be used on the client side too. - Adds apidoc documentation.
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
/*
|
|
* 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 { schema, TypeOf } from '@kbn/config-schema';
|
|
|
|
import { TRANSFORM_STATE } from '../constants';
|
|
|
|
export const transformIdsSchema = schema.arrayOf(
|
|
schema.object({
|
|
id: schema.string(),
|
|
})
|
|
);
|
|
|
|
export type TransformIdsSchema = TypeOf<typeof transformIdsSchema>;
|
|
|
|
export const transformStateSchema = schema.oneOf([
|
|
schema.literal(TRANSFORM_STATE.ABORTING),
|
|
schema.literal(TRANSFORM_STATE.FAILED),
|
|
schema.literal(TRANSFORM_STATE.INDEXING),
|
|
schema.literal(TRANSFORM_STATE.STARTED),
|
|
schema.literal(TRANSFORM_STATE.STOPPED),
|
|
schema.literal(TRANSFORM_STATE.STOPPING),
|
|
]);
|
|
|
|
export const indexPatternTitleSchema = schema.object({
|
|
/** Title of the index pattern for which to return stats. */
|
|
indexPatternTitle: schema.string(),
|
|
});
|
|
|
|
export type IndexPatternTitleSchema = TypeOf<typeof indexPatternTitleSchema>;
|
|
|
|
export const transformIdParamSchema = schema.object({
|
|
transformId: schema.string(),
|
|
});
|
|
|
|
export type TransformIdParamSchema = TypeOf<typeof transformIdParamSchema>;
|
|
|
|
export interface ResponseStatus {
|
|
success: boolean;
|
|
error?: any;
|
|
}
|
|
|
|
export interface CommonResponseStatusSchema {
|
|
[key: string]: ResponseStatus;
|
|
}
|