Documentation ¶
Overview ¶
package client contains code to manage CVM versions in Constellation's CDN API. It is used to upload and delete "latest" versions for AMD SEV-SNP and Intel TDX.
Index ¶
- Constants
- Variables
- func IsInputNewerThanOtherVersion(variant variant.Variant, inputVersion, otherVersion any) bool
- type Client
- func (c Client) DeleteVersion(ctx context.Context, attestation variant.Variant, versionStr string) error
- func (c Client) List(ctx context.Context, attestation variant.Variant) (attestationconfigapi.List, error)
- func (c Client) UploadLatestVersion(ctx context.Context, attestationVariant variant.Variant, ...) error
Constants ¶
const VersionFormat = "2006-01-02-15-04"
VersionFormat is the format of the version name in the S3 bucket.
Variables ¶
var ErrNoNewerVersion = errors.New("input version is not newer than latest API version")
ErrNoNewerVersion is returned if the input version is not newer than the latest API version.
Functions ¶
func IsInputNewerThanOtherVersion ¶ added in v2.18.0
IsInputNewerThanOtherVersion compares the input version with the other version and returns true if the input version is newer. This function panics if the input versions are not TDX or SEV-SNP versions.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages (modifies) the version information for the attestation variants.
func New ¶
func New(ctx context.Context, cfg staticupload.Config, cosignPwd, privateKey []byte, dryRun bool, versionWindowSize int, log *slog.Logger) (*Client, apiclient.CloseFunc, error)
New returns a new Client.
func (Client) DeleteVersion ¶
func (c Client) DeleteVersion(ctx context.Context, attestation variant.Variant, versionStr string) error
DeleteVersion deletes the given version (without .json suffix) from the API.
func (Client) List ¶
func (c Client) List(ctx context.Context, attestation variant.Variant) (attestationconfigapi.List, error)
List returns the list of versions for the given attestation variant.
func (Client) UploadLatestVersion ¶
func (c Client) UploadLatestVersion( ctx context.Context, attestationVariant variant.Variant, inputVersion, latestVersionInAPI any, now time.Time, force bool, ) error
UploadLatestVersion saves the given version to the cache, determines the smallest TCB version in the cache among the last cacheWindowSize versions and updates the latest version in the API if there is an update. force can be used to bypass the validation logic against the cached versions.