flags

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidFlagName added in v0.15.3

func ValidFlagName(name string) bool

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
}

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

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 CompanyFlagEntry added in v0.15.0

type CompanyFlagEntry struct {
	Flag        Flag                   `json:"flag"`
	Environment CompanyFlagEnvironment `json:"environment"`
}

type CompanyFlagEnvironment added in v0.15.0

type CompanyFlagEnvironment struct {
	Id            string `json:"id"`
	Name          string `json:"name"`
	EnvironmentId string `json:"environment_id"`
	AgentId       string `json:"agent_id"`
	AgentName     string `json:"agent_name,omitempty"`
	ProjectName   string `json:"project_name,omitempty"`
}

type Details

type Details struct {
	Name        string `json:"name"`
	ID          string `json:"id"`
	LastChanged string `json:"lastChanged,omitempty"`
	Promoted    bool   `json:"promoted,omitempty"`
}

type ErrorCode added in v0.14.7

type ErrorCode string

ErrorCode represents OFREP error codes

const (
	ErrorParseError          ErrorCode = "PARSE_ERROR"
	ErrorTargetingKeyMissing ErrorCode = "TARGETING_KEY_MISSING"
	ErrorInvalidContext      ErrorCode = "INVALID_CONTEXT"
	ErrorFlagNotFound        ErrorCode = "FLAG_NOT_FOUND"
	ErrorTypeMismatch        ErrorCode = "TYPE_MISMATCH"
	ErrorGeneral             ErrorCode = "GENERAL"
)

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 Flag

type Flag struct {
	Enabled bool    `json:"enabled"`
	Details Details `json:"details"`
}

type FlagNameChangeRequest

type FlagNameChangeRequest struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

type GenerateAPIKeyRequest added in v0.14.7

type GenerateAPIKeyRequest struct {
	ProjectID     string `json:"project_id"`
	AgentID       string `json:"agent_id"`
	EnvironmentID string `json:"environment_id,omitempty"`
}

type GenerateAPIKeyResponse added in v0.14.7

type GenerateAPIKeyResponse struct {
	APIKey    string `json:"api_key"`
	ExpiresAt string `json:"expires_at"`
}

type OFREPSystem added in v0.14.7

type OFREPSystem struct {
	Config *ConfigBuilder.Config
}

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(ctx context.Context, projectId, agentId, environmentId, flagKey string) (*Flag, error)

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 Response

type Response struct {
	Flags []Flag `json:"flags"`
}

type SecretMenu

type SecretMenu struct {
	Sequence []string          `json:"sequence,omitempty"`
	Styles   []SecretMenuStyle `json:"styles,omitempty"`
}

type SecretMenuStyle

type SecretMenuStyle struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

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
}

func NewSystem

func NewSystem(cfg *ConfigBuilder.Config) *System

func (*System) CreateFlagInDB

func (s *System) CreateFlagInDB(ctx context.Context, flag flagCreate) error

func (*System) CreateFlags

func (s *System) CreateFlags(w http.ResponseWriter, r *http.Request)

func (*System) DeleteAllFlagsForEnv

func (s *System) DeleteAllFlagsForEnv(ctx context.Context, envId string) error

func (*System) DeleteFlagFromDB

func (s *System) DeleteFlagFromDB(ctx context.Context, flag Flag) error

func (*System) DeleteFlags

func (s *System) DeleteFlags(w http.ResponseWriter, r *http.Request)

func (*System) EditFlag

func (s *System) EditFlag(w http.ResponseWriter, r *http.Request)

func (*System) EditFlagInDB

func (s *System) EditFlagInDB(ctx context.Context, cr FlagNameChangeRequest) error

func (*System) GetAgentFlags

func (s *System) GetAgentFlags(w http.ResponseWriter, r *http.Request)

func (*System) GetAgentFlagsFromDB

func (s *System) GetAgentFlagsFromDB(ctx context.Context, projectId, agentId, environmentId string) (*AgentResponse, error)

func (*System) GetClientFlags

func (s *System) GetClientFlags(w http.ResponseWriter, r *http.Request)

func (*System) GetClientFlagsFromDB

func (s *System) GetClientFlagsFromDB(ctx context.Context, environmentId string) ([]Flag, error)

func (*System) GetCompanyFlagsFromDB added in v0.15.0

func (s *System) GetCompanyFlagsFromDB(ctx context.Context, companyId string) ([]CompanyFlagEntry, error)

func (*System) GetDefaultEnvironment

func (s *System) GetDefaultEnvironment(ctx context.Context, projectId, agentId string) (string, error)

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 (s *System) PromoteFlagInDB(ctx context.Context, flagId string) error

func (*System) UpdateFlagInDB

func (s *System) UpdateFlagInDB(ctx context.Context, flag Flag) error

func (*System) UpdateFlags

func (s *System) UpdateFlags(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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