domain

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCacheNotFound is the error returned by a cache when there is no value for
	// a Key/Field
	ErrCacheNotFound = errors.New("cache: not found")

	// ErrCacheInternal is the error returned by a cache when there is an unexpected error
	ErrCacheInternal = errors.New("cache: internal error")
)

Functions

func ConvertTarget

func ConvertTarget(t Target) evaluation.Target

ConvertTarget converts types.Target to the evaluation.Target

Types

type AuthAPIKey

type AuthAPIKey string

AuthAPIKey is the APIKey type used for authentication lookups

func NewAuthAPIKey

func NewAuthAPIKey(key string) AuthAPIKey

NewAuthAPIKey creates an AuthAPIKey from a key

type AuthConfig

type AuthConfig struct {
	APIKey        AuthAPIKey
	EnvironmentID EnvironmentID
}

AuthConfig contains a hashed APIKey and the EnvironmentID it belongs to

type AuthRequest

type AuthRequest struct {
	APIKey string
	Target Target
}

AuthRequest contains the fields sent in an authentication request

type AuthResponse

type AuthResponse struct {
	AuthToken string `json:"authToken"`
}

AuthResponse contains the fields returned in an authentication response

type Claims

type Claims struct {
	Environment       string `json:"environment"`
	ClusterIdentifier string `json:"clusterIdentifier"`
	jwt.StandardClaims
}

Claims are custom jwt claims used by the proxy for generating a jwt token

type EnvironmentHealth

type EnvironmentHealth struct {
	ID           string       `json:"id"`
	StreamStatus StreamStatus `json:"streamStatus"`
}

EnvironmentHealth contains the health info for an environment

type EnvironmentID

type EnvironmentID string

EnvironmentID is the environment value we store in the cache

func (*EnvironmentID) MarshalBinary

func (a *EnvironmentID) MarshalBinary() ([]byte, error)

MarshalBinary marshals an EnvironmentID to bytes. Currently it uses json marshaling but if we want to optimise storage space we could use something more efficient

func (*EnvironmentID) UnmarshalBinary

func (a *EnvironmentID) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals bytes to an EnvironmentID

type EvaluationsByFeatureRequest

type EvaluationsByFeatureRequest struct {
	EnvironmentID     string
	TargetIdentifier  string
	FeatureIdentifier string
}

EvaluationsByFeatureRequest contains the fields sent in a GET /client/env/{environmentUUID}/target/{target}/evaluations/{feature} request

type EvaluationsRequest

type EvaluationsRequest struct {
	EnvironmentID    string
	TargetIdentifier string
}

EvaluationsRequest contains the fields sent in a GET /client/env/{environmentUUID}/target/{target}/evaluations

type FeatureConfig

type FeatureConfig struct {
	FeatureFlag
}

FeatureConfig is the type containing FeatureConfig information and is what we return from /GET client/env/<env>/feature-configs

type FeatureConfigByIdentifierRequest

type FeatureConfigByIdentifierRequest struct {
	EnvironmentID string
	Identifier    string
}

FeatureConfigByIdentifierRequest contains the fields sent in a GET /client/env/{environmentUUID}/feature-configs/{identifier}

type FeatureConfigRequest

type FeatureConfigRequest struct {
	EnvironmentID string
}

FeatureConfigRequest contains the fields sent in a GET /client/env/{environmentUUID}/feature-configs

type FeatureFlag

type FeatureFlag rest.FeatureConfig

FeatureFlag stores feature flag data

func (*FeatureFlag) MarshalBinary

func (f *FeatureFlag) MarshalBinary() ([]byte, error)

MarshalBinary marshals a FeatureFlag to bytes. Currently it just uses json marshaling but if we want to optimise storage space we could use something more efficient

func (*FeatureFlag) UnmarshalBinary

func (f *FeatureFlag) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals bytes to a FeatureFlag

type FeatureFlagKey

type FeatureFlagKey string

FeatureFlagKey is the key that maps to a FeatureConfig

func NewFeatureConfigKey

func NewFeatureConfigKey(envID string, identifier string) FeatureFlagKey

NewFeatureConfigKey creates a FeatureFlagKey from an environment and identifier

func NewFeatureConfigsKey

func NewFeatureConfigsKey(envID string) FeatureFlagKey

NewFeatureConfigsKey creates a FeatureFlagKey from and environmet

type HealthResponse

