openfeature

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 2 Imported by: 21

Documentation

Overview

Package openfeature provides global access to the OpenFeature API.

Deprecated: use github.com/open-feature/go-sdk/openfeature, instead.

Index

Constants

View Source
const (
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.Boolean,
	// instead.
	Boolean = openfeature.Boolean
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.String,
	// instead.
	String = openfeature.String
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.Float,
	// instead.
	Float = openfeature.Float
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.Int,
	// instead.
	Int = openfeature.Int
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.Object,
	// instead.
	Object = openfeature.Object
)
View Source
const (
	// DefaultReason - the resolved value was configured statically, or otherwise fell back to a pre-configured value.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.DefaultReason, instead.
	DefaultReason = openfeature.DefaultReason
	// TargetingMatchReason - the resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.TargetingMatchReason, instead.
	TargetingMatchReason = openfeature.TargetingMatchReason
	// SplitReason - the resolved value was the result of pseudorandom assignment.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.SplitReason, instead.
	SplitReason = openfeature.SplitReason
	// DisabledReason - the resolved value was the result of the flag being disabled in the management system.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.DisabledReason, instead.
	DisabledReason = openfeature.DisabledReason
	// StaticReason - the resolved value is static (no dynamic evaluation)
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.StaticReason, instead.
	StaticReason = openfeature.StaticReason
	// CachedReason - the resolved value was retrieved from cache
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.CachedReason, instead.
	CachedReason = openfeature.CachedReason
	// UnknownReason - the reason for the resolved value could not be determined.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.UnknownReason, instead.
	UnknownReason = openfeature.UnknownReason
	// ErrorReason - the resolved value was the result of an error.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.ErrorReason, instead.
	ErrorReason = openfeature.ErrorReason

	// Deprecated: use github.com/open-feature/go-sdk/openfeature.NotReadyState, instead.
	NotReadyState = openfeature.NotReadyState
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.ReadyState, instead.
	ReadyState = openfeature.ReadyState
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.ErrorState, instead.
	ErrorState = openfeature.ErrorState
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.StaleState, instead.
	StaleState = openfeature.StaleState

	// Deprecated: use github.com/open-feature/go-sdk/openfeature.ProviderReady, instead.
	ProviderReady = openfeature.ProviderReady
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.ProviderConfigChange, instead.
	ProviderConfigChange = openfeature.ProviderConfigChange
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.ProviderStale, instead.
	ProviderStale = openfeature.ProviderStale
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.ProviderError, instead.
	ProviderError = openfeature.ProviderError

	// Deprecated: use github.com/open-feature/go-sdk/openfeature.TargetingKey, instead.
	TargetingKey = openfeature.TargetingKey // evaluation context map key. The targeting key uniquely identifies the subject (end-user, or client service) of a flag evaluation.
)
View Source
const (
	// ProviderNotReadyCode - the value was resolved before the provider was ready.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.UnknownReason, instead.
	ProviderNotReadyCode = openfeature.ProviderNotReadyCode
	// FlagNotFoundCode - the flag could not be found.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.UnknownReason, instead.
	FlagNotFoundCode = openfeature.FlagNotFoundCode
	// ParseErrorCode - an error was encountered parsing data, such as a flag configuration.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.UnknownReason, instead.
	ParseErrorCode = openfeature.ParseErrorCode
	// TypeMismatchCode - the type of the flag value does not match the expected type.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.UnknownReason, instead.
	TypeMismatchCode = openfeature.TypeMismatchCode
	// TargetingKeyMissingCode - the provider requires a targeting key and one was not provided in the evaluation context.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.UnknownReason, instead.
	TargetingKeyMissingCode = openfeature.TargetingKeyMissingCode
	// InvalidContextCode - the evaluation context does not meet provider requirements.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.UnknownReason, instead.
	InvalidContextCode = openfeature.InvalidContextCode
	// GeneralCode - the error was for a reason not enumerated above.
	//
	// Deprecated: use github.com/open-feature/go-sdk/openfeature.UnknownReason, instead.
	GeneralCode = openfeature.GeneralCode
)

Variables

This section is empty.

Functions

func AddHandler deprecated added in v1.5.0

func AddHandler(eventType EventType, callback EventCallback)

AddHandler allows to add API level event handler

Deprecated: use github.com/open-feature/go-sdk/openfeature.AddHandler, instead.

