mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Use licenses to populate the Entitlements API (#3715)
* Use licenses for entitlements API Signed-off-by: Spike Curtis <spike@coder.com> * Tests for entitlements API Signed-off-by: Spike Curtis <spike@coder.com> * Add commentary about FeatureService Signed-off-by: Spike Curtis <spike@coder.com> * Lint Signed-off-by: Spike Curtis <spike@coder.com> * Quiet down the logs Signed-off-by: Spike Curtis <spike@coder.com> * Tell revive it's ok Signed-off-by: Spike Curtis <spike@coder.com> Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
+14
-1
@@ -7,7 +7,20 @@ import (
|
||||
"github.com/coder/coder/codersdk"
|
||||
)
|
||||
|
||||
func entitlements(rw http.ResponseWriter, _ *http.Request) {
|
||||
// FeaturesService is the interface for interacting with enterprise features.
|
||||
type FeaturesService interface {
|
||||
EntitlementsAPI(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
// TODO
|
||||
// Get returns the implementations for feature interfaces. Parameter `s `must be a pointer to a
|
||||
// struct type containing feature interfaces as fields. The FeatureService sets all fields to
|
||||
// the correct implementations depending on whether the features are turned on.
|
||||
// Get(s any) error
|
||||
}
|
||||
|
||||
type featuresService struct{}
|
||||
|
||||
func (featuresService) EntitlementsAPI(rw http.ResponseWriter, _ *http.Request) {
|
||||
features := make(map[string]codersdk.Feature)
|
||||
for _, f := range codersdk.FeatureNames {
|
||||
features[f] = codersdk.Feature{
|
||||
|
||||
Reference in New Issue
Block a user