Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ResponseOps][Rules] Add OAS schema for handled 4xx errors on rule apis #192616

Merged
merged 22 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
273277a
Add OAS schema for handled 403 errors on rule apis
Zacqary Sep 11, 2024
df6d074
Revert testing code
Zacqary Sep 11, 2024
5f74261
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine Sep 11, 2024
4c2785d
Document 400 and 404 errors
Zacqary Sep 13, 2024
68b5a50
Merge remote-tracking branch 'upstream/main' into 188514-rules-4xx-oas
Zacqary Sep 13, 2024
4c313c1
Merge branch '188514-rules-4xx-oas' of https://github.com/Zacqary/kib…
Zacqary Sep 13, 2024
cd4f607
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine Sep 13, 2024
4fa70e0
Merge remote-tracking branch 'upstream/main' into 188514-rules-4xx-oas
Zacqary Sep 16, 2024
dfc8f6f
Merge branch '188514-rules-4xx-oas' of https://github.com/Zacqary/kib…
Zacqary Sep 16, 2024
5528f14
Merge remote-tracking branch 'upstream/main' into 188514-rules-4xx-oas
Zacqary Sep 16, 2024
3c6121c
Merge branch 'main' into 188514-rules-4xx-oas
elasticmachine Sep 17, 2024
a8d4987
Add missing error codes and remove error schemas
Zacqary Sep 18, 2024
0c92742
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine Sep 18, 2024
29f1594
Add 400 and 403 to public find route
Zacqary Sep 18, 2024
5633021
Merge branch '188514-rules-4xx-oas' of https://github.com/Zacqary/kib…
Zacqary Sep 18, 2024
4470bba
Fix bad merge
Zacqary Sep 18, 2024
e68a37c
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine Sep 18, 2024
3e51490
Merge remote-tracking branch 'upstream/main' into 188514-rules-4xx-oas
Zacqary Sep 18, 2024
6a4a3df
Merge branch '188514-rules-4xx-oas' of https://github.com/Zacqary/kib…
Zacqary Sep 18, 2024
a5a1717
Merge branch 'main' into 188514-rules-4xx-oas
elasticmachine Sep 19, 2024
3d8474a
[CI] Auto-commit changed files from 'yarn openapi:bundle'
kibanamachine Sep 19, 2024
daec30b
Merge remote-tracking branch 'upstream/main' into 188514-rules-4xx-oas
Zacqary Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions oas_docs/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
}
},
"summary": "Delete a rule",
Expand Down Expand Up @@ -2399,6 +2408,15 @@
}
},
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
}
},
"summary": "Get rule details",
Expand Down Expand Up @@ -3586,6 +3604,15 @@
}
},
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"409": {
"description": "Indicates that the rule id is already in use."
}
},
"summary": "Create a rule",
Expand Down Expand Up @@ -4756,6 +4783,18 @@
}
},
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
},
"409": {
"description": "Indicates that the rule has already been updated by another user."
}
},
"summary": "Update a rule",
Expand Down Expand Up @@ -4821,6 +4860,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
}
},
"summary": "Disable a rule",
Expand Down Expand Up @@ -4868,6 +4916,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
}
},
"summary": "Enable a rule",
Expand Down Expand Up @@ -5009,6 +5066,18 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
},
"409": {
"description": "Indicates that the rule has already been updated by another user."
}
},
"summary": "Update the API key for a rule",
Expand Down Expand Up @@ -5065,6 +5134,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule or alert with the given ID does not exist."
}
},
"summary": "Mute an alert",
Expand Down Expand Up @@ -5121,6 +5199,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule or alert with the given ID does not exist."
}
},
"summary": "Unmute an alert",
Expand Down Expand Up @@ -6162,6 +6249,12 @@
}
},
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
}
},
"summary": "Get information about rules",
Expand Down
93 changes: 93 additions & 0 deletions oas_docs/bundle.serverless.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
}
},
"summary": "Delete a rule",
Expand Down Expand Up @@ -2399,6 +2408,15 @@
}
},
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
}
},
"summary": "Get rule details",
Expand Down Expand Up @@ -3586,6 +3604,15 @@
}
},
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"409": {
"description": "Indicates that the rule id is already in use."
}
},
"summary": "Create a rule",
Expand Down Expand Up @@ -4756,6 +4783,18 @@
}
},
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
},
"409": {
"description": "Indicates that the rule has already been updated by another user."
}
},
"summary": "Update a rule",
Expand Down Expand Up @@ -4821,6 +4860,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
}
},
"summary": "Disable a rule",
Expand Down Expand Up @@ -4868,6 +4916,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
}
},
"summary": "Enable a rule",
Expand Down Expand Up @@ -5009,6 +5066,18 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule with the given ID does not exist."
},
"409": {
"description": "Indicates that the rule has already been updated by another user."
}
},
"summary": "Update the API key for a rule",
Expand Down Expand Up @@ -5065,6 +5134,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule or alert with the given ID does not exist."
}
},
"summary": "Mute an alert",
Expand Down Expand Up @@ -5121,6 +5199,15 @@
"responses": {
"204": {
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
},
"404": {
"description": "Indicates a rule or alert with the given ID does not exist."
}
},
"summary": "Unmute an alert",
Expand Down Expand Up @@ -6162,6 +6249,12 @@
}
},
"description": "Indicates a successful call."
},
"400": {
"description": "Indicates an invalid schema or parameters."
},
"403": {
"description": "Indicates that this call is forbidden."
}
},
"summary": "Get information about rules",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
*/

import { IRouter } from '@kbn/core/server';
import { verifyAccessAndContext, handleDisabledApiKeysError } from '../../../lib';
import { ILicenseState, RuleTypeDisabledError } from '../../../../lib';
import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types';
import { handleDisabledApiKeysError, verifyAccessAndContext } from '../../../lib';

import {
bulkDisableRulesRequestBodySchemaV1,
BulkDisableRulesRequestBodyV1,
BulkDisableRulesResponseV1,
} from '../../../../../common/routes/rule/apis/bulk_disable';
import type { RuleParamsV1 } from '../../../../../common/routes/rule/response';
import { transformRuleToRuleResponseV1 } from '../../transforms';
import { Rule } from '../../../../application/rule/types';
import { transformRuleToRuleResponseV1 } from '../../transforms';

export const bulkDisableRulesRoute = ({
router,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
import { IRouter } from '@kbn/core/server';

import { ILicenseState, RuleTypeDisabledError } from '../../../../lib';
import { verifyAccessAndContext, handleDisabledApiKeysError } from '../../../lib';
import { AlertingRequestHandlerContext, INTERNAL_BASE_ALERTING_API_PATH } from '../../../../types';
import { handleDisabledApiKeysError, verifyAccessAndContext } from '../../../lib';

import {
bulkEditRulesRequestBodySchemaV1,
BulkEditRulesRequestBodyV1,
BulkEditRulesResponseV1,
} from '../../../../../common/routes/rule/apis/bulk_edit';
import { Rule } from '../../../../application/rule/types';
import type { RuleParamsV1 } from '../../../../../common/routes/rule/response';
import { Rule } from '../../../../application/rule/types';

import { transformRuleToRuleResponseV1 } from '../../transforms';
import { transformOperationsV1 } from './transforms';
import { validateRequiredGroupInDefaultActionsV1 } from '../../validation';
import { transformOperationsV1 } from './transforms';

interface BuildBulkEditRulesRouteParams {
licenseState: ILicenseState;
Expand Down
Loading