diff --git a/x-pack/plugins/cases/README.md b/x-pack/plugins/cases/README.md index 14afe89829a68..44750d2dd74e5 100644 --- a/x-pack/plugins/cases/README.md +++ b/x-pack/plugins/cases/README.md @@ -14,6 +14,7 @@ Case management in Kibana ## Table of Contents - [Cases API](#cases-api) +- [Cases Client API](#cases-client-api) - [Cases UI](#cases-ui) - [Case Action Type](#case-action-type) _feature in development, disabled by default_ @@ -21,6 +22,9 @@ Case management in Kibana ## Cases API [**Explore the API docs »**](https://www.elastic.co/guide/en/security/current/cases-api-overview.html) +## Cases Client API +[**Cases Client API docs**][cases-client-api-docs] + ## Cases UI #### Embed Cases UI components in any Kibana plugin @@ -263,4 +267,4 @@ For IBM Resilient connectors: [all-cases-modal-img]: images/all_cases_selector_modal.png [recent-cases-img]: images/recent_cases.png [case-view-img]: images/case_view.png - +[cases-client-api-docs]: docs/cases_client/cases_client_api.md diff --git a/x-pack/plugins/cases/common/api/cases/case.ts b/x-pack/plugins/cases/common/api/cases/case.ts index 05ab1a464071a..b3f7952a61ee7 100644 --- a/x-pack/plugins/cases/common/api/cases/case.ts +++ b/x-pack/plugins/cases/common/api/cases/case.ts @@ -31,13 +31,37 @@ const SettingsRt = rt.type({ }); const CaseBasicRt = rt.type({ + /** + * The description of the case + */ description: rt.string, + /** + * The current status of the case (open, closed, in-progress) + */ status: CaseStatusRt, + /** + * The identifying strings for filter a case + */ tags: rt.array(rt.string), + /** + * The title of a case + */ title: rt.string, + /** + * The type of a case (individual or collection) + */ [caseTypeField]: CaseTypeRt, + /** + * The external system that the case can be synced with + */ connector: CaseConnectorRt, + /** + * The alert sync settings + */ settings: SettingsRt, + /** + * The plugin owner of the case + */ owner: rt.string, }); @@ -74,11 +98,30 @@ export const CaseAttributesRt = rt.intersection([ ]); const CasePostRequestNoTypeRt = rt.type({ + /** + * Description of the case + */ description: rt.string, + /** + * Identifiers for the case. + */ tags: rt.array(rt.string), + /** + * Title of the case + */ title: rt.string, + /** + * The external configuration for the case + */ connector: CaseConnectorRt, + /** + * Sync settings for alerts + */ settings: SettingsRt, + /** + * The owner here must match the string used when a plugin registers a feature with access to the cases plugin. The user + * creating this case must also be granted access to that plugin's feature. + */ owner: rt.string, }); @@ -97,27 +140,77 @@ export const CasesClientPostRequestRt = rt.type({ * has all the necessary fields. CasesClientPostRequestRt is used for validation. */ export const CasePostRequestRt = rt.intersection([ + /** + * The case type: an individual case (one without children) or a collection case (one with children) + */ rt.partial({ [caseTypeField]: CaseTypeRt }), CasePostRequestNoTypeRt, ]); export const CasesFindRequestRt = rt.partial({ + /** + * Type of a case (individual, or collection) + */ type: CaseTypeRt, + /** + * Tags to filter by + */ tags: rt.union([rt.array(rt.string), rt.string]), + /** + * The status of the case (open, closed, in-progress) + */ status: CaseStatusRt, + /** + * The reporters to filter by + */ reporters: rt.union([rt.array(rt.string), rt.string]), + /** + * Operator to use for the `search` field + */ defaultSearchOperator: rt.union([rt.literal('AND'), rt.literal('OR')]), + /** + * The fields in the entity to return in the response + */ fields: rt.array(rt.string), + /** + * The page of objects to return + */ page: NumberFromString, + /** + * The number of objects to include in each page + */ perPage: NumberFromString, + /** + * An Elasticsearch simple_query_string + */ search: rt.string, + /** + * The fields to perform the simple_query_string parsed query against + */ searchFields: rt.union([rt.array(rt.string), rt.string]), + /** + * The field to use for sorting the found objects. + * + * This only supports, `create_at`, `closed_at`, and `status` + */ sortField: rt.string, + /** + * The order to sort by + */ sortOrder: rt.union([rt.literal('desc'), rt.literal('asc')]), + /** + * The owner(s) to filter by. The user making the request must have privileges to retrieve cases of that + * ownership or they will be ignored. If no owner is included, then all ownership types will be included in the response + * that the user has access to. + */ owner: rt.union([rt.array(rt.string), rt.string]), }); export const CasesByAlertIDRequestRt = rt.partial({ + /** + * The type of cases to retrieve given an alert ID. If no owner is provided, all cases + * that the user has access to will be returned. + */ owner: rt.union([rt.array(rt.string), rt.string]), }); @@ -148,6 +241,9 @@ export const CasesFindResponseRt = rt.intersection([ export const CasePatchRequestRt = rt.intersection([ rt.partial(CaseBasicRt.props), + /** + * The saved object ID and version + */ rt.type({ id: rt.string, version: rt.string }), ]); @@ -180,6 +276,10 @@ export const ExternalServiceResponseRt = rt.intersection([ ]); export const AllTagsFindRequestRt = rt.partial({ + /** + * The owner of the cases to retrieve the tags from. If no owner is provided the tags from all cases + * that the user has access to will be returned. + */ owner: rt.union([rt.array(rt.string), rt.string]), }); diff --git a/x-pack/plugins/cases/common/api/cases/comment.ts b/x-pack/plugins/cases/common/api/cases/comment.ts index 7cc64bbc1e856..5bc8da95639c8 100644 --- a/x-pack/plugins/cases/common/api/cases/comment.ts +++ b/x-pack/plugins/cases/common/api/cases/comment.ts @@ -133,6 +133,9 @@ export const AllCommentsResponseRt = rt.array(CommentResponseRt); export const FindQueryParamsRt = rt.partial({ ...SavedObjectFindOptionsRt.props, + /** + * If specified the attachments found will be associated to a sub case instead of a case object + */ subCaseId: rt.string, }); diff --git a/x-pack/plugins/cases/common/api/cases/configure.ts b/x-pack/plugins/cases/common/api/cases/configure.ts index eeeb9ed4ebd04..2814dd44f513f 100644 --- a/x-pack/plugins/cases/common/api/cases/configure.ts +++ b/x-pack/plugins/cases/common/api/cases/configure.ts @@ -16,8 +16,17 @@ import { OWNER_FIELD } from './constants'; const ClosureTypeRT = rt.union([rt.literal('close-by-user'), rt.literal('close-by-pushing')]); const CasesConfigureBasicRt = rt.type({ + /** + * The external connector + */ connector: CaseConnectorRt, + /** + * Whether to close the case after it has been synced with the external system + */ closure_type: ClosureTypeRT, + /** + * The plugin owner that manages this configuration + */ owner: rt.string, }); @@ -53,6 +62,10 @@ export const CaseConfigureResponseRt = rt.intersection([ ]); export const GetConfigureFindRequestRt = rt.partial({ + /** + * The configuration plugin owner to filter the search by. If this is left empty the results will include all configurations + * that the user has permissions to access + */ owner: rt.union([rt.array(rt.string), rt.string]), }); diff --git a/x-pack/plugins/cases/common/api/cases/sub_case.ts b/x-pack/plugins/cases/common/api/cases/sub_case.ts index 826654cab2d7f..654b74276733b 100644 --- a/x-pack/plugins/cases/common/api/cases/sub_case.ts +++ b/x-pack/plugins/cases/common/api/cases/sub_case.ts @@ -14,6 +14,9 @@ import { CasesStatusResponseRt } from './status'; import { CaseStatusRt } from './status'; const SubCaseBasicRt = rt.type({ + /** + * The status of the sub case (open, closed, in-progress) + */ status: CaseStatusRt, }); @@ -31,14 +34,41 @@ export const SubCaseAttributesRt = rt.intersection([ ]); export const SubCasesFindRequestRt = rt.partial({ + /** + * The status of the sub case (open, closed, in-progress) + */ status: CaseStatusRt, + /** + * Operator to use for the `search` field + */ defaultSearchOperator: rt.union([rt.literal('AND'), rt.literal('OR')]), + /** + * The fields in the entity to return in the response + */ fields: rt.array(rt.string), + /** + * The page of objects to return + */ page: NumberFromString, + /** + * The number of objects to include in each page + */ perPage: NumberFromString, + /** + * An Elasticsearch simple_query_string + */ search: rt.string, + /** + * The fields to perform the simple_query_string parsed query against + */ searchFields: rt.array(rt.string), + /** + * The field to use for sorting the found objects. + */ sortField: rt.string, + /** + * The order to sort by + */ sortOrder: rt.union([rt.literal('desc'), rt.literal('asc')]), owner: rt.string, }); diff --git a/x-pack/plugins/cases/common/api/saved_object.ts b/x-pack/plugins/cases/common/api/saved_object.ts index e0ae4ee82c490..2ed6ec2acdfe4 100644 --- a/x-pack/plugins/cases/common/api/saved_object.ts +++ b/x-pack/plugins/cases/common/api/saved_object.ts @@ -23,16 +23,49 @@ export const NumberFromString = new rt.Type( const ReferenceRt = rt.type({ id: rt.string, type: rt.string }); export const SavedObjectFindOptionsRt = rt.partial({ + /** + * The default operator to use for the simple_query_string + */ defaultSearchOperator: rt.union([rt.literal('AND'), rt.literal('OR')]), + /** + * The operator for controlling the logic of the `hasReference` field + */ hasReferenceOperator: rt.union([rt.literal('AND'), rt.literal('OR')]), + /** + * Filter by objects that have an association to another object + */ hasReference: rt.union([rt.array(ReferenceRt), ReferenceRt]), + /** + * The fields to return in the attributes key of the response + */ fields: rt.array(rt.string), + /** + * The filter is a KQL string with the caveat that if you filter with an attribute from your saved object type, it should look like that: savedObjectType.attributes.title: "myTitle". However, If you use a root attribute of a saved object such as updated_at, you will have to define your filter like that: savedObjectType.updated_at > 2018-12-22 + */ filter: rt.string, + /** + * The page of objects to return + */ page: NumberFromString, + /** + * The number of objects to return for a page + */ perPage: NumberFromString, + /** + * An Elasticsearch simple_query_string query that filters the objects in the response + */ search: rt.string, + /** + * The fields to perform the simple_query_string parsed query against + */ searchFields: rt.array(rt.string), + /** + * Sorts the response. Includes "root" and "type" fields. "root" fields exist for all saved objects, such as "updated_at". "type" fields are specific to an object type, such as fields returned in the attributes key of the response. When a single type is defined in the type parameter, the "root" and "type" fields are allowed, and validity checks are made in that order. When multiple types are defined in the type parameter, only "root" fields are allowed + */ sortField: rt.string, + /** + * Order to sort the response + */ sortOrder: rt.union([rt.literal('desc'), rt.literal('asc')]), }); diff --git a/x-pack/plugins/cases/docs/README.md b/x-pack/plugins/cases/docs/README.md new file mode 100644 index 0000000000000..85482d98dc509 --- /dev/null +++ b/x-pack/plugins/cases/docs/README.md @@ -0,0 +1,37 @@ +# Cases Client API Docs + +This directory contains generated docs using `typedoc` for the cases client API that can be called from other server +plugins. This README will describe how to generate a new version of these markdown docs in the event that new methods +or parameters are added. + +## TypeDoc Info + +See more info at: +and: for the markdown plugin + +## Install dependencies + +```bash +yarn global add typedoc typedoc-plugin-markdown +``` + +## Generate the docs + +```bash +cd x-pack/plugins/cases/docs +npx typedoc --options cases_client_typedoc.json +``` + +After running the above commands the files in the `server` directory will be updated to match the new tsdocs. +If additional markdown directory should be created we can create a new typedoc configuration file and adjust the `out` +directory accordingly. + +## Troubleshooting + +If you run into tsc errors that seem unrelated to the cases plugin try executing these commands before running `typedoc` + +```bash +cd +npx yarn kbn bootstrap +node scripts/build_ts_refs.js --clean --no-cache +``` diff --git a/x-pack/plugins/cases/docs/cases_client/cases_client_api.md b/x-pack/plugins/cases/docs/cases_client/cases_client_api.md new file mode 100644 index 0000000000000..d7e75af3142e6 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/cases_client_api.md @@ -0,0 +1,22 @@ +Cases Client API Interface + +# Cases Client API Interface + +## Table of contents + +### Modules + +- [attachments/add](modules/attachments_add.md) +- [attachments/client](modules/attachments_client.md) +- [attachments/delete](modules/attachments_delete.md) +- [attachments/get](modules/attachments_get.md) +- [attachments/update](modules/attachments_update.md) +- [cases/client](modules/cases_client.md) +- [cases/get](modules/cases_get.md) +- [cases/push](modules/cases_push.md) +- [client](modules/client.md) +- [configure/client](modules/configure_client.md) +- [stats/client](modules/stats_client.md) +- [sub\_cases/client](modules/sub_cases_client.md) +- [typedoc\_interfaces](modules/typedoc_interfaces.md) +- [user\_actions/client](modules/user_actions_client.md) diff --git a/x-pack/plugins/cases/docs/cases_client/classes/client.casesclient.md b/x-pack/plugins/cases/docs/cases_client/classes/client.casesclient.md new file mode 100644 index 0000000000000..8f6983dc4f769 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/classes/client.casesclient.md @@ -0,0 +1,178 @@ +[Cases Client API Interface](../cases_client_api.md) / [client](../modules/client.md) / CasesClient + +# Class: CasesClient + +[client](../modules/client.md).CasesClient + +Client wrapper that contains accessor methods for individual entities within the cases system. + +## Table of contents + +### Constructors + +- [constructor](client.casesclient.md#constructor) + +### Properties + +- [\_attachments](client.casesclient.md#_attachments) +- [\_cases](client.casesclient.md#_cases) +- [\_casesClientInternal](client.casesclient.md#_casesclientinternal) +- [\_configure](client.casesclient.md#_configure) +- [\_stats](client.casesclient.md#_stats) +- [\_subCases](client.casesclient.md#_subcases) +- [\_userActions](client.casesclient.md#_useractions) + +### Accessors + +- [attachments](client.casesclient.md#attachments) +- [cases](client.casesclient.md#cases) +- [configure](client.casesclient.md#configure) +- [stats](client.casesclient.md#stats) +- [subCases](client.casesclient.md#subcases) +- [userActions](client.casesclient.md#useractions) + +## Constructors + +### constructor + +\+ **new CasesClient**(`args`: CasesClientArgs): [*CasesClient*](client.casesclient.md) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `args` | CasesClientArgs | + +**Returns:** [*CasesClient*](client.casesclient.md) + +Defined in: [client.ts:28](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L28) + +## Properties + +### \_attachments + +• `Private` `Readonly` **\_attachments**: [*AttachmentsSubClient*](../interfaces/attachments_client.attachmentssubclient.md) + +Defined in: [client.ts:24](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L24) + +___ + +### \_cases + +• `Private` `Readonly` **\_cases**: [*CasesSubClient*](../interfaces/cases_client.casessubclient.md) + +Defined in: [client.ts:23](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L23) + +___ + +### \_casesClientInternal + +• `Private` `Readonly` **\_casesClientInternal**: *CasesClientInternal* + +Defined in: [client.ts:22](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L22) + +___ + +### \_configure + +• `Private` `Readonly` **\_configure**: [*ConfigureSubClient*](../interfaces/configure_client.configuresubclient.md) + +Defined in: [client.ts:27](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L27) + +___ + +### \_stats + +• `Private` `Readonly` **\_stats**: [*StatsSubClient*](../interfaces/stats_client.statssubclient.md) + +Defined in: [client.ts:28](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L28) + +___ + +### \_subCases + +• `Private` `Readonly` **\_subCases**: [*SubCasesClient*](../interfaces/sub_cases_client.subcasesclient.md) + +Defined in: [client.ts:26](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L26) + +___ + +### \_userActions + +• `Private` `Readonly` **\_userActions**: [*UserActionsSubClient*](../interfaces/user_actions_client.useractionssubclient.md) + +Defined in: [client.ts:25](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L25) + +## Accessors + +### attachments + +• get **attachments**(): [*AttachmentsSubClient*](../interfaces/attachments_client.attachmentssubclient.md) + +Retrieves an interface for interacting with attachments (comments) entities. + +**Returns:** [*AttachmentsSubClient*](../interfaces/attachments_client.attachmentssubclient.md) + +Defined in: [client.ts:50](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L50) + +___ + +### cases + +• get **cases**(): [*CasesSubClient*](../interfaces/cases_client.casessubclient.md) + +Retrieves an interface for interacting with cases entities. + +**Returns:** [*CasesSubClient*](../interfaces/cases_client.casessubclient.md) + +Defined in: [client.ts:43](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L43) + +___ + +### configure + +• get **configure**(): [*ConfigureSubClient*](../interfaces/configure_client.configuresubclient.md) + +Retrieves an interface for interacting with the configuration of external connectors for the plugin entities. + +**Returns:** [*ConfigureSubClient*](../interfaces/configure_client.configuresubclient.md) + +Defined in: [client.ts:76](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L76) + +___ + +### stats + +• get **stats**(): [*StatsSubClient*](../interfaces/stats_client.statssubclient.md) + +Retrieves an interface for retrieving statistics related to the cases entities. + +**Returns:** [*StatsSubClient*](../interfaces/stats_client.statssubclient.md) + +Defined in: [client.ts:83](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L83) + +___ + +### subCases + +• get **subCases**(): [*SubCasesClient*](../interfaces/sub_cases_client.subcasesclient.md) + +Retrieves an interface for interacting with the case as a connector entities. + +Currently this functionality is disabled and will throw an error if this function is called. + +**Returns:** [*SubCasesClient*](../interfaces/sub_cases_client.subcasesclient.md) + +Defined in: [client.ts:66](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L66) + +___ + +### userActions + +• get **userActions**(): [*UserActionsSubClient*](../interfaces/user_actions_client.useractionssubclient.md) + +Retrieves an interface for interacting with the user actions associated with the plugin entities. + +**Returns:** [*UserActionsSubClient*](../interfaces/user_actions_client.useractionssubclient.md) + +Defined in: [client.ts:57](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/client.ts#L57) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_add.addargs.md b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_add.addargs.md new file mode 100644 index 0000000000000..0e67fb488edeb --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_add.addargs.md @@ -0,0 +1,34 @@ +[Cases Client API Interface](../cases_client_api.md) / [attachments/add](../modules/attachments_add.md) / AddArgs + +# Interface: AddArgs + +[attachments/add](../modules/attachments_add.md).AddArgs + +The arguments needed for creating a new attachment to a case. + +## Table of contents + +### Properties + +- [caseId](attachments_add.addargs.md#caseid) +- [comment](attachments_add.addargs.md#comment) + +## Properties + +### caseId + +• **caseId**: *string* + +The case ID that this attachment will be associated with + +Defined in: [attachments/add.ts:308](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/add.ts#L308) + +___ + +### comment + +• **comment**: { `comment`: *string* ; `owner`: *string* ; `type`: user } \| { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } + +The attachment values. + +Defined in: [attachments/add.ts:312](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/add.ts#L312) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_client.attachmentssubclient.md b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_client.attachmentssubclient.md new file mode 100644 index 0000000000000..13a7a5a109a51 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_client.attachmentssubclient.md @@ -0,0 +1,147 @@ +[Cases Client API Interface](../cases_client_api.md) / [attachments/client](../modules/attachments_client.md) / AttachmentsSubClient + +# Interface: AttachmentsSubClient + +[attachments/client](../modules/attachments_client.md).AttachmentsSubClient + +API for interacting with the attachments to a case. + +## Table of contents + +### Methods + +- [add](attachments_client.attachmentssubclient.md#add) +- [delete](attachments_client.attachmentssubclient.md#delete) +- [deleteAll](attachments_client.attachmentssubclient.md#deleteall) +- [find](attachments_client.attachmentssubclient.md#find) +- [get](attachments_client.attachmentssubclient.md#get) +- [getAll](attachments_client.attachmentssubclient.md#getall) +- [update](attachments_client.attachmentssubclient.md#update) + +## Methods + +### add + +▸ **add**(`params`: [*AddArgs*](attachments_add.addargs.md)): *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Adds an attachment to a case. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | [*AddArgs*](attachments_add.addargs.md) | + +**Returns:** *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Defined in: [attachments/client.ts:25](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/client.ts#L25) + +___ + +### delete + +▸ **delete**(`deleteArgs`: [*DeleteArgs*](attachments_delete.deleteargs.md)): *Promise* + +Deletes a single attachment for a specific case. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `deleteArgs` | [*DeleteArgs*](attachments_delete.deleteargs.md) | + +**Returns:** *Promise* + +Defined in: [attachments/client.ts:33](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/client.ts#L33) + +___ + +### deleteAll + +▸ **deleteAll**(`deleteAllArgs`: [*DeleteAllArgs*](attachments_delete.deleteallargs.md)): *Promise* + +Deletes all attachments associated with a single case. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `deleteAllArgs` | [*DeleteAllArgs*](attachments_delete.deleteallargs.md) | + +**Returns:** *Promise* + +Defined in: [attachments/client.ts:29](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/client.ts#L29) + +___ + +### find + +▸ **find**(`findArgs`: [*FindArgs*](attachments_get.findargs.md)): *Promise*<[*ICommentsResponse*](typedoc_interfaces.icommentsresponse.md)\> + +Retrieves all comments matching the search criteria. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `findArgs` | [*FindArgs*](attachments_get.findargs.md) | + +**Returns:** *Promise*<[*ICommentsResponse*](typedoc_interfaces.icommentsresponse.md)\> + +Defined in: [attachments/client.ts:37](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/client.ts#L37) + +___ + +### get + +▸ **get**(`getArgs`: [*GetArgs*](attachments_get.getargs.md)): *Promise*<{ `comment`: *string* ; `owner`: *string* ; `type`: user } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* }\> + +Retrieves a single attachment for a case. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `getArgs` | [*GetArgs*](attachments_get.getargs.md) | + +**Returns:** *Promise*<{ `comment`: *string* ; `owner`: *string* ; `type`: user } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* }\> + +Defined in: [attachments/client.ts:45](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/client.ts#L45) + +___ + +### getAll + +▸ **getAll**(`getAllArgs`: [*GetAllArgs*](attachments_get.getallargs.md)): *Promise*<[*IAllCommentsResponse*](typedoc_interfaces.iallcommentsresponse.md)\> + +Gets all attachments for a single case. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `getAllArgs` | [*GetAllArgs*](attachments_get.getallargs.md) | + +**Returns:** *Promise*<[*IAllCommentsResponse*](typedoc_interfaces.iallcommentsresponse.md)\> + +Defined in: [attachments/client.ts:41](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/client.ts#L41) + +___ + +### update + +▸ **update**(`updateArgs`: [*UpdateArgs*](attachments_update.updateargs.md)): *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Updates a specific attachment. + +The request must include all fields for the attachment. Even the fields that are not changing. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `updateArgs` | [*UpdateArgs*](attachments_update.updateargs.md) | + +**Returns:** *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Defined in: [attachments/client.ts:51](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/client.ts#L51) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_delete.deleteallargs.md b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_delete.deleteallargs.md new file mode 100644 index 0000000000000..a0f5962fcc453 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_delete.deleteallargs.md @@ -0,0 +1,34 @@ +[Cases Client API Interface](../cases_client_api.md) / [attachments/delete](../modules/attachments_delete.md) / DeleteAllArgs + +# Interface: DeleteAllArgs + +[attachments/delete](../modules/attachments_delete.md).DeleteAllArgs + +Parameters for deleting all comments of a case or sub case. + +## Table of contents + +### Properties + +- [caseID](attachments_delete.deleteallargs.md#caseid) +- [subCaseID](attachments_delete.deleteallargs.md#subcaseid) + +## Properties + +### caseID + +• **caseID**: *string* + +The case ID to delete all attachments for + +Defined in: [attachments/delete.ts:26](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/delete.ts#L26) + +___ + +### subCaseID + +• `Optional` **subCaseID**: *string* + +If specified the caseID will be ignored and this value will be used to find a sub case for deleting all the attachments + +Defined in: [attachments/delete.ts:30](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/delete.ts#L30) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_delete.deleteargs.md b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_delete.deleteargs.md new file mode 100644 index 0000000000000..ab20f1b64b2a4 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_delete.deleteargs.md @@ -0,0 +1,45 @@ +[Cases Client API Interface](../cases_client_api.md) / [attachments/delete](../modules/attachments_delete.md) / DeleteArgs + +# Interface: DeleteArgs + +[attachments/delete](../modules/attachments_delete.md).DeleteArgs + +Parameters for deleting a single attachment of a case or sub case. + +## Table of contents + +### Properties + +- [attachmentID](attachments_delete.deleteargs.md#attachmentid) +- [caseID](attachments_delete.deleteargs.md#caseid) +- [subCaseID](attachments_delete.deleteargs.md#subcaseid) + +## Properties + +### attachmentID + +• **attachmentID**: *string* + +The attachment ID to delete + +Defined in: [attachments/delete.ts:44](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/delete.ts#L44) + +___ + +### caseID + +• **caseID**: *string* + +The case ID to delete an attachment from + +Defined in: [attachments/delete.ts:40](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/delete.ts#L40) + +___ + +### subCaseID + +• `Optional` **subCaseID**: *string* + +If specified the caseID will be ignored and this value will be used to find a sub case for deleting the attachment + +Defined in: [attachments/delete.ts:48](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/delete.ts#L48) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.findargs.md b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.findargs.md new file mode 100644 index 0000000000000..2a019220f8219 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.findargs.md @@ -0,0 +1,51 @@ +[Cases Client API Interface](../cases_client_api.md) / [attachments/get](../modules/attachments_get.md) / FindArgs + +# Interface: FindArgs + +[attachments/get](../modules/attachments_get.md).FindArgs + +Parameters for finding attachments of a case + +## Table of contents + +### Properties + +- [caseID](attachments_get.findargs.md#caseid) +- [queryParams](attachments_get.findargs.md#queryparams) + +## Properties + +### caseID + +• **caseID**: *string* + +The case ID for finding associated attachments + +Defined in: [attachments/get.ts:48](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/get.ts#L48) + +___ + +### queryParams + +• `Optional` **queryParams**: *object* + +Optional parameters for filtering the returned attachments + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `defaultSearchOperator` | *undefined* \| ``"AND"`` \| ``"OR"`` | +| `fields` | *undefined* \| *string*[] | +| `filter` | *undefined* \| *string* | +| `hasReference` | *undefined* \| { `id`: *string* ; `type`: *string* } \| { `id`: *string* ; `type`: *string* }[] | +| `hasReferenceOperator` | *undefined* \| ``"AND"`` \| ``"OR"`` | +| `page` | *undefined* \| *number* | +| `perPage` | *undefined* \| *number* | +| `search` | *undefined* \| *string* | +| `searchFields` | *undefined* \| *string*[] | +| `sortField` | *undefined* \| *string* | +| `sortOrder` | *undefined* \| ``"desc"`` \| ``"asc"`` | +| `subCaseId` | *undefined* \| *string* | + +Defined in: [attachments/get.ts:52](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/get.ts#L52) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.getallargs.md b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.getallargs.md new file mode 100644 index 0000000000000..c6f2123ee6056 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.getallargs.md @@ -0,0 +1,45 @@ +[Cases Client API Interface](../cases_client_api.md) / [attachments/get](../modules/attachments_get.md) / GetAllArgs + +# Interface: GetAllArgs + +[attachments/get](../modules/attachments_get.md).GetAllArgs + +Parameters for retrieving all attachments of a case + +## Table of contents + +### Properties + +- [caseID](attachments_get.getallargs.md#caseid) +- [includeSubCaseComments](attachments_get.getallargs.md#includesubcasecomments) +- [subCaseID](attachments_get.getallargs.md#subcaseid) + +## Properties + +### caseID + +• **caseID**: *string* + +The case ID to retrieve all attachments for + +Defined in: [attachments/get.ts:62](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/get.ts#L62) + +___ + +### includeSubCaseComments + +• `Optional` **includeSubCaseComments**: *boolean* + +Optionally include the attachments associated with a sub case + +Defined in: [attachments/get.ts:66](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/get.ts#L66) + +___ + +### subCaseID + +• `Optional` **subCaseID**: *string* + +If included the case ID will be ignored and the attachments will be retrieved from the specified ID of the sub case + +Defined in: [attachments/get.ts:70](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/get.ts#L70) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.getargs.md b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.getargs.md new file mode 100644 index 0000000000000..ffec56fc54c83 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_get.getargs.md @@ -0,0 +1,32 @@ +[Cases Client API Interface](../cases_client_api.md) / [attachments/get](../modules/attachments_get.md) / GetArgs + +# Interface: GetArgs + +[attachments/get](../modules/attachments_get.md).GetArgs + +## Table of contents + +### Properties + +- [attachmentID](attachments_get.getargs.md#attachmentid) +- [caseID](attachments_get.getargs.md#caseid) + +## Properties + +### attachmentID + +• **attachmentID**: *string* + +The ID of the attachment to retrieve + +Defined in: [attachments/get.ts:81](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/get.ts#L81) + +___ + +### caseID + +• **caseID**: *string* + +The ID of the case to retrieve an attachment from + +Defined in: [attachments/get.ts:77](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/get.ts#L77) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_update.updateargs.md b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_update.updateargs.md new file mode 100644 index 0000000000000..083723d76b10e --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/attachments_update.updateargs.md @@ -0,0 +1,45 @@ +[Cases Client API Interface](../cases_client_api.md) / [attachments/update](../modules/attachments_update.md) / UpdateArgs + +# Interface: UpdateArgs + +[attachments/update](../modules/attachments_update.md).UpdateArgs + +Parameters for updating a single attachment + +## Table of contents + +### Properties + +- [caseID](attachments_update.updateargs.md#caseid) +- [subCaseID](attachments_update.updateargs.md#subcaseid) +- [updateRequest](attachments_update.updateargs.md#updaterequest) + +## Properties + +### caseID + +• **caseID**: *string* + +The ID of the case that is associated with this attachment + +Defined in: [attachments/update.ts:29](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/update.ts#L29) + +___ + +### subCaseID + +• `Optional` **subCaseID**: *string* + +The ID of a sub case, if specified a sub case will be searched for to perform the attachment update instead of on a case + +Defined in: [attachments/update.ts:37](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/update.ts#L37) + +___ + +### updateRequest + +• **updateRequest**: { `comment`: *string* ; `owner`: *string* ; `type`: user } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `id`: *string* ; `version`: *string* } + +The full attachment request with the fields updated with appropriate values + +Defined in: [attachments/update.ts:33](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/attachments/update.ts#L33) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/cases_client.casessubclient.md b/x-pack/plugins/cases/docs/cases_client/interfaces/cases_client.casessubclient.md new file mode 100644 index 0000000000000..14315890b4f96 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/cases_client.casessubclient.md @@ -0,0 +1,189 @@ +[Cases Client API Interface](../cases_client_api.md) / [cases/client](../modules/cases_client.md) / CasesSubClient + +# Interface: CasesSubClient + +[cases/client](../modules/cases_client.md).CasesSubClient + +API for interacting with the cases entities. + +## Table of contents + +### Methods + +- [create](cases_client.casessubclient.md#create) +- [delete](cases_client.casessubclient.md#delete) +- [find](cases_client.casessubclient.md#find) +- [get](cases_client.casessubclient.md#get) +- [getCaseIDsByAlertID](cases_client.casessubclient.md#getcaseidsbyalertid) +- [getReporters](cases_client.casessubclient.md#getreporters) +- [getTags](cases_client.casessubclient.md#gettags) +- [push](cases_client.casessubclient.md#push) +- [update](cases_client.casessubclient.md#update) + +## Methods + +### create + +▸ **create**(`data`: [*ICasePostRequest*](typedoc_interfaces.icasepostrequest.md)): *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Creates a case. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `data` | [*ICasePostRequest*](typedoc_interfaces.icasepostrequest.md) | + +**Returns:** *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Defined in: [cases/client.ts:48](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L48) + +___ + +### delete + +▸ **delete**(`ids`: *string*[]): *Promise* + +Delete a case and all its comments. + +**`params`** ids an array of case IDs to delete + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `ids` | *string*[] | + +**Returns:** *Promise* + +Defined in: [cases/client.ts:72](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L72) + +___ + +### find + +▸ **find**(`params`: [*ICasesFindRequest*](typedoc_interfaces.icasesfindrequest.md)): *Promise*<[*ICasesFindResponse*](typedoc_interfaces.icasesfindresponse.md)\> + +Returns cases that match the search criteria. + +If the `owner` field is left empty then all the cases that the user has access to will be returned. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | [*ICasesFindRequest*](typedoc_interfaces.icasesfindrequest.md) | + +**Returns:** *Promise*<[*ICasesFindResponse*](typedoc_interfaces.icasesfindresponse.md)\> + +Defined in: [cases/client.ts:54](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L54) + +___ + +### get + +▸ **get**(`params`: [*GetParams*](cases_get.getparams.md)): *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Retrieves a single case with the specified ID. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | [*GetParams*](cases_get.getparams.md) | + +**Returns:** *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Defined in: [cases/client.ts:58](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L58) + +___ + +### getCaseIDsByAlertID + +▸ **getCaseIDsByAlertID**(`params`: [*CaseIDsByAlertIDParams*](cases_get.caseidsbyalertidparams.md)): *Promise* + +Retrieves the case IDs given a single alert ID + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | [*CaseIDsByAlertIDParams*](cases_get.caseidsbyalertidparams.md) | + +**Returns:** *Promise* + +Defined in: [cases/client.ts:84](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L84) + +___ + +### getReporters + +▸ **getReporters**(`params`: { `owner`: *undefined* \| *string* \| *string*[] }): *Promise*<{ `email`: *undefined* \| ``null`` \| *string* ; `full_name`: *undefined* \| ``null`` \| *string* ; `username`: *undefined* \| ``null`` \| *string* }[]\> + +Retrieves all the reporters across all accessible cases. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | *object* | +| `params.owner` | *undefined* \| *string* \| *string*[] | + +**Returns:** *Promise*<{ `email`: *undefined* \| ``null`` \| *string* ; `full_name`: *undefined* \| ``null`` \| *string* ; `username`: *undefined* \| ``null`` \| *string* }[]\> + +Defined in: [cases/client.ts:80](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L80) + +___ + +### getTags + +▸ **getTags**(`params`: { `owner`: *undefined* \| *string* \| *string*[] }): *Promise* + +Retrieves all the tags across all cases the user making the request has access to. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | *object* | +| `params.owner` | *undefined* \| *string* \| *string*[] | + +**Returns:** *Promise* + +Defined in: [cases/client.ts:76](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L76) + +___ + +### push + +▸ **push**(`args`: [*PushParams*](cases_push.pushparams.md)): *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Pushes a specific case to an external system. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `args` | [*PushParams*](cases_push.pushparams.md) | + +**Returns:** *Promise*<[*ICaseResponse*](typedoc_interfaces.icaseresponse.md)\> + +Defined in: [cases/client.ts:62](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L62) + +___ + +### update + +▸ **update**(`cases`: [*ICasesPatchRequest*](typedoc_interfaces.icasespatchrequest.md)): *Promise*<[*ICasesResponse*](typedoc_interfaces.icasesresponse.md)\> + +Update the specified cases with the passed in values. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `cases` | [*ICasesPatchRequest*](typedoc_interfaces.icasespatchrequest.md) | + +**Returns:** *Promise*<[*ICasesResponse*](typedoc_interfaces.icasesresponse.md)\> + +Defined in: [cases/client.ts:66](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/client.ts#L66) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/cases_get.caseidsbyalertidparams.md b/x-pack/plugins/cases/docs/cases_client/interfaces/cases_get.caseidsbyalertidparams.md new file mode 100644 index 0000000000000..d2aea5db75e54 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/cases_get.caseidsbyalertidparams.md @@ -0,0 +1,40 @@ +[Cases Client API Interface](../cases_client_api.md) / [cases/get](../modules/cases_get.md) / CaseIDsByAlertIDParams + +# Interface: CaseIDsByAlertIDParams + +[cases/get](../modules/cases_get.md).CaseIDsByAlertIDParams + +Parameters for finding cases IDs using an alert ID + +## Table of contents + +### Properties + +- [alertID](cases_get.caseidsbyalertidparams.md#alertid) +- [options](cases_get.caseidsbyalertidparams.md#options) + +## Properties + +### alertID + +• **alertID**: *string* + +The alert ID to search for + +Defined in: [cases/get.ts:47](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/get.ts#L47) + +___ + +### options + +• **options**: *object* + +The filtering options when searching for associated cases. + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `owner` | *undefined* \| *string* \| *string*[] | + +Defined in: [cases/get.ts:51](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/get.ts#L51) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/cases_get.getparams.md b/x-pack/plugins/cases/docs/cases_client/interfaces/cases_get.getparams.md new file mode 100644 index 0000000000000..78704eb8c5d4d --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/cases_get.getparams.md @@ -0,0 +1,45 @@ +[Cases Client API Interface](../cases_client_api.md) / [cases/get](../modules/cases_get.md) / GetParams + +# Interface: GetParams + +[cases/get](../modules/cases_get.md).GetParams + +The parameters for retrieving a case + +## Table of contents + +### Properties + +- [id](cases_get.getparams.md#id) +- [includeComments](cases_get.getparams.md#includecomments) +- [includeSubCaseComments](cases_get.getparams.md#includesubcasecomments) + +## Properties + +### id + +• **id**: *string* + +Case ID + +Defined in: [cases/get.ts:122](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/get.ts#L122) + +___ + +### includeComments + +• `Optional` **includeComments**: *boolean* + +Whether to include the attachments for a case in the response + +Defined in: [cases/get.ts:126](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/get.ts#L126) + +___ + +### includeSubCaseComments + +• `Optional` **includeSubCaseComments**: *boolean* + +Whether to include the attachments for all children of a case in the response + +Defined in: [cases/get.ts:130](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/get.ts#L130) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/cases_push.pushparams.md b/x-pack/plugins/cases/docs/cases_client/interfaces/cases_push.pushparams.md new file mode 100644 index 0000000000000..a6561152910d6 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/cases_push.pushparams.md @@ -0,0 +1,34 @@ +[Cases Client API Interface](../cases_client_api.md) / [cases/push](../modules/cases_push.md) / PushParams + +# Interface: PushParams + +[cases/push](../modules/cases_push.md).PushParams + +Parameters for pushing a case to an external system + +## Table of contents + +### Properties + +- [caseId](cases_push.pushparams.md#caseid) +- [connectorId](cases_push.pushparams.md#connectorid) + +## Properties + +### caseId + +• **caseId**: *string* + +The ID of a case + +Defined in: [cases/push.ts:53](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/push.ts#L53) + +___ + +### connectorId + +• **connectorId**: *string* + +The ID of an external system to push to + +Defined in: [cases/push.ts:57](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/push.ts#L57) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/configure_client.configuresubclient.md b/x-pack/plugins/cases/docs/cases_client/interfaces/configure_client.configuresubclient.md new file mode 100644 index 0000000000000..082dc808d6e17 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/configure_client.configuresubclient.md @@ -0,0 +1,84 @@ +[Cases Client API Interface](../cases_client_api.md) / [configure/client](../modules/configure_client.md) / ConfigureSubClient + +# Interface: ConfigureSubClient + +[configure/client](../modules/configure_client.md).ConfigureSubClient + +This is the public API for interacting with the connector configuration for cases. + +## Table of contents + +### Methods + +- [create](configure_client.configuresubclient.md#create) +- [get](configure_client.configuresubclient.md#get) +- [getConnectors](configure_client.configuresubclient.md#getconnectors) +- [update](configure_client.configuresubclient.md#update) + +## Methods + +### create + +▸ **create**(`configuration`: [*ICasesConfigureRequest*](typedoc_interfaces.icasesconfigurerequest.md)): *Promise*<[*ICasesConfigureResponse*](typedoc_interfaces.icasesconfigureresponse.md)\> + +Creates a configuration if one does not already exist. If one exists it is deleted and a new one is created. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `configuration` | [*ICasesConfigureRequest*](typedoc_interfaces.icasesconfigurerequest.md) | + +**Returns:** *Promise*<[*ICasesConfigureResponse*](typedoc_interfaces.icasesconfigureresponse.md)\> + +Defined in: [configure/client.ts:102](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/configure/client.ts#L102) + +___ + +### get + +▸ **get**(`params`: { `owner`: *undefined* \| *string* \| *string*[] }): *Promise*<{} \| [*ICasesConfigureResponse*](typedoc_interfaces.icasesconfigureresponse.md)\> + +Retrieves the external connector configuration for a particular case owner. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | *object* | +| `params.owner` | *undefined* \| *string* \| *string*[] | + +**Returns:** *Promise*<{} \| [*ICasesConfigureResponse*](typedoc_interfaces.icasesconfigureresponse.md)\> + +Defined in: [configure/client.ts:84](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/configure/client.ts#L84) + +___ + +### getConnectors + +▸ **getConnectors**(): *Promise* + +Retrieves the valid external connectors supported by the cases plugin. + +**Returns:** *Promise* + +Defined in: [configure/client.ts:88](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/configure/client.ts#L88) + +___ + +### update + +▸ **update**(`configurationId`: *string*, `configurations`: [*ICasesConfigurePatch*](typedoc_interfaces.icasesconfigurepatch.md)): *Promise*<[*ICasesConfigureResponse*](typedoc_interfaces.icasesconfigureresponse.md)\> + +Updates a particular configuration with new values. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `configurationId` | *string* | the ID of the configuration to update | +| `configurations` | [*ICasesConfigurePatch*](typedoc_interfaces.icasesconfigurepatch.md) | the new configuration parameters | + +**Returns:** *Promise*<[*ICasesConfigureResponse*](typedoc_interfaces.icasesconfigureresponse.md)\> + +Defined in: [configure/client.ts:95](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/configure/client.ts#L95) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/stats_client.statssubclient.md b/x-pack/plugins/cases/docs/cases_client/interfaces/stats_client.statssubclient.md new file mode 100644 index 0000000000000..9093bee1532aa --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/stats_client.statssubclient.md @@ -0,0 +1,25 @@ +[Cases Client API Interface](../cases_client_api.md) / [stats/client](../modules/stats_client.md) / StatsSubClient + +# Interface: StatsSubClient + +[stats/client](../modules/stats_client.md).StatsSubClient + +Statistics API contract. + +## Table of contents + +### Methods + +- [getStatusTotalsByType](stats_client.statssubclient.md#getstatustotalsbytype) + +## Methods + +### getStatusTotalsByType + +▸ **getStatusTotalsByType**(): *Promise*<{ `count_closed_cases`: *number* ; `count_in_progress_cases`: *number* ; `count_open_cases`: *number* }\> + +Retrieves the total number of open, closed, and in-progress cases. + +**Returns:** *Promise*<{ `count_closed_cases`: *number* ; `count_in_progress_cases`: *number* ; `count_open_cases`: *number* }\> + +Defined in: [stats/client.ts:21](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/stats/client.ts#L21) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/sub_cases_client.subcasesclient.md b/x-pack/plugins/cases/docs/cases_client/interfaces/sub_cases_client.subcasesclient.md new file mode 100644 index 0000000000000..db48224bab671 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/sub_cases_client.subcasesclient.md @@ -0,0 +1,89 @@ +[Cases Client API Interface](../cases_client_api.md) / [sub_cases/client](../modules/sub_cases_client.md) / SubCasesClient + +# Interface: SubCasesClient + +[sub_cases/client](../modules/sub_cases_client.md).SubCasesClient + +The API routes for interacting with sub cases. + +## Table of contents + +### Methods + +- [delete](sub_cases_client.subcasesclient.md#delete) +- [find](sub_cases_client.subcasesclient.md#find) +- [get](sub_cases_client.subcasesclient.md#get) +- [update](sub_cases_client.subcasesclient.md#update) + +## Methods + +### delete + +▸ **delete**(`ids`: *string*[]): *Promise* + +Deletes the specified entities and their attachments. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `ids` | *string*[] | + +**Returns:** *Promise* + +Defined in: [sub_cases/client.ts:60](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/sub_cases/client.ts#L60) + +___ + +### find + +▸ **find**(`findArgs`: FindArgs): *Promise*<[*ISubCasesFindResponse*](typedoc_interfaces.isubcasesfindresponse.md)\> + +Retrieves the sub cases matching the search criteria. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `findArgs` | FindArgs | + +**Returns:** *Promise*<[*ISubCasesFindResponse*](typedoc_interfaces.isubcasesfindresponse.md)\> + +Defined in: [sub_cases/client.ts:64](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/sub_cases/client.ts#L64) + +___ + +### get + +▸ **get**(`getArgs`: GetArgs): *Promise*<[*ISubCaseResponse*](typedoc_interfaces.isubcaseresponse.md)\> + +Retrieves a single sub case. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `getArgs` | GetArgs | + +**Returns:** *Promise*<[*ISubCaseResponse*](typedoc_interfaces.isubcaseresponse.md)\> + +Defined in: [sub_cases/client.ts:68](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/sub_cases/client.ts#L68) + +___ + +### update + +▸ **update**(`subCases`: { `subCases`: { `status`: *undefined* \| open \| *any*[*any*] \| closed } & { id: string; version: string; }[] }): *Promise*<[*ISubCasesResponse*](typedoc_interfaces.isubcasesresponse.md)\> + +Updates the specified sub cases to the new values included in the request. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `subCases` | *object* | +| `subCases.subCases` | { `status`: *undefined* \| open \| *any*[*any*] \| closed } & { id: string; version: string; }[] | + +**Returns:** *Promise*<[*ISubCasesResponse*](typedoc_interfaces.isubcasesresponse.md)\> + +Defined in: [sub_cases/client.ts:72](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/sub_cases/client.ts#L72) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.iallcommentsresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.iallcommentsresponse.md new file mode 100644 index 0000000000000..06322bb51e2ad --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.iallcommentsresponse.md @@ -0,0 +1,11 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / IAllCommentsResponse + +# Interface: IAllCommentsResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).IAllCommentsResponse + +## Hierarchy + +- *AllCommentsResponse* + + ↳ **IAllCommentsResponse** diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasepostrequest.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasepostrequest.md new file mode 100644 index 0000000000000..70533a15fe616 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasepostrequest.md @@ -0,0 +1,88 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICasePostRequest + +# Interface: ICasePostRequest + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICasePostRequest + +These are simply to make typedoc not attempt to expand the type aliases. If it attempts to expand them +the docs are huge. + +## Hierarchy + +- *CasePostRequest* + + ↳ **ICasePostRequest** + +## Table of contents + +### Properties + +- [connector](typedoc_interfaces.icasepostrequest.md#connector) +- [description](typedoc_interfaces.icasepostrequest.md#description) +- [owner](typedoc_interfaces.icasepostrequest.md#owner) +- [settings](typedoc_interfaces.icasepostrequest.md#settings) +- [tags](typedoc_interfaces.icasepostrequest.md#tags) +- [title](typedoc_interfaces.icasepostrequest.md#title) +- [type](typedoc_interfaces.icasepostrequest.md#type) + +## Properties + +### connector + +• **connector**: { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { issueType: string \| null; priority: string \| null; parent: string \| null; } ; `type`: jira } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { incidentTypes: string[] \| null; severityCode: string \| null; } ; `type`: resilient } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { impact: string \| null; severity: string \| null; urgency: string \| null; category: string \| null; subcategory: string \| null; } ; `type`: serviceNowITSM } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { category: string \| null; destIp: boolean \| null; malwareHash: boolean \| null; malwareUrl: boolean \| null; priority: string \| null; sourceIp: boolean \| null; subcategory: string \| null; } ; `type`: serviceNowSIR } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` ; `type`: none } + +Inherited from: CasePostRequest.connector + +___ + +### description + +• **description**: *string* + +Inherited from: CasePostRequest.description + +___ + +### owner + +• **owner**: *string* + +Inherited from: CasePostRequest.owner + +___ + +### settings + +• **settings**: *object* + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `syncAlerts` | *boolean* | + +Inherited from: CasePostRequest.settings + +___ + +### tags + +• **tags**: *string*[] + +Inherited from: CasePostRequest.tags + +___ + +### title + +• **title**: *string* + +Inherited from: CasePostRequest.title + +___ + +### type + +• **type**: *undefined* \| collection \| individual + +Inherited from: CasePostRequest.type diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icaseresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icaseresponse.md new file mode 100644 index 0000000000000..5db55e5552473 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icaseresponse.md @@ -0,0 +1,228 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICaseResponse + +# Interface: ICaseResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICaseResponse + +## Hierarchy + +- *CaseResponse* + + ↳ **ICaseResponse** + +## Table of contents + +### Properties + +- [closed\_at](typedoc_interfaces.icaseresponse.md#closed_at) +- [closed\_by](typedoc_interfaces.icaseresponse.md#closed_by) +- [comments](typedoc_interfaces.icaseresponse.md#comments) +- [connector](typedoc_interfaces.icaseresponse.md#connector) +- [created\_at](typedoc_interfaces.icaseresponse.md#created_at) +- [created\_by](typedoc_interfaces.icaseresponse.md#created_by) +- [description](typedoc_interfaces.icaseresponse.md#description) +- [external\_service](typedoc_interfaces.icaseresponse.md#external_service) +- [id](typedoc_interfaces.icaseresponse.md#id) +- [owner](typedoc_interfaces.icaseresponse.md#owner) +- [settings](typedoc_interfaces.icaseresponse.md#settings) +- [status](typedoc_interfaces.icaseresponse.md#status) +- [subCaseIds](typedoc_interfaces.icaseresponse.md#subcaseids) +- [subCases](typedoc_interfaces.icaseresponse.md#subcases) +- [tags](typedoc_interfaces.icaseresponse.md#tags) +- [title](typedoc_interfaces.icaseresponse.md#title) +- [totalAlerts](typedoc_interfaces.icaseresponse.md#totalalerts) +- [totalComment](typedoc_interfaces.icaseresponse.md#totalcomment) +- [type](typedoc_interfaces.icaseresponse.md#type) +- [updated\_at](typedoc_interfaces.icaseresponse.md#updated_at) +- [updated\_by](typedoc_interfaces.icaseresponse.md#updated_by) +- [version](typedoc_interfaces.icaseresponse.md#version) + +## Properties + +### closed\_at + +• **closed\_at**: ``null`` \| *string* + +Inherited from: CaseResponse.closed\_at + +___ + +### closed\_by + +• **closed\_by**: ``null`` \| { `email`: *undefined* \| ``null`` \| *string* ; `full_name`: *undefined* \| ``null`` \| *string* ; `username`: *undefined* \| ``null`` \| *string* } + +Inherited from: CaseResponse.closed\_by + +___ + +### comments + +• **comments**: *undefined* \| { `comment`: *string* ; `owner`: *string* ; `type`: user } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* }[] + +Inherited from: CaseResponse.comments + +___ + +### connector + +• **connector**: { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { issueType: string \| null; priority: string \| null; parent: string \| null; } ; `type`: jira } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { incidentTypes: string[] \| null; severityCode: string \| null; } ; `type`: resilient } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { impact: string \| null; severity: string \| null; urgency: string \| null; category: string \| null; subcategory: string \| null; } ; `type`: serviceNowITSM } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { category: string \| null; destIp: boolean \| null; malwareHash: boolean \| null; malwareUrl: boolean \| null; priority: string \| null; sourceIp: boolean \| null; subcategory: string \| null; } ; `type`: serviceNowSIR } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` ; `type`: none } + +Inherited from: CaseResponse.connector + +___ + +### created\_at + +• **created\_at**: *string* + +Inherited from: CaseResponse.created\_at + +___ + +### created\_by + +• **created\_by**: *object* + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `email` | *undefined* \| ``null`` \| *string* | +| `full_name` | *undefined* \| ``null`` \| *string* | +| `username` | *undefined* \| ``null`` \| *string* | + +Inherited from: CaseResponse.created\_by + +___ + +### description + +• **description**: *string* + +Inherited from: CaseResponse.description + +___ + +### external\_service + +• **external\_service**: ``null`` \| { `connector_id`: *string* ; `connector_name`: *string* ; `external_id`: *string* ; `external_title`: *string* ; `external_url`: *string* } & { `pushed_at`: *string* ; `pushed_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } + +Inherited from: CaseResponse.external\_service + +___ + +### id + +• **id**: *string* + +Inherited from: CaseResponse.id + +___ + +### owner + +• **owner**: *string* + +Inherited from: CaseResponse.owner + +___ + +### settings + +• **settings**: *object* + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `syncAlerts` | *boolean* | + +Inherited from: CaseResponse.settings + +___ + +### status + +• **status**: CaseStatuses + +Inherited from: CaseResponse.status + +___ + +### subCaseIds + +• **subCaseIds**: *undefined* \| *string*[] + +Inherited from: CaseResponse.subCaseIds + +___ + +### subCases + +• **subCases**: *undefined* \| { `status`: CaseStatuses } & { `closed_at`: ``null`` \| *string* ; `closed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `created_at`: *string* ; `created_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `totalAlerts`: *number* ; `totalComment`: *number* ; `version`: *string* } & { `comments`: *undefined* \| { `comment`: *string* ; `owner`: *string* ; `type`: user } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* }[] }[] + +Inherited from: CaseResponse.subCases + +___ + +### tags + +• **tags**: *string*[] + +Inherited from: CaseResponse.tags + +___ + +### title + +• **title**: *string* + +Inherited from: CaseResponse.title + +___ + +### totalAlerts + +• **totalAlerts**: *number* + +Inherited from: CaseResponse.totalAlerts + +___ + +### totalComment + +• **totalComment**: *number* + +Inherited from: CaseResponse.totalComment + +___ + +### type + +• **type**: CaseType + +Inherited from: CaseResponse.type + +___ + +### updated\_at + +• **updated\_at**: ``null`` \| *string* + +Inherited from: CaseResponse.updated\_at + +___ + +### updated\_by + +• **updated\_by**: ``null`` \| { `email`: *undefined* \| ``null`` \| *string* ; `full_name`: *undefined* \| ``null`` \| *string* ; `username`: *undefined* \| ``null`` \| *string* } + +Inherited from: CaseResponse.updated\_by + +___ + +### version + +• **version**: *string* + +Inherited from: CaseResponse.version diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigurepatch.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigurepatch.md new file mode 100644 index 0000000000000..3854fda03fb6a --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigurepatch.md @@ -0,0 +1,43 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICasesConfigurePatch + +# Interface: ICasesConfigurePatch + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICasesConfigurePatch + +## Hierarchy + +- *CasesConfigurePatch* + + ↳ **ICasesConfigurePatch** + +## Table of contents + +### Properties + +- [closure\_type](typedoc_interfaces.icasesconfigurepatch.md#closure_type) +- [connector](typedoc_interfaces.icasesconfigurepatch.md#connector) +- [version](typedoc_interfaces.icasesconfigurepatch.md#version) + +## Properties + +### closure\_type + +• **closure\_type**: *undefined* \| ``"close-by-user"`` \| ``"close-by-pushing"`` + +Inherited from: CasesConfigurePatch.closure\_type + +___ + +### connector + +• **connector**: *undefined* \| { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { issueType: string \| null; priority: string \| null; parent: string \| null; } ; `type`: jira } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { incidentTypes: string[] \| null; severityCode: string \| null; } ; `type`: resilient } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { impact: string \| null; severity: string \| null; urgency: string \| null; category: string \| null; subcategory: string \| null; } ; `type`: serviceNowITSM } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { category: string \| null; destIp: boolean \| null; malwareHash: boolean \| null; malwareUrl: boolean \| null; priority: string \| null; sourceIp: boolean \| null; subcategory: string \| null; } ; `type`: serviceNowSIR } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` ; `type`: none } + +Inherited from: CasesConfigurePatch.connector + +___ + +### version + +• **version**: *string* + +Inherited from: CasesConfigurePatch.version diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigurerequest.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigurerequest.md new file mode 100644 index 0000000000000..548e1a5c48f58 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigurerequest.md @@ -0,0 +1,43 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICasesConfigureRequest + +# Interface: ICasesConfigureRequest + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICasesConfigureRequest + +## Hierarchy + +- *CasesConfigureRequest* + + ↳ **ICasesConfigureRequest** + +## Table of contents + +### Properties + +- [closure\_type](typedoc_interfaces.icasesconfigurerequest.md#closure_type) +- [connector](typedoc_interfaces.icasesconfigurerequest.md#connector) +- [owner](typedoc_interfaces.icasesconfigurerequest.md#owner) + +## Properties + +### closure\_type + +• **closure\_type**: ``"close-by-user"`` \| ``"close-by-pushing"`` + +Inherited from: CasesConfigureRequest.closure\_type + +___ + +### connector + +• **connector**: { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { issueType: string \| null; priority: string \| null; parent: string \| null; } ; `type`: jira } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { incidentTypes: string[] \| null; severityCode: string \| null; } ; `type`: resilient } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { impact: string \| null; severity: string \| null; urgency: string \| null; category: string \| null; subcategory: string \| null; } ; `type`: serviceNowITSM } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { category: string \| null; destIp: boolean \| null; malwareHash: boolean \| null; malwareUrl: boolean \| null; priority: string \| null; sourceIp: boolean \| null; subcategory: string \| null; } ; `type`: serviceNowSIR } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` ; `type`: none } + +Inherited from: CasesConfigureRequest.connector + +___ + +### owner + +• **owner**: *string* + +Inherited from: CasesConfigureRequest.owner diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigureresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigureresponse.md new file mode 100644 index 0000000000000..c493a4c6c0f0c --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesconfigureresponse.md @@ -0,0 +1,123 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICasesConfigureResponse + +# Interface: ICasesConfigureResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICasesConfigureResponse + +## Hierarchy + +- *CasesConfigureResponse* + + ↳ **ICasesConfigureResponse** + +## Table of contents + +### Properties + +- [closure\_type](typedoc_interfaces.icasesconfigureresponse.md#closure_type) +- [connector](typedoc_interfaces.icasesconfigureresponse.md#connector) +- [created\_at](typedoc_interfaces.icasesconfigureresponse.md#created_at) +- [created\_by](typedoc_interfaces.icasesconfigureresponse.md#created_by) +- [error](typedoc_interfaces.icasesconfigureresponse.md#error) +- [id](typedoc_interfaces.icasesconfigureresponse.md#id) +- [mappings](typedoc_interfaces.icasesconfigureresponse.md#mappings) +- [owner](typedoc_interfaces.icasesconfigureresponse.md#owner) +- [updated\_at](typedoc_interfaces.icasesconfigureresponse.md#updated_at) +- [updated\_by](typedoc_interfaces.icasesconfigureresponse.md#updated_by) +- [version](typedoc_interfaces.icasesconfigureresponse.md#version) + +## Properties + +### closure\_type + +• **closure\_type**: ``"close-by-user"`` \| ``"close-by-pushing"`` + +Inherited from: CasesConfigureResponse.closure\_type + +___ + +### connector + +• **connector**: { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { issueType: string \| null; priority: string \| null; parent: string \| null; } ; `type`: jira } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { incidentTypes: string[] \| null; severityCode: string \| null; } ; `type`: resilient } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { impact: string \| null; severity: string \| null; urgency: string \| null; category: string \| null; subcategory: string \| null; } ; `type`: serviceNowITSM } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { category: string \| null; destIp: boolean \| null; malwareHash: boolean \| null; malwareUrl: boolean \| null; priority: string \| null; sourceIp: boolean \| null; subcategory: string \| null; } ; `type`: serviceNowSIR } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` ; `type`: none } + +Inherited from: CasesConfigureResponse.connector + +___ + +### created\_at + +• **created\_at**: *string* + +Inherited from: CasesConfigureResponse.created\_at + +___ + +### created\_by + +• **created\_by**: *object* + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `email` | *undefined* \| ``null`` \| *string* | +| `full_name` | *undefined* \| ``null`` \| *string* | +| `username` | *undefined* \| ``null`` \| *string* | + +Inherited from: CasesConfigureResponse.created\_by + +___ + +### error + +• **error**: ``null`` \| *string* + +Inherited from: CasesConfigureResponse.error + +___ + +### id + +• **id**: *string* + +Inherited from: CasesConfigureResponse.id + +___ + +### mappings + +• **mappings**: { `action_type`: ``"append"`` \| ``"nothing"`` \| ``"overwrite"`` ; `source`: ``"description"`` \| ``"title"`` \| ``"comments"`` ; `target`: *string* }[] + +Inherited from: CasesConfigureResponse.mappings + +___ + +### owner + +• **owner**: *string* + +Inherited from: CasesConfigureResponse.owner + +___ + +### updated\_at + +• **updated\_at**: ``null`` \| *string* + +Inherited from: CasesConfigureResponse.updated\_at + +___ + +### updated\_by + +• **updated\_by**: ``null`` \| { `email`: *undefined* \| ``null`` \| *string* ; `full_name`: *undefined* \| ``null`` \| *string* ; `username`: *undefined* \| ``null`` \| *string* } + +Inherited from: CasesConfigureResponse.updated\_by + +___ + +### version + +• **version**: *string* + +Inherited from: CasesConfigureResponse.version diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesfindrequest.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesfindrequest.md new file mode 100644 index 0000000000000..cb8ec7797677f --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesfindrequest.md @@ -0,0 +1,133 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICasesFindRequest + +# Interface: ICasesFindRequest + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICasesFindRequest + +## Hierarchy + +- *CasesFindRequest* + + ↳ **ICasesFindRequest** + +## Table of contents + +### Properties + +- [defaultSearchOperator](typedoc_interfaces.icasesfindrequest.md#defaultsearchoperator) +- [fields](typedoc_interfaces.icasesfindrequest.md#fields) +- [owner](typedoc_interfaces.icasesfindrequest.md#owner) +- [page](typedoc_interfaces.icasesfindrequest.md#page) +- [perPage](typedoc_interfaces.icasesfindrequest.md#perpage) +- [reporters](typedoc_interfaces.icasesfindrequest.md#reporters) +- [search](typedoc_interfaces.icasesfindrequest.md#search) +- [searchFields](typedoc_interfaces.icasesfindrequest.md#searchfields) +- [sortField](typedoc_interfaces.icasesfindrequest.md#sortfield) +- [sortOrder](typedoc_interfaces.icasesfindrequest.md#sortorder) +- [status](typedoc_interfaces.icasesfindrequest.md#status) +- [tags](typedoc_interfaces.icasesfindrequest.md#tags) +- [type](typedoc_interfaces.icasesfindrequest.md#type) + +## Properties + +### defaultSearchOperator + +• **defaultSearchOperator**: *undefined* \| ``"AND"`` \| ``"OR"`` + +Inherited from: CasesFindRequest.defaultSearchOperator + +___ + +### fields + +• **fields**: *undefined* \| *string*[] + +Inherited from: CasesFindRequest.fields + +___ + +### owner + +• **owner**: *undefined* \| *string* \| *string*[] + +Inherited from: CasesFindRequest.owner + +___ + +### page + +• **page**: *undefined* \| *number* + +Inherited from: CasesFindRequest.page + +___ + +### perPage + +• **perPage**: *undefined* \| *number* + +Inherited from: CasesFindRequest.perPage + +___ + +### reporters + +• **reporters**: *undefined* \| *string* \| *string*[] + +Inherited from: CasesFindRequest.reporters + +___ + +### search + +• **search**: *undefined* \| *string* + +Inherited from: CasesFindRequest.search + +___ + +### searchFields + +• **searchFields**: *undefined* \| *string* \| *string*[] + +Inherited from: CasesFindRequest.searchFields + +___ + +### sortField + +• **sortField**: *undefined* \| *string* + +Inherited from: CasesFindRequest.sortField + +___ + +### sortOrder + +• **sortOrder**: *undefined* \| ``"desc"`` \| ``"asc"`` + +Inherited from: CasesFindRequest.sortOrder + +___ + +### status + +• **status**: *undefined* \| open \| *any*[*any*] \| closed + +Inherited from: CasesFindRequest.status + +___ + +### tags + +• **tags**: *undefined* \| *string* \| *string*[] + +Inherited from: CasesFindRequest.tags + +___ + +### type + +• **type**: *undefined* \| collection \| individual + +Inherited from: CasesFindRequest.type diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesfindresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesfindresponse.md new file mode 100644 index 0000000000000..9be5fd5743a8e --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesfindresponse.md @@ -0,0 +1,79 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICasesFindResponse + +# Interface: ICasesFindResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICasesFindResponse + +## Hierarchy + +- *CasesFindResponse* + + ↳ **ICasesFindResponse** + +## Table of contents + +### Properties + +- [cases](typedoc_interfaces.icasesfindresponse.md#cases) +- [count\_closed\_cases](typedoc_interfaces.icasesfindresponse.md#count_closed_cases) +- [count\_in\_progress\_cases](typedoc_interfaces.icasesfindresponse.md#count_in_progress_cases) +- [count\_open\_cases](typedoc_interfaces.icasesfindresponse.md#count_open_cases) +- [page](typedoc_interfaces.icasesfindresponse.md#page) +- [per\_page](typedoc_interfaces.icasesfindresponse.md#per_page) +- [total](typedoc_interfaces.icasesfindresponse.md#total) + +## Properties + +### cases + +• **cases**: { `connector`: { id: string; name: string; } & { type: ConnectorTypes.jira; fields: { issueType: string \| null; priority: string \| null; parent: string \| null; } \| null; } & { id: string; name: string; } & { type: ConnectorTypes.resilient; fields: { incidentTypes: string[] \| null; severityCode: string \| null; } \| null; } & { id: string; name: string; } & { type: ConnectorTypes.serviceNowITSM; fields: { impact: string \| null; severity: string \| null; urgency: string \| null; category: string \| null; subcategory: string \| null; } \| null; } & { id: string; name: string; } & { type: ConnectorTypes.serviceNowSIR; fields: { category: string \| null; destIp: boolean \| null; malwareHash: boolean \| null; malwareUrl: boolean \| null; priority: string \| null; sourceIp: boolean \| null; subcategory: string \| null; } \| null; } & { id: string; name: string; } & { type: ConnectorTypes.none; fields: null; } ; `description`: *string* ; `owner`: *string* ; `settings`: { syncAlerts: boolean; } ; `status`: CaseStatuses ; `tags`: *string*[] ; `title`: *string* ; `type`: CaseType } & { `closed_at`: ``null`` \| *string* ; `closed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `external_service`: ``null`` \| { connector\_id: string; connector\_name: string; external\_id: string; external\_title: string; external\_url: string; } & { pushed\_at: string; pushed\_by: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; }; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `totalAlerts`: *number* ; `totalComment`: *number* ; `version`: *string* } & { `comments`: *undefined* \| { `comment`: *string* ; `owner`: *string* ; `type`: user } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* }[] ; `subCaseIds`: *undefined* \| *string*[] ; `subCases`: *undefined* \| { `status`: CaseStatuses } & { `closed_at`: ``null`` \| *string* ; `closed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `created_at`: *string* ; `created_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `totalAlerts`: *number* ; `totalComment`: *number* ; `version`: *string* } & { comments?: ((({ comment: string; type: CommentType.user; owner: string; } & { associationType: AssociationType; created\_at: string; created\_by: { email: string \| null \| undefined; full\_name: string \| ... 1 more ... \| undefined; username: string \| ... 1 more ... \| undefined; }; ... 4 more ...; updated\_by: { ...; } ...[] }[] + +Inherited from: CasesFindResponse.cases + +___ + +### count\_closed\_cases + +• **count\_closed\_cases**: *number* + +Inherited from: CasesFindResponse.count\_closed\_cases + +___ + +### count\_in\_progress\_cases + +• **count\_in\_progress\_cases**: *number* + +Inherited from: CasesFindResponse.count\_in\_progress\_cases + +___ + +### count\_open\_cases + +• **count\_open\_cases**: *number* + +Inherited from: CasesFindResponse.count\_open\_cases + +___ + +### page + +• **page**: *number* + +Inherited from: CasesFindResponse.page + +___ + +### per\_page + +• **per\_page**: *number* + +Inherited from: CasesFindResponse.per\_page + +___ + +### total + +• **total**: *number* + +Inherited from: CasesFindResponse.total diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasespatchrequest.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasespatchrequest.md new file mode 100644 index 0000000000000..bfdb3b7315e55 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasespatchrequest.md @@ -0,0 +1,25 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICasesPatchRequest + +# Interface: ICasesPatchRequest + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICasesPatchRequest + +## Hierarchy + +- *CasesPatchRequest* + + ↳ **ICasesPatchRequest** + +## Table of contents + +### Properties + +- [cases](typedoc_interfaces.icasespatchrequest.md#cases) + +## Properties + +### cases + +• **cases**: { `connector`: *undefined* \| { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { issueType: string \| null; priority: string \| null; parent: string \| null; } ; `type`: jira } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { incidentTypes: string[] \| null; severityCode: string \| null; } ; `type`: resilient } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { impact: string \| null; severity: string \| null; urgency: string \| null; category: string \| null; subcategory: string \| null; } ; `type`: serviceNowITSM } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` \| { category: string \| null; destIp: boolean \| null; malwareHash: boolean \| null; malwareUrl: boolean \| null; priority: string \| null; sourceIp: boolean \| null; subcategory: string \| null; } ; `type`: serviceNowSIR } & { `id`: *string* ; `name`: *string* } & { `fields`: ``null`` ; `type`: none } ; `description`: *undefined* \| *string* ; `owner`: *undefined* \| *string* ; `settings`: *undefined* \| { `syncAlerts`: *boolean* } ; `status`: *undefined* \| open \| *any*[*any*] \| closed ; `tags`: *undefined* \| *string*[] ; `title`: *undefined* \| *string* ; `type`: *undefined* \| collection \| individual } & { `id`: *string* ; `version`: *string* }[] + +Inherited from: CasesPatchRequest.cases diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesresponse.md new file mode 100644 index 0000000000000..2c9eed242d1fb --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icasesresponse.md @@ -0,0 +1,11 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICasesResponse + +# Interface: ICasesResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICasesResponse + +## Hierarchy + +- *CasesResponse* + + ↳ **ICasesResponse** diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icaseuseractionsresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icaseuseractionsresponse.md new file mode 100644 index 0000000000000..0347711e331dc --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icaseuseractionsresponse.md @@ -0,0 +1,11 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICaseUserActionsResponse + +# Interface: ICaseUserActionsResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICaseUserActionsResponse + +## Hierarchy + +- *CaseUserActionsResponse* + + ↳ **ICaseUserActionsResponse** diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icommentsresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icommentsresponse.md new file mode 100644 index 0000000000000..d34480b2c633c --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.icommentsresponse.md @@ -0,0 +1,52 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ICommentsResponse + +# Interface: ICommentsResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ICommentsResponse + +## Hierarchy + +- *CommentsResponse* + + ↳ **ICommentsResponse** + +## Table of contents + +### Properties + +- [comments](typedoc_interfaces.icommentsresponse.md#comments) +- [page](typedoc_interfaces.icommentsresponse.md#page) +- [per\_page](typedoc_interfaces.icommentsresponse.md#per_page) +- [total](typedoc_interfaces.icommentsresponse.md#total) + +## Properties + +### comments + +• **comments**: { `comment`: *string* ; `owner`: *string* ; `type`: user } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* }[] + +Inherited from: CommentsResponse.comments + +___ + +### page + +• **page**: *number* + +Inherited from: CommentsResponse.page + +___ + +### per\_page + +• **per\_page**: *number* + +Inherited from: CommentsResponse.per\_page + +___ + +### total + +• **total**: *number* + +Inherited from: CommentsResponse.total diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcaseresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcaseresponse.md new file mode 100644 index 0000000000000..b33b280d2e753 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcaseresponse.md @@ -0,0 +1,133 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ISubCaseResponse + +# Interface: ISubCaseResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ISubCaseResponse + +## Hierarchy + +- *SubCaseResponse* + + ↳ **ISubCaseResponse** + +## Table of contents + +### Properties + +- [closed\_at](typedoc_interfaces.isubcaseresponse.md#closed_at) +- [closed\_by](typedoc_interfaces.isubcaseresponse.md#closed_by) +- [comments](typedoc_interfaces.isubcaseresponse.md#comments) +- [created\_at](typedoc_interfaces.isubcaseresponse.md#created_at) +- [created\_by](typedoc_interfaces.isubcaseresponse.md#created_by) +- [id](typedoc_interfaces.isubcaseresponse.md#id) +- [owner](typedoc_interfaces.isubcaseresponse.md#owner) +- [status](typedoc_interfaces.isubcaseresponse.md#status) +- [totalAlerts](typedoc_interfaces.isubcaseresponse.md#totalalerts) +- [totalComment](typedoc_interfaces.isubcaseresponse.md#totalcomment) +- [updated\_at](typedoc_interfaces.isubcaseresponse.md#updated_at) +- [updated\_by](typedoc_interfaces.isubcaseresponse.md#updated_by) +- [version](typedoc_interfaces.isubcaseresponse.md#version) + +## Properties + +### closed\_at + +• **closed\_at**: ``null`` \| *string* + +Inherited from: SubCaseResponse.closed\_at + +___ + +### closed\_by + +• **closed\_by**: ``null`` \| { `email`: *undefined* \| ``null`` \| *string* ; `full_name`: *undefined* \| ``null`` \| *string* ; `username`: *undefined* \| ``null`` \| *string* } + +Inherited from: SubCaseResponse.closed\_by + +___ + +### comments + +• **comments**: *undefined* \| { `comment`: *string* ; `owner`: *string* ; `type`: user } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* }[] + +Inherited from: SubCaseResponse.comments + +___ + +### created\_at + +• **created\_at**: *string* + +Inherited from: SubCaseResponse.created\_at + +___ + +### created\_by + +• **created\_by**: ``null`` \| { `email`: *undefined* \| ``null`` \| *string* ; `full_name`: *undefined* \| ``null`` \| *string* ; `username`: *undefined* \| ``null`` \| *string* } + +Inherited from: SubCaseResponse.created\_by + +___ + +### id + +• **id**: *string* + +Inherited from: SubCaseResponse.id + +___ + +### owner + +• **owner**: *string* + +Inherited from: SubCaseResponse.owner + +___ + +### status + +• **status**: CaseStatuses + +Inherited from: SubCaseResponse.status + +___ + +### totalAlerts + +• **totalAlerts**: *number* + +Inherited from: SubCaseResponse.totalAlerts + +___ + +### totalComment + +• **totalComment**: *number* + +Inherited from: SubCaseResponse.totalComment + +___ + +### updated\_at + +• **updated\_at**: ``null`` \| *string* + +Inherited from: SubCaseResponse.updated\_at + +___ + +### updated\_by + +• **updated\_by**: ``null`` \| { `email`: *undefined* \| ``null`` \| *string* ; `full_name`: *undefined* \| ``null`` \| *string* ; `username`: *undefined* \| ``null`` \| *string* } + +Inherited from: SubCaseResponse.updated\_by + +___ + +### version + +• **version**: *string* + +Inherited from: SubCaseResponse.version diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcasesfindresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcasesfindresponse.md new file mode 100644 index 0000000000000..35d63126f608a --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcasesfindresponse.md @@ -0,0 +1,79 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ISubCasesFindResponse + +# Interface: ISubCasesFindResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ISubCasesFindResponse + +## Hierarchy + +- *SubCasesFindResponse* + + ↳ **ISubCasesFindResponse** + +## Table of contents + +### Properties + +- [count\_closed\_cases](typedoc_interfaces.isubcasesfindresponse.md#count_closed_cases) +- [count\_in\_progress\_cases](typedoc_interfaces.isubcasesfindresponse.md#count_in_progress_cases) +- [count\_open\_cases](typedoc_interfaces.isubcasesfindresponse.md#count_open_cases) +- [page](typedoc_interfaces.isubcasesfindresponse.md#page) +- [per\_page](typedoc_interfaces.isubcasesfindresponse.md#per_page) +- [subCases](typedoc_interfaces.isubcasesfindresponse.md#subcases) +- [total](typedoc_interfaces.isubcasesfindresponse.md#total) + +## Properties + +### count\_closed\_cases + +• **count\_closed\_cases**: *number* + +Inherited from: SubCasesFindResponse.count\_closed\_cases + +___ + +### count\_in\_progress\_cases + +• **count\_in\_progress\_cases**: *number* + +Inherited from: SubCasesFindResponse.count\_in\_progress\_cases + +___ + +### count\_open\_cases + +• **count\_open\_cases**: *number* + +Inherited from: SubCasesFindResponse.count\_open\_cases + +___ + +### page + +• **page**: *number* + +Inherited from: SubCasesFindResponse.page + +___ + +### per\_page + +• **per\_page**: *number* + +Inherited from: SubCasesFindResponse.per\_page + +___ + +### subCases + +• **subCases**: { `status`: CaseStatuses } & { `closed_at`: ``null`` \| *string* ; `closed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `created_at`: *string* ; `created_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `totalAlerts`: *number* ; `totalComment`: *number* ; `version`: *string* } & { `comments`: *undefined* \| { `comment`: *string* ; `owner`: *string* ; `type`: user } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* } & { `alertId`: *string* \| *string*[] ; `index`: *string* \| *string*[] ; `owner`: *string* ; `rule`: { id: string \| null; name: string \| null; } ; `type`: alert \| generatedAlert } & { `associationType`: AssociationType ; `created_at`: *string* ; `created_by`: { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `owner`: *string* ; `pushed_at`: ``null`` \| *string* ; `pushed_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } ; `updated_at`: ``null`` \| *string* ; `updated_by`: ``null`` \| { email: string \| null \| undefined; full\_name: string \| null \| undefined; username: string \| null \| undefined; } } & { `id`: *string* ; `version`: *string* }[] }[] + +Inherited from: SubCasesFindResponse.subCases + +___ + +### total + +• **total**: *number* + +Inherited from: SubCasesFindResponse.total diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcasesresponse.md b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcasesresponse.md new file mode 100644 index 0000000000000..6ee45e59b53b5 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/typedoc_interfaces.isubcasesresponse.md @@ -0,0 +1,11 @@ +[Cases Client API Interface](../cases_client_api.md) / [typedoc_interfaces](../modules/typedoc_interfaces.md) / ISubCasesResponse + +# Interface: ISubCasesResponse + +[typedoc_interfaces](../modules/typedoc_interfaces.md).ISubCasesResponse + +## Hierarchy + +- *SubCasesResponse* + + ↳ **ISubCasesResponse** diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/user_actions_client.useractionget.md b/x-pack/plugins/cases/docs/cases_client/interfaces/user_actions_client.useractionget.md new file mode 100644 index 0000000000000..e492747c7baad --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/user_actions_client.useractionget.md @@ -0,0 +1,34 @@ +[Cases Client API Interface](../cases_client_api.md) / [user_actions/client](../modules/user_actions_client.md) / UserActionGet + +# Interface: UserActionGet + +[user_actions/client](../modules/user_actions_client.md).UserActionGet + +Parameters for retrieving user actions for a particular case + +## Table of contents + +### Properties + +- [caseId](user_actions_client.useractionget.md#caseid) +- [subCaseId](user_actions_client.useractionget.md#subcaseid) + +## Properties + +### caseId + +• **caseId**: *string* + +The ID of the case + +Defined in: [user_actions/client.ts:19](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/user_actions/client.ts#L19) + +___ + +### subCaseId + +• `Optional` **subCaseId**: *string* + +If specified then a sub case will be used for finding all the user actions + +Defined in: [user_actions/client.ts:23](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/user_actions/client.ts#L23) diff --git a/x-pack/plugins/cases/docs/cases_client/interfaces/user_actions_client.useractionssubclient.md b/x-pack/plugins/cases/docs/cases_client/interfaces/user_actions_client.useractionssubclient.md new file mode 100644 index 0000000000000..70dc3958b5de6 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/interfaces/user_actions_client.useractionssubclient.md @@ -0,0 +1,31 @@ +[Cases Client API Interface](../cases_client_api.md) / [user_actions/client](../modules/user_actions_client.md) / UserActionsSubClient + +# Interface: UserActionsSubClient + +[user_actions/client](../modules/user_actions_client.md).UserActionsSubClient + +API for interacting the actions performed by a user when interacting with the cases entities. + +## Table of contents + +### Methods + +- [getAll](user_actions_client.useractionssubclient.md#getall) + +## Methods + +### getAll + +▸ **getAll**(`clientArgs`: [*UserActionGet*](user_actions_client.useractionget.md)): *Promise*<[*ICaseUserActionsResponse*](typedoc_interfaces.icaseuseractionsresponse.md)\> + +Retrieves all user actions for a particular case. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `clientArgs` | [*UserActionGet*](user_actions_client.useractionget.md) | + +**Returns:** *Promise*<[*ICaseUserActionsResponse*](typedoc_interfaces.icaseuseractionsresponse.md)\> + +Defined in: [user_actions/client.ts:33](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/user_actions/client.ts#L33) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/attachments_add.md b/x-pack/plugins/cases/docs/cases_client/modules/attachments_add.md new file mode 100644 index 0000000000000..d9ac6e6ce431b --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/attachments_add.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / attachments/add + +# Module: attachments/add + +## Table of contents + +### Interfaces + +- [AddArgs](../interfaces/attachments_add.addargs.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/attachments_client.md b/x-pack/plugins/cases/docs/cases_client/modules/attachments_client.md new file mode 100644 index 0000000000000..47d96b98356e7 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/attachments_client.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / attachments/client + +# Module: attachments/client + +## Table of contents + +### Interfaces + +- [AttachmentsSubClient](../interfaces/attachments_client.attachmentssubclient.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/attachments_delete.md b/x-pack/plugins/cases/docs/cases_client/modules/attachments_delete.md new file mode 100644 index 0000000000000..0e2cf420b6375 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/attachments_delete.md @@ -0,0 +1,10 @@ +[Cases Client API Interface](../cases_client_api.md) / attachments/delete + +# Module: attachments/delete + +## Table of contents + +### Interfaces + +- [DeleteAllArgs](../interfaces/attachments_delete.deleteallargs.md) +- [DeleteArgs](../interfaces/attachments_delete.deleteargs.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/attachments_get.md b/x-pack/plugins/cases/docs/cases_client/modules/attachments_get.md new file mode 100644 index 0000000000000..99358d6683256 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/attachments_get.md @@ -0,0 +1,11 @@ +[Cases Client API Interface](../cases_client_api.md) / attachments/get + +# Module: attachments/get + +## Table of contents + +### Interfaces + +- [FindArgs](../interfaces/attachments_get.findargs.md) +- [GetAllArgs](../interfaces/attachments_get.getallargs.md) +- [GetArgs](../interfaces/attachments_get.getargs.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/attachments_update.md b/x-pack/plugins/cases/docs/cases_client/modules/attachments_update.md new file mode 100644 index 0000000000000..011fe531ede34 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/attachments_update.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / attachments/update + +# Module: attachments/update + +## Table of contents + +### Interfaces + +- [UpdateArgs](../interfaces/attachments_update.updateargs.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/cases_client.md b/x-pack/plugins/cases/docs/cases_client/modules/cases_client.md new file mode 100644 index 0000000000000..c6e9cf17d9840 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/cases_client.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / cases/client + +# Module: cases/client + +## Table of contents + +### Interfaces + +- [CasesSubClient](../interfaces/cases_client.casessubclient.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/cases_get.md b/x-pack/plugins/cases/docs/cases_client/modules/cases_get.md new file mode 100644 index 0000000000000..69cd5b856bbd7 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/cases_get.md @@ -0,0 +1,53 @@ +[Cases Client API Interface](../cases_client_api.md) / cases/get + +# Module: cases/get + +## Table of contents + +### Interfaces + +- [CaseIDsByAlertIDParams](../interfaces/cases_get.caseidsbyalertidparams.md) +- [GetParams](../interfaces/cases_get.getparams.md) + +### Functions + +- [getReporters](cases_get.md#getreporters) +- [getTags](cases_get.md#gettags) + +## Functions + +### getReporters + +▸ **getReporters**(`params`: AllReportersFindRequest, `clientArgs`: CasesClientArgs): *Promise* + +Retrieves the reporters from all the cases. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | AllReportersFindRequest | +| `clientArgs` | CasesClientArgs | + +**Returns:** *Promise* + +Defined in: [cases/get.ts:279](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/get.ts#L279) + +___ + +### getTags + +▸ **getTags**(`params`: AllTagsFindRequest, `clientArgs`: CasesClientArgs): *Promise* + +Retrieves the tags from all the cases. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `params` | AllTagsFindRequest | +| `clientArgs` | CasesClientArgs | + +**Returns:** *Promise* + +Defined in: [cases/get.ts:217](https://github.com/jonathan-buttner/kibana/blob/085f89ff3ca/x-pack/plugins/cases/server/client/cases/get.ts#L217) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/cases_push.md b/x-pack/plugins/cases/docs/cases_client/modules/cases_push.md new file mode 100644 index 0000000000000..4be9df64bb420 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/cases_push.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / cases/push + +# Module: cases/push + +## Table of contents + +### Interfaces + +- [PushParams](../interfaces/cases_push.pushparams.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/client.md b/x-pack/plugins/cases/docs/cases_client/modules/client.md new file mode 100644 index 0000000000000..7fb6b64253dd9 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/client.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / client + +# Module: client + +## Table of contents + +### Classes + +- [CasesClient](../classes/client.casesclient.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/configure_client.md b/x-pack/plugins/cases/docs/cases_client/modules/configure_client.md new file mode 100644 index 0000000000000..7cfc43e3d0a88 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/configure_client.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / configure/client + +# Module: configure/client + +## Table of contents + +### Interfaces + +- [ConfigureSubClient](../interfaces/configure_client.configuresubclient.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/stats_client.md b/x-pack/plugins/cases/docs/cases_client/modules/stats_client.md new file mode 100644 index 0000000000000..992a1a1ab501a --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/stats_client.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / stats/client + +# Module: stats/client + +## Table of contents + +### Interfaces + +- [StatsSubClient](../interfaces/stats_client.statssubclient.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/sub_cases_client.md b/x-pack/plugins/cases/docs/cases_client/modules/sub_cases_client.md new file mode 100644 index 0000000000000..6bdf073566b1c --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/sub_cases_client.md @@ -0,0 +1,9 @@ +[Cases Client API Interface](../cases_client_api.md) / sub_cases/client + +# Module: sub\_cases/client + +## Table of contents + +### Interfaces + +- [SubCasesClient](../interfaces/sub_cases_client.subcasesclient.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/typedoc_interfaces.md b/x-pack/plugins/cases/docs/cases_client/modules/typedoc_interfaces.md new file mode 100644 index 0000000000000..4719d2a2719c0 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/typedoc_interfaces.md @@ -0,0 +1,26 @@ +[Cases Client API Interface](../cases_client_api.md) / typedoc_interfaces + +# Module: typedoc\_interfaces + +This file defines simpler types for typedoc. This helps reduce the type alias expansion for the io-ts types because it +can be very large. These types are equivalent to the io-ts aliases. + +## Table of contents + +### Interfaces + +- [IAllCommentsResponse](../interfaces/typedoc_interfaces.iallcommentsresponse.md) +- [ICasePostRequest](../interfaces/typedoc_interfaces.icasepostrequest.md) +- [ICaseResponse](../interfaces/typedoc_interfaces.icaseresponse.md) +- [ICaseUserActionsResponse](../interfaces/typedoc_interfaces.icaseuseractionsresponse.md) +- [ICasesConfigurePatch](../interfaces/typedoc_interfaces.icasesconfigurepatch.md) +- [ICasesConfigureRequest](../interfaces/typedoc_interfaces.icasesconfigurerequest.md) +- [ICasesConfigureResponse](../interfaces/typedoc_interfaces.icasesconfigureresponse.md) +- [ICasesFindRequest](../interfaces/typedoc_interfaces.icasesfindrequest.md) +- [ICasesFindResponse](../interfaces/typedoc_interfaces.icasesfindresponse.md) +- [ICasesPatchRequest](../interfaces/typedoc_interfaces.icasespatchrequest.md) +- [ICasesResponse](../interfaces/typedoc_interfaces.icasesresponse.md) +- [ICommentsResponse](../interfaces/typedoc_interfaces.icommentsresponse.md) +- [ISubCaseResponse](../interfaces/typedoc_interfaces.isubcaseresponse.md) +- [ISubCasesFindResponse](../interfaces/typedoc_interfaces.isubcasesfindresponse.md) +- [ISubCasesResponse](../interfaces/typedoc_interfaces.isubcasesresponse.md) diff --git a/x-pack/plugins/cases/docs/cases_client/modules/user_actions_client.md b/x-pack/plugins/cases/docs/cases_client/modules/user_actions_client.md new file mode 100644 index 0000000000000..b48e3faac2135 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client/modules/user_actions_client.md @@ -0,0 +1,10 @@ +[Cases Client API Interface](../cases_client_api.md) / user_actions/client + +# Module: user\_actions/client + +## Table of contents + +### Interfaces + +- [UserActionGet](../interfaces/user_actions_client.useractionget.md) +- [UserActionsSubClient](../interfaces/user_actions_client.useractionssubclient.md) diff --git a/x-pack/plugins/cases/docs/cases_client_typedoc.json b/x-pack/plugins/cases/docs/cases_client_typedoc.json new file mode 100644 index 0000000000000..5f67719b47574 --- /dev/null +++ b/x-pack/plugins/cases/docs/cases_client_typedoc.json @@ -0,0 +1,25 @@ +{ + "entryPoints": [ + "../server/client/client.ts", + "../server/client/typedoc_interfaces.ts", + "../server/client/attachments", + "../server/client/cases/client.ts", + "../server/client/cases/get.ts", + "../server/client/cases/push.ts", + "../server/client/configure/client.ts", + "../server/client/stats/client.ts", + "../server/client/sub_cases/client.ts", + "../server/client/user_actions/client.ts" + ], + "exclude": [ + "**/mock.ts", + "../server/client/cases/+(mock.ts|utils.ts|utils.test.ts|types.ts)" + ], + "excludeExternals": true, + "out": "cases_client", + "theme": "markdown", + "plugin": "typedoc-plugin-markdown", + "entryDocument": "cases_client_api.md", + "readme": "none", + "name": "Cases Client API Interface" +} diff --git a/x-pack/plugins/cases/server/client/attachments/add.ts b/x-pack/plugins/cases/server/client/attachments/add.ts index bce2d4e31908b..8a16141bd2feb 100644 --- a/x-pack/plugins/cases/server/client/attachments/add.ts +++ b/x-pack/plugins/cases/server/client/attachments/add.ts @@ -302,10 +302,21 @@ async function getCombinedCase({ * The arguments needed for creating a new attachment to a case. */ export interface AddArgs { + /** + * The case ID that this attachment will be associated with + */ caseId: string; + /** + * The attachment values. + */ comment: CommentRequest; } +/** + * Create an attachment to a case. + * + * @ignore + */ export const addComment = async ( addArgs: AddArgs, clientArgs: CasesClientArgs, diff --git a/x-pack/plugins/cases/server/client/attachments/client.ts b/x-pack/plugins/cases/server/client/attachments/client.ts index 41f1db81719fc..1f6945a9d0584 100644 --- a/x-pack/plugins/cases/server/client/attachments/client.ts +++ b/x-pack/plugins/cases/server/client/attachments/client.ts @@ -5,30 +5,57 @@ * 2.0. */ -import { - AllCommentsResponse, - CaseResponse, - CommentResponse, - CommentsResponse, -} from '../../../common/api'; +import { CommentResponse } from '../../../common/api'; import { CasesClientInternal } from '../client_internal'; +import { IAllCommentsResponse, ICaseResponse, ICommentsResponse } from '../typedoc_interfaces'; import { CasesClientArgs } from '../types'; import { AddArgs, addComment } from './add'; import { DeleteAllArgs, deleteAll, DeleteArgs, deleteComment } from './delete'; import { find, FindArgs, get, getAll, GetAllArgs, GetArgs } from './get'; import { update, UpdateArgs } from './update'; +/** + * API for interacting with the attachments to a case. + */ export interface AttachmentsSubClient { - add(params: AddArgs): Promise; + /** + * Adds an attachment to a case. + */ + add(params: AddArgs): Promise; + /** + * Deletes all attachments associated with a single case. + */ deleteAll(deleteAllArgs: DeleteAllArgs): Promise; + /** + * Deletes a single attachment for a specific case. + */ delete(deleteArgs: DeleteArgs): Promise; - find(findArgs: FindArgs): Promise; - getAll(getAllArgs: GetAllArgs): Promise; + /** + * Retrieves all comments matching the search criteria. + */ + find(findArgs: FindArgs): Promise; + /** + * Gets all attachments for a single case. + */ + getAll(getAllArgs: GetAllArgs): Promise; + /** + * Retrieves a single attachment for a case. + */ get(getArgs: GetArgs): Promise; - update(updateArgs: UpdateArgs): Promise; + /** + * Updates a specific attachment. + * + * The request must include all fields for the attachment. Even the fields that are not changing. + */ + update(updateArgs: UpdateArgs): Promise; } +/** + * Creates an API object for interacting with attachments. + * + * @ignore + */ export const createAttachmentsSubClient = ( clientArgs: CasesClientArgs, casesClientInternal: CasesClientInternal diff --git a/x-pack/plugins/cases/server/client/attachments/delete.ts b/x-pack/plugins/cases/server/client/attachments/delete.ts index 83df367d951ee..28e56c21fd255 100644 --- a/x-pack/plugins/cases/server/client/attachments/delete.ts +++ b/x-pack/plugins/cases/server/client/attachments/delete.ts @@ -20,21 +20,38 @@ import { Operations } from '../../authorization'; * Parameters for deleting all comments of a case or sub case. */ export interface DeleteAllArgs { + /** + * The case ID to delete all attachments for + */ caseID: string; + /** + * If specified the caseID will be ignored and this value will be used to find a sub case for deleting all the attachments + */ subCaseID?: string; } /** - * Parameters for deleting a single comment of a case or sub case. + * Parameters for deleting a single attachment of a case or sub case. */ export interface DeleteArgs { + /** + * The case ID to delete an attachment from + */ caseID: string; + /** + * The attachment ID to delete + */ attachmentID: string; + /** + * If specified the caseID will be ignored and this value will be used to find a sub case for deleting the attachment + */ subCaseID?: string; } /** * Delete all comments for a case or sub case. + * + * @ignore */ export async function deleteAll( { caseID, subCaseID }: DeleteAllArgs, @@ -108,6 +125,11 @@ export async function deleteAll( } } +/** + * Deletes an attachment + * + * @ignore + */ export async function deleteComment( { caseID, attachmentID, subCaseID }: DeleteArgs, clientArgs: CasesClientArgs diff --git a/x-pack/plugins/cases/server/client/attachments/get.ts b/x-pack/plugins/cases/server/client/attachments/get.ts index f6f5bcfb4f046..d65d25d080226 100644 --- a/x-pack/plugins/cases/server/client/attachments/get.ts +++ b/x-pack/plugins/cases/server/client/attachments/get.ts @@ -38,24 +38,53 @@ import { import { Operations } from '../../authorization'; import { includeFieldsRequiredForAuthentication } from '../../authorization/utils'; +/** + * Parameters for finding attachments of a case + */ export interface FindArgs { + /** + * The case ID for finding associated attachments + */ caseID: string; + /** + * Optional parameters for filtering the returned attachments + */ queryParams?: FindQueryParams; } +/** + * Parameters for retrieving all attachments of a case + */ export interface GetAllArgs { + /** + * The case ID to retrieve all attachments for + */ caseID: string; + /** + * Optionally include the attachments associated with a sub case + */ includeSubCaseComments?: boolean; + /** + * If included the case ID will be ignored and the attachments will be retrieved from the specified ID of the sub case + */ subCaseID?: string; } export interface GetArgs { + /** + * The ID of the case to retrieve an attachment from + */ caseID: string; + /** + * The ID of the attachment to retrieve + */ attachmentID: string; } /** * Retrieves the attachments for a case entity. This support pagination. + * + * @ignore */ export async function find( { caseID, queryParams }: FindArgs, @@ -146,6 +175,8 @@ export async function find( /** * Retrieves a single attachment by its ID. + * + * @ignore */ export async function get( { attachmentID, caseID }: GetArgs, @@ -186,6 +217,8 @@ export async function get( /** * Retrieves all the attachments for a case. The `includeSubCaseComments` can be used to include the sub case comments for * collections. If the entity is a sub case, pass in the subCaseID. + * + * @ignore */ export async function getAll( { caseID, includeSubCaseComments, subCaseID }: GetAllArgs, diff --git a/x-pack/plugins/cases/server/client/attachments/update.ts b/x-pack/plugins/cases/server/client/attachments/update.ts index 26c44509abce8..713fd931dcb90 100644 --- a/x-pack/plugins/cases/server/client/attachments/update.ts +++ b/x-pack/plugins/cases/server/client/attachments/update.ts @@ -19,9 +19,21 @@ import { decodeCommentRequest, ensureAuthorized } from '../utils'; import { createCaseError } from '../../common/error'; import { Operations } from '../../authorization'; +/** + * Parameters for updating a single attachment + */ export interface UpdateArgs { + /** + * The ID of the case that is associated with this attachment + */ caseID: string; + /** + * The full attachment request with the fields updated with appropriate values + */ updateRequest: CommentPatchRequest; + /** + * The ID of a sub case, if specified a sub case will be searched for to perform the attachment update instead of on a case + */ subCaseID?: string; } @@ -78,6 +90,8 @@ async function getCommentableCase({ /** * Update an attachment. + * + * @ignore */ export async function update( { caseID, subCaseID, updateRequest: queryParams }: UpdateArgs, diff --git a/x-pack/plugins/cases/server/client/cases/client.ts b/x-pack/plugins/cases/server/client/cases/client.ts index 06a90a3b2cd95..20670f331443b 100644 --- a/x-pack/plugins/cases/server/client/cases/client.ts +++ b/x-pack/plugins/cases/server/client/cases/client.ts @@ -5,57 +5,89 @@ * 2.0. */ -import { ActionsClient } from '../../../../actions/server'; import { CasePostRequest, - CaseResponse, CasesPatchRequest, - CasesResponse, CasesFindRequest, - CasesFindResponse, User, AllTagsFindRequest, AllReportersFindRequest, } from '../../../common/api'; import { CasesClient } from '../client'; import { CasesClientInternal } from '../client_internal'; +import { + ICasePostRequest, + ICaseResponse, + ICasesFindRequest, + ICasesFindResponse, + ICasesPatchRequest, + ICasesResponse, +} from '../typedoc_interfaces'; import { CasesClientArgs } from '../types'; import { create } from './create'; import { deleteCases } from './delete'; import { find } from './find'; -import { CaseIDsByAlertIDParams, get, getCaseIDsByAlertID, getReporters, getTags } from './get'; -import { push } from './push'; +import { + CaseIDsByAlertIDParams, + get, + getCaseIDsByAlertID, + GetParams, + getReporters, + getTags, +} from './get'; +import { push, PushParams } from './push'; import { update } from './update'; -interface CaseGet { - id: string; - includeComments?: boolean; - includeSubCaseComments?: boolean; -} - -interface CasePush { - actionsClient: ActionsClient; - caseId: string; - connectorId: string; -} - /** - * The public API for interacting with cases. + * API for interacting with the cases entities. */ export interface CasesSubClient { - create(data: CasePostRequest): Promise; - find(params: CasesFindRequest): Promise; - get(params: CaseGet): Promise; - push(args: CasePush): Promise; - update(cases: CasesPatchRequest): Promise; + /** + * Creates a case. + */ + create(data: ICasePostRequest): Promise; + /** + * Returns cases that match the search criteria. + * + * If the `owner` field is left empty then all the cases that the user has access to will be returned. + */ + find(params: ICasesFindRequest): Promise; + /** + * Retrieves a single case with the specified ID. + */ + get(params: GetParams): Promise; + /** + * Pushes a specific case to an external system. + */ + push(args: PushParams): Promise; + /** + * Update the specified cases with the passed in values. + */ + update(cases: ICasesPatchRequest): Promise; + /** + * Delete a case and all its comments. + * + * @params ids an array of case IDs to delete + */ delete(ids: string[]): Promise; + /** + * Retrieves all the tags across all cases the user making the request has access to. + */ getTags(params: AllTagsFindRequest): Promise; + /** + * Retrieves all the reporters across all accessible cases. + */ getReporters(params: AllReportersFindRequest): Promise; + /** + * Retrieves the case IDs given a single alert ID + */ getCaseIDsByAlertID(params: CaseIDsByAlertIDParams): Promise; } /** * Creates the interface for CRUD on cases objects. + * + * @ignore */ export const createCasesSubClient = ( clientArgs: CasesClientArgs, @@ -65,8 +97,8 @@ export const createCasesSubClient = ( const casesSubClient: CasesSubClient = { create: (data: CasePostRequest) => create(data, clientArgs), find: (params: CasesFindRequest) => find(params, clientArgs), - get: (params: CaseGet) => get(params, clientArgs), - push: (params: CasePush) => push(params, clientArgs, casesClient, casesClientInternal), + get: (params: GetParams) => get(params, clientArgs), + push: (params: PushParams) => push(params, clientArgs, casesClient, casesClientInternal), update: (cases: CasesPatchRequest) => update(cases, clientArgs, casesClientInternal), delete: (ids: string[]) => deleteCases(ids, clientArgs), getTags: (params: AllTagsFindRequest) => getTags(params, clientArgs), diff --git a/x-pack/plugins/cases/server/client/cases/create.ts b/x-pack/plugins/cases/server/client/cases/create.ts index 334b1a2ee4648..1d3e8d432410d 100644 --- a/x-pack/plugins/cases/server/client/cases/create.ts +++ b/x-pack/plugins/cases/server/client/cases/create.ts @@ -37,6 +37,8 @@ import { CasesClientArgs } from '..'; /** * Creates a new case. + * + * @ignore */ export const create = async ( data: CasePostRequest, diff --git a/x-pack/plugins/cases/server/client/cases/delete.ts b/x-pack/plugins/cases/server/client/cases/delete.ts index 256a8be2ccbe0..de6d317d7c2d8 100644 --- a/x-pack/plugins/cases/server/client/cases/delete.ts +++ b/x-pack/plugins/cases/server/client/cases/delete.ts @@ -50,6 +50,11 @@ async function deleteSubCases({ ); } +/** + * Deletes the specified cases and their attachments. + * + * @ignore + */ export async function deleteCases(ids: string[], clientArgs: CasesClientArgs): Promise { const { savedObjectsClient: soClient, diff --git a/x-pack/plugins/cases/server/client/cases/find.ts b/x-pack/plugins/cases/server/client/cases/find.ts index 0899cd3d0150f..a7e36461965a9 100644 --- a/x-pack/plugins/cases/server/client/cases/find.ts +++ b/x-pack/plugins/cases/server/client/cases/find.ts @@ -29,6 +29,8 @@ import { CasesClientArgs } from '..'; /** * Retrieves a case and optionally its comments and sub case comments. + * + * @ignore */ export const find = async ( params: CasesFindRequest, diff --git a/x-pack/plugins/cases/server/client/cases/get.ts b/x-pack/plugins/cases/server/client/cases/get.ts index 92e4ea798eaa2..1434d54f6a2b7 100644 --- a/x-pack/plugins/cases/server/client/cases/get.ts +++ b/x-pack/plugins/cases/server/client/cases/get.ts @@ -37,14 +37,25 @@ import { } from '../utils'; import { CaseService } from '../../services'; +/** + * Parameters for finding cases IDs using an alert ID + */ export interface CaseIDsByAlertIDParams { + /** + * The alert ID to search for + */ alertID: string; + /** + * The filtering options when searching for associated cases. + */ options: CasesByAlertIDRequest; } /** * Case Client wrapper function for retrieving the case IDs that have a particular alert ID * attached to them. This handles RBAC before calling the saved object API. + * + * @ignore */ export const getCaseIDsByAlertID = async ( { alertID, options }: CaseIDsByAlertIDParams, @@ -101,14 +112,28 @@ export const getCaseIDsByAlertID = async ( } }; -interface GetParams { +/** + * The parameters for retrieving a case + */ +export interface GetParams { + /** + * Case ID + */ id: string; + /** + * Whether to include the attachments for a case in the response + */ includeComments?: boolean; + /** + * Whether to include the attachments for all children of a case in the response + */ includeSubCaseComments?: boolean; } /** * Retrieves a case and optionally its comments and sub case comments. + * + * @ignore */ export const get = async ( { id, includeComments, includeSubCaseComments }: GetParams, diff --git a/x-pack/plugins/cases/server/client/cases/push.ts b/x-pack/plugins/cases/server/client/cases/push.ts index 846b07885c817..c85fcd05f7e4d 100644 --- a/x-pack/plugins/cases/server/client/cases/push.ts +++ b/x-pack/plugins/cases/server/client/cases/push.ts @@ -43,11 +43,25 @@ function shouldCloseByPush( ); } -interface PushParams { +/** + * Parameters for pushing a case to an external system + */ +export interface PushParams { + /** + * The ID of a case + */ caseId: string; + /** + * The ID of an external system to push to + */ connectorId: string; } +/** + * Push a case to an external service. + * + * @ignore + */ export const push = async ( { connectorId, caseId }: PushParams, clientArgs: CasesClientArgs, diff --git a/x-pack/plugins/cases/server/client/cases/update.ts b/x-pack/plugins/cases/server/client/cases/update.ts index de3c499db5098..b11c8574c5d62 100644 --- a/x-pack/plugins/cases/server/client/cases/update.ts +++ b/x-pack/plugins/cases/server/client/cases/update.ts @@ -383,6 +383,11 @@ function partitionPatchRequest( }; } +/** + * Updates the specified cases with new values + * + * @ignore + */ export const update = async ( cases: CasesPatchRequest, clientArgs: CasesClientArgs, diff --git a/x-pack/plugins/cases/server/client/client.ts b/x-pack/plugins/cases/server/client/client.ts index 9d0da7018518f..4b21b401f5b7b 100644 --- a/x-pack/plugins/cases/server/client/client.ts +++ b/x-pack/plugins/cases/server/client/client.ts @@ -15,6 +15,9 @@ import { ENABLE_CASE_CONNECTOR } from '../../common/constants'; import { ConfigureSubClient, createConfigurationSubClient } from './configure/client'; import { createStatsSubClient, StatsSubClient } from './stats/client'; +/** + * Client wrapper that contains accessor methods for individual entities within the cases system. + */ export class CasesClient { private readonly _casesClientInternal: CasesClientInternal; private readonly _cases: CasesSubClient; @@ -34,18 +37,32 @@ export class CasesClient { this._stats = createStatsSubClient(args); } + /** + * Retrieves an interface for interacting with cases entities. + */ public get cases() { return this._cases; } + /** + * Retrieves an interface for interacting with attachments (comments) entities. + */ public get attachments() { return this._attachments; } + /** + * Retrieves an interface for interacting with the user actions associated with the plugin entities. + */ public get userActions() { return this._userActions; } + /** + * Retrieves an interface for interacting with the case as a connector entities. + * + * Currently this functionality is disabled and will throw an error if this function is called. + */ public get subCases() { if (!ENABLE_CASE_CONNECTOR) { throw new Error('The case connector feature is disabled'); @@ -53,15 +70,29 @@ export class CasesClient { return this._subCases; } + /** + * Retrieves an interface for interacting with the configuration of external connectors for the plugin entities. + */ public get configure() { return this._configure; } + /** + * Retrieves an interface for retrieving statistics related to the cases entities. + */ public get stats() { return this._stats; } } +/** + * Creates a {@link CasesClient} for interacting with the cases entities + * + * @param args arguments for initializing the cases client + * @returns a {@link CasesClient} + * + * @ignore + */ export const createCasesClient = (args: CasesClientArgs): CasesClient => { return new CasesClient(args); }; diff --git a/x-pack/plugins/cases/server/client/configure/client.ts b/x-pack/plugins/cases/server/client/configure/client.ts index 1e44e615626b7..7145491b8f2bf 100644 --- a/x-pack/plugins/cases/server/client/configure/client.ts +++ b/x-pack/plugins/cases/server/client/configure/client.ts @@ -54,9 +54,16 @@ import { } from './types'; import { createMappings } from './create_mappings'; import { updateMappings } from './update_mappings'; +import { + ICasesConfigurePatch, + ICasesConfigureRequest, + ICasesConfigureResponse, +} from '../typedoc_interfaces'; /** * Defines the internal helper functions. + * + * @ignore */ export interface InternalConfigureSubClient { getFields(params: ConfigurationGetFields): Promise; @@ -71,18 +78,35 @@ export interface InternalConfigureSubClient { * This is the public API for interacting with the connector configuration for cases. */ export interface ConfigureSubClient { - get(params: GetConfigureFindRequest): Promise; + /** + * Retrieves the external connector configuration for a particular case owner. + */ + get(params: GetConfigureFindRequest): Promise; + /** + * Retrieves the valid external connectors supported by the cases plugin. + */ getConnectors(): Promise; + /** + * Updates a particular configuration with new values. + * + * @param configurationId the ID of the configuration to update + * @param configurations the new configuration parameters + */ update( configurationId: string, - configurations: CasesConfigurePatch - ): Promise; - create(configuration: CasesConfigureRequest): Promise; + configurations: ICasesConfigurePatch + ): Promise; + /** + * Creates a configuration if one does not already exist. If one exists it is deleted and a new one is created. + */ + create(configuration: ICasesConfigureRequest): Promise; } /** * These functions should not be exposed on the plugin contract. They are for internal use to support the CRUD of * configurations. + * + * @ignore */ export const createInternalConfigurationSubClient = ( clientArgs: CasesClientArgs, @@ -100,6 +124,11 @@ export const createInternalConfigurationSubClient = ( return Object.freeze(configureSubClient); }; +/** + * Creates an API object for interacting with the configuration entities + * + * @ignore + */ export const createConfigurationSubClient = ( clientArgs: CasesClientArgs, casesInternalClient: CasesClientInternal diff --git a/x-pack/plugins/cases/server/client/factory.ts b/x-pack/plugins/cases/server/client/factory.ts index 1202fe8c2a421..86e979fc32647 100644 --- a/x-pack/plugins/cases/server/client/factory.ts +++ b/x-pack/plugins/cases/server/client/factory.ts @@ -16,12 +16,12 @@ import { SAVED_OBJECT_TYPES } from '../../common/constants'; import { Authorization } from '../authorization/authorization'; import { GetSpaceFn } from '../authorization/types'; import { - AlertServiceContract, CaseConfigureService, CaseService, CaseUserActionService, ConnectorMappingsService, AttachmentService, + AlertService, } from '../services'; import { PluginStartContract as FeaturesPluginStart } from '../../../features/server'; import { PluginStartContract as ActionsPluginStart } from '../../../actions/server'; @@ -29,12 +29,6 @@ import { AuthorizationAuditLogger } from '../authorization'; import { CasesClient, createCasesClient } from '.'; interface CasesClientFactoryArgs { - caseConfigureService: CaseConfigureService; - caseService: CaseService; - connectorMappingsService: ConnectorMappingsService; - userActionService: CaseUserActionService; - alertsService: AlertServiceContract; - attachmentService: AttachmentService; securityPluginSetup?: SecurityPluginSetup; securityPluginStart?: SecurityPluginStart; getSpace: GetSpaceFn; @@ -71,22 +65,14 @@ export class CasesClientFactory { scopedClusterClient, savedObjectsService, }: { - // TODO: make these required when the case connector can get a request and savedObjectsService - request?: KibanaRequest; - savedObjectsService?: SavedObjectsServiceStart; + request: KibanaRequest; + savedObjectsService: SavedObjectsServiceStart; scopedClusterClient: ElasticsearchClient; }): Promise { if (!this.isInitialized || !this.options) { throw new Error('CasesClientFactory must be initialized before calling create'); } - // TODO: remove this - if (!request || !savedObjectsService) { - throw new Error( - 'CasesClientFactory must be initialized with a request and saved object service' - ); - } - const auditLogger = this.options.securityPluginSetup?.audit.asScoped(request); const auth = await Authorization.create({ @@ -97,21 +83,22 @@ export class CasesClientFactory { auditLogger: new AuthorizationAuditLogger(auditLogger), }); - const userInfo = this.options.caseService.getUser({ request }); + const caseService = new CaseService(this.logger, this.options?.securityPluginStart?.authc); + const userInfo = caseService.getUser({ request }); return createCasesClient({ - alertsService: this.options.alertsService, + alertsService: new AlertService(), scopedClusterClient, savedObjectsClient: savedObjectsService.getScopedClient(request, { includedHiddenTypes: SAVED_OBJECT_TYPES, }), // We only want these fields from the userInfo object user: { username: userInfo.username, email: userInfo.email, full_name: userInfo.full_name }, - caseService: this.options.caseService, - caseConfigureService: this.options.caseConfigureService, - connectorMappingsService: this.options.connectorMappingsService, - userActionService: this.options.userActionService, - attachmentService: this.options.attachmentService, + caseService, + caseConfigureService: new CaseConfigureService(this.logger), + connectorMappingsService: new ConnectorMappingsService(this.logger), + userActionService: new CaseUserActionService(this.logger), + attachmentService: new AttachmentService(this.logger), logger: this.logger, authorization: auth, auditLogger, diff --git a/x-pack/plugins/cases/server/client/stats/client.ts b/x-pack/plugins/cases/server/client/stats/client.ts index 8c18c35e8f4fd..eb9f885a735aa 100644 --- a/x-pack/plugins/cases/server/client/stats/client.ts +++ b/x-pack/plugins/cases/server/client/stats/client.ts @@ -15,11 +15,16 @@ import { constructQueryOptions, getAuthorizationFilter } from '../utils'; * Statistics API contract. */ export interface StatsSubClient { + /** + * Retrieves the total number of open, closed, and in-progress cases. + */ getStatusTotalsByType(): Promise; } /** * Creates the interface for retrieving the number of open, closed, and in progress cases. + * + * @ignore */ export function createStatsSubClient(clientArgs: CasesClientArgs): StatsSubClient { return Object.freeze({ diff --git a/x-pack/plugins/cases/server/client/sub_cases/client.ts b/x-pack/plugins/cases/server/client/sub_cases/client.ts index 102cbee14a206..3830c84248502 100644 --- a/x-pack/plugins/cases/server/client/sub_cases/client.ts +++ b/x-pack/plugins/cases/server/client/sub_cases/client.ts @@ -15,7 +15,6 @@ import { SubCasesFindResponse, SubCasesFindResponseRt, SubCasesPatchRequest, - SubCasesResponse, } from '../../../common/api'; import { CasesClientArgs, CasesClientInternal } from '..'; import { countAlertsForID, flattenSubCaseSavedObject, transformSubCases } from '../../common'; @@ -25,29 +24,58 @@ import { buildCaseUserActionItem } from '../../services/user_actions/helpers'; import { constructQueryOptions } from '../utils'; import { defaultPage, defaultPerPage } from '../../routes/api'; import { update } from './update'; +import { ISubCaseResponse, ISubCasesFindResponse, ISubCasesResponse } from '../typedoc_interfaces'; interface FindArgs { + /** + * The case ID for finding associated sub cases + */ caseID: string; + /** + * Options for filtering the returned sub cases + */ queryParams: SubCasesFindRequest; } interface GetArgs { + /** + * A flag to include the attachments with the results + */ includeComments: boolean; + /** + * The ID of the sub case to retrieve + */ id: string; } /** * The API routes for interacting with sub cases. + * + * @public */ export interface SubCasesClient { + /** + * Deletes the specified entities and their attachments. + */ delete(ids: string[]): Promise; - find(findArgs: FindArgs): Promise; - get(getArgs: GetArgs): Promise; - update(subCases: SubCasesPatchRequest): Promise; + /** + * Retrieves the sub cases matching the search criteria. + */ + find(findArgs: FindArgs): Promise; + /** + * Retrieves a single sub case. + */ + get(getArgs: GetArgs): Promise; + /** + * Updates the specified sub cases to the new values included in the request. + */ + update(subCases: SubCasesPatchRequest): Promise; } /** * Creates a client for handling the different exposed API routes for interacting with sub cases. + * + * @ignore */ export function createSubCasesClient( clientArgs: CasesClientArgs, diff --git a/x-pack/plugins/cases/server/client/typedoc_interfaces.ts b/x-pack/plugins/cases/server/client/typedoc_interfaces.ts new file mode 100644 index 0000000000000..bf444ee9420ed --- /dev/null +++ b/x-pack/plugins/cases/server/client/typedoc_interfaces.ts @@ -0,0 +1,57 @@ +/* + * 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. + */ + +/** + * This file defines simpler types for typedoc. This helps reduce the type alias expansion for the io-ts types because it + * can be very large. These types are equivalent to the io-ts aliases. + * @module + */ + +/* eslint-disable @typescript-eslint/no-empty-interface */ + +import { + AllCommentsResponse, + CasePostRequest, + CaseResponse, + CasesConfigurePatch, + CasesConfigureRequest, + CasesConfigureResponse, + CasesFindRequest, + CasesFindResponse, + CasesPatchRequest, + CasesResponse, + CaseUserActionsResponse, + CommentsResponse, + SubCaseResponse, + SubCasesFindResponse, + SubCasesResponse, +} from '../../common'; + +/** + * These are simply to make typedoc not attempt to expand the type aliases. If it attempts to expand them + * the docs are huge. + */ + +export interface ICasePostRequest extends CasePostRequest {} +export interface ICasesFindRequest extends CasesFindRequest {} +export interface ICasesPatchRequest extends CasesPatchRequest {} +export interface ICaseResponse extends CaseResponse {} +export interface ICasesResponse extends CasesResponse {} +export interface ICasesFindResponse extends CasesFindResponse {} + +export interface ICasesConfigureResponse extends CasesConfigureResponse {} +export interface ICasesConfigureRequest extends CasesConfigureRequest {} +export interface ICasesConfigurePatch extends CasesConfigurePatch {} + +export interface ICommentsResponse extends CommentsResponse {} +export interface IAllCommentsResponse extends AllCommentsResponse {} + +export interface ISubCasesFindResponse extends SubCasesFindResponse {} +export interface ISubCaseResponse extends SubCaseResponse {} +export interface ISubCasesResponse extends SubCasesResponse {} + +export interface ICaseUserActionsResponse extends CaseUserActionsResponse {} diff --git a/x-pack/plugins/cases/server/client/types.ts b/x-pack/plugins/cases/server/client/types.ts index 5147cea0b59f0..340327cecabd9 100644 --- a/x-pack/plugins/cases/server/client/types.ts +++ b/x-pack/plugins/cases/server/client/types.ts @@ -20,6 +20,9 @@ import { } from '../services'; import { ActionsClient } from '../../../actions/server'; +/** + * Parameters for initializing a cases client + */ export interface CasesClientArgs { readonly scopedClusterClient: ElasticsearchClient; readonly caseConfigureService: CaseConfigureService; diff --git a/x-pack/plugins/cases/server/client/user_actions/client.ts b/x-pack/plugins/cases/server/client/user_actions/client.ts index 909c533785302..1e2fe8d4f4fca 100644 --- a/x-pack/plugins/cases/server/client/user_actions/client.ts +++ b/x-pack/plugins/cases/server/client/user_actions/client.ts @@ -5,19 +5,39 @@ * 2.0. */ -import { CaseUserActionsResponse } from '../../../common/api'; +import { ICaseUserActionsResponse } from '../typedoc_interfaces'; import { CasesClientArgs } from '../types'; import { get } from './get'; +/** + * Parameters for retrieving user actions for a particular case + */ export interface UserActionGet { + /** + * The ID of the case + */ caseId: string; + /** + * If specified then a sub case will be used for finding all the user actions + */ subCaseId?: string; } +/** + * API for interacting the actions performed by a user when interacting with the cases entities. + */ export interface UserActionsSubClient { - getAll(clientArgs: UserActionGet): Promise; + /** + * Retrieves all user actions for a particular case. + */ + getAll(clientArgs: UserActionGet): Promise; } +/** + * Creates an API object for interacting with the user action entities + * + * @ignore + */ export const createUserActionsSubClient = (clientArgs: CasesClientArgs): UserActionsSubClient => { const attachmentSubClient: UserActionsSubClient = { getAll: (params: UserActionGet) => get(params, clientArgs), diff --git a/x-pack/plugins/cases/server/client/user_actions/get.ts b/x-pack/plugins/cases/server/client/user_actions/get.ts index 0b03fb75614a8..30e2e3095c8a4 100644 --- a/x-pack/plugins/cases/server/client/user_actions/get.ts +++ b/x-pack/plugins/cases/server/client/user_actions/get.ts @@ -16,14 +16,10 @@ import { checkEnabledCaseConnectorOrThrow } from '../../common'; import { CasesClientArgs } from '..'; import { ensureAuthorized } from '../utils'; import { Operations } from '../../authorization'; - -interface GetParams { - caseId: string; - subCaseId?: string; -} +import { UserActionGet } from './client'; export const get = async ( - { caseId, subCaseId }: GetParams, + { caseId, subCaseId }: UserActionGet, clientArgs: CasesClientArgs ): Promise => { const { savedObjectsClient, userActionService, logger, authorization, auditLogger } = clientArgs; diff --git a/x-pack/plugins/cases/server/connectors/case/index.test.ts b/x-pack/plugins/cases/server/connectors/case/index.test.ts index a2afc1df4ecf7..0727fbbe76776 100644 --- a/x-pack/plugins/cases/server/connectors/case/index.test.ts +++ b/x-pack/plugins/cases/server/connectors/case/index.test.ts @@ -903,7 +903,7 @@ describe('case connector', () => { } }); - // TODO: enable these when the actions framework provides a request and a saved objects service + // Enable these when the actions framework provides a request and a saved objects service // ENABLE_CASE_CONNECTOR: enable these tests after the case connector feature is completed describe.skip('execute', () => { it('allows only supported sub-actions', async () => { diff --git a/x-pack/plugins/cases/server/connectors/case/index.ts b/x-pack/plugins/cases/server/connectors/case/index.ts index f647c67d286d9..4a706d8fcb52c 100644 --- a/x-pack/plugins/cases/server/connectors/case/index.ts +++ b/x-pack/plugins/cases/server/connectors/case/index.ts @@ -26,6 +26,7 @@ import * as i18n from './translations'; import { GetActionTypeParams, isCommentGeneratedAlert, separator } from '..'; import { createCaseError } from '../../common/error'; import { ENABLE_CASE_CONNECTOR } from '../../../common/constants'; +import { CasesClient } from '../../client'; const supportedSubActions: string[] = ['create', 'update', 'addComment']; @@ -57,16 +58,11 @@ async function executor( throw new Error(msg); } - const { actionId, params, services } = execOptions; + const { actionId, params } = execOptions; const { subAction, subActionParams } = params; let data: CaseExecutorResponse | null = null; - const { scopedClusterClient } = services; - const casesClient = await factory.create({ - request: undefined, - savedObjectsService: undefined, - scopedClusterClient, - }); + let casesClient: CasesClient | undefined; if (!supportedSubActions.includes(subAction)) { const errorMessage = `[Action][Case] subAction ${subAction} not implemented.`; @@ -74,54 +70,57 @@ async function executor( throw new Error(errorMessage); } - if (subAction === 'create') { - try { - data = await casesClient.cases.create({ - ...(subActionParams as CasePostRequest), - }); - } catch (error) { - throw createCaseError({ - message: `Failed to create a case using connector: ${error}`, - error, - logger, - }); + // When the actions framework provides the request and a way to retrieve the saved objects client with access to our + // hidden types then remove this outer if block and initialize the casesClient using the factory. + if (casesClient) { + if (subAction === 'create') { + try { + data = await casesClient.cases.create({ + ...(subActionParams as CasePostRequest), + }); + } catch (error) { + throw createCaseError({ + message: `Failed to create a case using connector: ${error}`, + error, + logger, + }); + } } - } - if (subAction === 'update') { - const updateParamsWithoutNullValues = Object.entries(subActionParams).reduce( - (acc, [key, value]) => ({ - ...acc, - ...(value != null ? { [key]: value } : {}), - }), - {} as CasePatchRequest - ); + if (subAction === 'update') { + const updateParamsWithoutNullValues = Object.entries(subActionParams).reduce( + (acc, [key, value]) => ({ + ...acc, + ...(value != null ? { [key]: value } : {}), + }), + {} as CasePatchRequest + ); - try { - data = await casesClient.cases.update({ cases: [updateParamsWithoutNullValues] }); - } catch (error) { - throw createCaseError({ - message: `Failed to update case using connector id: ${updateParamsWithoutNullValues?.id} version: ${updateParamsWithoutNullValues?.version}: ${error}`, - error, - logger, - }); + try { + data = await casesClient.cases.update({ cases: [updateParamsWithoutNullValues] }); + } catch (error) { + throw createCaseError({ + message: `Failed to update case using connector id: ${updateParamsWithoutNullValues?.id} version: ${updateParamsWithoutNullValues?.version}: ${error}`, + error, + logger, + }); + } } - } - if (subAction === 'addComment') { - const { caseId, comment } = subActionParams as ExecutorSubActionAddCommentParams; - try { - const formattedComment = transformConnectorComment(comment, logger); - data = await casesClient.attachments.add({ caseId, comment: formattedComment }); - } catch (error) { - throw createCaseError({ - message: `Failed to create comment using connector case id: ${caseId}: ${error}`, - error, - logger, - }); + if (subAction === 'addComment') { + const { caseId, comment } = subActionParams as ExecutorSubActionAddCommentParams; + try { + const formattedComment = transformConnectorComment(comment, logger); + data = await casesClient.attachments.add({ caseId, comment: formattedComment }); + } catch (error) { + throw createCaseError({ + message: `Failed to create comment using connector case id: ${caseId}: ${error}`, + error, + logger, + }); + } } } - return { status: 'ok', data: data ?? {}, actionId }; } diff --git a/x-pack/plugins/cases/server/index.ts b/x-pack/plugins/cases/server/index.ts index 628a39ba77489..fffaf08d2cc43 100644 --- a/x-pack/plugins/cases/server/index.ts +++ b/x-pack/plugins/cases/server/index.ts @@ -18,3 +18,5 @@ export const config: PluginConfigDescriptor = { }; export const plugin = (initializerContext: PluginInitializerContext) => new CasePlugin(initializerContext); + +export { PluginsStartContract } from './plugin'; diff --git a/x-pack/plugins/cases/server/plugin.ts b/x-pack/plugins/cases/server/plugin.ts index ad601e132535b..c9560bb82ded8 100644 --- a/x-pack/plugins/cases/server/plugin.ts +++ b/x-pack/plugins/cases/server/plugin.ts @@ -25,20 +25,13 @@ import { caseUserActionSavedObjectType, subCaseSavedObjectType, } from './saved_object_types'; -import { - CaseConfigureService, - CaseService, - CaseUserActionService, - ConnectorMappingsService, - AlertService, -} from './services'; + import { CasesClient } from './client'; import { registerConnectors } from './connectors'; import type { CasesRequestHandlerContext } from './types'; import { CasesClientFactory } from './client/factory'; import { SpacesPluginStart } from '../../spaces/server'; import { PluginStartContract as FeaturesPluginStart } from '../../features/server'; -import { AttachmentService } from './services/attachments'; function createConfig(context: PluginInitializerContext) { return context.config.get(); @@ -56,14 +49,21 @@ export interface PluginsStart { actions: ActionsPluginStart; } +/** + * Cases server exposed contract for interacting with cases entities. + */ +export interface PluginsStartContract { + /** + * Returns a client which can be used to interact with the cases backend entities. + * + * @param request a KibanaRequest + * @returns a {@link CasesClient} + */ + getCasesClientWithRequest(request: KibanaRequest): Promise; +} + export class CasePlugin { private readonly log: Logger; - private caseConfigureService?: CaseConfigureService; - private caseService?: CaseService; - private connectorMappingsService?: ConnectorMappingsService; - private userActionService?: CaseUserActionService; - private alertsService?: AlertService; - private attachmentService?: AttachmentService; private clientFactory: CasesClientFactory; private securityPluginSetup?: SecurityPluginSetup; @@ -93,16 +93,6 @@ export class CasePlugin { )}] and plugins [${Object.keys(plugins)}]` ); - this.caseService = new CaseService( - this.log, - plugins.security != null ? plugins.security.authc : undefined - ); - this.caseConfigureService = new CaseConfigureService(this.log); - this.connectorMappingsService = new ConnectorMappingsService(this.log); - this.userActionService = new CaseUserActionService(this.log); - this.alertsService = new AlertService(); - this.attachmentService = new AttachmentService(this.log); - core.http.registerRouteHandlerContext( APP_ID, this.createRouteHandlerContext({ @@ -113,11 +103,6 @@ export class CasePlugin { const router = core.http.createRouter(); initCaseApi({ logger: this.log, - caseService: this.caseService, - caseConfigureService: this.caseConfigureService, - connectorMappingsService: this.connectorMappingsService, - userActionService: this.userActionService, - attachmentService: this.attachmentService, router, }); @@ -131,16 +116,10 @@ export class CasePlugin { } } - public start(core: CoreStart, plugins: PluginsStart) { + public start(core: CoreStart, plugins: PluginsStart): PluginsStartContract { this.log.debug(`Starting Case Workflow`); this.clientFactory.initialize({ - alertsService: this.alertsService!, - caseConfigureService: this.caseConfigureService!, - caseService: this.caseService!, - connectorMappingsService: this.connectorMappingsService!, - userActionService: this.userActionService!, - attachmentService: this.attachmentService!, securityPluginSetup: this.securityPluginSetup, securityPluginStart: plugins.security, getSpace: async (request: KibanaRequest) => { @@ -150,19 +129,18 @@ export class CasePlugin { actionsPluginStart: plugins.actions, }); - const getCasesClientWithRequestAndContext = async ( - context: CasesRequestHandlerContext, - request: KibanaRequest - ): Promise => { + const client = core.elasticsearch.client; + + const getCasesClientWithRequest = async (request: KibanaRequest): Promise => { return this.clientFactory.create({ request, - scopedClusterClient: context.core.elasticsearch.client.asCurrentUser, + scopedClusterClient: client.asScoped(request).asCurrentUser, savedObjectsService: core.savedObjects, }); }; return { - getCasesClientWithRequestAndContext, + getCasesClientWithRequest, }; } @@ -177,6 +155,7 @@ export class CasePlugin { }): IContextProvider => { return async (context, request, response) => { const [{ savedObjects }] = await core.getStartServices(); + return { getCasesClient: async () => { return this.clientFactory.create({ diff --git a/x-pack/plugins/cases/server/routes/api/cases/find_cases.ts b/x-pack/plugins/cases/server/routes/api/cases/find_cases.ts index c6ec5245ebd8a..1ded265a8b176 100644 --- a/x-pack/plugins/cases/server/routes/api/cases/find_cases.ts +++ b/x-pack/plugins/cases/server/routes/api/cases/find_cases.ts @@ -10,7 +10,7 @@ import { wrapError, escapeHatch } from '../utils'; import { RouteDeps } from '../types'; import { CASES_URL } from '../../../../common/constants'; -export function initFindCasesApi({ caseService, router, logger }: RouteDeps) { +export function initFindCasesApi({ router, logger }: RouteDeps) { router.get( { path: `${CASES_URL}/_find`, diff --git a/x-pack/plugins/cases/server/routes/api/cases/push_case.ts b/x-pack/plugins/cases/server/routes/api/cases/push_case.ts index 4028f192e725c..a49e1a99c418f 100644 --- a/x-pack/plugins/cases/server/routes/api/cases/push_case.ts +++ b/x-pack/plugins/cases/server/routes/api/cases/push_case.ts @@ -32,11 +32,6 @@ export function initPushCaseApi({ router, logger }: RouteDeps) { } const casesClient = await context.cases.getCasesClient(); - const actionsClient = context.actions?.getActionsClient(); - - if (actionsClient == null) { - return response.badRequest({ body: 'Action client not found' }); - } const params = pipe( CasePushRequestParamsRt.decode(request.params), @@ -45,7 +40,6 @@ export function initPushCaseApi({ router, logger }: RouteDeps) { return response.ok({ body: await casesClient.cases.push({ - actionsClient, caseId: params.case_id, connectorId: params.connector_id, }), diff --git a/x-pack/plugins/cases/server/routes/api/sub_case/delete_sub_cases.ts b/x-pack/plugins/cases/server/routes/api/sub_case/delete_sub_cases.ts index 45899735ddb04..11b68b70390fe 100644 --- a/x-pack/plugins/cases/server/routes/api/sub_case/delete_sub_cases.ts +++ b/x-pack/plugins/cases/server/routes/api/sub_case/delete_sub_cases.ts @@ -10,7 +10,7 @@ import { RouteDeps } from '../types'; import { wrapError } from '../utils'; import { SUB_CASES_PATCH_DEL_URL } from '../../../../common/constants'; -export function initDeleteSubCasesApi({ caseService, router, logger }: RouteDeps) { +export function initDeleteSubCasesApi({ router, logger }: RouteDeps) { router.delete( { path: SUB_CASES_PATCH_DEL_URL, diff --git a/x-pack/plugins/cases/server/routes/api/sub_case/find_sub_cases.ts b/x-pack/plugins/cases/server/routes/api/sub_case/find_sub_cases.ts index 8243e4a952993..e062f2238439e 100644 --- a/x-pack/plugins/cases/server/routes/api/sub_case/find_sub_cases.ts +++ b/x-pack/plugins/cases/server/routes/api/sub_case/find_sub_cases.ts @@ -17,7 +17,7 @@ import { RouteDeps } from '../types'; import { escapeHatch, wrapError } from '../utils'; import { SUB_CASES_URL } from '../../../../common/constants'; -export function initFindSubCasesApi({ caseService, router, logger }: RouteDeps) { +export function initFindSubCasesApi({ router, logger }: RouteDeps) { router.get( { path: `${SUB_CASES_URL}/_find`, diff --git a/x-pack/plugins/cases/server/routes/api/sub_case/patch_sub_cases.ts b/x-pack/plugins/cases/server/routes/api/sub_case/patch_sub_cases.ts index ce03c3bf970ab..1fb260453d188 100644 --- a/x-pack/plugins/cases/server/routes/api/sub_case/patch_sub_cases.ts +++ b/x-pack/plugins/cases/server/routes/api/sub_case/patch_sub_cases.ts @@ -10,7 +10,7 @@ import { SUB_CASES_PATCH_DEL_URL } from '../../../../common/constants'; import { RouteDeps } from '../types'; import { escapeHatch, wrapError } from '../utils'; -export function initPatchSubCasesApi({ router, caseService, logger }: RouteDeps) { +export function initPatchSubCasesApi({ router, logger }: RouteDeps) { router.patch( { path: SUB_CASES_PATCH_DEL_URL, diff --git a/x-pack/plugins/cases/server/routes/api/types.ts b/x-pack/plugins/cases/server/routes/api/types.ts index d41e89dae31f8..9211aee5606a6 100644 --- a/x-pack/plugins/cases/server/routes/api/types.ts +++ b/x-pack/plugins/cases/server/routes/api/types.ts @@ -7,23 +7,10 @@ import type { Logger } from 'kibana/server'; -import type { - CaseConfigureService, - CaseService, - CaseUserActionService, - ConnectorMappingsService, - AttachmentService, -} from '../../services'; - import type { CasesRouter } from '../../types'; export interface RouteDeps { - caseConfigureService: CaseConfigureService; - caseService: CaseService; - connectorMappingsService: ConnectorMappingsService; router: CasesRouter; - userActionService: CaseUserActionService; - attachmentService: AttachmentService; logger: Logger; } diff --git a/x-pack/plugins/cases/server/types.ts b/x-pack/plugins/cases/server/types.ts index b943babc3bbda..c3b8e0a273221 100644 --- a/x-pack/plugins/cases/server/types.ts +++ b/x-pack/plugins/cases/server/types.ts @@ -6,7 +6,6 @@ */ import type { IRouter, RequestHandlerContext } from 'src/core/server'; -import type { ActionsApiRequestHandlerContext } from '../../actions/server'; import { ActionTypeConfig, ActionTypeSecrets, @@ -25,7 +24,6 @@ export interface CaseRequestContext { */ export interface CasesRequestHandlerContext extends RequestHandlerContext { cases: CaseRequestContext; - actions: ActionsApiRequestHandlerContext; } /** diff --git a/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/kibana.json b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/kibana.json new file mode 100644 index 0000000000000..21dd9a58ffaad --- /dev/null +++ b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/kibana.json @@ -0,0 +1,10 @@ +{ + "id": "casesClientUserFixture", + "version": "1.0.0", + "kibanaVersion": "kibana", + "configPath": ["xpack"], + "requiredPlugins": ["features", "cases"], + "optionalPlugins": ["security", "spaces"], + "server": true, + "ui": false +} diff --git a/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/package.json b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/package.json new file mode 100644 index 0000000000000..d396141fb0059 --- /dev/null +++ b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/package.json @@ -0,0 +1,14 @@ +{ + "name": "cases-client-user-fixture", + "version": "1.0.0", + "kibana": { + "version": "kibana", + "templateVersion": "1.0.0" + }, + "main": "target/test/plugin_api_integration/plugins/cases_client_user_fixture", + "scripts": { + "kbn": "node ../../../../../../../scripts/kbn.js", + "build": "rm -rf './target' && ../../../../../../../node_modules/.bin/tsc" + }, + "license": "Elastic License 2.0" +} diff --git a/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/server/index.ts b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/server/index.ts new file mode 100644 index 0000000000000..d39c2f2e714df --- /dev/null +++ b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/server/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 + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { PluginInitializerContext } from 'kibana/server'; +import { FixturePlugin } from './plugin'; + +export const plugin = (initializerContext: PluginInitializerContext) => + new FixturePlugin(initializerContext); diff --git a/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/server/plugin.ts b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/server/plugin.ts new file mode 100644 index 0000000000000..4b307281fa4d9 --- /dev/null +++ b/x-pack/test/case_api_integration/common/fixtures/plugins/cases_client_user/server/plugin.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 + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { Plugin, CoreSetup, CoreStart, PluginInitializerContext, Logger } from 'kibana/server'; +import { schema } from '@kbn/config-schema'; + +import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../../plugins/features/server'; +import { SpacesPluginStart } from '../../../../../../../plugins/spaces/server'; +import { SecurityPluginStart } from '../../../../../../../plugins/security/server'; +import { PluginsStartContract as CasesPluginStart } from '../../../../../../../plugins/cases/server'; +import { CasesPatchRequest } from '../../../../../../../plugins/cases/common'; + +export interface FixtureSetupDeps { + features: FeaturesPluginSetup; +} + +export interface FixtureStartDeps { + security?: SecurityPluginStart; + spaces?: SpacesPluginStart; + cases?: CasesPluginStart; +} + +export class FixturePlugin implements Plugin { + private readonly log: Logger; + private casesPluginStart?: CasesPluginStart; + constructor(initContext: PluginInitializerContext) { + this.log = initContext.logger.get(); + } + + public setup(core: CoreSetup, deps: FixtureSetupDeps) { + const router = core.http.createRouter(); + /** + * This simply wraps the cases patch case api so that we can test updating the status of an alert using + * the cases client interface instead of going through the case plugin's RESTful interface + */ + router.patch( + { + path: '/api/cases_user/cases', + validate: { + body: schema.object({}, { unknowns: 'allow' }), + }, + }, + async (context, request, response) => { + try { + const client = await this.casesPluginStart?.getCasesClientWithRequest(request); + if (!client) { + throw new Error('Cases client was undefined'); + } + + return response.ok({ + body: await client.cases.update(request.body as CasesPatchRequest), + }); + } catch (error) { + this.log.error(`CasesClientUser failure: ${error}`); + throw error; + } + } + ); + } + public start(core: CoreStart, plugins: FixtureStartDeps) { + this.casesPluginStart = plugins.cases; + } + public stop() {} +} diff --git a/x-pack/test/case_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts b/x-pack/test/case_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts new file mode 100644 index 0000000000000..44284c0aec639 --- /dev/null +++ b/x-pack/test/case_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts @@ -0,0 +1,167 @@ +/* + * 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 expect from '@kbn/expect'; +import { FtrProviderContext } from '../../../../common/ftr_provider_context'; + +import { postCaseReq } from '../../../../common/lib/mock'; +import { + createCase, + createComment, + deleteAllCaseItems, + getSignalsWithES, +} from '../../../../common/lib/utils'; +import { CasesResponse, CaseStatuses, CommentType } from '../../../../../../plugins/cases/common'; + +// eslint-disable-next-line import/no-default-export +export default ({ getService }: FtrProviderContext): void => { + const supertest = getService('supertest'); + const es = getService('es'); + const esArchiver = getService('esArchiver'); + + describe('update_alert_status', () => { + const defaultSignalsIndex = '.siem-signals-default-000001'; + + beforeEach(async () => { + await esArchiver.load('cases/signals/default'); + }); + afterEach(async () => { + await esArchiver.unload('cases/signals/default'); + await deleteAllCaseItems(es); + }); + + it('should update the status of multiple alerts attached to multiple cases using the cases client', async () => { + const signalID = '5f2b9ec41f8febb1c06b5d1045aeabb9874733b7617e88a370510f2fb3a41a5d'; + const signalID2 = '4d0f4b1533e46b66b43bdd0330d23f39f2cf42a7253153270e38d30cce9ff0c6'; + + // does NOT updates alert status when adding comments and syncAlerts=false + const individualCase1 = await createCase(supertest, { + ...postCaseReq, + settings: { + syncAlerts: false, + }, + }); + + const updatedInd1WithComment = await createComment({ + supertest, + caseId: individualCase1.id, + params: { + alertId: signalID, + index: defaultSignalsIndex, + rule: { id: 'test-rule-id', name: 'test-index-id' }, + type: CommentType.alert, + owner: 'securitySolutionFixture', + }, + }); + + const individualCase2 = await createCase(supertest, { + ...postCaseReq, + settings: { + syncAlerts: false, + }, + }); + + const updatedInd2WithComment = await createComment({ + supertest, + caseId: individualCase2.id, + params: { + alertId: signalID2, + index: defaultSignalsIndex, + rule: { id: 'test-rule-id', name: 'test-index-id' }, + type: CommentType.alert, + owner: 'securitySolutionFixture', + }, + }); + + await es.indices.refresh({ index: defaultSignalsIndex }); + + let signals = await getSignalsWithES({ + es, + indices: defaultSignalsIndex, + ids: [signalID, signalID2], + }); + + // There should be no change in their status since syncing is disabled + expect(signals.get(defaultSignalsIndex)?.get(signalID)?._source?.signal.status).to.be( + CaseStatuses.open + ); + expect(signals.get(defaultSignalsIndex)?.get(signalID2)?._source?.signal.status).to.be( + CaseStatuses.open + ); + + // does NOT updates alert status when the status is updated and syncAlerts=false + // this performs the cases update through the test plugin that leverages the cases client instead + // of going through RESTful API of the cases plugin + const { body: updatedIndWithStatus }: { body: CasesResponse } = await supertest + .patch('/api/cases_user/cases') + .set('kbn-xsrf', 'true') + .send({ + cases: [ + { + id: updatedInd1WithComment.id, + version: updatedInd1WithComment.version, + status: CaseStatuses.closed, + }, + { + id: updatedInd2WithComment.id, + version: updatedInd2WithComment.version, + status: CaseStatuses['in-progress'], + }, + ], + }) + .expect(200); + + await es.indices.refresh({ index: defaultSignalsIndex }); + + signals = await getSignalsWithES({ + es, + indices: defaultSignalsIndex, + ids: [signalID, signalID2], + }); + + // There should still be no change in their status since syncing is disabled + expect(signals.get(defaultSignalsIndex)?.get(signalID)?._source?.signal.status).to.be( + CaseStatuses.open + ); + expect(signals.get(defaultSignalsIndex)?.get(signalID2)?._source?.signal.status).to.be( + CaseStatuses.open + ); + + // it updates alert status when syncAlerts is turned on + // turn on the sync settings + // this performs the cases update through the test plugin that leverages the cases client instead + // of going through RESTful API of the cases plugin + await supertest + .patch('/api/cases_user/cases') + .set('kbn-xsrf', 'true') + .send({ + cases: updatedIndWithStatus.map((caseInfo) => ({ + id: caseInfo.id, + version: caseInfo.version, + settings: { syncAlerts: true }, + })), + }) + .expect(200); + + await es.indices.refresh({ index: defaultSignalsIndex }); + + signals = await getSignalsWithES({ + es, + indices: defaultSignalsIndex, + ids: [signalID, signalID2], + }); + + // alerts should be updated now that the + expect(signals.get(defaultSignalsIndex)?.get(signalID)?._source?.signal.status).to.be( + CaseStatuses.closed + ); + expect(signals.get(defaultSignalsIndex)?.get(signalID2)?._source?.signal.status).to.be( + CaseStatuses['in-progress'] + ); + }); + }); +}; diff --git a/x-pack/test/case_api_integration/security_and_spaces/tests/common/index.ts b/x-pack/test/case_api_integration/security_and_spaces/tests/common/index.ts index 3a4e6bec70483..9d35d5ec82fc5 100644 --- a/x-pack/test/case_api_integration/security_and_spaces/tests/common/index.ts +++ b/x-pack/test/case_api_integration/security_and_spaces/tests/common/index.ts @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export export default ({ loadTestFile }: FtrProviderContext): void => { describe('Common', function () { + loadTestFile(require.resolve('./client/update_alert_status')); loadTestFile(require.resolve('./comments/delete_comment')); loadTestFile(require.resolve('./comments/find_comments')); loadTestFile(require.resolve('./comments/get_comment'));