2024-02-28 08:55:54 +00:00
|
|
|
package feature
|
|
|
|
|
2024-07-05 07:36:00 +00:00
|
|
|
import "slices"
|
|
|
|
|
2024-02-28 08:55:54 +00:00
|
|
|
//go:generate enumer -type Key -transform snake -trimprefix Key
|
|
|
|
type Key int
|
|
|
|
|
|
|
|
const (
|
|
|
|
KeyUnspecified Key = iota
|
|
|
|
KeyLoginDefaultOrg
|
|
|
|
KeyTriggerIntrospectionProjections
|
|
|
|
KeyLegacyIntrospection
|
2024-03-12 13:50:13 +00:00
|
|
|
KeyUserSchema
|
2024-03-20 10:18:46 +00:00
|
|
|
KeyTokenExchange
|
2024-04-09 17:21:21 +00:00
|
|
|
KeyActions
|
2024-05-24 11:32:57 +00:00
|
|
|
KeyImprovedPerformance
|
2024-02-28 08:55:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
//go:generate enumer -type Level -transform snake -trimprefix Level
|
|
|
|
type Level int
|
|
|
|
|
|
|
|
const (
|
|
|
|
LevelUnspecified Level = iota
|
|
|
|
LevelSystem
|
|
|
|
LevelInstance
|
|
|
|
LevelOrg
|
|
|
|
LevelProject
|
|
|
|
LevelApp
|
|
|
|
LevelUser
|
|
|
|
)
|
|
|
|
|
|
|
|
type Features struct {
|
2024-05-24 11:32:57 +00:00
|
|
|
LoginDefaultOrg bool `json:"login_default_org,omitempty"`
|
|
|
|
TriggerIntrospectionProjections bool `json:"trigger_introspection_projections,omitempty"`
|
|
|
|
LegacyIntrospection bool `json:"legacy_introspection,omitempty"`
|
|
|
|
UserSchema bool `json:"user_schema,omitempty"`
|
|
|
|
TokenExchange bool `json:"token_exchange,omitempty"`
|
|
|
|
Actions bool `json:"actions,omitempty"`
|
|
|
|
ImprovedPerformance []ImprovedPerformanceType `json:"improved_performance,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ImprovedPerformanceType int32
|
|
|
|
|
|
|
|
const (
|
|
|
|
ImprovedPerformanceTypeUnknown = iota
|
|
|
|
ImprovedPerformanceTypeOrgByID
|
2024-07-03 15:00:56 +00:00
|
|
|
ImprovedPerformanceTypeProjectGrant
|
|
|
|
ImprovedPerformanceTypeProject
|
2024-07-04 16:18:43 +00:00
|
|
|
ImprovedPerformanceTypeUserGrant
|
2024-07-05 07:36:00 +00:00
|
|
|
ImprovedPerformanceTypeOrgDomainVerified
|
2024-05-24 11:32:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (f Features) ShouldUseImprovedPerformance(typ ImprovedPerformanceType) bool {
|
2024-07-05 07:36:00 +00:00
|
|
|
return slices.Contains(f.ImprovedPerformance, typ)
|
2024-02-28 08:55:54 +00:00
|
|
|
}
|