Skip to content

Commit

Permalink
[Fleet] Revert enrollment api key list removal
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet committed Nov 13, 2024
1 parent 0cc2e56 commit c7ce232
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export interface GetEnrollmentAPIKeysRequest {
query: ListWithKuery;
}

export type GetEnrollmentAPIKeysResponse = ListResult<EnrollmentAPIKey>;
export type GetEnrollmentAPIKeysResponse = ListResult<EnrollmentAPIKey> & {
// deprecated in 8.x
list?: EnrollmentAPIKey[];
};

export interface GetOneEnrollmentAPIKeyRequest {
params: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const getEnrollmentApiKeysHandler: RequestHandler<
spaceId: useSpaceAwareness ? getCurrentNamespace(soClient) : undefined,
});
const body: GetEnrollmentAPIKeysResponse = {
list: items, // deprecated
items,
total,
page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export const registerRoutes = (router: FleetAuthzRouter) => {
request: GetEnrollmentAPIKeysRequestSchema,
response: {
200: {
body: () => ListResponseSchema(EnrollmentAPIKeySchema),
body: () =>
ListResponseSchema(EnrollmentAPIKeySchema).extends({
list: schema.arrayOf(EnrollmentAPIKeySchema, { meta: { deprecated: true } }),
}),
},
400: {
body: genericErrorResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export default function (providerContext: FtrProviderContext) {

expect(apiResponse.total).to.be(2);
expect(apiResponse.items[0]).to.have.keys('id', 'api_key_id', 'name');
// Deprecated property list
expect(apiResponse.list[0]).to.have.keys('id', 'api_key_id', 'name');
expect(apiResponse).to.have.keys('items');
});

Expand Down

0 comments on commit c7ce232

Please sign in to comment.