Skip to content

Commit

Permalink
[Fleet] Revert enrollment api key list removal (elastic#200087)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet authored and CAWilson94 committed Nov 18, 2024
1 parent 0757f04 commit 7bfaae1
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 4 deletions.
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 @@ -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:
Expand All @@ -16697,6 +16735,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 @@ -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:
Expand All @@ -19481,6 +19519,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

0 comments on commit 7bfaae1

Please sign in to comment.