state

package
v0.0.0-...-78ba6d8 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const FALLBACK_STATE_TABLE_NAME string = "aws-fail-az-state-table"

The default table name to store resource states

View Source
const STATE_TABLE_SCHEMA_VERSION string = "2023-09-06"

The current schema version of the state table

Variables

This section is empty.

Functions

This section is empty.

Types

type QueryStatesInput

type QueryStatesInput struct {
	ResourceType string
	ResourceKey  string
}

Represents the input of a QueryStates operation

type ResourceState

type ResourceState struct {
	Namespace    string `dynamodbav:"namespace"`
	Key          string `dynamodbav:"key"`
	ResourceKey  string `dynamodbav:"resourceKey"`
	ResourceType string `dynamodbav:"resourceType"`
	CreatedTime  int64  `dynamodbav:"createdTime"`
	State        []byte `dynamodbav:"state"`
}

A structure to represent an AWS resource's state

func (ResourceState) GetKey

func (state ResourceState) GetKey() map[string]types.AttributeValue

GetKey returns a representation of the Dynamodb Table key of the main index

type StateManager

type StateManager interface {

	// Initialize the state manager by establishing the connection with Dynamodb
	// This function only needs to be called once for every object that implements
	// StateManager. Further calls will have no effect
	Initialize() error

	// Save a new state in storage
	Save(resourceType string, resourceKey string, state []byte) error

	// Reads a single state object from storage
	// Returns a pointer to a ResourceState object or an error if the state is not found
	GetState(resourceType string, resourceKey string) (*ResourceState, error)

	// QueryStates finds state objects in storage by resourceType or resourceKey
	// Returns a list of ResourceState objects found in storage
	QueryStates(params *QueryStatesInput) ([]ResourceState, error)

	// Removes a single state object from storage
	RemoveState(stateObj ResourceState) error
}

StateManager provides the API to manage resource states in Dynamodb

func NewStateManager

func NewStateManager(provider awsapis.AWSProvider, namespace string) (StateManager, error)

Jump to

Keyboard shortcuts

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