Skip to content

Commit

Permalink
[8.x] chore(slo): Migrate deprecated access tag (#201824) (#201866)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [chore(slo): Migrate deprecated access tag
(#201824)](#201824)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kevin
Delemme","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-26T20:31:11Z","message":"chore(slo):
Migrate deprecated access tag
(#201824)","sha":"fc674b7081f8aba3be183d43f99441bade9dc33e","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management","v8.18.0"],"title":"chore(slo):
Migrate deprecated access
tag","number":201824,"url":"https://github.com/elastic/kibana/pull/201824","mergeCommit":{"message":"chore(slo):
Migrate deprecated access tag
(#201824)","sha":"fc674b7081f8aba3be183d43f99441bade9dc33e"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201824","number":201824,"mergeCommit":{"message":"chore(slo):
Migrate deprecated access tag
(#201824)","sha":"fc674b7081f8aba3be183d43f99441bade9dc33e"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Kevin Delemme <[email protected]>
  • Loading branch information
kibanamachine and kdelemme authored Dec 2, 2024
1 parent 3baf357 commit 91fb172
Showing 1 changed file with 111 additions and 66 deletions.
177 changes: 111 additions & 66 deletions x-pack/plugins/observability_solution/slo/server/routes/slo/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ const getSpaceId = async (plugins: SLORoutesDependencies['plugins'], request: Ki

const createSLORoute = createSloServerRoute({
endpoint: 'POST /api/observability/slos 2023-10-31',
options: {
tags: ['access:slo_write'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: createSLOParamsSchema,
handler: async ({ context, response, params, logger, request, plugins, corePlugins }) => {
Expand Down Expand Up @@ -134,9 +136,11 @@ const createSLORoute = createSloServerRoute({

const inspectSLORoute = createSloServerRoute({
endpoint: 'POST /internal/observability/slos/_inspect',
options: {
tags: ['access:slo_write'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: createSLOParamsSchema,
handler: async ({ context, params, logger, request, plugins, corePlugins }) => {
Expand Down Expand Up @@ -186,9 +190,11 @@ const inspectSLORoute = createSloServerRoute({

const updateSLORoute = createSloServerRoute({
endpoint: 'PUT /api/observability/slos/{id} 2023-10-31',
options: {
tags: ['access:slo_write'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: updateSLOParamsSchema,
handler: async ({ context, request, params, logger, plugins, corePlugins }) => {
Expand Down Expand Up @@ -239,9 +245,11 @@ const updateSLORoute = createSloServerRoute({

const deleteSLORoute = createSloServerRoute({
endpoint: 'DELETE /api/observability/slos/{id} 2023-10-31',
options: {
tags: ['access:slo_write'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: deleteSLOParamsSchema,
handler: async ({ request, response, context, params, logger, plugins }) => {
Expand Down Expand Up @@ -295,9 +303,11 @@ const deleteSLORoute = createSloServerRoute({

const getSLORoute = createSloServerRoute({
endpoint: 'GET /api/observability/slos/{id} 2023-10-31',
options: {
tags: ['access:slo_read'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: getSLOParamsSchema,
handler: async ({ request, context, params, logger, plugins }) => {
Expand All @@ -321,9 +331,11 @@ const getSLORoute = createSloServerRoute({

const enableSLORoute = createSloServerRoute({
endpoint: 'POST /api/observability/slos/{id}/enable 2023-10-31',
options: {
tags: ['access:slo_write'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: manageSLOParamsSchema,
handler: async ({ request, response, context, params, logger, plugins }) => {
Expand Down Expand Up @@ -366,9 +378,11 @@ const enableSLORoute = createSloServerRoute({

const disableSLORoute = createSloServerRoute({
endpoint: 'POST /api/observability/slos/{id}/disable 2023-10-31',
options: {
tags: ['access:slo_write'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: manageSLOParamsSchema,
handler: async ({ response, request, context, params, logger, plugins }) => {
Expand Down Expand Up @@ -410,9 +424,11 @@ const disableSLORoute = createSloServerRoute({

const resetSLORoute = createSloServerRoute({
endpoint: 'POST /api/observability/slos/{id}/_reset 2023-10-31',
options: {
tags: ['access:slo_write'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: resetSLOParamsSchema,
handler: async ({ context, request, params, logger, plugins, corePlugins }) => {
Expand Down Expand Up @@ -463,9 +479,11 @@ const resetSLORoute = createSloServerRoute({

const findSLORoute = createSloServerRoute({
endpoint: 'GET /api/observability/slos 2023-10-31',
options: {
tags: ['access:slo_read'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: findSLOParamsSchema,
handler: async ({ context, request, params, logger, plugins }) => {
Expand All @@ -485,9 +503,11 @@ const findSLORoute = createSloServerRoute({

const findSLOGroupsRoute = createSloServerRoute({
endpoint: 'GET /internal/observability/slos/_groups',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: findSLOGroupsParamsSchema,
handler: async ({ context, request, params, logger, plugins }) => {
Expand All @@ -504,9 +524,11 @@ const findSLOGroupsRoute = createSloServerRoute({

const getSLOSuggestionsRoute = createSloServerRoute({
endpoint: 'GET /internal/observability/slos/suggestions',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
handler: async ({ context, plugins }) => {
await assertPlatinumLicense(plugins);
Expand All @@ -519,9 +541,11 @@ const getSLOSuggestionsRoute = createSloServerRoute({

const deleteSloInstancesRoute = createSloServerRoute({
endpoint: 'POST /api/observability/slos/_delete_instances 2023-10-31',
options: {
tags: ['access:slo_write'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: deleteSLOInstancesParamsSchema,
handler: async ({ response, context, params, plugins }) => {
Expand All @@ -537,9 +561,11 @@ const deleteSloInstancesRoute = createSloServerRoute({

const findSloDefinitionsRoute = createSloServerRoute({
endpoint: 'GET /api/observability/slos/_definitions 2023-10-31',
options: {
tags: ['access:slo_read'],
access: 'public',
options: { access: 'public' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: findSloDefinitionsParamsSchema,
handler: async ({ context, params, logger, plugins }) => {
Expand All @@ -555,9 +581,11 @@ const findSloDefinitionsRoute = createSloServerRoute({

const fetchHistoricalSummary = createSloServerRoute({
endpoint: 'POST /internal/observability/slos/_historical_summary',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: fetchHistoricalSummaryParamsSchema,
handler: async ({ context, params, plugins }) => {
Expand All @@ -572,9 +600,11 @@ const fetchHistoricalSummary = createSloServerRoute({

const getSLOInstancesRoute = createSloServerRoute({
endpoint: 'GET /internal/observability/slos/{id}/_instances',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: getSLOInstancesParamsSchema,
handler: async ({ context, params, logger, plugins }) => {
Expand All @@ -591,9 +621,12 @@ const getSLOInstancesRoute = createSloServerRoute({

const getDiagnosisRoute = createSloServerRoute({
endpoint: 'GET /internal/observability/slos/_diagnosis',
options: {
tags: [],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
enabled: false,
reason: 'The endpoint is used to diagnose SLOs and does not require any specific privileges.',
},
},
params: undefined,
handler: async ({ context, plugins }) => {
Expand All @@ -614,9 +647,11 @@ const getDiagnosisRoute = createSloServerRoute({

const fetchSloHealthRoute = createSloServerRoute({
endpoint: 'POST /internal/observability/slos/_health',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: fetchSLOHealthParamsSchema,
handler: async ({ context, params, logger, plugins }) => {
Expand All @@ -636,9 +671,11 @@ const fetchSloHealthRoute = createSloServerRoute({

const getSloBurnRates = createSloServerRoute({
endpoint: 'POST /internal/observability/slos/{id}/_burn_rates',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: getSLOBurnRatesParamsSchema,
handler: async ({ request, context, params, logger, plugins }) => {
Expand Down Expand Up @@ -669,9 +706,11 @@ const getSloBurnRates = createSloServerRoute({

const getPreviewData = createSloServerRoute({
endpoint: 'POST /internal/observability/slos/_preview',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: getPreviewDataParamsSchema,
handler: async ({ request, context, params, plugins }) => {
Expand All @@ -690,9 +729,11 @@ const getPreviewData = createSloServerRoute({

const getSloSettingsRoute = createSloServerRoute({
endpoint: 'GET /internal/slo/settings',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
handler: async ({ context, plugins }) => {
await assertPlatinumLicense(plugins);
Expand All @@ -706,9 +747,11 @@ const getSloSettingsRoute = createSloServerRoute({
const putSloSettings = (isServerless?: boolean) =>
createSloServerRoute({
endpoint: 'PUT /internal/slo/settings',
options: {
tags: ['access:slo_write'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_write'],
},
},
params: isServerless ? putSLOServerlessSettingsParamsSchema : putSLOSettingsParamsSchema,
handler: async ({ context, params, plugins }) => {
Expand All @@ -723,9 +766,11 @@ const putSloSettings = (isServerless?: boolean) =>

const getSLOsOverview = createSloServerRoute({
endpoint: 'GET /internal/observability/slos/overview',
options: {
tags: ['access:slo_read'],
access: 'internal',
options: { access: 'internal' },
security: {
authz: {
requiredPrivileges: ['slo_read'],
},
},
params: getOverviewParamsSchema,
handler: async ({ context, params, request, logger, plugins }) => {
Expand Down

0 comments on commit 91fb172

Please sign in to comment.