[Fleet] Revert enrollment api key list removal (#200087)

This commit is contained in:
Nicolas Chaulet 2024-11-14 07:52:13 -05:00 committed by GitHub
parent cffa49773c
commit 75679b21b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 179 additions and 4 deletions

View file

@ -16951,6 +16951,49 @@
},
"type": "array"
},
"list": {
"deprecated": true,
"items": {
"additionalProperties": false,
"properties": {
"active": {
"description": "When false, the enrollment API key is revoked and cannot be used for enrolling Elastic Agents.",
"type": "boolean"
},
"api_key": {
"description": "The enrollment API key (token) used for enrolling Elastic Agents.",
"type": "string"
},
"api_key_id": {
"description": "The ID of the API key in the Security API.",
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"description": "The name of the enrollment API key.",
"type": "string"
},
"policy_id": {
"description": "The ID of the agent policy the Elastic Agent will be enrolled in.",
"type": "string"
}
},
"required": [
"id",
"api_key_id",
"api_key",
"active",
"created_at"
],
"type": "object"
},
"type": "array"
},
"page": {
"type": "number"
},
@ -16965,7 +17008,8 @@
"items",
"total",
"page",
"perPage"
"perPage",
"list"
],
"type": "object"
}

View file

@ -16951,6 +16951,49 @@
},
"type": "array"
},
"list": {
"deprecated": true,
"items": {
"additionalProperties": false,
"properties": {
"active": {
"description": "When false, the enrollment API key is revoked and cannot be used for enrolling Elastic Agents.",
"type": "boolean"
},
"api_key": {
"description": "The enrollment API key (token) used for enrolling Elastic Agents.",
"type": "string"
},
"api_key_id": {
"description": "The ID of the API key in the Security API.",
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"description": "The name of the enrollment API key.",
"type": "string"
},
"policy_id": {
"description": "The ID of the agent policy the Elastic Agent will be enrolled in.",
"type": "string"
}
},
"required": [
"id",
"api_key_id",
"api_key",
"active",
"created_at"
],
"type": "object"
},
"type": "array"
},
"page": {
"type": "number"
},
@ -16965,7 +17008,8 @@
"items",
"total",
"page",
"perPage"
"perPage",
"list"
],
"type": "object"
}

View file

@ -16686,6 +16686,44 @@ paths:
- active
- created_at
type: array
list:
deprecated: true
items:
additionalProperties: false
type: object
properties:
active:
description: >-
When false, the enrollment API key is revoked and
cannot be used for enrolling Elastic Agents.
type: boolean
api_key:
description: >-
The enrollment API key (token) used for enrolling
Elastic Agents.
type: string
api_key_id:
description: The ID of the API key in the Security API.
type: string
created_at:
type: string
id:
type: string
name:
description: The name of the enrollment API key.
type: string
policy_id:
description: >-
The ID of the agent policy the Elastic Agent will be
enrolled in.
type: string
required:
- id
- api_key_id
- api_key
- active
- created_at
type: array
page:
type: number
perPage:
@ -16697,6 +16735,7 @@ paths:
- total
- page
- perPage
- list
'400':
content:
application/json; Elastic-Api-Version=2023-10-31:

View file

@ -19470,6 +19470,44 @@ paths:
- active
- created_at
type: array
list:
deprecated: true
items:
additionalProperties: false
type: object
properties:
active:
description: >-
When false, the enrollment API key is revoked and
cannot be used for enrolling Elastic Agents.
type: boolean
api_key:
description: >-
The enrollment API key (token) used for enrolling
Elastic Agents.
type: string
api_key_id:
description: The ID of the API key in the Security API.
type: string
created_at:
type: string
id:
type: string
name:
description: The name of the enrollment API key.
type: string
policy_id:
description: >-
The ID of the agent policy the Elastic Agent will be
enrolled in.
type: string
required:
- id
- api_key_id
- api_key
- active
- created_at
type: array
page:
type: number
perPage:
@ -19481,6 +19519,7 @@ paths:
- total
- page
- perPage
- list
'400':
content:
application/json; Elastic-Api-Version=2023-10-31:

View file

@ -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: {

View file

@ -43,6 +43,7 @@ export const getEnrollmentApiKeysHandler: RequestHandler<
spaceId: useSpaceAwareness ? getCurrentNamespace(soClient) : undefined,
});
const body: GetEnrollmentAPIKeysResponse = {
list: items, // deprecated
items,
total,
page,

View file

@ -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,

View file

@ -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');
});