feat: agent specifications query and get endpoints
All checks were successful
arcad/emissary/pipeline/head This commit looks good

This commit is contained in:
2024-03-13 16:07:16 +01:00
parent cec5c783fe
commit 85ccf2e1df
15 changed files with 261 additions and 55 deletions

View File

@ -45,17 +45,29 @@ func (c *Controller) reconcileAgent(ctx context.Context, client *client.Client,
return nil
}
specs, err := client.GetAgentSpecs(ctx, agent.ID)
specHeaders, err := client.QueryAgentSpecs(ctx, agent.ID)
if err != nil {
err = errors.WithStack(err)
logger.Error(ctx, "could not retrieve agent specs", logger.CapturedE(err))
logger.Error(ctx, "could not query agent specs", logger.CapturedE(err))
return nil
}
state.ClearSpecs()
for _, spec := range specs {
for _, sh := range specHeaders {
spec, err := client.GetAgentSpec(ctx, agent.ID, sh.DefinitionName, sh.DefinitionVersion)
if err != nil {
logger.Error(
ctx, "could not retrieve agent spec",
logger.F("specName", sh.DefinitionName),
logger.F("specVersion", sh.DefinitionVersion),
logger.CapturedE(errors.WithStack(err)),
)
continue
}
state.SetSpec(spec)
}