func AddHooks deprecated

func AddHooks(hooks ...Hook)

AddHooks appends to the collection of any previously added hooks

Deprecated: use github.com/open-feature/go-sdk/openfeature.AddHooks, instead.

func RemoveHandler deprecated added in v1.5.0

func RemoveHandler(eventType EventType, callback EventCallback)

RemoveHandler allows to remove API level event handler

Deprecated: use github.com/open-feature/go-sdk/openfeature.RemoveHandler, instead.

func SetEvaluationContext deprecated

func SetEvaluationContext(evalCtx EvaluationContext)

SetEvaluationContext sets the global evaluation context.

Deprecated: use github.com/open-feature/go-sdk/openfeature.SetEvaluationContext, instead.

func SetLogger deprecated

func SetLogger(l logr.Logger)

SetLogger sets the global Logger.

Deprecated: use github.com/open-feature/go-sdk/openfeature.SetLogger, instead.

func SetNamedProvider deprecated added in v1.5.0

func SetNamedProvider(clientName string, provider FeatureProvider) error

SetNamedProvider sets a provider mapped to the given Client name. Provider initialization is asynchronous and status can be checked from provider status

Deprecated: use github.com/open-feature/go-sdk/openfeature.SetNamedProvider, instead.

func SetProvider deprecated

func SetProvider(provider FeatureProvider) error

SetProvider sets the default provider. Provider initialization is asynchronous and status can be checked from provider status

Deprecated: use github.com/open-feature/go-sdk/openfeature.SetProvider, instead.

func Shutdown deprecated added in v1.5.0

func Shutdown()

Shutdown active providers

Deprecated: use github.com/open-feature/go-sdk/openfeature.Shutdown, instead.

Types

type BoolResolutionDetail deprecated

type BoolResolutionDetail = openfeature.BoolResolutionDetail

BoolResolutionDetail provides a resolution detail with boolean type

Deprecated: use github.com/open-feature/go-sdk/openfeature.BoolResolutionDetail, instead.

type BooleanEvaluationDetails deprecated added in v0.5.0

type BooleanEvaluationDetails = openfeature.BooleanEvaluationDetails

Deprecated: use github.com/open-feature/go-sdk/openfeature.BooleanEvaluationDetails, instead.

type Client deprecated

type Client = openfeature.Client

Client implements the behaviour required of an openfeature client

Deprecated: use github.com/open-feature/go-sdk/openfeature.Client, instead.

func NewClient deprecated

func NewClient(name string) *Client

NewClient returns a new Client. Name is a unique identifier for this client

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewClient, instead.

type ClientMetadata deprecated

type ClientMetadata = openfeature.ClientMetadata

ClientMetadata provides a client's metadata

Deprecated: use github.com/open-feature/go-sdk/openfeature.ClientMetadata, instead.

func NewClientMetadata deprecated added in v1.1.0

func NewClientMetadata(name string) ClientMetadata

NewClientMetadata constructs ClientMetadata Allows for simplified hook test cases while maintaining immutability

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewClientMetadata, instead.

type ErrorCode deprecated added in v0.5.0

type ErrorCode = openfeature.ErrorCode

Deprecated: use github.com/open-feature/go-sdk/openfeature.ErrorCode, instead.

type EvaluationContext deprecated

type EvaluationContext = openfeature.EvaluationContext

EvaluationContext provides ambient information for the purposes of flag evaluation The use of the constructor, NewEvaluationContext, is enforced to set EvaluationContext's fields in order to enforce immutability. https://openfeature.dev/specification/sections/evaluation-context

Deprecated: use github.com/open-feature/go-sdk/openfeature.EvaluationContext, instead.

func NewEvaluationContext deprecated added in v0.6.0

func NewEvaluationContext(targetingKey string, attributes map[string]interface{}) EvaluationContext

NewEvaluationContext constructs an EvaluationContext

targetingKey - uniquely identifying the subject (end-user, or client service) of a flag evaluation attributes - contextual data used in flag evaluation

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewEvaluationContext, instead.

func NewTargetlessEvaluationContext deprecated added in v1.6.0

func NewTargetlessEvaluationContext(attributes map[string]interface{}) EvaluationContext

NewTargetlessEvaluationContext constructs an EvaluationContext with an empty targeting key

attributes - contextual data used in flag evaluation

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewTargetlessEvaluationContext, instead.

