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

[Fleet] Revert enrollment api key list removal #200087

Merged
Merged
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
46 changes: 45 additions & 1 deletion oas_docs/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -16965,7 +17008,8 @@
"items",
"total",
"page",
"perPage"
"perPage",
"list"
],
"type": "object"
}
Expand Down
46 changes: 45 additions & 1 deletion oas_docs/bundle.serverless.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -16965,7 +17008,8 @@
"items",
"total",
"page",
"perPage"
"perPage",
"list"
],
"type": "object"
}
Expand Down
39 changes: 39 additions & 0 deletions oas_docs/output/kibana.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17704,6 +17704,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:
Expand All @@ -17715,6 +17753,7 @@ paths:
- total
- page
- perPage
- list
'400':
content:
application/json; Elastic-Api-Version=2023-10-31:
Expand Down
39 changes: 39 additions & 0 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21023,6 +21023,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:
Expand All @@ -21034,6 +21072,7 @@ paths:
- total
- page
- perPage
- list
'400':
content:
application/json; Elastic-Api-Version=2023-10-31:
Expand Down
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
Loading