mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-27 00:19:36 -05:00
4d6a7fa759
* license: refactor license check to be agnostic of input * license: remove unused code * cli: only check license file in enterprise version Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * bazel: fix enterprise CLI build * bazel: add keep directive * Update internal/constellation/apply.go Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com> * license: check for return value --------- Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com>
35 lines
742 B
Go
35 lines
742 B
Go
//go:build enterprise
|
|
|
|
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package license
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
|
)
|
|
|
|
type Checker struct {
|
|
quotaChecker QuotaChecker
|
|
}
|
|
|
|
func NewChecker(quotaChecker QuotaChecker) *Checker {
|
|
return &Checker{
|
|
quotaChecker: quotaChecker,
|
|
}
|
|
}
|
|
|
|
// CheckLicense contacts the license server to fetch quota information for the given license.
|
|
func (c *Checker) CheckLicense(ctx context.Context, provider cloudprovider.Provider, licenseID string) (QuotaCheckResponse, error) {
|
|
return c.quotaChecker.QuotaCheck(ctx, QuotaCheckRequest{
|
|
License: licenseID,
|
|
Action: Init,
|
|
Provider: provider.String(),
|
|
})
|
|
}
|