type EvaluationDetails deprecated

type EvaluationDetails = openfeature.EvaluationDetails

Deprecated: use github.com/open-feature/go-sdk/openfeature.EvaluationDetails, instead.

type EvaluationOptions deprecated

type EvaluationOptions = openfeature.EvaluationOptions

EvaluationOptions should contain a list of hooks to be executed for a flag evaluation

Deprecated: use github.com/open-feature/go-sdk/openfeature.EvaluationOptions, instead.

type Event deprecated added in v1.5.0

type Event = openfeature.Event

Event is an event emitted by a FeatureProvider.

Deprecated: use github.com/open-feature/go-sdk/openfeature.Event, instead.

type EventCallback deprecated added in v1.5.0

type EventCallback = openfeature.EventCallback

Deprecated: use github.com/open-feature/go-sdk/openfeature.EventCallback, instead.

type EventDetails deprecated added in v1.5.0

type EventDetails = openfeature.EventDetails

Deprecated: use github.com/open-feature/go-sdk/openfeature.EventDetails, instead.

type EventHandler deprecated added in v1.5.0

type EventHandler = openfeature.EventHandler

EventHandler is the eventing contract enforced for FeatureProvider

Deprecated: use github.com/open-feature/go-sdk/openfeature.EventHandler, instead.

type EventType deprecated added in v1.5.0

type EventType = openfeature.EventType

EventType emitted by a provider implementation

Deprecated: use github.com/open-feature/go-sdk/openfeature.EventType, instead.

type FeatureProvider deprecated

type FeatureProvider = openfeature.FeatureProvider

FeatureProvider interface defines a set of functions that can be called in order to evaluate a flag. This should be implemented by flag management systems.

Deprecated: use github.com/open-feature/go-sdk/openfeature.FeatureProvider, instead.

type FlagMetadata deprecated added in v1.4.0

type FlagMetadata = openfeature.FlagMetadata

FlagMetadata is a structure which supports definition of arbitrary properties, with keys of type string, and values of type boolean, string, int64 or float64. This structure is populated by a provider for use by an Application Author (via the Evaluation API) or an Application Integrator (via hooks).

Deprecated: use github.com/open-feature/go-sdk/openfeature.FlagMetadata, instead.

type FlattenedContext deprecated added in v0.5.0

type FlattenedContext = openfeature.FlattenedContext

FlattenedContext contains metadata for a given flag evaluation in a flattened structure. TargetingKey ("targetingKey") is stored as a string value if provided in the evaluation context.

Deprecated: use github.com/open-feature/go-sdk/openfeature.FlattenedContext, instead.

type FloatEvaluationDetails deprecated added in v0.5.0

type FloatEvaluationDetails = openfeature.FloatEvaluationDetails

Deprecated: use github.com/open-feature/go-sdk/openfeature.FloatEvaluationDetails, instead.

type FloatResolutionDetail deprecated

type FloatResolutionDetail = openfeature.FloatResolutionDetail

FloatResolutionDetail provides a resolution detail with float64 type

Deprecated: use github.com/open-feature/go-sdk/openfeature.FloatResolutionDetail, instead.

type Hook deprecated

type Hook = openfeature.Hook

Hook allows application developers to add arbitrary behavior to the flag evaluation lifecycle. They operate similarly to middleware in many web frameworks. https://github.com/open-feature/spec/blob/main/specification/hooks.md

Deprecated: use github.com/open-feature/go-sdk/openfeature.Hook, instead.

type HookContext deprecated

type HookContext = openfeature.HookContext

HookContext defines the base level fields of a hook context

Deprecated: use github.com/open-feature/go-sdk/openfeature.HookContext, instead.

func NewHookContext deprecated added in v1.1.0

func NewHookContext(
	flagKey string,
	flagType Type,
	defaultValue interface{},
	clientMetadata ClientMetadata,
	providerMetadata Metadata,
	evaluationContext EvaluationContext,
) HookContext

NewHookContext constructs HookContext Allows for simplified hook test cases while maintaining immutability

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewHookContext, instead.

type HookHints deprecated

type HookHints = openfeature.HookHints

HookHints contains a map of hints for hooks

Deprecated: use github.com/open-feature/go-sdk/openfeature.HookHints, instead.

func NewHookHints deprecated

func NewHookHints(mapOfHints map[string]interface{}) HookHints

