mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
cli: fix Azure SEV-SNP latest version logic (#2343)
This commit is contained in:
parent
2776e40df7
commit
118f789c2f
26 changed files with 547 additions and 245 deletions
|
@ -10,34 +10,36 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/internal/api/fetcher"
|
||||
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||
)
|
||||
|
||||
// Fetcher fetches version API resources without authentication.
|
||||
type Fetcher struct {
|
||||
fetcher.HTTPClient
|
||||
cdnURL string
|
||||
}
|
||||
|
||||
// NewFetcher returns a new Fetcher.
|
||||
func NewFetcher() *Fetcher {
|
||||
return &Fetcher{fetcher.NewHTTPClient()}
|
||||
return &Fetcher{fetcher.NewHTTPClient(), constants.CDNRepositoryURL}
|
||||
}
|
||||
|
||||
// FetchVersionList fetches the given version list from the versions API.
|
||||
func (f *Fetcher) FetchVersionList(ctx context.Context, list List) (List, error) {
|
||||
return fetcher.Fetch(ctx, f.HTTPClient, list)
|
||||
return fetcher.Fetch(ctx, f.HTTPClient, f.cdnURL, list)
|
||||
}
|
||||
|
||||
// FetchVersionLatest fetches the latest version from the versions API.
|
||||
func (f *Fetcher) FetchVersionLatest(ctx context.Context, latest Latest) (Latest, error) {
|
||||
return fetcher.Fetch(ctx, f.HTTPClient, latest)
|
||||
return fetcher.Fetch(ctx, f.HTTPClient, f.cdnURL, latest)
|
||||
}
|
||||
|
||||
// FetchImageInfo fetches the given image info from the versions API.
|
||||
func (f *Fetcher) FetchImageInfo(ctx context.Context, imageInfo ImageInfo) (ImageInfo, error) {
|
||||
return fetcher.Fetch(ctx, f.HTTPClient, imageInfo)
|
||||
return fetcher.Fetch(ctx, f.HTTPClient, f.cdnURL, imageInfo)
|
||||
}
|
||||
|
||||
// FetchCLIInfo fetches the given cli info from the versions API.
|
||||
func (f *Fetcher) FetchCLIInfo(ctx context.Context, cliInfo CLIInfo) (CLIInfo, error) {
|
||||
return fetcher.Fetch(ctx, f.HTTPClient, cliInfo)
|
||||
return fetcher.Fetch(ctx, f.HTTPClient, f.cdnURL, cliInfo)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue