Skip to content

Commit

Permalink
update alerts as data client docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley14 committed Aug 5, 2021
1 parent daf6871 commit 77f9413
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 96 deletions.
192 changes: 108 additions & 84 deletions x-pack/plugins/rule_registry/docs/alerts_client/classes/alertsclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ on alerts as data.

- [buildEsQueryWithAuthz](alertsclient.md#buildesquerywithauthz)
- [bulkUpdate](alertsclient.md#bulkupdate)
- [fetchAlertAndAudit](alertsclient.md#fetchalertandaudit)
- [fetchAlertAuditOperate](alertsclient.md#fetchalertauditoperate)
- [ensureAllAuthorized](alertsclient.md#ensureallauthorized)
- [get](alertsclient.md#get)
- [getAuthorizedAlertsIndices](alertsclient.md#getauthorizedalertsindices)
- [mgetAlertsAuditOperate](alertsclient.md#mgetalertsauditoperate)
- [queryAndAuditAllAlerts](alertsclient.md#queryandauditallalerts)
- [singleSearchAfterAndAudit](alertsclient.md#singlesearchafterandaudit)
- [update](alertsclient.md#update)

## Constructors
Expand All @@ -39,13 +40,13 @@ on alerts as data.

#### Parameters

| Name | Type |
| :------------------ | :-------------------------------------------------------- |
| Name | Type |
| :------ | :------ |
| `__namedParameters` | [ConstructorOptions](../interfaces/constructoroptions.md) |

#### Defined in

[alerts_client.ts:90](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L90)
[alerts_client.ts:93](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L93)

## Properties

Expand All @@ -55,47 +56,47 @@ on alerts as data.

#### Defined in

[alerts_client.ts:87](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L87)
[alerts_client.ts:90](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L90)

---
___

### authorization

`Private` `Readonly` **authorization**: `PublicMethodsOf`<AlertingAuthorization\>

#### Defined in

[alerts_client.ts:88](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L88)
[alerts_client.ts:91](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L91)

---
___

### esClient

`Private` `Readonly` **esClient**: `ElasticsearchClient`

#### Defined in

[alerts_client.ts:89](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L89)
[alerts_client.ts:92](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L92)

---
___

### logger

`Private` `Readonly` **logger**: `Logger`

#### Defined in

[alerts_client.ts:86](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L86)
[alerts_client.ts:89](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L89)

---
___

### spaceId

`Private` `Readonly` **spaceId**: `undefined` \| `string`

#### Defined in

[alerts_client.ts:90](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L90)
[alerts_client.ts:93](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L93)

## Methods

Expand All @@ -105,38 +106,38 @@ on alerts as data.

#### Parameters

| Name | Type |
| :------------- | :-------------------------------- |
| `query` | `undefined` \| `null` \| `string` |
| `id` | `undefined` \| `null` \| `string` |
| `alertSpaceId` | `string` |
| `operation` | `Update` \| `Get` \| `Find` |
| `config` | `EsQueryConfig` |
| Name | Type |
| :------ | :------ |
| `query` | `undefined` \| ``null`` \| `string` |
| `id` | `undefined` \| ``null`` \| `string` |
| `alertSpaceId` | `string` |
| `operation` | `Get` \| `Find` \| `Update` |
| `config` | `EsQueryConfig` |

#### Returns

`Promise`<`Object`\>

#### Defined in

[alerts_client.ts:242](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L242)
[alerts_client.ts:305](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L305)

---
___

### bulkUpdate

**bulkUpdate**<Params\>(`__namedParameters`): `Promise`<ApiResponse<BulkResponse, unknown\> \| ApiResponse<UpdateByQueryResponse, unknown\>\>

#### Type parameters

| Name | Type |
| :------- | :------------------------------------ |
| Name | Type |
| :------ | :------ |
| `Params` | `Params`: `AlertTypeParams` = `never` |

#### Parameters

| Name | Type |
| :------------------ | :--------------------------------------------------------------- |
| Name | Type |
| :------ | :------ |
| `__namedParameters` | [BulkUpdateOptions](../interfaces/bulkupdateoptions.md)<Params\> |

#### Returns
Expand All @@ -145,138 +146,161 @@ on alerts as data.

#### Defined in

[alerts_client.ts:424](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L424)
[alerts_client.ts:475](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L475)

---
___

### fetchAlertAndAudit
### ensureAllAuthorized

`Private` **fetchAlertAndAudit**(`__namedParameters`): `Promise`<SearchResponse<OutputOf<SetOptional<`Object`\>\>\>\>
`Private` **ensureAllAuthorized**(`items`, `operation`): `Promise`<(undefined \| void)[]\>

This will be used as a part of the "find" api
In the future we will add an "aggs" param
Accepts an array of ES documents and executes ensureAuthorized for the given operation

#### Parameters

| Name | Type |
| :------------------ | :------------------------- |
| `__namedParameters` | `FetchAndAuditAlertParams` |
| Name | Type |
| :------ | :------ |
| `items` | { `_id`: `string` ; `_source?`: ``null`` \| { `kibana.alert.owner?`: ``null`` \| `string` ; `rule.id?`: ``null`` \| `string` } }[] |
| `operation` | `Get` \| `Find` \| `Update` |

#### Returns

`Promise`<SearchResponse<OutputOf<SetOptional<`Object`\>\>\>\>
`Promise`<(undefined \| void)[]\>

#### Defined in

[alerts_client.ts:108](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L108)
[alerts_client.ts:111](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L111)

---
___

### fetchAlertAuditOperate

`Private` **fetchAlertAuditOperate**(`__namedParameters`): `Promise`<ApiResponse<BulkResponse, unknown\>\>
### get

When an update by ids is requested, do a multi-get, ensure authz and audit alerts, then execute bulk update
**get**(`__namedParameters`): `Promise`<undefined \| OutputOf<SetOptional<`Object`\>\>\>

#### Parameters

| Name | Type |
| :---------------------------- | :------------------------------------ |
| `__namedParameters` | `Object` |
| `__namedParameters.ids` | `string`[] |
| `__namedParameters.indexName` | `string` |
| `__namedParameters.operation` | `WriteOperations` \| `ReadOperations` |
| `__namedParameters.status` | `STATUS\_VALUES` |
| Name | Type |
| :------ | :------ |
| `__namedParameters` | `GetAlertParams` |

#### Returns

`Promise`<ApiResponse<BulkResponse, unknown\>\>
`Promise`<undefined \| OutputOf<SetOptional<`Object`\>\>\>

#### Defined in

[alerts_client.ts:185](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L185)
[alerts_client.ts:407](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L407)

---
___

### get
### getAuthorizedAlertsIndices

**get**(`__namedParameters`): `Promise`<undefined \| OutputOf<SetOptional<`Object`\>\>\>
**getAuthorizedAlertsIndices**(`featureIds`): `Promise`<undefined \| string[]\>

#### Parameters

| Name | Type |
| :------------------ | :--------------- |
| `__namedParameters` | `GetAlertParams` |
| Name | Type |
| :------ | :------ |
| `featureIds` | `string`[] |

#### Returns

`Promise`<undefined \| OutputOf<SetOptional<`Object`\>\>\>
`Promise`<undefined \| string[]\>

#### Defined in

[alerts_client.ts:344](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L344)
[alerts_client.ts:533](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L533)

---
___

### getAuthorizedAlertsIndices
### mgetAlertsAuditOperate

**getAuthorizedAlertsIndices**(`featureIds`): `Promise`<undefined \| string[]\>
`Private` **mgetAlertsAuditOperate**(`__namedParameters`): `Promise`<ApiResponse<BulkResponse, unknown\>\>

When an update by ids is requested, do a multi-get, ensure authz and audit alerts, then execute bulk update

#### Parameters

| Name | Type |
| :----------- | :--------- |
| `featureIds` | `string`[] |
| Name | Type |
| :------ | :------ |
| `__namedParameters` | `Object` |
| `__namedParameters.ids` | `string`[] |
| `__namedParameters.indexName` | `string` |
| `__namedParameters.operation` | `Get` \| `Find` \| `Update` |
| `__namedParameters.status` | `STATUS\_VALUES` |

#### Returns

`Promise`<undefined \| string[]\>
`Promise`<ApiResponse<BulkResponse, unknown\>\>

#### Defined in

[alerts_client.ts:481](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L481)
[alerts_client.ts:252](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L252)

---
___

### queryAndAuditAllAlerts

`Private` **queryAndAuditAllAlerts**(`__namedParameters`): `Promise`<undefined \| { `auditedAlerts`: `boolean` = true; `authorizedQuery`: {} }\>
`Private` **queryAndAuditAllAlerts**(`__namedParameters`): `Promise`<undefined \| { `auditedAlerts`: `boolean` = true; `authorizedQuery`: {} }\>

executes a search after to find alerts with query (+ authz filter)

#### Parameters

| Name | Type |
| :---------------------------- | :-------------------------- |
| `__namedParameters` | `Object` |
| `__namedParameters.index` | `string` |
| `__namedParameters.operation` | `Update` \| `Get` \| `Find` |
| `__namedParameters.query` | `string` |
| Name | Type |
| :------ | :------ |
| `__namedParameters` | `Object` |
| `__namedParameters.index` | `string` |
| `__namedParameters.operation` | `Get` \| `Find` \| `Update` |
| `__namedParameters.query` | `string` |

#### Returns

`Promise`<undefined \| { `auditedAlerts`: `boolean` = true; `authorizedQuery`: {} }\>

#### Defined in

[alerts_client.ts:343](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L343)

___

### singleSearchAfterAndAudit

`Private` **singleSearchAfterAndAudit**(`__namedParameters`): `Promise`<SearchResponse<OutputOf<SetOptional<`Object`\>\>\>\>

This will be used as a part of the "find" api
In the future we will add an "aggs" param

#### Parameters

| Name | Type |
| :------ | :------ |
| `__namedParameters` | `SingleSearchAfterAndAudit` |

#### Returns

`Promise`<undefined \| { `auditedAlerts`: `boolean` = true; `authorizedQuery`: {} }\>
`Promise`<SearchResponse<OutputOf<SetOptional<`Object`\>\>\>\>

#### Defined in

[alerts_client.ts:280](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L280)
[alerts_client.ts:176](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L176)

---
___

### update

**update**<Params\>(`__namedParameters`): `Promise`<`Object`\>

#### Type parameters

| Name | Type |
| :------- | :------------------------------------ |
| Name | Type |
| :------ | :------ |
| `Params` | `Params`: `AlertTypeParams` = `never` |

#### Parameters

| Name | Type |
| :------------------ | :------------------------------------------------------- |
| Name | Type |
| :------ | :------ |
| `__namedParameters` | [UpdateOptions](../interfaces/updateoptions.md)<Params\> |

#### Returns
Expand All @@ -285,4 +309,4 @@ executes a search after to find alerts with query (+ authz filter)

#### Defined in

[alerts_client.ts:375](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L375)
[alerts_client.ts:432](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L432)
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#### Defined in

[alerts_client.ts:61](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L61)
[alerts_client.ts:64](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L64)

___

Expand All @@ -35,7 +35,7 @@ ___

#### Defined in

[alerts_client.ts:63](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L63)
[alerts_client.ts:66](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L66)

___

Expand All @@ -45,7 +45,7 @@ ___

#### Defined in

[alerts_client.ts:64](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L64)
[alerts_client.ts:67](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L67)

___

Expand All @@ -55,4 +55,4 @@ ___

#### Defined in

[alerts_client.ts:62](https://github.com/elastic/kibana/blob/84a50dc4bb6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L62)
[alerts_client.ts:65](https://github.com/elastic/kibana/blob/daf6871ba4b/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L65)
Loading

0 comments on commit 77f9413

Please sign in to comment.