Documentation ¶
Overview ¶
Package flags containts utilities for managing feature flags.
Index ¶
- func Bool(ctx context.Context, client openfeature.IClient, feature Experiment) bool
- func OpenFeatureProviderFromFlags(ctx context.Context, cfg config.FlagsConfig)
- type Experiment
- type FakeClient
- func (_ *FakeClient) AddHandler(_ openfeature.EventType, _ openfeature.EventCallback)
- func (_ *FakeClient) AddHooks(_ ...openfeature.Hook)
- func (f *FakeClient) Boolean(_ context.Context, flag string, defaultValue bool, ...) bool
- func (f *FakeClient) BooleanValue(_ context.Context, flag string, defaultValue bool, ...) (bool, error)
- func (_ *FakeClient) BooleanValueDetails(_ context.Context, _ string, _ bool, _ openfeature.EvaluationContext, ...) (openfeature.BooleanEvaluationDetails, error)
- func (_ *FakeClient) EvaluationContext() openfeature.EvaluationContext
- func (f *FakeClient) Float(_ context.Context, flag string, defaultValue float64, ...) float64
- func (f *FakeClient) FloatValue(_ context.Context, flag string, defaultValue float64, ...) (float64, error)
- func (_ *FakeClient) FloatValueDetails(_ context.Context, _ string, _ float64, _ openfeature.EvaluationContext, ...) (openfeature.FloatEvaluationDetails, error)
- func (f *FakeClient) Int(_ context.Context, flag string, defaultValue int64, ...) int64
- func (f *FakeClient) IntValue(_ context.Context, flag string, defaultValue int64, ...) (int64, error)
- func (_ *FakeClient) IntValueDetails(_ context.Context, _ string, _ int64, _ openfeature.EvaluationContext, ...) (openfeature.IntEvaluationDetails, error)
- func (_ *FakeClient) Metadata() openfeature.ClientMetadata
- func (f *FakeClient) Object(_ context.Context, flag string, defaultValue interface{}, ...) interface{}
- func (f *FakeClient) ObjectValue(_ context.Context, flag string, defaultValue interface{}, ...) (interface{}, error)
- func (_ *FakeClient) ObjectValueDetails(_ context.Context, _ string, _ interface{}, _ openfeature.EvaluationContext, ...) (openfeature.InterfaceEvaluationDetails, error)
- func (_ *FakeClient) RemoveHandler(_ openfeature.EventType, _ openfeature.EventCallback)
- func (_ *FakeClient) SetEvaluationContext(_ openfeature.EvaluationContext)
- func (f *FakeClient) String(_ context.Context, flag string, defaultValue string, ...) string
- func (f *FakeClient) StringValue(_ context.Context, flag string, defaultValue string, ...) (string, error)
- func (_ *FakeClient) StringValueDetails(_ context.Context, _ string, _ string, _ openfeature.EvaluationContext, ...) (openfeature.StringEvaluationDetails, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
func Bool(ctx context.Context, client openfeature.IClient, feature Experiment) bool
Bool provides a simple wrapper around client.Boolean to normalize usage for Minder.
func OpenFeatureProviderFromFlags ¶
func OpenFeatureProviderFromFlags(ctx context.Context, cfg config.FlagsConfig)
OpenFeatureProviderFromFlags installs an OpenFeature Provider based on the flags config. This curently only supports the GoFeatureFlag file-based provider.
Types ¶
type Experiment ¶
type Experiment string
Experiment is a type alias for a feature flag experiment, to ensure that all feature flags are registered in constants.go, not littered all over the codebase.
const ( // UserManagement enables user management, i.e. invitations, role assignments, etc. UserManagement Experiment = "user_management" // DockerHubProvider enables the DockerHub provider. DockerHubProvider Experiment = "dockerhub_provider" // GitLabProvider enables the GitLab provider. GitLabProvider Experiment = "gitlab_provider" // VulnCheckErrorTemplate enables improved evaluation details // messages in the vulncheck rule. VulnCheckErrorTemplate Experiment = "vulncheck_error_template" )
type FakeClient ¶
FakeClient implements a simple in-memory client for testing.
see https://github.com/open-feature/go-sdk/issues/266 for the proper support.
func (*FakeClient) AddHandler ¶
func (_ *FakeClient) AddHandler(_ openfeature.EventType, _ openfeature.EventCallback)
AddHandler implements openfeature.IClient.
func (*FakeClient) AddHooks ¶
func (_ *FakeClient) AddHooks(_ ...openfeature.Hook)
AddHooks implements openfeature.IClient.
func (*FakeClient) Boolean ¶
func (f *FakeClient) Boolean(_ context.Context, flag string, defaultValue bool, _ openfeature.EvaluationContext, _ ...openfeature.Option) bool
Boolean implements openfeature.IClient.
func (*FakeClient) BooleanValue ¶
func (f *FakeClient) BooleanValue(_ context.Context, flag string, defaultValue bool, _ openfeature.EvaluationContext, _ ...openfeature.Option) (bool, error)
BooleanValue implements openfeature.IClient.
func (*FakeClient) BooleanValueDetails ¶
func (_ *FakeClient) BooleanValueDetails(_ context.Context, _ string, _ bool, _ openfeature.EvaluationContext, _ ...openfeature.Option) (openfeature.BooleanEvaluationDetails, error)
BooleanValueDetails implements openfeature.IClient.
func (*FakeClient) EvaluationContext ¶
func (_ *FakeClient) EvaluationContext() openfeature.EvaluationContext
EvaluationContext implements openfeature.IClient.
func (*FakeClient) Float ¶
func (f *FakeClient) Float(_ context.Context, flag string, defaultValue float64, _ openfeature.EvaluationContext, _ ...openfeature.Option) float64
Float implements openfeature.IClient.
func (*FakeClient) FloatValue ¶
func (f *FakeClient) FloatValue(_ context.Context, flag string, defaultValue float64, _ openfeature.EvaluationContext, _ ...openfeature.Option) (float64, error)
FloatValue implements openfeature.IClient.
func (*FakeClient) FloatValueDetails ¶
func (_ *FakeClient) FloatValueDetails(_ context.Context, _ string, _ float64, _ openfeature.EvaluationContext, _ ...openfeature.Option) (openfeature.FloatEvaluationDetails, error)
FloatValueDetails implements openfeature.IClient.
func (*FakeClient) Int ¶
func (f *FakeClient) Int(_ context.Context, flag string, defaultValue int64, _ openfeature.EvaluationContext, _ ...openfeature.Option) int64
Int implements openfeature.IClient.
func (*FakeClient) IntValue ¶
func (f *FakeClient) IntValue(_ context.Context, flag string, defaultValue int64, _ openfeature.EvaluationContext, _ ...openfeature.Option) (int64, error)
IntValue implements openfeature.IClient.
func (*FakeClient) IntValueDetails ¶
func (_ *FakeClient) IntValueDetails(_ context.Context, _ string, _ int64, _ openfeature.EvaluationContext, _ ...openfeature.Option) (openfeature.IntEvaluationDetails, error)
IntValueDetails implements openfeature.IClient.
func (*FakeClient) Metadata ¶
func (_ *FakeClient) Metadata() openfeature.ClientMetadata
Metadata implements openfeature.IClient.
func (*FakeClient) Object ¶
func (f *FakeClient) Object(_ context.Context, flag string, defaultValue interface{}, _ openfeature.EvaluationContext, _ ...openfeature.Option) interface{}
Object implements openfeature.IClient.
func (*FakeClient) ObjectValue ¶
func (f *FakeClient) ObjectValue(_ context.Context, flag string, defaultValue interface{}, _ openfeature.EvaluationContext, _ ...openfeature.Option) (interface{}, error)
ObjectValue implements openfeature.IClient.
func (*FakeClient) ObjectValueDetails ¶
func (_ *FakeClient) ObjectValueDetails(_ context.Context, _ string, _ interface{}, _ openfeature.EvaluationContext, _ ...openfeature.Option) (openfeature.InterfaceEvaluationDetails, error)
ObjectValueDetails implements openfeature.IClient.
func (*FakeClient) RemoveHandler ¶
func (_ *FakeClient) RemoveHandler(_ openfeature.EventType, _ openfeature.EventCallback)
RemoveHandler implements openfeature.IClient.
func (*FakeClient) SetEvaluationContext ¶
func (_ *FakeClient) SetEvaluationContext(_ openfeature.EvaluationContext)
SetEvaluationContext implements openfeature.IClient.
func (*FakeClient) String ¶
func (f *FakeClient) String(_ context.Context, flag string, defaultValue string, _ openfeature.EvaluationContext, _ ...openfeature.Option) string
String implements openfeature.IClient.
func (*FakeClient) StringValue ¶
func (f *FakeClient) StringValue(_ context.Context, flag string, defaultValue string, _ openfeature.EvaluationContext, _ ...openfeature.Option) (string, error)
StringValue implements openfeature.IClient.
func (*FakeClient) StringValueDetails ¶
func (_ *FakeClient) StringValueDetails(_ context.Context, _ string, _ string, _ openfeature.EvaluationContext, _ ...openfeature.Option) (openfeature.StringEvaluationDetails, error)
StringValueDetails implements openfeature.IClient.