NewHookHints constructs HookHints

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewHookHints, instead.

type IClient deprecated

type IClient = openfeature.IClient

IClient defines the behaviour required of an openfeature client

Deprecated: use github.com/open-feature/go-sdk/openfeature.IClient, instead.

type IntEvaluationDetails deprecated added in v0.5.0

type IntEvaluationDetails = openfeature.IntEvaluationDetails

Deprecated: use github.com/open-feature/go-sdk/openfeature.IntEvaluationDetails, instead.

type IntResolutionDetail deprecated

type IntResolutionDetail = openfeature.IntResolutionDetail

IntResolutionDetail provides a resolution detail with int64 type

Deprecated: use github.com/open-feature/go-sdk/openfeature.IntResolutionDetail, instead.

type InterfaceEvaluationDetails deprecated added in v0.5.0

type InterfaceEvaluationDetails = openfeature.InterfaceEvaluationDetails

Deprecated: use github.com/open-feature/go-sdk/openfeature.InterfaceEvaluationDetails, instead.

type InterfaceResolutionDetail deprecated

type InterfaceResolutionDetail = openfeature.InterfaceResolutionDetail

InterfaceResolutionDetail provides a resolution detail with interface{} type

Deprecated: use github.com/open-feature/go-sdk/openfeature.InterfaceResolutionDetail, instead.

type Metadata deprecated

type Metadata = openfeature.Metadata

Metadata provides provider name

Deprecated: use github.com/open-feature/go-sdk/openfeature.Metadata, instead.

func ProviderMetadata deprecated

func ProviderMetadata() Metadata

ProviderMetadata returns the default provider's metadata

Deprecated: use github.com/open-feature/go-sdk/openfeature.ProviderMetadata, instead.

type NoopEventHandler deprecated added in v1.5.0

type NoopEventHandler = openfeature.NoopEventHandler

NoopEventHandler is the out-of-the-box EventHandler which is noop

Deprecated: use github.com/open-feature/go-sdk/openfeature.NoopEventHandler, instead.

type NoopProvider deprecated

type NoopProvider = openfeature.NoopProvider

NoopProvider implements the FeatureProvider interface and provides functions for evaluating flags

Deprecated: use github.com/open-feature/go-sdk/openfeature.NoopProvider, instead.

type NoopStateHandler deprecated added in v1.5.0

type NoopStateHandler = openfeature.NoopStateHandler

NoopStateHandler is a noop StateHandler implementation Status always set to ReadyState to comply with specification

Deprecated: use github.com/open-feature/go-sdk/openfeature.NoopStateHandler, instead.

type Option deprecated added in v0.5.0

type Option = openfeature.Option

Option applies a change to EvaluationOptions

Deprecated: use github.com/open-feature/go-sdk/openfeature.Option, instead.

func WithHookHints deprecated added in v0.5.0

func WithHookHints(hookHints HookHints) Option

WithHookHints applies provided hook hints.

Deprecated: use github.com/open-feature/go-sdk/openfeature.WithHookHints, instead.

func WithHooks deprecated added in v0.5.0

func WithHooks(hooks ...Hook) Option

WithHooks applies provided hooks.

Deprecated: use github.com/open-feature/go-sdk/openfeature.WithHooks, instead.

type ProviderEventDetails deprecated added in v1.5.0

type ProviderEventDetails = openfeature.ProviderEventDetails

ProviderEventDetails is the event payload emitted by FeatureProvider

Deprecated: use github.com/open-feature/go-sdk/openfeature.ProviderEventDetails, instead.

type ProviderResolutionDetail deprecated added in v0.5.0

type ProviderResolutionDetail = openfeature.ProviderResolutionDetail

ProviderResolutionDetail is a structure which contains a subset of the fields defined in the EvaluationDetail, representing the result of the provider's flag resolution process see https://github.com/open-feature/spec/blob/main/specification/types.md#resolution-details N.B we could use generics but to support older versions of go for now we will have type specific resolution detail

Deprecated: use github.com/open-feature/go-sdk/openfeature.ProviderResolutionDetail, instead.

type Reason deprecated added in v0.5.0

type Reason = openfeature.Reason

Reason indicates the semantic reason for a returned flag value

Deprecated: use github.com/open-feature/go-sdk/openfeature.Reason, instead.

type ResolutionDetail deprecated

