Skip to content

Commit

Permalink
[APM] Set explicit access options for APM public APIs (#197435)
Browse files Browse the repository at this point in the history
## Summary

Closes #192473 
Part of #186781

Set explicit `access` option to `public` for APM public APIs.

List of affected APIs:
```
POST /api/apm/agent_keys 2023-10-31
GET /api/apm/services/{serviceName}/annotation/search 2023-10-31
POST /api/apm/services/{serviceName}/annotation 2023-10-31
GET /api/apm/settings/agent-configuration 2023-10-31
DELETE /api/apm/settings/agent-configuration 2023-10-31
PUT /api/apm/settings/agent-configuration 2023-10-31
POST /api/apm/settings/agent-configuration/search 2023-10-31
GET /api/apm/sourcemaps 2023-10-31
POST /api/apm/sourcemaps 2023-10-31
DELETE /api/apm/sourcemaps/{id} 2023-10-31
GET /api/apm/settings/agent-configuration/view 2023-10-31
GET /api/apm/settings/agent-configuration/environments 2023-10-31
GET /api/apm/settings/agent-configuration/agent_name 2023-10-31
POST /api/apm/fleet/apm_server_schema 2023-10-31
```
  • Loading branch information
miloszmarcinkowski authored Oct 24, 2024
1 parent 4c0b5c5 commit db0a898
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ const invalidateAgentKeyRoute = createApmServerRoute({

const createAgentKeyRoute = createApmServerRoute({
endpoint: 'POST /api/apm/agent_keys 2023-10-31',
options: { tags: ['access:apm', 'access:apm_settings_write', 'oas-tag:APM agent keys'] },
options: {
tags: ['access:apm', 'access:apm_settings_write', 'oas-tag:APM agent keys'],
access: 'public',
},
params: t.type({
body: t.type({
name: t.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const fleetAgentsRoute = createApmServerRoute({

const saveApmServerSchemaRoute = createApmServerRoute({
endpoint: 'POST /api/apm/fleet/apm_server_schema 2023-10-31',
options: { tags: ['access:apm', 'access:apm_write'] },
options: { tags: ['access:apm', 'access:apm_write'], access: 'public' },
params: t.type({
body: t.type({
schema: t.record(t.string, t.unknown),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ const serviceAnnotationsRoute = createApmServerRoute({
}),
query: t.intersection([environmentRt, rangeRt]),
}),
options: { tags: ['access:apm', 'oas-tag:APM annotations'] },
options: { tags: ['access:apm', 'oas-tag:APM annotations'], access: 'public' },
handler: async (resources): Promise<ServiceAnnotationResponse> => {
const apmEventClient = await getApmEventClient(resources);
const { params, plugins, context, request, logger, config } = resources;
Expand Down Expand Up @@ -440,6 +440,7 @@ const serviceAnnotationsCreateRoute = createApmServerRoute({
endpoint: 'POST /api/apm/services/{serviceName}/annotation 2023-10-31',
options: {
tags: ['access:apm', 'access:apm_write', 'oas-tag:APM annotations'],
access: 'public',
},
params: t.type({
path: t.type({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function throwNotFoundIfAgentConfigNotAvailable(featureFlags: ApmFeatureFlags):
// get list of configurations
const agentConfigurationRoute = createApmServerRoute({
endpoint: 'GET /api/apm/settings/agent-configuration 2023-10-31',
options: { tags: ['access:apm'] },
options: { tags: ['access:apm'], access: 'public' },
handler: async (
resources
): Promise<{
Expand Down Expand Up @@ -68,7 +68,7 @@ const getSingleAgentConfigurationRoute = createApmServerRoute({
params: t.partial({
query: serviceRt,
}),
options: { tags: ['access:apm'] },
options: { tags: ['access:apm'], access: 'public' },
handler: async (resources): Promise<AgentConfiguration> => {
throwNotFoundIfAgentConfigNotAvailable(resources.featureFlags);

Expand Down Expand Up @@ -100,6 +100,7 @@ const deleteAgentConfigurationRoute = createApmServerRoute({
endpoint: 'DELETE /api/apm/settings/agent-configuration 2023-10-31',
options: {
tags: ['access:apm', 'access:apm_settings_write'],
access: 'public',
},
params: t.type({
body: t.type({
Expand Down Expand Up @@ -156,6 +157,7 @@ const createOrUpdateAgentConfigurationRoute = createApmServerRoute({
endpoint: 'PUT /api/apm/settings/agent-configuration 2023-10-31',
options: {
tags: ['access:apm', 'access:apm_settings_write'],
access: 'public',
},
params: t.intersection([
t.partial({ query: t.partial({ overwrite: toBooleanRt }) }),
Expand Down Expand Up @@ -224,7 +226,7 @@ const agentConfigurationSearchRoute = createApmServerRoute({
params: t.type({
body: searchParamsRt,
}),
options: { tags: ['access:apm'], disableTelemetry: true },
options: { tags: ['access:apm'], disableTelemetry: true, access: 'public' },
handler: async (
resources
): Promise<SearchHit<AgentConfiguration, undefined, undefined> | null> => {
Expand Down Expand Up @@ -286,7 +288,7 @@ const listAgentConfigurationEnvironmentsRoute = createApmServerRoute({
params: t.partial({
query: t.partial({ serviceName: t.string }),
}),
options: { tags: ['access:apm'] },
options: { tags: ['access:apm'], access: 'public' },
handler: async (
resources
): Promise<{
Expand Down Expand Up @@ -327,7 +329,7 @@ const agentConfigurationAgentNameRoute = createApmServerRoute({
params: t.type({
query: t.type({ serviceName: t.string }),
}),
options: { tags: ['access:apm'] },
options: { tags: ['access:apm'], access: 'public' },
handler: async (resources): Promise<{ agentName: string | undefined }> => {
throwNotFoundIfAgentConfigNotAvailable(resources.featureFlags);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function throwNotImplementedIfSourceMapNotAvailable(featureFlags: ApmFeatureFlag

const listSourceMapRoute = createApmServerRoute({
endpoint: 'GET /api/apm/sourcemaps 2023-10-31',
options: { tags: ['access:apm'] },
options: { tags: ['access:apm'], access: 'public' },
params: t.partial({
query: t.partial({
page: toNumberRt,
Expand Down Expand Up @@ -87,6 +87,7 @@ const uploadSourceMapRoute = createApmServerRoute({
options: {
tags: ['access:apm', 'access:apm_write'],
body: { accepts: ['multipart/form-data'] },
access: 'public',
},
params: t.type({
body: t.type({
Expand Down Expand Up @@ -159,7 +160,7 @@ const uploadSourceMapRoute = createApmServerRoute({

const deleteSourceMapRoute = createApmServerRoute({
endpoint: 'DELETE /api/apm/sourcemaps/{id} 2023-10-31',
options: { tags: ['access:apm', 'access:apm_write'] },
options: { tags: ['access:apm', 'access:apm_write'], access: 'public' },
params: t.type({
path: t.type({
id: t.string,
Expand Down

0 comments on commit db0a898

Please sign in to comment.