Skip to content

Commit

Permalink
updates typedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley14 committed Jul 1, 2021
1 parent fbd3905 commit d2173f5
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 62 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class APMPlugin
});

const ruleDataClient = new RuleDataClient({
feature: 'devin',
feature: APM_SERVER_FEATURE_ID,
alias: ruleDataService.getFullAssetName('observability-apm'),
getClusterClient: async () => {
const coreStart = await getCoreStart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,78 @@ Alerts as data client API Interface

- [ConstructorOptions](interfaces/constructoroptions.md)
- [UpdateOptions](interfaces/updateoptions.md)

### Type aliases

- [ValidFeatureId](alerts_client_api.md#validfeatureid)

### Variables

- [mapConsumerToIndexName](alerts_client_api.md#mapconsumertoindexname)
- [validFeatureIds](alerts_client_api.md#validfeatureids)

### Functions

- [isValidFeatureId](alerts_client_api.md#isvalidfeatureid)

## Type aliases

### ValidFeatureId

Ƭ **ValidFeatureId**: keyof typeof [mapConsumerToIndexName](alerts_client_api.md#mapconsumertoindexname)

#### Defined in

[rule_registry/server/alert_data_client/alerts_client.ts:59](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L59)

## Variables

### mapConsumerToIndexName

`Const` **mapConsumerToIndexName**: `Object`

registering a new instance of the rule data client
in a new plugin will require updating the below data structure
to include the index name where the alerts as data will be written to.

#### Type declaration

| Name | Type |
| :------ | :------ |
| `apm` | `string` |
| `observability` | `string` |
| `siem` | `string`[] |

#### Defined in

[rule_registry/server/alert_data_client/alerts_client.ts:54](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L54)

___

### validFeatureIds

`Const` **validFeatureIds**: `string`[]

#### Defined in

[rule_registry/server/alert_data_client/alerts_client.ts:61](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L61)

## Functions

### isValidFeatureId

`Const` **isValidFeatureId**(`a`): a is "apm" \| "observability" \| "siem"

#### Parameters

| Name | Type |
| :------ | :------ |
| `a` | `string` |

#### Returns

a is "apm" \| "observability" \| "siem"

#### Defined in

[rule_registry/server/alert_data_client/alerts_client.ts:62](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L62)
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ on alerts as data.
- [authorization](alertsclient.md#authorization)
- [esClient](alertsclient.md#esclient)
- [logger](alertsclient.md#logger)
- [ruleDataService](alertsclient.md#ruledataservice)

### Methods

- [fetchAlert](alertsclient.md#fetchalert)
- [get](alertsclient.md#get)
- [getAlertsIndex](alertsclient.md#getalertsindex)
- [getFullAssetName](alertsclient.md#getfullassetname)
- [getAuthorizedAlertsIndices](alertsclient.md#getauthorizedalertsindices)
- [update](alertsclient.md#update)

## Constructors
Expand All @@ -42,7 +41,7 @@ on alerts as data.

#### Defined in

[alerts_client.ts:56](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L56)
[rule_registry/server/alert_data_client/alerts_client.ts:73](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L73)

## Properties

Expand All @@ -52,7 +51,7 @@ on alerts as data.

#### Defined in

[alerts_client.ts:53](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L53)
[rule_registry/server/alert_data_client/alerts_client.ts:71](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L71)

___

Expand All @@ -62,7 +61,7 @@ ___

#### Defined in

[alerts_client.ts:54](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L54)
[rule_registry/server/alert_data_client/alerts_client.ts:72](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L72)

___

Expand All @@ -72,7 +71,7 @@ ___

#### Defined in

[alerts_client.ts:55](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L55)
[rule_registry/server/alert_data_client/alerts_client.ts:73](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L73)

___

Expand All @@ -82,23 +81,13 @@ ___

#### Defined in

[alerts_client.ts:52](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L52)

___

### ruleDataService

`Private` `Readonly` **ruleDataService**: `PublicMethodsOf`<RuleDataPluginService\>

#### Defined in

[alerts_client.ts:56](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L56)
[rule_registry/server/alert_data_client/alerts_client.ts:70](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L70)

## Methods

### fetchAlert

`Private` **fetchAlert**(`__namedParameters`): `Promise`<OutputOf<SetOptional<`Object`\>\>\>
`Private` **fetchAlert**(`__namedParameters`): `Promise`<AlertType\>

#### Parameters

Expand All @@ -108,11 +97,11 @@ ___

#### Returns

`Promise`<OutputOf<SetOptional<`Object`\>\>\>
`Promise`<AlertType\>

#### Defined in

[alerts_client.ts:83](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L83)
[rule_registry/server/alert_data_client/alerts_client.ts:93](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L93)

___

Expand All @@ -132,47 +121,54 @@ ___

#### Defined in

[alerts_client.ts:108](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L108)
[rule_registry/server/alert_data_client/alerts_client.ts:122](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L122)

___

### getAlertsIndex

**getAlertsIndex**(`featureIds`): `Promise`<undefined \| string[]\>
**getAlertsIndex**(`featureIds`, `operations`): `Promise`<`Object`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `featureIds` | `string`[] |
| `operations` | (`ReadOperations` \| `WriteOperations`)[] |

#### Returns

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

#### Defined in

[alerts_client.ts:76](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L76)
[rule_registry/server/alert_data_client/alerts_client.ts:82](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L82)

___

### getFullAssetName
### getAuthorizedAlertsIndices

**getAuthorizedAlertsIndices**(`featureIds`): `Promise`<undefined \| string[]\>

#### Parameters

**getFullAssetName**(): `string`
| Name | Type |
| :------ | :------ |
| `featureIds` | `string`[] |

#### Returns

`string`
`Promise`<undefined \| string[]\>

#### Defined in

[alerts_client.ts:72](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L72)
[rule_registry/server/alert_data_client/alerts_client.ts:214](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L214)

___

### update

**update**<Params\>(`__namedParameters`): `Promise`<undefined \| ``null`` \| OutputOf<SetOptional<`Object`\>\>\>
**update**<Params\>(`__namedParameters`): `Promise`<`Object`\>

#### Type parameters

Expand All @@ -188,8 +184,8 @@ ___

#### Returns

`Promise`<undefined \| ``null`` \| OutputOf<SetOptional<`Object`\>\>\>
`Promise`<`Object`\>

#### Defined in

[alerts_client.ts:146](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L146)
[rule_registry/server/alert_data_client/alerts_client.ts:160](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L160)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
- [authorization](constructoroptions.md#authorization)
- [esClient](constructoroptions.md#esclient)
- [logger](constructoroptions.md#logger)
- [ruleDataService](constructoroptions.md#ruledataservice)

## Properties

Expand All @@ -20,7 +19,7 @@

#### Defined in

[alerts_client.ts:26](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L26)
[rule_registry/server/alert_data_client/alerts_client.ts:33](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L33)

___

Expand All @@ -30,7 +29,7 @@ ___

#### Defined in

[alerts_client.ts:25](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L25)
[rule_registry/server/alert_data_client/alerts_client.ts:32](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L32)

___

Expand All @@ -40,7 +39,7 @@ ___

#### Defined in

[alerts_client.ts:27](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L27)
[rule_registry/server/alert_data_client/alerts_client.ts:34](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L34)

___

Expand All @@ -50,14 +49,4 @@ ___

#### Defined in

[alerts_client.ts:24](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L24)

___

### ruleDataService

**ruleDataService**: `PublicMethodsOf`<RuleDataPluginService\>

#### Defined in

[alerts_client.ts:28](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L28)
[rule_registry/server/alert_data_client/alerts_client.ts:31](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L31)
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@

### Properties

- [data](updateoptions.md#data)
- [\_version](updateoptions.md#_version)
- [id](updateoptions.md#id)
- [indexName](updateoptions.md#indexname)
- [index](updateoptions.md#index)
- [status](updateoptions.md#status)

## Properties

### data
### \_version

**data**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `status` | `string` |
**\_version**: `undefined` \| `string`

#### Defined in

[alerts_client.ts:33](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L33)
[rule_registry/server/alert_data_client/alerts_client.ts:40](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L40)

___

Expand All @@ -40,14 +35,24 @@ ___

#### Defined in

[alerts_client.ts:32](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L32)
[rule_registry/server/alert_data_client/alerts_client.ts:38](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L38)

___

### index

**index**: `string`

#### Defined in

[rule_registry/server/alert_data_client/alerts_client.ts:41](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L41)

___

### indexName
### status

**indexName**: `string`
**status**: `string`

#### Defined in

[alerts_client.ts:37](https://github.com/dhurley14/kibana/blob/25bf227f8c6/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L37)
[rule_registry/server/alert_data_client/alerts_client.ts:39](https://github.com/dhurley14/kibana/blob/fbd3905673e/x-pack/plugins/rule_registry/server/alert_data_client/alerts_client.ts#L39)
7 changes: 7 additions & 0 deletions x-pack/plugins/rule_registry/server/rule_data_client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export interface IRuleDataClient {
createOrUpdateWriteTarget(options: { namespace?: string }): Promise<void>;
}

/**
* The purpose of the `feature` param is to force the user to update
* the data structure which contains the mapping of consumers to alerts
* as data indices. The idea is it is typed such that it forces the
* user to go to the code and modify it. At least until a better system
* is put in place or we move the alerts as data client out of rule registry.
*/
export interface RuleDataClientConstructorOptions {
getClusterClient: () => Promise<ElasticsearchClient>;
ready: () => Promise<void>;
Expand Down

0 comments on commit d2173f5

Please sign in to comment.