Documentation
¶
Index ¶
- type APIKeyClaims
- type APIKeyHTTPSystem
- type APIKeySystem
- type AgentResponse
- type BulkEvaluationRequest
- type BulkEvaluationResponse
- type Details
- type ErrorCode
- type ErrorEvaluationResponse
- type EvaluationContext
- type EvaluationRequest
- type Flag
- type FlagNameChangeRequest
- type GenerateAPIKeyRequest
- type GenerateAPIKeyResponse
- type OFREPSystem
- func (s *OFREPSystem) EvaluateBulkFlags(w http.ResponseWriter, r *http.Request)
- func (s *OFREPSystem) EvaluateSingleFlag(w http.ResponseWriter, r *http.Request)
- func (s *OFREPSystem) GetSingleFlagFromDB(projectId, agentId, environmentId, flagKey string) (*Flag, error)
- func (s *OFREPSystem) SetContext(ctx context.Context) *OFREPSystem
- type ResolutionReason
- type Response
- type SecretMenu
- type SecretMenuStyle
- type SuccessEvaluationResponse
- type System
- func (s *System) CreateFlagInDB(flag flagCreate) error
- func (s *System) CreateFlags(w http.ResponseWriter, r *http.Request)
- func (s *System) DeleteAllFlagsForEnv(envId string) error
- func (s *System) DeleteFlagFromDB(flag Flag) error
- func (s *System) DeleteFlags(w http.ResponseWriter, r *http.Request)
- func (s *System) EditFlag(w http.ResponseWriter, r *http.Request)
- func (s *System) EditFlagInDB(cr FlagNameChangeRequest) error
- func (s *System) GetAgentFlags(w http.ResponseWriter, r *http.Request)
- func (s *System) GetAgentFlagsFromDB(projectId, agentId, environmentId string) (*AgentResponse, error)
- func (s *System) GetClientFlags(w http.ResponseWriter, r *http.Request)
- func (s *System) GetClientFlagsFromDB(environmentId string) ([]Flag, error)
- func (s *System) GetDefaultEnvironment(projectId, agentId string) (string, error)
- func (s *System) PromoteFlag(w http.ResponseWriter, r *http.Request)
- func (s *System) PromoteFlagInDB(flagId string) error
- func (s *System) SetContext(ctx context.Context) *System
- func (s *System) UpdateFlagInDB(flag Flag) error
- func (s *System) UpdateFlags(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeyClaims ¶ added in v0.14.7
type APIKeyClaims struct {
ProjectID string `json:"project_id"`
AgentID string `json:"agent_id"`
EnvironmentID string `json:"environment_id,omitempty"`
jwt.RegisteredClaims
}
APIKeyClaims represents the JWT claims for an API key
type APIKeyHTTPSystem ¶ added in v0.14.7
type APIKeyHTTPSystem struct {
Config *ConfigBuilder.Config
Context context.Context
}
func NewAPIKeyHTTPSystem ¶ added in v0.14.7
func NewAPIKeyHTTPSystem(cfg *ConfigBuilder.Config) *APIKeyHTTPSystem
func (*APIKeyHTTPSystem) GenerateAPIKeyHandler ¶ added in v0.14.7
func (s *APIKeyHTTPSystem) GenerateAPIKeyHandler(w http.ResponseWriter, r *http.Request)
GenerateAPIKeyHandler handles POST /api-key/generate
func (*APIKeyHTTPSystem) SetContext ¶ added in v0.14.7
func (s *APIKeyHTTPSystem) SetContext(ctx context.Context) *APIKeyHTTPSystem
type APIKeySystem ¶ added in v0.14.7
type APIKeySystem struct {
Config *ConfigBuilder.Config
}
APIKeySystem handles API key generation and validation
func NewAPIKeySystem ¶ added in v0.14.7
func NewAPIKeySystem(cfg *ConfigBuilder.Config) *APIKeySystem
func (*APIKeySystem) GenerateAPIKey ¶ added in v0.14.7
func (s *APIKeySystem) GenerateAPIKey(projectID, agentID, environmentID string) (string, error)
GenerateAPIKey creates a JWT-based API key with project, agent, and environment info
func (*APIKeySystem) ValidateAPIKey ¶ added in v0.14.7
func (s *APIKeySystem) ValidateAPIKey(tokenString string) (*APIKeyClaims, error)
ValidateAPIKey parses and validates a JWT-based API key
type AgentResponse ¶
type AgentResponse struct {
IntervalAllowed int `json:"intervalAllowed,omitempty"`
SecretMenu SecretMenu `json:"secretMenu,omitempty"`
Flags []Flag `json:"flags,omitempty"`
}
type BulkEvaluationRequest ¶ added in v0.14.7
type BulkEvaluationRequest struct {
Context EvaluationContext `json:"context,omitempty"`
}
BulkEvaluationRequest is for evaluating multiple flags
type BulkEvaluationResponse ¶ added in v0.14.7
type BulkEvaluationResponse struct {
Flags []interface{} `json:"flags"`
}
BulkEvaluationResponse wraps multiple flag evaluations
type ErrorEvaluationResponse ¶ added in v0.14.7
type ErrorEvaluationResponse struct {
Key string `json:"key"`
ErrorCode ErrorCode `json:"errorCode"`
ErrorDetails string `json:"errorDetails,omitempty"`
Reason ResolutionReason `json:"reason"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
ErrorEvaluationResponse represents a failed flag evaluation
type EvaluationContext ¶ added in v0.14.7
type EvaluationContext struct {
TargetingKey string `json:"targetingKey,omitempty"`
Context map[string]interface{} `json:"context,omitempty"`
}
EvaluationContext represents the context for flag evaluation
type EvaluationRequest ¶ added in v0.14.7
type EvaluationRequest struct {
Context EvaluationContext `json:"context,omitempty"`
}
EvaluationRequest is the request body for flag evaluation
type FlagNameChangeRequest ¶
type GenerateAPIKeyRequest ¶ added in v0.14.7
type GenerateAPIKeyResponse ¶ added in v0.14.7
type OFREPSystem ¶ added in v0.14.7
type OFREPSystem struct {
Config *ConfigBuilder.Config
Context context.Context
}
OFREPSystem handles OFREP endpoints
func NewOFREPSystem ¶ added in v0.14.7
func NewOFREPSystem(cfg *ConfigBuilder.Config) *OFREPSystem
func (*OFREPSystem) EvaluateBulkFlags ¶ added in v0.14.7
func (s *OFREPSystem) EvaluateBulkFlags(w http.ResponseWriter, r *http.Request)
EvaluateBulkFlags handles POST /ofrep/v1/evaluate/flags
func (*OFREPSystem) EvaluateSingleFlag ¶ added in v0.14.7
func (s *OFREPSystem) EvaluateSingleFlag(w http.ResponseWriter, r *http.Request)
EvaluateSingleFlag handles POST /ofrep/v1/evaluate/flags/{key}
func (*OFREPSystem) GetSingleFlagFromDB ¶ added in v0.14.7
func (s *OFREPSystem) GetSingleFlagFromDB(projectId, agentId, environmentId, flagKey string) (*Flag, error)
func (*OFREPSystem) SetContext ¶ added in v0.14.7
func (s *OFREPSystem) SetContext(ctx context.Context) *OFREPSystem
type ResolutionReason ¶ added in v0.14.7
type ResolutionReason string
ResolutionReason represents why a flag was resolved to its value
const ( ReasonStatic ResolutionReason = "STATIC" ReasonTargetingMatch ResolutionReason = "TARGETING_MATCH" ReasonDefault ResolutionReason = "DEFAULT" ReasonDisabled ResolutionReason = "DISABLED" ReasonError ResolutionReason = "ERROR" ReasonUnknown ResolutionReason = "UNKNOWN" )
type SecretMenu ¶
type SecretMenu struct {
Sequence []string `json:"sequence,omitempty"`
Styles []SecretMenuStyle `json:"styles,omitempty"`
}
type SecretMenuStyle ¶
type SuccessEvaluationResponse ¶ added in v0.14.7
type SuccessEvaluationResponse struct {
Key string `json:"key"`
Reason ResolutionReason `json:"reason"`
Variant string `json:"variant,omitempty"`
Value interface{} `json:"value"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
SuccessEvaluationResponse represents a successful flag evaluation
type System ¶
type System struct {
Config *ConfigBuilder.Config
Context context.Context
}
func NewSystem ¶
func NewSystem(cfg *ConfigBuilder.Config) *System
func (*System) CreateFlagInDB ¶
func (*System) CreateFlags ¶
func (s *System) CreateFlags(w http.ResponseWriter, r *http.Request)
func (*System) DeleteAllFlagsForEnv ¶
func (*System) DeleteFlagFromDB ¶
func (*System) DeleteFlags ¶
func (s *System) DeleteFlags(w http.ResponseWriter, r *http.Request)
func (*System) EditFlagInDB ¶
func (s *System) EditFlagInDB(cr FlagNameChangeRequest) error
func (*System) GetAgentFlags ¶
func (s *System) GetAgentFlags(w http.ResponseWriter, r *http.Request)
func (*System) GetAgentFlagsFromDB ¶
func (s *System) GetAgentFlagsFromDB(projectId, agentId, environmentId string) (*AgentResponse, error)
func (*System) GetClientFlags ¶
func (s *System) GetClientFlags(w http.ResponseWriter, r *http.Request)
func (*System) GetClientFlagsFromDB ¶
func (*System) GetDefaultEnvironment ¶
func (*System) PromoteFlag ¶ added in v0.14.7
func (s *System) PromoteFlag(w http.ResponseWriter, r *http.Request)
func (*System) PromoteFlagInDB ¶ added in v0.14.7
func (*System) UpdateFlagInDB ¶
func (*System) UpdateFlags ¶
func (s *System) UpdateFlags(w http.ResponseWriter, r *http.Request)