MCPcopy Create free account
hub / github.com/CrowdStrike/perseus / lookupLatestModuleVersion

Function lookupLatestModuleVersion

query.go:343–359  ·  view source on GitHub ↗

lookupLatestModuleVersion invokes the Perseus API to retrieve the highest known semantic version for the specified module.

(ctx context.Context, c perseusapiconnect.PerseusServiceClient, modulePath string)

Source from the content-addressed store, hash-verified

341// lookupLatestModuleVersion invokes the Perseus API to retrieve the highest known semantic version for
342// the specified module.
343func lookupLatestModuleVersion(ctx context.Context, c perseusapiconnect.PerseusServiceClient, modulePath string) (version string, err error) {
344 req := connect.NewRequest(&perseusapi.ListModuleVersionsRequest{
345 ModuleName: modulePath,
346 VersionOption: perseusapi.ModuleVersionOption_latest,
347 })
348 resp, err := retryOp(func() (*connect.Response[perseusapi.ListModuleVersionsResponse], error) {
349 return c.ListModuleVersions(ctx, req)
350 })
351 if err != nil {
352 return "", err
353 }
354 if len(resp.Msg.Modules) == 0 || len(resp.Msg.Modules[0].Versions) == 0 {
355 return "", fmt.Errorf("no version found for module %s", modulePath)
356 }
357
358 return resp.Msg.Modules[0].Versions[0], nil
359}
360
361// dependencyTreeNode defines the information returned by walkDependencies
362type dependencyTreeNode struct {

Callers 2

runQueryModuleGraphCmdFunction · 0.85
parseModuleArgFunction · 0.85

Calls 2

retryOpFunction · 0.85
ListModuleVersionsMethod · 0.65

Tested by

no test coverage detected