Skip to content

Commit

Permalink
Prepare the connector GetAll API for versioning (#162799)
Browse files Browse the repository at this point in the history
Part of: elastic/response-ops-team#125

This PR intends to prepare the `GET ${BASE_ACTION_API_PATH}/connectors`
API for versioning as shown in the above issue.

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
ersin-erdal and kibanamachine authored Aug 23, 2023
1 parent 0d85af2 commit d65b02c
Show file tree
Hide file tree
Showing 41 changed files with 1,314 additions and 730 deletions.
17 changes: 17 additions & 0 deletions x-pack/plugins/actions/common/routes/connector/response/index.ts
Original file line number Diff line number Diff line change
@@ -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
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

// Latest
export type { ConnectorResponse, ActionTypeConfig } from './types/latest';
export { connectorResponseSchema } from './schemas/latest';

// v1
export type {
ConnectorResponse as ConnectorResponseV1,
ActionTypeConfig as ActionTypeConfigV1,
} from './types/v1';
export { connectorResponseSchema as connectorResponseSchemaV1 } from './schemas/v1';
Original file line number Diff line number Diff line change
@@ -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
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export { connectorResponseSchema } from './v1';
Original file line number Diff line number Diff line change
@@ -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
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { schema } from '@kbn/config-schema';

export const connectorResponseSchema = schema.object({
id: schema.string(),
name: schema.string(),
config: schema.maybe(schema.recordOf(schema.string(), schema.any())),
connector_type_id: schema.string(),
is_missing_secrets: schema.maybe(schema.boolean()),
is_preconfigured: schema.boolean(),
is_deprecated: schema.boolean(),
is_system_action: schema.boolean(),
referenced_by_count: schema.number(),
});
Original file line number Diff line number Diff line change
@@ -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
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export * from './v1';
Original file line number Diff line number Diff line change
@@ -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
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { TypeOf } from '@kbn/config-schema';
import { connectorResponseSchemaV1 } from '..';

export type ActionTypeConfig = Record<string, unknown>;
type ConnectorResponseSchemaType = TypeOf<typeof connectorResponseSchemaV1>;

export interface ConnectorResponse<Config extends ActionTypeConfig = ActionTypeConfig> {
id: ConnectorResponseSchemaType['id'];
name: ConnectorResponseSchemaType['name'];
config?: Config;
connector_type_id: ConnectorResponseSchemaType['connector_type_id'];
is_missing_secrets?: ConnectorResponseSchemaType['is_missing_secrets'];
is_preconfigured: ConnectorResponseSchemaType['is_preconfigured'];
is_deprecated: ConnectorResponseSchemaType['is_deprecated'];
is_system_action: ConnectorResponseSchemaType['is_system_action'];
referenced_by_count: ConnectorResponseSchemaType['referenced_by_count'];
}
Loading

0 comments on commit d65b02c

Please sign in to comment.