type ResolutionDetail = openfeature.ResolutionDetail

Deprecated: use github.com/open-feature/go-sdk/openfeature.ResolutionDetail, instead.

type ResolutionError deprecated added in v0.5.0

type ResolutionError = openfeature.ResolutionError

ResolutionError is an enumerated error code with an optional message

Deprecated: use github.com/open-feature/go-sdk/openfeature.ResolutionError, instead.

func NewFlagNotFoundResolutionError deprecated added in v0.5.0

func NewFlagNotFoundResolutionError(msg string) ResolutionError

NewFlagNotFoundResolutionError constructs a resolution error with code FLAG_NOT_FOUND

Explanation - The flag could not be found.

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewFlagNotFoundResolutionError, instead.

func NewGeneralResolutionError deprecated added in v0.5.0

func NewGeneralResolutionError(msg string) ResolutionError

NewGeneralResolutionError constructs a resolution error with code GENERAL

Explanation - The error was for a reason not enumerated above.

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewGeneralResolutionError, instead.

func NewInvalidContextResolutionError deprecated added in v0.5.0

func NewInvalidContextResolutionError(msg string) ResolutionError

NewInvalidContextResolutionError constructs a resolution error with code INVALID_CONTEXT

Explanation - The evaluation context does not meet provider requirements.

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewInvalidContextResolutionError, instead.

func NewParseErrorResolutionError deprecated added in v0.5.0

func NewParseErrorResolutionError(msg string) ResolutionError

NewParseErrorResolutionError constructs a resolution error with code PARSE_ERROR

Explanation - An error was encountered parsing data, such as a flag configuration.

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewParseErrorResolutionError, instead.

func NewProviderNotReadyResolutionError deprecated added in v0.5.0

func NewProviderNotReadyResolutionError(msg string) ResolutionError

NewProviderNotReadyResolutionError constructs a resolution error with code PROVIDER_NOT_READY

Explanation - The value was resolved before the provider was ready.

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewProviderNotReadyResolutionError, instead.

func NewTargetingKeyMissingResolutionError deprecated added in v0.5.0

func NewTargetingKeyMissingResolutionError(msg string) ResolutionError

NewTargetingKeyMissingResolutionError constructs a resolution error with code TARGETING_KEY_MISSING

Explanation - The provider requires a targeting key and one was not provided in the evaluation context.

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewTargetingKeyMissingResolutionError, instead.

func NewTypeMismatchResolutionError deprecated added in v0.5.0

func NewTypeMismatchResolutionError(msg string) ResolutionError

NewTypeMismatchResolutionError constructs a resolution error with code TYPE_MISMATCH

Explanation - The type of the flag value does not match the expected type.

Deprecated: use github.com/open-feature/go-sdk/openfeature.NewTypeMismatchResolutionError, instead.

type State deprecated added in v1.5.0

type State = openfeature.State

State represents the status of the provider

Deprecated: use github.com/open-feature/go-sdk/openfeature.State, instead.

type StateHandler deprecated added in v1.5.0

type StateHandler = openfeature.StateHandler

StateHandler is the contract for initialization & shutdown. FeatureProvider can opt in for this behavior by implementing the interface

Deprecated: use github.com/open-feature/go-sdk/openfeature.StateHandler, instead.

type StringEvaluationDetails deprecated added in v0.5.0

type StringEvaluationDetails = openfeature.StringEvaluationDetails

Deprecated: use github.com/open-feature/go-sdk/openfeature.StringEvaluationDetails, instead.

type StringResolutionDetail deprecated

type StringResolutionDetail = openfeature.StringResolutionDetail

StringResolutionDetail provides a resolution detail with string type

Deprecated: use github.com/open-feature/go-sdk/openfeature.StringResolutionDetail, instead.

type Type deprecated

type Type = openfeature.Type

Type represents the type of a flag

Deprecated: use github.com/open-feature/go-sdk/openfeature.Type, instead.

type UnimplementedHook deprecated

type UnimplementedHook = openfeature.UnimplementedHook

UnimplementedHook implements all hook methods with empty functions Include UnimplementedHook in your hook struct to avoid defining empty functions e.g.

type MyHook = openfeature.MyHook
  UnimplementedHook
}

Deprecated: use github.com/open-feature/go-sdk/openfeature.UnimplementedHook, instead.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL