Documentation
¶
Overview ¶
Package appconfig -- this file implements the experiment RUN half of the A/B-testing family (experiment_definitions.go implements the definition half). Unlike deployments.go's growth-curve state machine, an experiment run has no duration to progress through automatically: real AWS AppConfig keeps a run RUNNING, serving its configured exposure percentage, until a caller explicitly stops it (or updates it). So there is no background reconciler goroutine here -- StartExperimentRun/StopExperimentRun/ UpdateExperimentRun perform their entire state transition synchronously, and ListExperimentRunEvents returns exactly what those calls recorded as they happened.
This backend does not model the underlying "real" deployment AWS creates to actually serve treatment variations to production traffic, nor an analytics engine that would compute variant metrics/statistical significance from live exposure -- see ExperimentRunResult's doc comment in models.go and the results_verdict discussion in PARITY.md for what this means for what StopExperimentRun's Result field can and cannot contain.
Package appconfig provides an in-memory stub for the AWS AppConfig service, which manages feature flags and application configuration.
Index ¶
- Variables
- type AccountSettings
- type Application
- type AppliedExtension
- type AttributeValue
- type ConfigurationProfile
- type DeletionProtectionSettings
- type Deployment
- type DeploymentEvent
- type DeploymentParameters
- type DeploymentStrategy
- type Environment
- type ExperimentDefinition
- type ExperimentDefinitionSnapshot
- type ExperimentRun
- type ExperimentRunEvent
- type ExperimentRunResult
- type Extension
- type ExtensionAction
- type ExtensionAssociation
- type ExtensionParameter
- type FlagValue
- type Handler
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type HostedConfigurationVersion
- type InMemoryBackend
- func (b *InMemoryBackend) CreateApplication(name, description string, tags map[string]string) (*Application, error)
- func (b *InMemoryBackend) CreateConfigurationProfile(...) (*ConfigurationProfile, error)
- func (b *InMemoryBackend) CreateDeploymentStrategy(name, description string, deploymentDuration, bakeTime int32, ...) (*DeploymentStrategy, error)
- func (b *InMemoryBackend) CreateEnvironment(applicationID, name, description string, monitors []Monitor, ...) (*Environment, error)
- func (b *InMemoryBackend) CreateExperimentDefinition(applicationIdentifier, name, environmentIdentifier, ... string, ...) (*ExperimentDefinition, error)
- func (b *InMemoryBackend) CreateExtension(name, description string, actions map[string][]ExtensionAction, ...) (*Extension, error)
- func (b *InMemoryBackend) CreateExtensionAssociation(extensionIdentifier, resourceIdentifier string, parameters map[string]string, ...) (*ExtensionAssociation, error)
- func (b *InMemoryBackend) CreateHostedConfigurationVersion(applicationID, profileID, contentType, description, versionLabel string, ...) (*HostedConfigurationVersion, error)
- func (b *InMemoryBackend) CurrentDeployedConfiguration(application, environment, configuration string) ([]byte, string, string, error)
- func (b *InMemoryBackend) DeleteApplication(applicationID string) error
- func (b *InMemoryBackend) DeleteConfigurationProfile(applicationID, profileID string) error
- func (b *InMemoryBackend) DeleteDeploymentStrategy(strategyID string) error
- func (b *InMemoryBackend) DeleteEnvironment(applicationID, environmentID string) error
- func (b *InMemoryBackend) DeleteExperimentDefinition(applicationIdentifier, experimentDefinitionIdentifier, deleteType string) error
- func (b *InMemoryBackend) DeleteExtension(extensionIdentifier string, versionNumber int32) error
- func (b *InMemoryBackend) DeleteExtensionAssociation(extensionAssociationID string) error
- func (b *InMemoryBackend) DeleteHostedConfigurationVersion(applicationID, profileID string, versionNumber int32) error
- func (b *InMemoryBackend) GetAccountSettings() (*AccountSettings, error)
- func (b *InMemoryBackend) GetApplication(applicationID string) (*Application, error)
- func (b *InMemoryBackend) GetConfiguration(application, environment, configuration string) (*HostedConfigurationVersion, error)
- func (b *InMemoryBackend) GetConfigurationProfile(applicationID, profileID string) (*ConfigurationProfile, error)
- func (b *InMemoryBackend) GetDeployment(applicationID, environmentID string, deploymentNumber int32) (*Deployment, error)
- func (b *InMemoryBackend) GetDeploymentStrategy(strategyID string) (*DeploymentStrategy, error)
- func (b *InMemoryBackend) GetEnvironment(applicationID, environmentID string) (*Environment, error)
- func (b *InMemoryBackend) GetExperimentDefinition(applicationIdentifier, experimentDefinitionIdentifier string) (*ExperimentDefinition, error)
- func (b *InMemoryBackend) GetExperimentRun(applicationIdentifier, experimentDefinitionIdentifier string, run int32) (*ExperimentRun, error)
- func (b *InMemoryBackend) GetExtension(extensionIdentifier string, versionNumber int32) (*Extension, error)
- func (b *InMemoryBackend) GetExtensionAssociation(extensionAssociationID string) (*ExtensionAssociation, error)
- func (b *InMemoryBackend) GetHostedConfigurationVersion(applicationID, profileID string, versionNumber int32) (*HostedConfigurationVersion, error)
- func (b *InMemoryBackend) ListApplications(nextToken string, maxResults int) ([]Application, string)
- func (b *InMemoryBackend) ListConfigurationProfiles(applicationID, nextToken string, maxResults int) ([]ConfigurationProfile, string, error)
- func (b *InMemoryBackend) ListDeploymentStrategies(nextToken string, maxResults int) ([]DeploymentStrategy, string)
- func (b *InMemoryBackend) ListDeployments(applicationID, environmentID, nextToken string, maxResults int) ([]Deployment, string, error)
- func (b *InMemoryBackend) ListEnvironments(applicationID, nextToken string, maxResults int) ([]Environment, string, error)
- func (b *InMemoryBackend) ListExperimentDefinitions(...) ([]ExperimentDefinition, string)
- func (b *InMemoryBackend) ListExperimentRunEvents(applicationIdentifier, experimentDefinitionIdentifier string, run int32, ...) ([]ExperimentRunEvent, string, error)
- func (b *InMemoryBackend) ListExperimentRuns(...) ([]ExperimentRun, string, error)
- func (b *InMemoryBackend) ListExtensionAssociations(nextToken, extensionIdentifier, resourceIdentifier string, maxResults int) ([]ExtensionAssociation, string)
- func (b *InMemoryBackend) ListExtensions(nextToken string, maxResults int, nameFilter string) ([]Extension, string)
- func (b *InMemoryBackend) ListHostedConfigurationVersions(applicationID, profileID, nextToken, versionLabel string, maxResults int) ([]HostedConfigurationVersion, string, error)
- func (b *InMemoryBackend) ListTagsForResource(resourceArn string) (map[string]string, error)
- func (b *InMemoryBackend) PaginationSecret() string
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartDeployment(...) (*Deployment, error)
- func (b *InMemoryBackend) StartExperimentRun(applicationIdentifier, experimentDefinitionIdentifier, description string, ...) (*ExperimentRun, error)
- func (b *InMemoryBackend) StopDeployment(applicationID, environmentID string, deploymentNumber int32, allowRevert bool) error
- func (b *InMemoryBackend) StopExperimentRun(applicationIdentifier, experimentDefinitionIdentifier string, run int32, ...) (*ExperimentRun, error)
- func (b *InMemoryBackend) TagResource(resourceArn string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceArn string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateAccountSettings(deletionProtection *DeletionProtectionSettings) (*AccountSettings, error)
- func (b *InMemoryBackend) UpdateApplication(applicationID string, name, description *string) (*Application, error)
- func (b *InMemoryBackend) UpdateConfigurationProfile(applicationID, profileID string, name, description, retrievalRoleArn *string, ...) (*ConfigurationProfile, error)
- func (b *InMemoryBackend) UpdateDeploymentStrategy(strategyID, name string, description *string, ...) (*DeploymentStrategy, error)
- func (b *InMemoryBackend) UpdateEnvironment(applicationID, environmentID string, name, description *string, ...) (*Environment, error)
- func (b *InMemoryBackend) UpdateExperimentDefinition(applicationIdentifier, experimentDefinitionIdentifier string, ...) (*ExperimentDefinition, error)
- func (b *InMemoryBackend) UpdateExperimentRun(applicationIdentifier, experimentDefinitionIdentifier string, run int32, ...) (*ExperimentRun, error)
- func (b *InMemoryBackend) UpdateExtension(extensionIdentifier string, description *string, ...) (*Extension, error)
- func (b *InMemoryBackend) UpdateExtensionAssociation(extensionAssociationID string, parameters map[string]string) (*ExtensionAssociation, error)
- func (b *InMemoryBackend) ValidateConfiguration(applicationID, profileID, _ string) error
- type Monitor
- type Provider
- type StorageBackend
- type Treatment
- type TreatmentOverrides
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ( // ErrApplicationNotFound is returned when the requested application does not exist. ErrApplicationNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrEnvironmentNotFound is returned when the requested environment does not exist. ErrEnvironmentNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrConfigurationProfileNotFound is returned when the requested configuration profile does not exist. ErrConfigurationProfileNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrHostedConfigVersionNotFound is returned when the requested hosted configuration version does not exist. ErrHostedConfigVersionNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrDeploymentStrategyNotFound is returned when the requested deployment strategy does not exist. ErrDeploymentStrategyNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrDeploymentNotFound is returned when the requested deployment does not exist. ErrDeploymentNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrExtensionNotFound is returned when the requested extension does not exist. ErrExtensionNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrExtensionAssociationNotFound is returned when the requested extension association does not exist. ErrExtensionAssociationNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrExtensionAlreadyExists is returned when an extension with the same name already exists. ErrExtensionAlreadyExists = awserr.New("ConflictException", awserr.ErrAlreadyExists) // ErrBadRequest is returned when a required field is missing or invalid. ErrBadRequest = awserr.New("BadRequestException", awserr.ErrInvalidParameter) // ErrConflict is returned when a resource with the same name already exists. ErrConflict = awserr.New("ConflictException", awserr.ErrAlreadyExists) // ErrPayloadTooLarge is returned when a hosted configuration version exceeds the maximum size. ErrPayloadTooLarge = awserr.New("PayloadTooLargeException", awserr.ErrInvalidParameter) // ErrExperimentDefinitionNotFound is returned when the requested experiment definition does not exist. ErrExperimentDefinitionNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) // ErrExperimentRunNotFound is returned when the requested experiment run does not exist. ErrExperimentRunNotFound = awserr.New("ResourceNotFoundException", awserr.ErrNotFound) )
Functions ¶
This section is empty.
Types ¶
type AccountSettings ¶
type AccountSettings struct {
DeletionProtection *DeletionProtectionSettings `json:"DeletionProtection,omitempty"`
}
AccountSettings holds account-level AppConfig settings.
type Application ¶
type Application struct {
CreatedAt time.Time `json:"CreatedAt,omitzero"`
UpdatedAt time.Time `json:"UpdatedAt,omitzero"`
ID string `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description,omitempty"`
}
Application represents an AppConfig application. JSON field names match the AWS AppConfig REST API (PascalCase).
type AppliedExtension ¶ added in v1.2.0
type AppliedExtension struct {
Parameters map[string]string `json:"Parameters,omitempty"`
ExtensionAssociationID string `json:"ExtensionAssociationId,omitempty"`
ExtensionID string `json:"ExtensionId,omitempty"`
VersionNumber int32 `json:"VersionNumber,omitempty"`
}
AppliedExtension identifies an extension association that was in effect for an application, environment, or configuration profile when a deployment started.
type AttributeValue ¶ added in v1.2.0
type AttributeValue struct {
BooleanValue *bool `json:"BooleanValue,omitempty"`
NumberValue *float64 `json:"NumberValue,omitempty"`
StringValue *string `json:"StringValue,omitempty"`
NumberArray []float64 `json:"NumberArray,omitempty"`
StringArray []string `json:"StringArray,omitempty"`
}
AttributeValue is a single attribute value attached to a Treatment's FlagValue.AttributeValues map. Real AWS AppConfig models this as a tagged union (aws-sdk-go-v2/service/appconfig/types.AttributeValue: BooleanValue | NumberValue | StringValue | NumberArray | StringArray, selected by which JSON key is present on the wire -- see awsRestjson1_serializeDocumentAttributeValue in the SDK's serializers.go). This backend does not evaluate flag values (no flag-evaluation engine exists here, matching the family's other "storage only" fields), so rather than reimplement a Go union type it stores whichever member(s) the client sent and echoes them back unchanged on the same wire keys -- a faithful round-trip without fabricating semantics this backend can't give meaning to.
type ConfigurationProfile ¶
type ConfigurationProfile struct {
ApplicationID string `json:"ApplicationId"`
ID string `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description,omitempty"`
LocationURI string `json:"LocationUri"`
Type string `json:"Type,omitempty"`
RetrievalRoleArn string `json:"RetrievalRoleArn,omitempty"`
Validators []Validator `json:"Validators,omitempty"`
}
ConfigurationProfile represents an AppConfig configuration profile.
type DeletionProtectionSettings ¶
type DeletionProtectionSettings struct {
Enabled *bool `json:"Enabled,omitempty"`
ProtectionPeriodInMinutes *int32 `json:"ProtectionPeriodInMinutes,omitempty"`
}
DeletionProtectionSettings represents the deletion protection configuration for an account.
type Deployment ¶
type Deployment struct {
StartedAt time.Time `json:"StartedAt,omitzero"`
CompletedAt time.Time `json:"CompletedAt,omitzero"`
ApplicationID string `json:"ApplicationId"`
EnvironmentID string `json:"EnvironmentId"`
ConfigurationProfileID string `json:"ConfigurationProfileId"`
DeploymentStrategyID string `json:"DeploymentStrategyId"`
ConfigurationVersion string `json:"ConfigurationVersion"`
State string `json:"State"`
TriggeredBy string `json:"TriggeredBy,omitempty"`
Description string `json:"Description,omitempty"`
ConfigurationName string `json:"ConfigurationName,omitempty"`
ConfigurationLocationURI string `json:"ConfigurationLocationUri,omitempty"`
GrowthType string `json:"GrowthType,omitempty"`
VersionLabel string `json:"VersionLabel,omitempty"`
EventLog []DeploymentEvent `json:"EventLog,omitempty"`
AppliedExtensions []AppliedExtension `json:"AppliedExtensions,omitempty"`
PercentageComplete float32 `json:"PercentageComplete,omitempty"`
GrowthFactor float32 `json:"GrowthFactor,omitempty"`
DeploymentNumber int32 `json:"DeploymentNumber"`
DeploymentDurationInMinutes int32 `json:"DeploymentDurationInMinutes,omitempty"`
FinalBakeTimeInMinutes int32 `json:"FinalBakeTimeInMinutes,omitempty"`
}
Deployment represents an AppConfig deployment.
type DeploymentEvent ¶ added in v1.2.0
type DeploymentEvent struct {
OccurredAt time.Time `json:"OccurredAt,omitzero"`
EventType string `json:"EventType"`
Description string `json:"Description,omitempty"`
TriggeredBy string `json:"TriggeredBy,omitempty"`
}
DeploymentEvent represents a single event in a deployment's history. ActionInvocations is intentionally unmodeled: this backend does not simulate real extension-action execution (Lambda invocation, SSM documents, ...), so a real SDK client's ActionInvocations would always come back empty here regardless -- see AppliedExtensions on Deployment for the same rationale. That matches AWS's own shape (the field is optional) rather than fabricating invocation data.
type DeploymentParameters ¶ added in v1.2.0
type DeploymentParameters struct {
DynamicExtensionParameters map[string]string `json:"DynamicExtensionParameters,omitempty"`
Tags map[string]string `json:"Tags,omitempty"`
}
DeploymentParameters carries the optional KMS/extension-parameter configuration a StartExperimentRun/StopExperimentRun/UpdateExperimentRun request can attach to the underlying deployment real AWS creates to expose treatments. This backend has no such underlying deployment to configure (see the ExperimentRun doc comment in experiment_runs.go) and real GetExperimentRun/StartExperimentRun/etc. output shapes never echo DeploymentParameters back to the caller either -- so it is accepted on input and intentionally discarded rather than stored, matching what a real client would actually observe (nothing).
type DeploymentStrategy ¶
type DeploymentStrategy struct {
CreatedAt time.Time `json:"CreatedAt,omitzero"`
UpdatedAt time.Time `json:"UpdatedAt,omitzero"`
ID string `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description,omitempty"`
GrowthType string `json:"GrowthType"`
ReplicateTo string `json:"ReplicateTo"`
DeploymentDurationInMinutes int32 `json:"DeploymentDurationInMinutes"`
GrowthFactor float32 `json:"GrowthFactor"`
FinalBakeTimeInMinutes int32 `json:"FinalBakeTimeInMinutes"`
}
DeploymentStrategy represents an AppConfig deployment strategy.
type Environment ¶
type Environment struct {
CreatedAt time.Time `json:"CreatedAt,omitzero"`
UpdatedAt time.Time `json:"UpdatedAt,omitzero"`
ApplicationID string `json:"ApplicationId"`
ID string `json:"Id"`
Name string `json:"Name"`
Description string `json:"Description,omitempty"`
State string `json:"State"`
Monitors []Monitor `json:"Monitors,omitempty"`
}
Environment represents an AppConfig environment.
type ExperimentDefinition ¶ added in v1.2.0
type ExperimentDefinition struct {
CreatedAt time.Time `json:"CreatedAt,omitzero"`
UpdatedAt time.Time `json:"UpdatedAt,omitzero"`
ApplicationID string `json:"ApplicationId"`
ID string `json:"Id"`
Name string `json:"Name"`
ConfigurationProfileID string `json:"ConfigurationProfileId"`
EnvironmentID string `json:"EnvironmentId"`
FlagKey string `json:"FlagKey"`
AudienceDescription string `json:"AudienceDescription,omitempty"`
AudienceRule string `json:"AudienceRule"`
Hypothesis string `json:"Hypothesis,omitempty"`
LaunchCriteria string `json:"LaunchCriteria,omitempty"`
KmsKeyIdentifier string `json:"KmsKeyIdentifier,omitempty"`
Status string `json:"Status"`
Control Treatment `json:"Control"`
Treatments []Treatment `json:"Treatments,omitempty"`
}
ExperimentDefinition represents an AppConfig experiment definition: the purpose, scope, and treatment configuration of an A/B test attached to a feature-flag configuration profile.
type ExperimentDefinitionSnapshot ¶ added in v1.2.0
type ExperimentDefinitionSnapshot struct {
ApplicationID string `json:"ApplicationId"`
AudienceDescription string `json:"AudienceDescription,omitempty"`
AudienceRule string `json:"AudienceRule"`
ConfigurationProfileID string `json:"ConfigurationProfileId"`
Control Treatment `json:"Control"`
EnvironmentID string `json:"EnvironmentId"`
FlagKey string `json:"FlagKey"`
Hypothesis string `json:"Hypothesis,omitempty"`
ID string `json:"Id"`
LaunchCriteria string `json:"LaunchCriteria,omitempty"`
Name string `json:"Name"`
Treatments []Treatment `json:"Treatments,omitempty"`
}
ExperimentDefinitionSnapshot captures an ExperimentDefinition's fields at the moment StartExperimentRun was called, matching real AWS's "a snapshot of the experiment definition at the time the run was started" semantics: a later UpdateExperimentDefinition must not retroactively change what an already-started run reports it ran against.
type ExperimentRun ¶ added in v1.2.0
type ExperimentRun struct {
StartedAt time.Time `json:"StartedAt,omitzero"`
EndedAt time.Time `json:"EndedAt,omitzero"`
UpdatedAt time.Time `json:"UpdatedAt,omitzero"`
ApplicationID string `json:"ApplicationId"`
ExperimentDefinitionID string `json:"ExperimentDefinitionId"`
Description string `json:"Description,omitempty"`
Status string `json:"Status"`
Result *ExperimentRunResult `json:"Result,omitempty"`
ExperimentDefinitionSnapshot *ExperimentDefinitionSnapshot `json:"ExperimentDefinitionSnapshot,omitempty"`
TreatmentOverrides TreatmentOverrides `json:"TreatmentOverrides,omitzero"`
Events []ExperimentRunEvent `json:"-"`
ExposurePercentage float32 `json:"ExposurePercentage,omitempty"`
Run int32 `json:"Run"`
}
ExperimentRun represents one execution of an ExperimentDefinition: audience exposure, treatment overrides, and status over its lifetime. Real GetExperimentRun/StartExperimentRun/etc. output shapes have no DeploymentParameters member and no embedded event list -- events are retrieved separately via ListExperimentRunEvents -- so Events is intentionally unexported from JSON (internal bookkeeping only).
type ExperimentRunEvent ¶ added in v1.2.0
type ExperimentRunEvent struct {
OccurredAt time.Time `json:"OccurredAt,omitzero"`
TreatmentOverrides TreatmentOverrides `json:"TreatmentOverrides,omitzero"`
AssociatedDeployment string `json:"AssociatedDeployment,omitempty"`
Description string `json:"Description,omitempty"`
EventType string `json:"EventType"`
TriggeredBy string `json:"TriggeredBy,omitempty"`
ExposurePercentage float32 `json:"ExposurePercentage,omitempty"`
}
ExperimentRunEvent records a single lifecycle event -- run start, an exposure-percentage change, a treatment-override change, or a run stop -- observed during an experiment run. Events are recorded by this backend as they actually occur (see experiment_runs.go), never fabricated after the fact or synthesized as a plausible-looking timeline.
type ExperimentRunResult ¶ added in v1.2.0
type ExperimentRunResult struct {
ExecutiveSummary string `json:"ExecutiveSummary,omitempty"`
ReasonsNotToLaunch string `json:"ReasonsNotToLaunch,omitempty"`
ReasonsToLaunch string `json:"ReasonsToLaunch,omitempty"`
}
ExperimentRunResult captures the free-text, client-supplied narrative outcome of an experiment run (an executive summary and launch/no-launch rationale). This backend has no analytics engine to compute these itself -- see the results_verdict discussion in PARITY.md -- so it only stores and echoes back whatever a caller (typically StopExperimentRun) supplies.
type Extension ¶
type Extension struct {
Actions map[string][]ExtensionAction `json:"Actions,omitempty"`
Parameters map[string]ExtensionParameter `json:"Parameters,omitempty"`
Arn string `json:"Arn"`
Description string `json:"Description,omitempty"`
ID string `json:"Id"`
Name string `json:"Name"`
VersionNumber int32 `json:"VersionNumber"`
}
Extension represents an AppConfig extension.
type ExtensionAction ¶
type ExtensionAction struct {
Name string `json:"Name,omitempty"`
Description string `json:"Description,omitempty"`
RoleArn string `json:"RoleArn,omitempty"`
URI string `json:"Uri,omitempty"`
}
ExtensionAction represents a single action in an AppConfig extension.
type ExtensionAssociation ¶
type ExtensionAssociation struct {
Parameters map[string]string `json:"Parameters,omitempty"`
Arn string `json:"Arn"`
ExtensionArn string `json:"ExtensionArn"`
ID string `json:"Id"`
ResourceArn string `json:"ResourceArn"`
ExtensionVersionNumber int32 `json:"ExtensionVersionNumber"`
}
ExtensionAssociation represents an association between an extension and an AppConfig resource.
type ExtensionParameter ¶
type ExtensionParameter struct {
Description string `json:"Description,omitempty"`
Required bool `json:"Required,omitempty"`
}
ExtensionParameter describes a parameter accepted by an extension.
type FlagValue ¶ added in v1.2.0
type FlagValue struct {
AttributeValues map[string]AttributeValue `json:"AttributeValues,omitempty"`
Enabled bool `json:"Enabled"`
}
FlagValue is the feature flag value served to users assigned to a Treatment.
type Handler ¶
type Handler struct {
Backend StorageBackend
}
Handler is the Echo HTTP handler for AppConfig operations.
func NewHandler ¶
func NewHandler(backend StorageBackend) *Handler
NewHandler creates a new AppConfig Handler.
func (*Handler) ChaosOperations ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler instance handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name based on the parsed path and HTTP method.
func (*Handler) ExtractResource ¶
ExtractResource extracts the primary resource ID from the URL path.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler function for AppConfig operations.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function matching AppConfig REST API requests.
func (*Handler) Snapshot ¶
Snapshot implements persistence.Persistable by delegating to the backend. Handler previously had no Snapshot/Restore of its own -- and neither did InMemoryBackend -- so cli.go's generic setupPersistence (which type-asserts the registered service.Registerable, i.e. the Handler, for a Snapshot/Restore pair) never picked AppConfig up at all: dead wiring, with no persistence underneath it either. This delegation (matching the cleanrooms/codecommit/emr/workmail pattern) is what wires AppConfig into persistence for the first time.
type HostedConfigurationVersion ¶
type HostedConfigurationVersion struct {
CreatedAt time.Time `json:"CreatedAt,omitzero"`
ApplicationID string `json:"ApplicationId"`
ConfigurationProfileID string `json:"ConfigurationProfileId"`
ContentType string `json:"ContentType"`
Description string `json:"Description,omitempty"`
VersionLabel string `json:"VersionLabel,omitempty"`
Content []byte `json:"-"`
VersionNumber int32 `json:"VersionNumber"`
}
HostedConfigurationVersion represents a hosted configuration version.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend implements StorageBackend for AppConfig using a store.Registry of store.Table-backed resource collections.
applications, deploymentStrategies, extensions, and extensionAssociations are flat, top-level collections keyed by their own real identity field (ID), matching the services/sesv2 / services/dax / services/datasync clean-direct-register template.
environments and configProfiles were previously nested two levels deep (outer key = applicationID; inner key = the resource's own ID). Both Environment.ID and ConfigurationProfile.ID are generated by the same globally-random newResourceID() every other resource in this backend uses (not parent-scoped), so -- per the opsworks/datasync "globally-unique ID, bare-ID lookups" precedent -- each registers DIRECTLY on its own ID, with a companion byApp *store.Index (grouping entries by ApplicationID) added additively for the per-application List/cascade-delete operations the nested maps used to answer directly. A second byAppName *store.Index (composite "applicationID|name" key) replaces the old environmentsByName/configProfilesByName nested reverse maps for the per-application name-uniqueness checks.
hostedConfigVersions and deployments were previously nested three levels deep (outer key = applicationID; middle key = profileID/environmentID; inner key = an int32 VersionNumber/DeploymentNumber). Unlike the resource IDs above, VersionNumber and DeploymentNumber are per-parent counters -- unique only within their owning profile/environment, not globally -- so per the composite-key rule each flattens to one *store.Table keyed by a composite "applicationID|parentID|number" string (see hcvKey/deploymentKey below), with companion *store.Index values grouping entries by profile/env (List operations) and by application (DeleteApplication's cascade delete). hostedConfigVersions additionally carries a byLabel *store.Index replacing the old versionLabelIndex raw map: VersionLabel uniqueness is answered by the index instead of a parallel set.
Left as plain maps (not store.Table-backed):
- tags (map[string]map[string]string): its values are plain string maps, not *T, so it does not fit store.Table's keyed-by-identity-value shape.
- versionCounters, deploymentCounters (map[string]map[string]int32): their values are int32, not *T. Both must survive Snapshot/Restore (see persistence.go) since they are the source of truth for the next version/deployment number -- reconstructing them from the tables' current contents would under-count after any delete.
- accountSettings is a single struct, not a map at all.
func NewInMemoryBackend ¶
func NewInMemoryBackend(accountID, region string) *InMemoryBackend
NewInMemoryBackend creates a new InMemoryBackend for AppConfig.
func (*InMemoryBackend) CreateApplication ¶
func (b *InMemoryBackend) CreateApplication(name, description string, tags map[string]string) (*Application, error)
CreateApplication creates a new AppConfig application. See CreateExperimentDefinition's doc comment for why tags are applied directly to b.tags rather than via TagResource.
func (*InMemoryBackend) CreateConfigurationProfile ¶
func (b *InMemoryBackend) CreateConfigurationProfile( applicationID, name, description, locationURI, profileType, retrievalRoleArn string, validators []Validator, tags map[string]string, ) (*ConfigurationProfile, error)
CreateConfigurationProfile creates a new configuration profile. See CreateExperimentDefinition's doc comment for why tags are applied directly to b.tags rather than via TagResource.
func (*InMemoryBackend) CreateDeploymentStrategy ¶
func (b *InMemoryBackend) CreateDeploymentStrategy( name, description string, deploymentDuration, bakeTime int32, growthFactor float32, growthType, replicateTo string, tags map[string]string, ) (*DeploymentStrategy, error)
CreateDeploymentStrategy creates a new deployment strategy. See CreateExperimentDefinition's doc comment for why tags are applied directly to b.tags rather than via TagResource.
func (*InMemoryBackend) CreateEnvironment ¶
func (b *InMemoryBackend) CreateEnvironment( applicationID, name, description string, monitors []Monitor, tags map[string]string, ) (*Environment, error)
CreateEnvironment creates a new environment within an application. See CreateExperimentDefinition's doc comment for why tags are applied directly to b.tags rather than via TagResource.
func (*InMemoryBackend) CreateExperimentDefinition ¶ added in v1.2.0
func (b *InMemoryBackend) CreateExperimentDefinition( applicationIdentifier, name, environmentIdentifier, configurationProfileIdentifier, flagKey, audienceRule, audienceDescription, hypothesis, launchCriteria string, control *Treatment, treatments []Treatment, tags map[string]string, ) (*ExperimentDefinition, error)
CreateExperimentDefinition creates a new experiment definition. See the StorageBackend interface doc comment for parameter semantics.
func (*InMemoryBackend) CreateExtension ¶
func (b *InMemoryBackend) CreateExtension( name, description string, actions map[string][]ExtensionAction, parameters map[string]ExtensionParameter, tags map[string]string, ) (*Extension, error)
CreateExtension creates a new AppConfig extension at version 1. See CreateExperimentDefinition's doc comment for why tags are applied directly to b.tags rather than via TagResource.
func (*InMemoryBackend) CreateExtensionAssociation ¶
func (b *InMemoryBackend) CreateExtensionAssociation( extensionIdentifier, resourceIdentifier string, parameters map[string]string, extensionVersionNumber *int32, tags map[string]string, ) (*ExtensionAssociation, error)
CreateExtensionAssociation creates an association between an extension and a resource. See CreateExperimentDefinition's doc comment for why tags are applied directly to b.tags rather than via TagResource.
func (*InMemoryBackend) CreateHostedConfigurationVersion ¶
func (b *InMemoryBackend) CreateHostedConfigurationVersion( applicationID, profileID, contentType, description, versionLabel string, content []byte, latestVersionNumber *int32, ) (*HostedConfigurationVersion, error)
CreateHostedConfigurationVersion creates a hosted configuration version. latestVersionNumber implements real CreateHostedConfigurationVersionInput's optional optimistic-concurrency check (the "Latest-Version-Number" request header): when non-nil, it must match the profile's current highest version, or the create is rejected with a conflict rather than silently racing another writer.
func (*InMemoryBackend) CurrentDeployedConfiguration ¶ added in v1.2.0
func (b *InMemoryBackend) CurrentDeployedConfiguration( application, environment, configuration string, ) ([]byte, string, string, error)
CurrentDeployedConfiguration returns the content, content type, and version label of the configuration currently active (the most recently COMPLETEd deployment) for the given application/environment/configuration profile. See the StorageBackend interface doc comment for why this exists: it is a public accessor with no caller inside this package today, exposed for a future appconfig -> appconfigdata bridge.
func (*InMemoryBackend) DeleteApplication ¶
func (b *InMemoryBackend) DeleteApplication(applicationID string) error
DeleteApplication deletes an application by ID.
func (*InMemoryBackend) DeleteConfigurationProfile ¶
func (b *InMemoryBackend) DeleteConfigurationProfile(applicationID, profileID string) error
DeleteConfigurationProfile deletes a configuration profile.
func (*InMemoryBackend) DeleteDeploymentStrategy ¶
func (b *InMemoryBackend) DeleteDeploymentStrategy(strategyID string) error
DeleteDeploymentStrategy deletes a deployment strategy.
func (*InMemoryBackend) DeleteEnvironment ¶
func (b *InMemoryBackend) DeleteEnvironment(applicationID, environmentID string) error
DeleteEnvironment deletes an environment.
func (*InMemoryBackend) DeleteExperimentDefinition ¶ added in v1.2.0
func (b *InMemoryBackend) DeleteExperimentDefinition( applicationIdentifier, experimentDefinitionIdentifier, deleteType string, ) error
DeleteExperimentDefinition archives or permanently destroys an experiment definition. See the StorageBackend interface doc comment for deleteType semantics, including the ARCHIVE default this backend applies when deleteType is empty: the real SDK's DeleteType doc text describes ARCHIVE as "hide but preserve" and DESTROY as the explicit opt-in to permanent removal, so an omitted deleteType is treated as the non-destructive choice rather than assuming irreversible deletion was intended (unverified against real AWS -- the SDK does not document a default -- and called out here plus in PARITY.md as an assumption, not a confirmed wire fact).
func (*InMemoryBackend) DeleteExtension ¶
func (b *InMemoryBackend) DeleteExtension(extensionIdentifier string, versionNumber int32) error
DeleteExtension deletes an extension version by identifier (ID or name). A versionNumber of 0 means "not specified" -- matching real AWS AppConfig, this deletes the highest (most recently created) version only, not every version. Deleting the last remaining version removes the extension entirely, including its tags. Returns ErrConflict (matching real AWS's ConflictException) if any ExtensionAssociation still references the version being deleted.
func (*InMemoryBackend) DeleteExtensionAssociation ¶
func (b *InMemoryBackend) DeleteExtensionAssociation(extensionAssociationID string) error
DeleteExtensionAssociation deletes an extension association by ID.
func (*InMemoryBackend) DeleteHostedConfigurationVersion ¶
func (b *InMemoryBackend) DeleteHostedConfigurationVersion( applicationID, profileID string, versionNumber int32, ) error
DeleteHostedConfigurationVersion deletes a hosted configuration version.
func (*InMemoryBackend) GetAccountSettings ¶
func (b *InMemoryBackend) GetAccountSettings() (*AccountSettings, error)
GetAccountSettings returns the account-level AppConfig settings.
func (*InMemoryBackend) GetApplication ¶
func (b *InMemoryBackend) GetApplication(applicationID string) (*Application, error)
GetApplication retrieves an application by ID.
func (*InMemoryBackend) GetConfiguration ¶
func (b *InMemoryBackend) GetConfiguration( application, environment, configuration string, ) (*HostedConfigurationVersion, error)
GetConfiguration retrieves the latest DEPLOYED configuration for the given application, environment, and configuration profile (deprecated API).
func (*InMemoryBackend) GetConfigurationProfile ¶
func (b *InMemoryBackend) GetConfigurationProfile( applicationID, profileID string, ) (*ConfigurationProfile, error)
GetConfigurationProfile retrieves a configuration profile.
func (*InMemoryBackend) GetDeployment ¶
func (b *InMemoryBackend) GetDeployment( applicationID, environmentID string, deploymentNumber int32, ) (*Deployment, error)
GetDeployment retrieves a deployment.
func (*InMemoryBackend) GetDeploymentStrategy ¶
func (b *InMemoryBackend) GetDeploymentStrategy(strategyID string) (*DeploymentStrategy, error)
GetDeploymentStrategy retrieves a deployment strategy by ID.
func (*InMemoryBackend) GetEnvironment ¶
func (b *InMemoryBackend) GetEnvironment( applicationID, environmentID string, ) (*Environment, error)
GetEnvironment retrieves an environment by application and environment ID.
func (*InMemoryBackend) GetExperimentDefinition ¶ added in v1.2.0
func (b *InMemoryBackend) GetExperimentDefinition( applicationIdentifier, experimentDefinitionIdentifier string, ) (*ExperimentDefinition, error)
GetExperimentDefinition retrieves an experiment definition by application and experiment definition identifier (each accepted by ID or name).
func (*InMemoryBackend) GetExperimentRun ¶ added in v1.2.0
func (b *InMemoryBackend) GetExperimentRun( applicationIdentifier, experimentDefinitionIdentifier string, run int32, ) (*ExperimentRun, error)
GetExperimentRun retrieves an experiment run by application, experiment definition identifier, and run number.
func (*InMemoryBackend) GetExtension ¶
func (b *InMemoryBackend) GetExtension( extensionIdentifier string, versionNumber int32, ) (*Extension, error)
GetExtension retrieves an extension by identifier (ID or name). A versionNumber of 0 means "not specified" -- matching real AWS AppConfig, this returns the highest (most recently created) version.
func (*InMemoryBackend) GetExtensionAssociation ¶
func (b *InMemoryBackend) GetExtensionAssociation( extensionAssociationID string, ) (*ExtensionAssociation, error)
GetExtensionAssociation retrieves an extension association by ID.
func (*InMemoryBackend) GetHostedConfigurationVersion ¶
func (b *InMemoryBackend) GetHostedConfigurationVersion( applicationID, profileID string, versionNumber int32, ) (*HostedConfigurationVersion, error)
GetHostedConfigurationVersion retrieves a hosted configuration version.
func (*InMemoryBackend) ListApplications ¶
func (b *InMemoryBackend) ListApplications( nextToken string, maxResults int, ) ([]Application, string)
ListApplications returns paginated applications.
func (*InMemoryBackend) ListConfigurationProfiles ¶
func (b *InMemoryBackend) ListConfigurationProfiles( applicationID, nextToken string, maxResults int, ) ([]ConfigurationProfile, string, error)
ListConfigurationProfiles returns paginated profiles for an application.
func (*InMemoryBackend) ListDeploymentStrategies ¶
func (b *InMemoryBackend) ListDeploymentStrategies( nextToken string, maxResults int, ) ([]DeploymentStrategy, string)
ListDeploymentStrategies returns paginated deployment strategies.
func (*InMemoryBackend) ListDeployments ¶
func (b *InMemoryBackend) ListDeployments( applicationID, environmentID, nextToken string, maxResults int, ) ([]Deployment, string, error)
ListDeployments returns paginated deployments for an environment.
func (*InMemoryBackend) ListEnvironments ¶
func (b *InMemoryBackend) ListEnvironments( applicationID, nextToken string, maxResults int, ) ([]Environment, string, error)
ListEnvironments returns paginated environments for an application.
func (*InMemoryBackend) ListExperimentDefinitions ¶ added in v1.2.0
func (b *InMemoryBackend) ListExperimentDefinitions( applicationIdentifier, configurationProfileIdentifier, environmentIdentifier, status, nextToken string, maxResults int, ) ([]ExperimentDefinition, string)
ListExperimentDefinitions returns experiment definitions across the account, optionally filtered by application/configuration-profile/ environment identifier and status. See the StorageBackend interface doc comment for the identifier-filter resolution rules.
func (*InMemoryBackend) ListExperimentRunEvents ¶ added in v1.2.0
func (b *InMemoryBackend) ListExperimentRunEvents( applicationIdentifier, experimentDefinitionIdentifier string, run int32, nextToken string, maxResults int, ) ([]ExperimentRunEvent, string, error)
ListExperimentRunEvents returns the events this backend actually recorded during the run's lifecycle, most-recent-first.
func (*InMemoryBackend) ListExperimentRuns ¶ added in v1.2.0
func (b *InMemoryBackend) ListExperimentRuns( applicationIdentifier, experimentDefinitionIdentifier, status, nextToken string, maxResults int, ) ([]ExperimentRun, string, error)
ListExperimentRuns returns paginated runs for an experiment definition, optionally filtered by status.
func (*InMemoryBackend) ListExtensionAssociations ¶
func (b *InMemoryBackend) ListExtensionAssociations( nextToken, extensionIdentifier, resourceIdentifier string, maxResults int, ) ([]ExtensionAssociation, string)
ListExtensionAssociations returns paginated extension associations, optionally filtered by extensionIdentifier (ARN prefix) and/or resourceIdentifier (ARN prefix).
func (*InMemoryBackend) ListExtensions ¶
func (b *InMemoryBackend) ListExtensions( nextToken string, maxResults int, nameFilter string, ) ([]Extension, string)
ListExtensions returns paginated extensions, optionally filtered by name. Real ListExtensionsInput has no version filter (extensions are versioned resources, but ListExtensions summarizes one row per extension at its current/highest version -- there is no ListExtensionVersions API), so one row is returned per distinct extension ID, at its latest version.
func (*InMemoryBackend) ListHostedConfigurationVersions ¶
func (b *InMemoryBackend) ListHostedConfigurationVersions( applicationID, profileID, nextToken, versionLabel string, maxResults int, ) ([]HostedConfigurationVersion, string, error)
ListHostedConfigurationVersions returns paginated versions for a profile, optionally filtered by versionLabel.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceArn string) (map[string]string, error)
ListTagsForResource returns the tags for the given resource ARN.
func (*InMemoryBackend) PaginationSecret ¶
func (b *InMemoryBackend) PaginationSecret() string
PaginationSecret returns the HMAC secret for pagination tokens.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore deserializes backend state from a snapshot. It implements persistence.Persistable.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serializes the backend state to JSON. It implements persistence.Persistable.
func (*InMemoryBackend) StartDeployment ¶
func (b *InMemoryBackend) StartDeployment( applicationID, environmentID, configProfileID, strategyID, configVersion, description string, ) (*Deployment, error)
StartDeployment starts a deployment.
func (*InMemoryBackend) StartExperimentRun ¶ added in v1.2.0
func (b *InMemoryBackend) StartExperimentRun( applicationIdentifier, experimentDefinitionIdentifier, description string, exposurePercentage *float32, treatmentOverrides map[string]string, tags map[string]string, ) (*ExperimentRun, error)
StartExperimentRun starts a new run of an experiment definition. See the StorageBackend interface doc comment for parameter semantics.
func (*InMemoryBackend) StopDeployment ¶
func (b *InMemoryBackend) StopDeployment( applicationID, environmentID string, deploymentNumber int32, allowRevert bool, ) error
StopDeployment stops an in-progress deployment, moving it to ROLLED_BACK. When allowRevert is true and the deployment is already COMPLETE, it instead reverts the environment to the previous configuration version and moves the deployment to REVERTED -- matching real StopDeploymentInput.AllowRevert semantics.
func (*InMemoryBackend) StopExperimentRun ¶ added in v1.2.0
func (b *InMemoryBackend) StopExperimentRun( applicationIdentifier, experimentDefinitionIdentifier string, run int32, result *ExperimentRunResult, ) (*ExperimentRun, error)
StopExperimentRun stops a RUNNING experiment run, moving it to DONE.
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceArn string, tags map[string]string) error
TagResource adds or replaces tags on the given resource ARN.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceArn string, tagKeys []string) error
UntagResource removes the specified tag keys from the given resource ARN.
func (*InMemoryBackend) UpdateAccountSettings ¶
func (b *InMemoryBackend) UpdateAccountSettings( deletionProtection *DeletionProtectionSettings, ) (*AccountSettings, error)
UpdateAccountSettings updates account-level AppConfig settings.
func (*InMemoryBackend) UpdateApplication ¶
func (b *InMemoryBackend) UpdateApplication( applicationID string, name, description *string, ) (*Application, error)
UpdateApplication updates an application's name and description. A nil name/description means the request omitted that field, and AWS AppConfig leaves an omitted field unchanged rather than clearing it (only an explicit, present value -- including "" -- overwrites).
func (*InMemoryBackend) UpdateConfigurationProfile ¶
func (b *InMemoryBackend) UpdateConfigurationProfile( applicationID, profileID string, name, description, retrievalRoleArn *string, validators *[]Validator, ) (*ConfigurationProfile, error)
UpdateConfigurationProfile updates a configuration profile. A nil name/description/retrievalRoleArn/validators means the request omitted that field, and AWS AppConfig leaves an omitted field unchanged rather than clearing it.
func (*InMemoryBackend) UpdateDeploymentStrategy ¶
func (b *InMemoryBackend) UpdateDeploymentStrategy( strategyID, name string, description *string, deploymentDuration, bakeTime int32, growthFactor float32, ) (*DeploymentStrategy, error)
UpdateDeploymentStrategy updates a deployment strategy. A nil description means the request omitted that field, and AWS AppConfig leaves an omitted field unchanged rather than clearing it.
func (*InMemoryBackend) UpdateEnvironment ¶
func (b *InMemoryBackend) UpdateEnvironment( applicationID, environmentID string, name, description *string, monitors *[]Monitor, ) (*Environment, error)
UpdateEnvironment updates an environment's name, description, and monitors. A nil name/description/monitors means the request omitted that field, and AWS AppConfig leaves an omitted field unchanged rather than clearing it.
func (*InMemoryBackend) UpdateExperimentDefinition ¶ added in v1.2.0
func (b *InMemoryBackend) UpdateExperimentDefinition( applicationIdentifier, experimentDefinitionIdentifier string, audienceDescription, audienceRule *string, control *Treatment, hypothesis, launchCriteria *string, treatments *[]Treatment, ) (*ExperimentDefinition, error)
UpdateExperimentDefinition updates an experiment definition. See the StorageBackend interface doc comment for nil-means-unchanged semantics.
func (*InMemoryBackend) UpdateExperimentRun ¶ added in v1.2.0
func (b *InMemoryBackend) UpdateExperimentRun( applicationIdentifier, experimentDefinitionIdentifier string, run int32, description *string, exposurePercentage *float32, treatmentOverrides *TreatmentOverrides, ) (*ExperimentRun, error)
UpdateExperimentRun updates a RUNNING experiment run. See the StorageBackend interface doc comment for semantics.
func (*InMemoryBackend) UpdateExtension ¶
func (b *InMemoryBackend) UpdateExtension( extensionIdentifier string, description *string, actions map[string][]ExtensionAction, parameters map[string]ExtensionParameter, ) (*Extension, error)
UpdateExtension updates an extension's description, actions, and parameters by creating a NEW version from the current highest version -- matching real AWS AppConfig, where every UpdateExtension call produces a new, independently addressable extension version rather than mutating one in place. A nil description means the request omitted that field, and AWS AppConfig leaves an omitted field unchanged rather than clearing it.
func (*InMemoryBackend) UpdateExtensionAssociation ¶
func (b *InMemoryBackend) UpdateExtensionAssociation( extensionAssociationID string, parameters map[string]string, ) (*ExtensionAssociation, error)
UpdateExtensionAssociation updates an extension association's parameters.
func (*InMemoryBackend) ValidateConfiguration ¶
func (b *InMemoryBackend) ValidateConfiguration(applicationID, profileID, _ string) error
ValidateConfiguration validates a configuration version against its validators. In this implementation, all well-formed configurations are considered valid. The configurationVersion parameter is accepted for API compatibility but not evaluated.
type Monitor ¶
type Monitor struct {
AlarmArn string `json:"AlarmArn"`
AlarmRoleArn string `json:"AlarmRoleArn,omitempty"`
}
Monitor represents an Amazon CloudWatch alarm used to monitor an AppConfig environment.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for the AppConfig service.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initialises the AppConfig backend and handler.
type StorageBackend ¶
type StorageBackend interface {
// PaginationSecret returns the HMAC secret used to sign pagination tokens.
PaginationSecret() string
// Snapshot and Restore implement persistence.Persistable. Handler
// delegates to them (see persistence.go) so cli.go's generic
// setupPersistence picks AppConfig up.
Snapshot(ctx context.Context) []byte
Restore(ctx context.Context, data []byte) error
// CreateApplication creates a new AppConfig application. tags are
// applied inline at creation time (see CreateExperimentDefinition's
// doc comment for why TagResource is not used for this).
CreateApplication(name, description string, tags map[string]string) (*Application, error)
// GetApplication retrieves an application by ID.
GetApplication(applicationID string) (*Application, error)
// ListApplications returns paginated applications.
ListApplications(nextToken string, maxResults int) ([]Application, string)
// UpdateApplication updates an application's name and description. A nil
// name/description means the field was omitted from the request and must
// be left unchanged (real UpdateApplicationInput.Name/Description are
// optional *string members; only a present, non-nil member overwrites
// the existing value -- see AWS AppConfig's UpdateApplication contract).
UpdateApplication(applicationID string, name, description *string) (*Application, error)
// DeleteApplication deletes an application by ID.
DeleteApplication(applicationID string) error
// CreateEnvironment creates a new environment within an application.
// tags are applied inline at creation time (see CreateApplication).
CreateEnvironment(
applicationID, name, description string,
monitors []Monitor,
tags map[string]string,
) (*Environment, error)
// GetEnvironment retrieves an environment by application and environment ID.
GetEnvironment(applicationID, environmentID string) (*Environment, error)
// ListEnvironments returns paginated environments for an application.
ListEnvironments(applicationID, nextToken string, maxResults int) ([]Environment, string, error)
// UpdateEnvironment updates an environment's name, description, and
// monitors. A nil name/description leaves the field unchanged (see
// UpdateApplication doc); a nil monitors leaves the existing monitor
// list unchanged, while a non-nil (possibly empty) slice replaces it,
// matching UpdateEnvironmentInput's optional Monitors member.
UpdateEnvironment(
applicationID, environmentID string,
name, description *string,
monitors *[]Monitor,
) (*Environment, error)
// DeleteEnvironment deletes an environment.
DeleteEnvironment(applicationID, environmentID string) error
// CreateConfigurationProfile creates a new configuration profile. tags
// are applied inline at creation time (see CreateApplication).
CreateConfigurationProfile(
applicationID, name, description, locationURI, profileType, retrievalRoleArn string,
validators []Validator,
tags map[string]string,
) (*ConfigurationProfile, error)
// GetConfigurationProfile retrieves a configuration profile.
GetConfigurationProfile(applicationID, profileID string) (*ConfigurationProfile, error)
// ListConfigurationProfiles returns paginated profiles for an application.
ListConfigurationProfiles(
applicationID, nextToken string,
maxResults int,
) ([]ConfigurationProfile, string, error)
// UpdateConfigurationProfile updates a configuration profile. Nil
// name/description/retrievalRoleArn leave the field unchanged; a nil
// validators leaves the existing validator list unchanged, while a
// non-nil (possibly empty) slice replaces it -- matching
// UpdateConfigurationProfileInput's optional members.
UpdateConfigurationProfile(
applicationID, profileID string,
name, description, retrievalRoleArn *string,
validators *[]Validator,
) (*ConfigurationProfile, error)
// DeleteConfigurationProfile deletes a configuration profile.
DeleteConfigurationProfile(applicationID, profileID string) error
// CreateHostedConfigurationVersion creates a hosted configuration
// version. latestVersionNumber implements the optional
// optimistic-concurrency check real AWS binds to the
// "Latest-Version-Number" request header: when non-nil, it must match
// the profile's current latest version or the call is rejected.
CreateHostedConfigurationVersion(
applicationID, profileID, contentType, description, versionLabel string,
content []byte,
latestVersionNumber *int32,
) (*HostedConfigurationVersion, error)
// GetHostedConfigurationVersion retrieves a hosted configuration version.
GetHostedConfigurationVersion(
applicationID, profileID string,
versionNumber int32,
) (*HostedConfigurationVersion, error)
// ListHostedConfigurationVersions returns paginated versions for a profile.
ListHostedConfigurationVersions(
applicationID, profileID, nextToken, versionLabel string,
maxResults int,
) ([]HostedConfigurationVersion, string, error)
// DeleteHostedConfigurationVersion deletes a hosted configuration version.
DeleteHostedConfigurationVersion(applicationID, profileID string, versionNumber int32) error
// CreateDeploymentStrategy creates a new deployment strategy. tags are
// applied inline at creation time (see CreateApplication).
CreateDeploymentStrategy(
name, description string,
deploymentDuration, bakeTime int32,
growthFactor float32,
growthType, replicateTo string,
tags map[string]string,
) (*DeploymentStrategy, error)
// GetDeploymentStrategy retrieves a deployment strategy by ID.
GetDeploymentStrategy(strategyID string) (*DeploymentStrategy, error)
// ListDeploymentStrategies returns paginated deployment strategies.
ListDeploymentStrategies(nextToken string, maxResults int) ([]DeploymentStrategy, string)
// UpdateDeploymentStrategy updates a deployment strategy. A nil
// description leaves the field unchanged (real
// UpdateDeploymentStrategyInput.Description is an optional *string
// member); name has no counterpart in the real API and is applied only
// when non-empty, matching this backend's pre-existing behavior.
UpdateDeploymentStrategy(
strategyID, name string,
description *string,
deploymentDuration, bakeTime int32,
growthFactor float32,
) (*DeploymentStrategy, error)
// DeleteDeploymentStrategy deletes a deployment strategy.
DeleteDeploymentStrategy(strategyID string) error
// StartDeployment starts a deployment.
StartDeployment(
applicationID, environmentID, configProfileID, strategyID, configVersion, description string,
) (*Deployment, error)
// GetDeployment retrieves a deployment by application, environment, and deployment number.
GetDeployment(applicationID, environmentID string, deploymentNumber int32) (*Deployment, error)
// ListDeployments returns paginated deployments for an environment.
ListDeployments(
applicationID, environmentID, nextToken string,
maxResults int,
) ([]Deployment, string, error)
// StopDeployment stops an in-progress deployment, or -- when
// allowRevert is true and the deployment is already COMPLETE --
// reverts the environment to the previous configuration version
// (real StopDeploymentInput.AllowRevert semantics).
StopDeployment(applicationID, environmentID string, deploymentNumber int32, allowRevert bool) error
// ListTagsForResource returns the tags for a resource by ARN.
ListTagsForResource(resourceArn string) (map[string]string, error)
// TagResource adds or updates tags on a resource.
TagResource(resourceArn string, tags map[string]string) error
// UntagResource removes tags from a resource.
UntagResource(resourceArn string, tagKeys []string) error
// CreateExtension creates a new AppConfig extension. tags are applied
// inline at creation time (see CreateApplication).
CreateExtension(
name, description string,
actions map[string][]ExtensionAction,
parameters map[string]ExtensionParameter,
tags map[string]string,
) (*Extension, error)
// GetExtension retrieves an extension by identifier (ID or name) and
// optional version number (0 means unspecified: the highest version).
GetExtension(extensionIdentifier string, versionNumber int32) (*Extension, error)
// ListExtensions returns paginated extensions, optionally filtered by name.
ListExtensions(
nextToken string,
maxResults int,
nameFilter string,
) ([]Extension, string)
// UpdateExtension updates an extension's description, actions, and
// parameters. A nil description leaves the field unchanged (real
// UpdateExtensionInput.Description is an optional *string member).
UpdateExtension(
extensionIdentifier string,
description *string,
actions map[string][]ExtensionAction,
parameters map[string]ExtensionParameter,
) (*Extension, error)
// DeleteExtension deletes an extension version by identifier (ID or
// name) and optional version number (0 means unspecified: the highest
// version).
DeleteExtension(extensionIdentifier string, versionNumber int32) error
// CreateExtensionAssociation creates an association between an
// extension and a resource. tags are applied inline at creation time
// (see CreateApplication).
CreateExtensionAssociation(
extensionIdentifier, resourceIdentifier string,
parameters map[string]string,
extensionVersionNumber *int32,
tags map[string]string,
) (*ExtensionAssociation, error)
// GetExtensionAssociation retrieves an extension association by ID.
GetExtensionAssociation(extensionAssociationID string) (*ExtensionAssociation, error)
// ListExtensionAssociations returns paginated extension associations.
ListExtensionAssociations(
nextToken, extensionIdentifier, resourceIdentifier string,
maxResults int,
) ([]ExtensionAssociation, string)
// UpdateExtensionAssociation updates an extension association's parameters.
UpdateExtensionAssociation(
extensionAssociationID string,
parameters map[string]string,
) (*ExtensionAssociation, error)
// DeleteExtensionAssociation deletes an extension association by ID.
DeleteExtensionAssociation(extensionAssociationID string) error
// GetAccountSettings returns the account-level AppConfig settings.
GetAccountSettings() (*AccountSettings, error)
// UpdateAccountSettings updates account-level AppConfig settings.
UpdateAccountSettings(deletionProtection *DeletionProtectionSettings) (*AccountSettings, error)
// GetConfiguration retrieves the latest deployed configuration (deprecated API).
GetConfiguration(
application, environment, configuration string,
) (*HostedConfigurationVersion, error)
// ValidateConfiguration validates a configuration version against its validators.
ValidateConfiguration(applicationID, profileID, configurationVersion string) error
// CurrentDeployedConfiguration returns the content, content type, and
// version label of the configuration currently active (the most
// recently COMPLETEd deployment) for the given
// application/environment/configuration-profile, each resolved by ID
// or name exactly like GetConfiguration. It has no caller within this
// package today -- it is a public read accessor exposed for a future
// appconfig -> appconfigdata bridge (bd gopherstack-uiyi): once a
// deployment completes, cli.go wiring (out of scope for this change)
// can call this and push the result into
// appconfigdata's SetConfiguration(app, env, profile, content,
// contentType) so GetLatestConfiguration polling reflects real
// deployment state instead of an unpopulated store.
CurrentDeployedConfiguration(
application, environment, configuration string,
) (content []byte, contentType, versionLabel string, err error)
// CreateExperimentDefinition creates a new experiment definition
// attached to a feature-flag configuration profile. applicationIdentifier,
// environmentIdentifier, and configurationProfileIdentifier are each
// resolved by ID or name and validated against real backend state.
// control must be non-nil with a non-nil FlagValue; every element of
// treatments must likewise carry a non-nil FlagValue. Key on both is
// server-generated (see the Treatment doc comment in models.go). tags
// are applied inline to the new definition's ARN at creation time (see
// CreateExperimentDefinition's doc comment in experiment_definitions.go
// for why -- avoids the inline-Tags-dropped bug tracked by bd
// gopherstack-lcan).
CreateExperimentDefinition(
applicationIdentifier, name, environmentIdentifier, configurationProfileIdentifier, flagKey,
audienceRule, audienceDescription, hypothesis, launchCriteria string,
control *Treatment,
treatments []Treatment,
tags map[string]string,
) (*ExperimentDefinition, error)
// GetExperimentDefinition retrieves an experiment definition by
// application and experiment definition identifier (each accepted by
// ID or name).
GetExperimentDefinition(
applicationIdentifier, experimentDefinitionIdentifier string,
) (*ExperimentDefinition, error)
// ListExperimentDefinitions returns experiment definitions across the
// account, optionally filtered by application/configuration-profile/
// environment identifier and status. An identifier filter that cannot
// be resolved yields an empty result (a filter with no matches), not
// an error.
ListExperimentDefinitions(
applicationIdentifier, configurationProfileIdentifier, environmentIdentifier, status, nextToken string,
maxResults int,
) ([]ExperimentDefinition, string)
// UpdateExperimentDefinition updates an experiment definition. A nil
// pointer field means the request omitted it and it is left unchanged;
// a non-nil treatments fully replaces the treatment list (fresh Keys
// assigned). Returns ErrConflict if a RUNNING run currently exists for
// this definition, matching real AWS's "cannot update ... while an
// experiment run is active."
UpdateExperimentDefinition(
applicationIdentifier, experimentDefinitionIdentifier string,
audienceDescription, audienceRule *string,
control *Treatment,
hypothesis, launchCriteria *string,
treatments *[]Treatment,
) (*ExperimentDefinition, error)
// DeleteExperimentDefinition archives (deleteType "ARCHIVE", the
// default this backend applies when deleteType is empty -- see the doc
// comment in experiment_definitions.go for why) or permanently
// destroys (deleteType "DESTROY") an experiment definition. DESTROY
// cascade-deletes every run, run event, and tag scoped to it.
DeleteExperimentDefinition(applicationIdentifier, experimentDefinitionIdentifier, deleteType string) error
// StartExperimentRun starts a new run of an experiment definition.
// Only one run may be RUNNING per definition at a time (ErrConflict
// otherwise). exposurePercentage nil defaults to 0 -- see the doc
// comment in experiment_runs.go. tags are applied inline to the new
// run's own ARN, same inline-tagging fix as CreateExperimentDefinition.
StartExperimentRun(
applicationIdentifier, experimentDefinitionIdentifier, description string,
exposurePercentage *float32,
treatmentOverrides map[string]string,
tags map[string]string,
) (*ExperimentRun, error)
// GetExperimentRun retrieves an experiment run by application,
// experiment definition identifier, and run number.
GetExperimentRun(
applicationIdentifier, experimentDefinitionIdentifier string, run int32,
) (*ExperimentRun, error)
// ListExperimentRuns returns paginated runs for an experiment
// definition, optionally filtered by status.
ListExperimentRuns(
applicationIdentifier, experimentDefinitionIdentifier, status, nextToken string,
maxResults int,
) ([]ExperimentRun, string, error)
// UpdateExperimentRun updates a RUNNING experiment run's description,
// exposure percentage (which can only increase, matching real AWS),
// and/or treatment overrides. A nil field is left unchanged. Returns
// ErrBadRequest if the run is not RUNNING or the new exposure
// percentage would decrease it.
UpdateExperimentRun(
applicationIdentifier, experimentDefinitionIdentifier string,
run int32,
description *string,
exposurePercentage *float32,
treatmentOverrides *TreatmentOverrides,
) (*ExperimentRun, error)
// StopExperimentRun stops a RUNNING experiment run, moving it to DONE.
// Returns ErrBadRequest if the run is not currently RUNNING.
StopExperimentRun(
applicationIdentifier, experimentDefinitionIdentifier string,
run int32,
result *ExperimentRunResult,
) (*ExperimentRun, error)
// ListExperimentRunEvents returns the events this backend actually
// recorded during the run's lifecycle (RUN_STARTED/EXPOSURE_UPDATED/
// OVERRIDES_UPDATED/RUN_STOPPED), most-recent-first -- never a
// fabricated timeline.
ListExperimentRunEvents(
applicationIdentifier, experimentDefinitionIdentifier string,
run int32,
nextToken string,
maxResults int,
) ([]ExperimentRunEvent, string, error)
}
StorageBackend defines the operations supported by the AppConfig in-memory backend.
type Treatment ¶ added in v1.2.0
type Treatment struct {
FlagValue *FlagValue `json:"FlagValue,omitempty"`
Description string `json:"Description,omitempty"`
Key string `json:"Key,omitempty"`
Weight float32 `json:"Weight"`
}
Treatment represents one variation (or the control) evaluated during an experiment. Key is server-generated: real CreateExperimentDefinition's TreatmentInput/UpdateExperimentDefinitionInput carry no client-supplied key at all (only Description/FlagValue/Weight), so AWS itself must assign it. This backend assigns "Control" to the control treatment and "Treatment1".."TreatmentN" (1-indexed, in the order supplied) to the rest -- see CreateExperimentDefinition's doc comment in experiment_definitions.go for why this specific, deterministic scheme was chosen over a random one.
type TreatmentOverrides ¶ added in v1.2.0
TreatmentOverrides assigns specific entity IDs directly to treatment keys, bypassing random assignment. Real AWS models this as a tagged union (types.TreatmentOverrides) with exactly one known member, "Inline" (a map of entity ID -> treatment key, see awsRestjson1_serializeDocumentTreatmentOverrides in the SDK); this backend models the union directly as that one member since it is the only variant the SDK ships.
Source Files
¶
- account_settings.go
- applications.go
- configuration.go
- configuration_profiles.go
- deployment_strategies.go
- deployments.go
- environments.go
- errors.go
- experiment_definitions.go
- experiment_runs.go
- extensions.go
- feature_flags.go
- handler.go
- handler_account_settings.go
- handler_applications.go
- handler_configuration.go
- handler_configuration_profiles.go
- handler_deployment_strategies.go
- handler_deployments.go
- handler_environments.go
- handler_experiment_definitions.go
- handler_experiment_runs.go
- handler_extensions.go
- handler_hosted_configuration_versions.go
- handler_tags.go
- hosted_configuration_versions.go
- interfaces.go
- models.go
- persistence.go
- provider.go
- store.go
- store_setup.go
- tags.go