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

moved DELETE agent_config body to query params #200281

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ async function deleteConfig(config: Config, toasts: NotificationsStart['toasts']
await callApmApi('DELETE /api/apm/settings/agent-configuration 2023-10-31', {
signal: null,
params: {
body: {
service: {
name: config.service.name,
environment: config.service.environment,
},
query: {
serviceName: config.service.name,
serviceEnvironment: config.service.environment,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,22 @@ const deleteAgentConfigurationRoute = createApmServerRoute({
tags: ['access:apm', 'access:apm_settings_write'],
access: 'public',
},
params: t.type({
body: t.type({
service: serviceRt,
}),
params: t.partial({
query: t.intersection([
t.partial({ serviceName: t.string }),
t.partial({ serviceEnvironment: t.string }),
]),
}),
handler: async (resources): Promise<{ result: string }> => {
throwNotFoundIfAgentConfigNotAvailable(resources.featureFlags);

const { params, logger, core, telemetryUsageCounter } = resources;
const { service } = params.body;
const { serviceName, serviceEnvironment } = params.query;
const service = {
name: serviceName ? decodeURIComponent(serviceName) : null,
environment: serviceEnvironment ? decodeURIComponent(serviceEnvironment) : null,
};

const apmIndices = await resources.getApmIndices();
const [internalESClient, apmEventClient] = await Promise.all([
createInternalESClientWithResources(resources),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ export default function featureControlsTests({ getService }: FtrProviderContext)
}

function deleteAgent(
body: APIClientRequestParamsOf<'DELETE /api/apm/settings/agent-configuration 2023-10-31'>['params']['body']
query: APIClientRequestParamsOf<'DELETE /api/apm/settings/agent-configuration 2023-10-31'>['params']['query']
) {
return apmApiClient.writeUser({
endpoint: 'DELETE /api/apm/settings/agent-configuration 2023-10-31',
params: {
body,
query,
},
});
}
Expand Down Expand Up @@ -283,7 +283,10 @@ export default function featureControlsTests({ getService }: FtrProviderContext)

after(async () => {
log.info('deleting agent configuration');
await deleteAgent({ service: config.service });
await deleteAgent({
serviceName: config.service.name,
serviceEnvironment: config.service.environment,
});
log.info('Agent configuration deleted');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ export default function ApiTest(ftrProviderContext: FtrProviderContext) {
async function deleteConfiguration(configuration: any) {
return apmApiClient.writeUser({
endpoint: 'DELETE /api/apm/settings/agent-configuration 2023-10-31',
params: { body: { service: configuration.service } },
params: {
query: {
serviceName: configuration.service.name,
serviceEnvironment: configuration.service.environment,
},
},
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function agentConfigurationTests({ getService }: FtrProviderConte

return supertestClient({
endpoint: 'DELETE /api/apm/settings/agent-configuration 2023-10-31',
params: { body: { service } },
params: { query: { service } },
});
}

Expand All @@ -96,8 +96,8 @@ export default function agentConfigurationTests({ getService }: FtrProviderConte
endpoint: 'GET /api/apm/settings/agent-configuration/view 2023-10-31',
params: {
query: {
name,
environment,
serviceName: name,
serviceEnvironment: environment,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ export default function ({ getService }: APMFtrContextProvider) {
await apmApiClient.slsUser({
endpoint: 'DELETE /api/apm/settings/agent-configuration 2023-10-31',
params: {
body: {
service: {},
query: {
serviceName: '',
serviceEnvironment: '',
},
},
roleAuthc,
Expand Down