Skip to content

Commit

Permalink
[Alerting] Enable creating system actions through the Create Rule API (
Browse files Browse the repository at this point in the history
…#167884)

## Summary

This PR enables system actions only to the Create Rule API. Other PRs
will follow on a subsequent PR.

Depends on: #167871

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Julia <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2023
1 parent a291f7a commit 8dedac8
Show file tree
Hide file tree
Showing 37 changed files with 2,030 additions and 467 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ export class ActionsClient {
/**
* Get all system connectors
*/
public async getAllSystemConnectors(): Promise<FindConnectorResult[]> {
public async getAllSystemConnectors(): Promise<ConnectorWithExtraFindData[]> {
return getAllSystemConnectors({ context: this.context });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function getAllSystemConnectors({
context,
}: {
context: GetAllParams['context'];
}): Promise<FindConnectorResult[]> {
}): Promise<ConnectorWithExtraFindData[]> {
try {
await context.authorization.ensureAuthorized({ operation: 'get' });
} catch (error) {
Expand Down
4 changes: 3 additions & 1 deletion x-pack/plugins/actions/server/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import {
} from '@kbn/core/server/mocks';
import { encryptedSavedObjectsMock } from '@kbn/encrypted-saved-objects-plugin/server/mocks';
import { Logger } from '@kbn/core/server';
import { actionsClientMock } from './actions_client/actions_client.mock';
import { actionsClientMock, ActionsClientMock } from './actions_client/actions_client.mock';
import { PluginSetupContract, PluginStartContract, renderActionParameterTemplates } from './plugin';
import { Services } from './types';
import { actionsAuthorizationMock } from './authorization/actions_authorization.mock';
import { ConnectorTokenClient } from './lib/connector_token_client';
import { unsecuredActionsClientMock } from './unsecured_actions_client/unsecured_actions_client.mock';
export { actionsAuthorizationMock };
export { actionsClientMock };
export type { ActionsClientMock };

const logger = loggingSystemMock.create().get() as jest.Mocked<Logger>;

const createSetupMock = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const actionAlertsFilterSchema = schema.object({

export const actionSchema = schema.object({
uuid: schema.maybe(schema.string()),
group: schema.string(),
group: schema.maybe(schema.string()),
id: schema.string(),
actionTypeId: schema.maybe(schema.string()),
params: schema.recordOf(schema.string(), schema.maybe(schema.any()), { defaultValue: {} }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const actionAlertsFilterSchema = schema.object({

const actionSchema = schema.object({
uuid: schema.maybe(schema.string()),
group: schema.string(),
group: schema.maybe(schema.string()),
id: schema.string(),
connector_type_id: schema.string(),
params: actionParamsSchema,
Expand Down
Loading

0 comments on commit 8dedac8

Please sign in to comment.