servicedef

package
v2.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package servicedef contains definitions for the REST protocol that test services must implement. See the top-level README.md for more details.

The package is used by the test harness, but can also be imported by any test service code that is Go-based.

Index

Constants

View Source
const (
	CommandEvaluateFlag             = "evaluate"
	CommandEvaluateAllFlags         = "evaluateAll"
	CommandIdentifyEvent            = "identifyEvent"
	CommandCustomEvent              = "customEvent"
	CommandAliasEvent               = "aliasEvent"
	CommandFlushEvents              = "flushEvents"
	CommandGetBigSegmentStoreStatus = "getBigSegmentStoreStatus"
	CommandContextBuild             = "contextBuild"
	CommandContextConvert           = "contextConvert"
	CommandContextComparison        = "contextComparison"
	CommandSecureModeHash           = "secureModeHash"
	CommandMigrationVariation       = "migrationVariation"
	CommandMigrationOperation       = "migrationOperation"
)
View Source
const (
	ValueTypeBool   = "bool"
	ValueTypeInt    = "int"
	ValueTypeDouble = "double"
	ValueTypeString = "string"
	ValueTypeAny    = "any"
)
View Source
const (
	Redis    = SDKConfigPersistentType("redis")
	DynamoDB = SDKConfigPersistentType("dynamodb")
	Consul   = SDKConfigPersistentType("consul")
)
View Source
const (
	CacheModeOff      = SDKConfigPersistentMode("off")
	CacheModeTTL      = SDKConfigPersistentMode("ttl")
	CacheModeInfinite = SDKConfigPersistentMode("infinite")
)
View Source
const (
	CapabilityClientSide         = "client-side"
	CapabilityServerSide         = "server-side"
	CapabilityStronglyTyped      = "strongly-typed"
	CapabilityMobile             = "mobile"
	CapabilityPHP                = "php"
	CapabilityRoku               = "roku"
	CapabilitySingleton          = "singleton"
	CapabilityClientIndependence = "client-independence"

	CapabilityAllFlagsWithReasons                = "all-flags-with-reasons"
	CapabilityAllFlagsClientSideOnly             = "all-flags-client-side-only"
	CapabilityAllFlagsDetailsOnlyForTrackedFlags = "all-flags-details-only-for-tracked-flags"

	CapabilityBigSegments                 = "big-segments"
	CapabilityContextType                 = "context-type"
	CapabilityContextComparison           = "context-comparison"
	CapabilitySecureModeHash              = "secure-mode-hash"
	CapabilityServerSidePolling           = "server-side-polling"
	CapabilityServiceEndpoints            = "service-endpoints"
	CapabilityTags                        = "tags"
	CapabilityUserType                    = "user-type"
	CapabilityFiltering                   = "filtering"
	CapabilityFilteringStrict             = "filtering-strict"
	CapabilityAutoEnvAttributes           = "auto-env-attributes"
	CapabilityMigrations                  = "migrations"
	CapabilityEventSampling               = "event-sampling"
	CapabilityEventGzip                   = "event-gzip"
	CapabilityOptionalEventGzip           = "optional-event-gzip"
	CapabilityETagCaching                 = "etag-caching"
	CapabilityInlineContext               = "inline-context"
	CapabilityAnonymousRedaction          = "anonymous-redaction"
	CapabilityPollingGzip                 = "polling-gzip"
	CapabilityEvaluationHooks             = "evaluation-hooks"
	CapabilityClientPrereqEvents          = "client-prereq-events"
	CapabilityPersistentDataStoreRedis    = "persistent-data-store-redis"
	CapabilityPersistentDataStoreConsul   = "persistent-data-store-consul"
	CapabilityPersistentDataStoreDynamoDB = "persistent-data-store-dynamodb"

	// CapabilityTLSVerifyPeer means the SDK is capable of establishing a TLS session and verifying
	// its peer. This is generally a standard capability of all SDKs.
	// However, the additional tests this enables may cause the suite to run slower than normal and may cause
	// unexpected behavior. Therefore, it should be manually tested first.
	CapabilityTLSVerifyPeer = "tls:verify-peer"

	// CapabilityTLSSkipVerifyPeer means the SDK is capable of establishing a TLS session but can be configured to
	// skip the peer verification step. This allows the SDK to establish a connection with the test harness using
	// a self-signed certificate without a CA. Not all SDKs have this capability.
	CapabilityTLSSkipVerifyPeer = "tls:skip-verify-peer"

	// CapabilityTLSCustomCA means the SDK is capable of establishing a TLS session and configuring peer verification
	// to use a custom CA certificate. The path to this CA cert is provided to the SDK. The SDK should then configure this
	// path as the only CA cert in its trust store (rather than adding it to an existing trust store.)
	CapabilityTLSCustomCA = "tls:custom-ca"

	CapabilityOmitAnonymousContexts = "omit-anonymous-contexts"

	// CapabilityWrapper indicates that the SDK supports setting wrapper name and version and including them in request
	// headers.
	CapabilityWrapper = "wrapper"

	// CapabilityHTTPProxy indicates that the SDK supports setting an HTTP proxy, through which the SDK will
	// make all requests.
	CapabilityHTTPProxy = "http-proxy"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeDefinition added in v2.3.0

type AttributeDefinition struct {
	Name  string        `json:"name"`
	Value ldvalue.Value `json:"value,omitempty"`
}

type BigSegmentStoreStatusResponse

type BigSegmentStoreStatusResponse struct {
	Available bool `json:"available"`
	Stale     bool `json:"stale"`
}

type CommandParams

type CommandParams struct {
	Command            string                               `json:"command"`
	Evaluate           o.Maybe[EvaluateFlagParams]          `json:"evaluate,omitempty"`
	EvaluateAll        o.Maybe[EvaluateAllFlagsParams]      `json:"evaluateAll,omitempty"`
	CustomEvent        o.Maybe[CustomEventParams]           `json:"customEvent,omitempty"`
	IdentifyEvent      o.Maybe[IdentifyEventParams]         `json:"identifyEvent,omitempty"`
	ContextBuild       o.Maybe[ContextBuildParams]          `json:"contextBuild,omitempty"`
	ContextConvert     o.Maybe[ContextConvertParams]        `json:"contextConvert,omitempty"`
	ContextComparison  o.Maybe[ContextComparisonPairParams] `json:"contextComparison,omitempty"`
	SecureModeHash     o.Maybe[SecureModeHashParams]        `json:"secureModeHash,omitempty"`
	MigrationVariation o.Maybe[MigrationVariationParams]    `json:"migrationVariation,omitempty"`
	MigrationOperation o.Maybe[MigrationOperationParams]    `json:"migrationOperation,omitempty"`
}

type ContextBuildParams

type ContextBuildParams struct {
	Single *ContextBuildSingleParams  `json:"single,omitempty"`
	Multi  []ContextBuildSingleParams `json:"multi,omitempty"`
}

type ContextBuildResponse

type ContextBuildResponse struct {
	Output string `json:"output"`
	Error  string `json:"error"`
}

type ContextBuildSingleParams

type ContextBuildSingleParams struct {
	Kind      *string                  `json:"kind,omitempty"`
	Key       string                   `json:"key"`
	Name      *string                  `json:"name,omitempty"`
	Anonymous *bool                    `json:"anonymous,omitempty"`
	Private   []string                 `json:"private,omitempty"`
	Custom    map[string]ldvalue.Value `json:"custom,omitempty"`
}

type ContextComparisonPairParams added in v2.3.0

type ContextComparisonPairParams struct {
	Context1 ContextComparisonParams `json:"context1"`
	Context2 ContextComparisonParams `json:"context2"`
}

type ContextComparisonParams added in v2.3.0

type ContextComparisonParams struct {
	Single *ContextComparisonSingleParams  `json:"single,omitempty"`
	Multi  []ContextComparisonSingleParams `json:"multi,omitempty"`
}

type ContextComparisonResponse added in v2.3.0

type ContextComparisonResponse struct {
	Equals bool `json:"equals"`
}

type ContextComparisonSingleParams added in v2.3.0

type ContextComparisonSingleParams struct {
	Kind              string                `json:"kind"`
	Key               string                `json:"key"`
	Attributes        []AttributeDefinition `json:"attributes,omitempty"`
	PrivateAttributes []PrivateAttribute    `json:"privateAttributes:omitempty"`
}

type ContextConvertParams

type ContextConvertParams struct {
	Input string `json:"input"`
}

type CreateInstanceParams

type CreateInstanceParams struct {
	Configuration SDKConfigParams `json:"configuration"`
	Tag           string          `json:"tag"`
}

type CustomEventParams

type CustomEventParams struct {
	EventKey     string                     `json:"eventKey"`
	Context      o.Maybe[ldcontext.Context] `json:"context,omitempty"`
	User         json.RawMessage            `json:"user,omitempty"`
	Data         ldvalue.Value              `json:"data,omitempty"`
	OmitNullData bool                       `json:"omitNullData"`
	MetricValue  o.Maybe[float64]           `json:"metricValue,omitempty"`
}

type EvaluateAllFlagsParams

type EvaluateAllFlagsParams struct {
	Context                    o.Maybe[ldcontext.Context] `json:"context,omitempty"`
	User                       json.RawMessage            `json:"user,omitempty"`
	WithReasons                bool                       `json:"withReasons"`
	ClientSideOnly             bool                       `json:"clientSideOnly"`
	DetailsOnlyForTrackedFlags bool                       `json:"detailsOnlyForTrackedFlags"`
}

type EvaluateAllFlagsResponse

type EvaluateAllFlagsResponse struct {
	State map[string]ldvalue.Value `json:"state"`
}

type EvaluateFlagParams

type EvaluateFlagParams struct {
	FlagKey      string                     `json:"flagKey"`
	Context      o.Maybe[ldcontext.Context] `json:"context,omitempty"`
	User         json.RawMessage            `json:"user,omitempty"`
	ValueType    ValueType                  `json:"valueType"`
	DefaultValue ldvalue.Value              `json:"defaultValue"`
	Detail       bool                       `json:"detail"`
}

type EvaluateFlagResponse

type EvaluateFlagResponse struct {
	Value          ldvalue.Value                      `json:"value"`
	VariationIndex o.Maybe[int]                       `json:"variationIndex,omitempty"`
	Reason         o.Maybe[ldreason.EvaluationReason] `json:"reason,omitempty"`
}

type EvaluationSeriesContext added in v2.9.0

type EvaluationSeriesContext struct {
	FlagKey      string            `json:"flagKey"`
	Context      ldcontext.Context `json:"context"`
	DefaultValue ldvalue.Value     `json:"defaultValue"`
	Method       string            `json:"method"`
}

type HookExecutionPayload added in v2.9.0

type HookExecutionPayload struct {
	EvaluationSeriesContext o.Maybe[EvaluationSeriesContext]  `json:"evaluationSeriesContext"`
	EvaluationSeriesData    o.Maybe[map[string]ldvalue.Value] `json:"evaluationSeriesData"`
	EvaluationDetail        o.Maybe[EvaluateFlagResponse]     `json:"evaluationDetail"`
	Stage                   o.Maybe[HookStage]                `json:"stage"`
}

type HookStage added in v2.9.0

type HookStage string
const (
	BeforeEvaluation HookStage = "beforeEvaluation"
	AfterEvaluation  HookStage = "afterEvaluation"
)

type IdentifyEventParams

type IdentifyEventParams struct {
	Context o.Maybe[ldcontext.Context] `json:"context"`
	User    json.RawMessage            `json:"user,omitempty"`
}

type MigrationOperationParams added in v2.2.0

type MigrationOperationParams struct {
	Key                string                     `json:"key"`
	Context            ldcontext.Context          `json:"context"`
	DefaultStage       ldmigration.Stage          `json:"defaultStage"`
	ReadExecutionOrder ldmigration.ExecutionOrder `json:"readExecutionOrder"`
	Operation          ldmigration.Operation      `json:"operation"`
	OldEndpoint        string                     `json:"oldEndpoint"`
	NewEndpoint        string                     `json:"newEndpoint"`
	Payload            o.Maybe[string]            `json:"payload,omitempty"`
	TrackLatency       bool                       `json:"trackLatency"`
	TrackErrors        bool                       `json:"trackErrors"`
	TrackConsistency   bool                       `json:"trackConsistency"`
}

type MigrationOperationResponse added in v2.2.0

type MigrationOperationResponse struct {
	Result string `json:"result"`
}

type MigrationVariationParams added in v2.2.0

type MigrationVariationParams struct {
	Key          string            `json:"key"`
	Context      ldcontext.Context `json:"context"`
	DefaultStage ldmigration.Stage `json:"defaultStage"`
}

type MigrationVariationResponse added in v2.2.0

type MigrationVariationResponse struct {
	Result string `json:"result"`
}

type PrivateAttribute added in v2.3.0

type PrivateAttribute struct {
	Value   string `json:"value"`
	Literal bool   `json:"literal"`
}

type SDKConfigBigSegmentsParams

type SDKConfigBigSegmentsParams struct {
	CallbackURI          string                              `json:"callbackUri"`
	UserCacheSize        o.Maybe[int]                        `json:"userCacheSize,omitempty"`
	UserCacheTimeMS      o.Maybe[ldtime.UnixMillisecondTime] `json:"userCacheTimeMs,omitempty"`
	StatusPollIntervalMS o.Maybe[ldtime.UnixMillisecondTime] `json:"statusPollIntervalMs,omitempty"`
	StaleAfterMS         o.Maybe[ldtime.UnixMillisecondTime] `json:"staleAfterMs,omitempty"`
}

type SDKConfigClientSideParams

type SDKConfigClientSideParams struct {
	InitialContext               o.Maybe[ldcontext.Context] `json:"initialContext,omitempty"`
	InitialUser                  json.RawMessage            `json:"initialUser,omitempty"`
	EvaluationReasons            o.Maybe[bool]              `json:"evaluationReasons,omitempty"`
	UseReport                    o.Maybe[bool]              `json:"useReport,omitempty"`
	IncludeEnvironmentAttributes o.Maybe[bool]              `json:"includeEnvironmentAttributes,omitempty"`
}

type SDKConfigEvaluationHookData added in v2.9.0

type SDKConfigEvaluationHookData map[string]ldvalue.Value

type SDKConfigEventParams

type SDKConfigEventParams struct {
	BaseURI                 string                              `json:"baseUri,omitempty"`
	Capacity                o.Maybe[int]                        `json:"capacity,omitempty"`
	EnableDiagnostics       bool                                `json:"enableDiagnostics"`
	AllAttributesPrivate    bool                                `json:"allAttributesPrivate,omitempty"`
	GlobalPrivateAttributes []string                            `json:"globalPrivateAttributes,omitempty"`
	FlushIntervalMS         o.Maybe[ldtime.UnixMillisecondTime] `json:"flushIntervalMs,omitempty"`
	OmitAnonymousContexts   bool                                `json:"omitAnonymousContexts,omitempty"`
	EnableGzip              o.Maybe[bool]                       `json:"enableGzip,omitempty"`
}

type SDKConfigHookInstance added in v2.9.0

type SDKConfigHookInstance struct {
	Name        string                                    `json:"name"`
	CallbackURI string                                    `json:"callbackUri"`
	Data        map[HookStage]SDKConfigEvaluationHookData `json:"data,omitempty"`
	Errors      map[HookStage]o.Maybe[string]             `json:"errors,omitempty"`
}

type SDKConfigHooksParams added in v2.9.0

type SDKConfigHooksParams struct {
	Hooks []SDKConfigHookInstance `json:"hooks"`
}

type SDKConfigParams

type SDKConfigParams struct {
	Credential          string                                      `json:"credential"`
	StartWaitTimeMS     o.Maybe[ldtime.UnixMillisecondTime]         `json:"startWaitTimeMs,omitempty"`
	InitCanFail         bool                                        `json:"initCanFail,omitempty"`
	ServiceEndpoints    o.Maybe[SDKConfigServiceEndpointsParams]    `json:"serviceEndpoints,omitempty"`
	TLS                 o.Maybe[SDKConfigTLSParams]                 `json:"tls,omitempty"`
	Proxy               o.Maybe[SDKConfigProxyParams]               `json:"proxy,omitempty"`
	Streaming           o.Maybe[SDKConfigStreamingParams]           `json:"streaming,omitempty"`
	Polling             o.Maybe[SDKConfigPollingParams]             `json:"polling,omitempty"`
	Events              o.Maybe[SDKConfigEventParams]               `json:"events,omitempty"`
	BigSegments         o.Maybe[SDKConfigBigSegmentsParams]         `json:"bigSegments,omitempty"`
	Tags                o.Maybe[SDKConfigTagsParams]                `json:"tags,omitempty"`
	ClientSide          o.Maybe[SDKConfigClientSideParams]          `json:"clientSide,omitempty"`
	Hooks               o.Maybe[SDKConfigHooksParams]               `json:"hooks,omitempty"`
	Wrapper             o.Maybe[SDKConfigWrapper]                   `json:"wrapper,omitempty"`
	PersistentDataStore o.Maybe[SDKConfigPersistentDataStoreParams] `json:"persistentDataStore,omitempty"`
}

type SDKConfigPersistentCache added in v2.25.0

type SDKConfigPersistentCache struct {
	Mode SDKConfigPersistentMode `json:"mode"`

	// This value is only valid when the Mode is set to TTL. It must be a positive integer.
	TTL o.Maybe[int] `json:"ttl,omitempty"`
}

type SDKConfigPersistentDataStoreParams

type SDKConfigPersistentDataStoreParams struct {
	Store SDKConfigPersistentStore `json:"store"`
	Cache SDKConfigPersistentCache `json:"cache"`
}

type SDKConfigPersistentMode added in v2.25.0

type SDKConfigPersistentMode string

type SDKConfigPersistentStore added in v2.25.0

type SDKConfigPersistentStore struct {
	Type   SDKConfigPersistentType `json:"type"`
	Prefix o.Maybe[string]         `json:"prefix,omitempty"`
	DSN    string                  `json:"dsn"`
}

type SDKConfigPersistentType added in v2.25.0

type SDKConfigPersistentType string

type SDKConfigPollingParams

type SDKConfigPollingParams struct {
	BaseURI        string                              `json:"baseUri,omitempty"`
	PollIntervalMS o.Maybe[ldtime.UnixMillisecondTime] `json:"pollIntervalMs,omitempty"`
	Filter         o.Maybe[string]                     `json:"filter,omitempty"`
}

type SDKConfigProxyParams added in v2.26.0

type SDKConfigProxyParams struct {
	HTTPProxy o.Maybe[string] `json:"httpProxy,omitempty"`
}

type SDKConfigServiceEndpointsParams

type SDKConfigServiceEndpointsParams struct {
	Streaming string `json:"streaming,omitempty"`
	Polling   string `json:"polling,omitempty"`
	Events    string `json:"events,omitempty"`
}

type SDKConfigStreamingParams

type SDKConfigStreamingParams struct {
	BaseURI             string                              `json:"baseUri,omitempty"`
	InitialRetryDelayMS o.Maybe[ldtime.UnixMillisecondTime] `json:"initialRetryDelayMs,omitempty"`
	Filter              o.Maybe[string]                     `json:"filter,omitempty"`
}

type SDKConfigTLSParams added in v2.13.0

type SDKConfigTLSParams struct {
	SkipVerifyPeer bool   `json:"skipVerifyPeer,omitempty"`
	CustomCAFile   string `json:"customCAFile,omitempty"`
}

type SDKConfigTagsParams

type SDKConfigTagsParams struct {
	ApplicationID      o.Maybe[string] `json:"applicationId,omitempty"`
	ApplicationVersion o.Maybe[string] `json:"applicationVersion,omitempty"`
}

type SDKConfigWrapper added in v2.18.0

type SDKConfigWrapper struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type SecureModeHashParams

type SecureModeHashParams struct {
	Context o.Maybe[ldcontext.Context] `json:"context,omitempty"`
	User    json.RawMessage            `json:"user,omitempty"`
}

type SecureModeHashResponse

type SecureModeHashResponse struct {
	Result string `json:"result"`
}

type StatusRep

type StatusRep struct {
	serviceinfo.TestServiceInfo
	ClientVersion string `json:"clientVersion"`
}

type ValueType

type ValueType string

Directories

Path Synopsis
Package callbackfixtures contains definitions for the REST protocol that test services must implement, specifically for callback requests from the test service to the test harness.
Package callbackfixtures contains definitions for the REST protocol that test services must implement, specifically for callback requests from the test service to the test harness.

Jump to

Keyboard shortcuts

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