mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit f147fe8b98
)
Co-authored-by: Josh Dover <1813008+joshdover@users.noreply.github.com>
This commit is contained in:
parent
88c8949749
commit
6b98f69525
3 changed files with 28 additions and 0 deletions
|
@ -93,7 +93,12 @@ interface AgentBase {
|
|||
export interface Agent extends AgentBase {
|
||||
id: string;
|
||||
access_api_key?: string;
|
||||
// @deprecated
|
||||
default_api_key_history?: FleetServerAgent['default_api_key_history'];
|
||||
outputs?: Array<{
|
||||
api_key_id: string;
|
||||
to_retire_api_key_ids?: FleetServerAgent['default_api_key_history'];
|
||||
}>;
|
||||
status?: AgentStatus;
|
||||
packages: string[];
|
||||
sort?: Array<number | string | null>;
|
||||
|
|
|
@ -331,6 +331,15 @@ describe('invalidateAPIKeysForAgents', () => {
|
|||
id: 'defaultApiKeyHistory2',
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
api_key_id: 'outputApiKey1',
|
||||
to_retire_api_key_ids: [{ id: 'outputApiKeyRetire1' }, { id: 'outputApiKeyRetire2' }],
|
||||
},
|
||||
{
|
||||
api_key_id: 'outputApiKey2',
|
||||
},
|
||||
],
|
||||
} as any,
|
||||
]);
|
||||
|
||||
|
@ -340,6 +349,10 @@ describe('invalidateAPIKeysForAgents', () => {
|
|||
'defaultApiKey1',
|
||||
'defaultApiKeyHistory1',
|
||||
'defaultApiKeyHistory2',
|
||||
'outputApiKey1',
|
||||
'outputApiKeyRetire1',
|
||||
'outputApiKeyRetire2',
|
||||
'outputApiKey2',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -215,6 +215,16 @@ export async function invalidateAPIKeysForAgents(agents: Agent[]) {
|
|||
if (agent.default_api_key_history) {
|
||||
agent.default_api_key_history.forEach((apiKey) => keys.push(apiKey.id));
|
||||
}
|
||||
if (agent.outputs) {
|
||||
agent.outputs.forEach((output) => {
|
||||
if (output.api_key_id) {
|
||||
keys.push(output.api_key_id);
|
||||
}
|
||||
if (output.to_retire_api_key_ids) {
|
||||
output.to_retire_api_key_ids.forEach((apiKey) => keys.push(apiKey.id));
|
||||
}
|
||||
});
|
||||
}
|
||||
return keys;
|
||||
}, []);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue