-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Ingest Manager] expose method to get agent and list agents to other plugins #70087
[Ingest Manager] expose method to get agent and list agents to other plugins #70087
Conversation
Pinging @elastic/ingest-management (Team:Ingest Management) |
@@ -236,7 +241,7 @@ export class IngestManagerPlugin | |||
plugins: { | |||
encryptedSavedObjects: EncryptedSavedObjectsPluginStart; | |||
} | |||
) { | |||
): Promise<IngestManagerStartContract> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
options: { | ||
page: number; | ||
perPage: number; | ||
kuery?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nchaulet thanks for making this change. So we must page through the data? What is the relationship between showInactive and kuery? And do you have an example of the kuery to get a the unenrolled agent that have or had an Endpoint Integration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the showInactive
allow to show inactive agent (unenrolled), kuery allow to filter on other fields
For the kuery to get unenrolled agent that have an endpoint integration it will be something like this (if this get merged #69731)
listAgents(soClient, {
showInactive: true,
kuery: `fleet-agents.package:endpoint`
});
if this is not merged you will have to provide the config id
listAgents(soClient, {
showInactive: true,
kuery: `fleet-agents.config_id:config_with_endpoint_1 or fleet-agents.config_id:config_with_endpoint_1`
});
Also I am working on adding an unrolled_at
field so you can filter by date after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the first one. I can start coding against the API once you merge.
authenticateAgentWithAccessToken( | ||
soClient: SavedObjectsClientContract, | ||
request: KibanaRequest | ||
): Promise<Agent>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this method and why do we pass the whole request? Can we pass what is needed incase the request is not compatible from Security Solution to Ingest Manager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is used for the endpoint artifact API, to authenticate user, the method is already used it was just not typed correctly
/** | ||
* Get an Agent by id | ||
*/ | ||
getAgent(soClient: SavedObjectsClientContract, agentId: string): Promise<Agent>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we use this method, we will have to look at the active property of the agent to know if it is unenrolled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's correct
@elasticmachine merge upstream |
💚 Build SucceededBuild metricspage load asset sizebeta
History
To update your PR or re-run it, just comment with: |
Description
Expose methods to list and get agents to other plugins (endpoint is going to use).
The
agentService
in ingest manager plugin start now expose alistAgents
method and agetAgent
The
listAgents
method support akuery
parameter that make most of the endpoint queries possible,If some fields are not queriable with kuery, I will make the changes in a follow up PR.