type HealthResponse struct {
	Environments []EnvironmentHealth `json:"environments"`
	CacheStatus  string              `json:"cacheStatus"`
}

HealthResponse contains the fields returned in a healthcheck response

type MetricsRequest

type MetricsRequest struct {
	EnvironmentID string `json:"environment_id"`
	clientgen.Metrics
}

MetricsRequest contains the fields sent in a POST /metrics request

type SDKClientMap

type SDKClientMap struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

SDKClientMap is a map of environmentIDs to sdks

func NewSDKClientMap

func NewSDKClientMap() *SDKClientMap

NewSDKClientMap creates an SDKClientMap

func (*SDKClientMap) Copy

func (s *SDKClientMap) Copy() map[string]*harness.CfClient

Copy returns a copy of the map

func (*SDKClientMap) Set

func (s *SDKClientMap) Set(key string, value *harness.CfClient)

Set sets a key and value in the map

func (*SDKClientMap) StreamConnected

func (s *SDKClientMap) StreamConnected(key string) bool

StreamConnected checks if the sdk for the given key has a healthy stream connection. If an SDK doesn't exist for the key it will return false

type Segment

type Segment rest.Segment

Segment is a rest.Segment that we can declare methods on

func (*Segment) MarshalBinary

func (s *Segment) MarshalBinary() ([]byte, error)

MarshalBinary marshals a Segment to bytes. Currently it uses json marshaling but if we want to optimise storage space we could use something more efficient

func (*Segment) UnmarshalBinary

func (s *Segment) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals bytes to a Segment

type SegmentKey

type SegmentKey string

SegmentKey is the key that maps to a Segment

func NewSegmentKey

func NewSegmentKey(envID string, identifier string) SegmentKey

NewSegmentKey creates a SegmentKey from an environment and identifier

func NewSegmentsKey

func NewSegmentsKey(envID string) SegmentKey

NewSegmentsKey creates a SegmentKey from an environment

type StreamRequest

type StreamRequest struct {
	APIKey string `json:"api_key"`
}

StreamRequest contains the fields sent in a GET /stream request

type StreamResponse

type StreamResponse struct {
	GripChannel string
}

StreamResponse contains the fields returned by a Stream request

type StreamState

type StreamState string

StreamState is the connection state for a stream

const (
	// StreamStateConnected is the status for when a stream is connected
	StreamStateConnected StreamState = "CONNECTED"
	// StreamStateDisconnected is the status for when a stream is disconnected
	StreamStateDisconnected StreamState = "DISCONNECTED"
	// StreamStateInitializing is the status for when the stream is initialising
	StreamStateInitializing StreamState = "INITIALIZING"
)

type StreamStatus

type StreamStatus struct {
	State StreamState `json:"state"`
	Since int64       `json:"since"`
}

StreamStatus contains a streams state

type Target

type Target struct {
	admingen.Target
}

Target is a admingen.Target that we can declare methods on

func (*Target) MarshalBinary

func (t *Target) MarshalBinary() ([]byte, error)

MarshalBinary marshals a Target to bytes. Currently it uses json marshaling but if we want to optimise storage space we could use something more efficient

func (*Target) UnmarshalBinary

func (t *Target) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals bytes to a Target

type TargetKey

type TargetKey string

TargetKey is the key that maps to a Target

func NewTargetKey

func NewTargetKey(envID string, identifier string) TargetKey

NewTargetKey creates a TargetKey from an environment and identifier

func NewTargetsKey

func NewTargetsKey(envID string) TargetKey

NewTargetsKey creates a TargetKey from an environment

type TargetSegmentsByIdentifierRequest

type TargetSegmentsByIdentifierRequest struct {
	EnvironmentID string
	Identifier    string
}

TargetSegmentsByIdentifierRequest contains the fields sent in a GET /client/env/{environmentUUID}/target-segments/{identifier}

type TargetSegmentsRequest

type TargetSegmentsRequest struct {
	EnvironmentID string
}

TargetSegmentsRequest contains the fields sent in a GET /client/env/{environmentUUID}/target-segments

type Token

type Token struct {
	// contains filtered or unexported fields
}

Token is a type that contains a generated token string and the claims

func NewToken

func NewToken(tokenString string, claims Claims) Token

NewToken creates a new token

func (Token) Claims

func (t Token) Claims() Claims

Claims returns the tokens claims

func (Token) TokenString

func (t Token) TokenString() string

TokenString returns the auth token string

Jump to

Keyboard shortcuts

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