model

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCreatable

func IsCreatable(status ConstructStatus) bool

func IsDeletable

func IsDeletable(status ConstructStatus) bool

func IsDeployable

func IsDeployable(status ConstructStatus) bool

func IsUpdatable

func IsUpdatable(status ConstructStatus) bool

func UrnPath

func UrnPath(urn URN) (string, error)

UrnPath returns the relative filesystem path of the output for a given URN (e.g., project/application/environment/construct)

Types

type ApplicationEnvironment

type ApplicationEnvironment struct {
	SchemaVersion int                  `yaml:"schemaVersion,omitempty"`
	Version       int                  `yaml:"version,omitempty"`
	ProjectURN    URN                  `yaml:"project_urn,omitempty"`
	AppURN        URN                  `yaml:"app_urn,omitempty"`
	Environment   string               `yaml:"environment,omitempty"`
	Constructs    map[string]Construct `yaml:"constructs,omitempty"`
	DefaultRegion string               `yaml:"default_region,omitempty"`
}

func ParseIRFile

func ParseIRFile(content []byte) (*ApplicationEnvironment, error)

func ReadIRFile

func ReadIRFile(filename string) (*ApplicationEnvironment, error)

type Binding

type Binding struct {
	URN    *URN             `yaml:"urn,omitempty"`
	Inputs map[string]Input `yaml:"inputs,omitempty"`
}

type Construct

type Construct struct {
	URN       *URN                   `yaml:"urn,omitempty"`
	Version   int                    `yaml:"version,omitempty"`
	Inputs    map[string]Input       `yaml:"inputs,omitempty"`
	Outputs   map[string]any         `yaml:"outputs,omitempty"`
	Bindings  []Binding              `yaml:"bindings,omitempty"`
	Options   map[string]interface{} `yaml:"options,omitempty"`
	DependsOn []*URN                 `yaml:"dependsOn,omitempty"`
}

type ConstructAction

type ConstructAction string
const (
	ConstructActionCreate ConstructAction = "create"
	ConstructActionUpdate ConstructAction = "update"
	ConstructActionDelete ConstructAction = "delete"
)

type ConstructState

type ConstructState struct {
	Status      ConstructStatus  `yaml:"status,omitempty"`
	LastUpdated string           `yaml:"last_updated,omitempty"`
	Inputs      map[string]Input `yaml:"inputs,omitempty"`
	Outputs     map[string]any   `yaml:"outputs,omitempty"`
	Bindings    []Binding        `yaml:"bindings,omitempty"`
	Options     map[string]any   `yaml:"options,omitempty"`
	DependsOn   []*URN           `yaml:"dependsOn,omitempty"`
	PulumiStack UUID             `yaml:"pulumi_stack,omitempty"`
	URN         *URN             `yaml:"urn,omitempty"`
}

type ConstructStatus

type ConstructStatus string
const (
	// Create-related statuses
	ConstructCreating       ConstructStatus = "creating"
	ConstructCreateComplete ConstructStatus = "create_complete"
	ConstructCreateFailed   ConstructStatus = "create_failed"

	// Update-related statuses
	ConstructUpdating       ConstructStatus = "updating"
	ConstructUpdateComplete ConstructStatus = "update_complete"
	ConstructUpdateFailed   ConstructStatus = "update_failed"

	// Delete-related statuses
	ConstructDeleting       ConstructStatus = "deleting"
	ConstructDeleteComplete ConstructStatus = "delete_complete"
	ConstructDeleteFailed   ConstructStatus = "delete_failed"

	// Unknown status
	ConstructUnknown ConstructStatus = "unknown"
)

type DryRun

type DryRun int
const (
	// DryRunNone is the default value, no dry run
	DryRunNone DryRun = iota

	// DryRunPreview is a dry run that uses Pulumi preview
	DryRunPreview

	// DryRunCompile is a dry run that only runs `tsc` on the resulting IaC
	DryRunCompile

	// DryRunFileOnly is a dry run that only writes the files to disk
	DryRunFileOnly
)

type Input

type Input struct {
	Value     interface{} `yaml:"value,omitempty"`
	Encrypted bool        `yaml:"encrypted,omitempty"`
	Status    InputStatus `yaml:"status,omitempty"`
	DependsOn string      `yaml:"dependsOn,omitempty"`
}

type InputStatus

type InputStatus string
const (
	InputStatusPending  InputStatus = "pending"
	InputStatusResolved InputStatus = "resolved"
	InputStatusError    InputStatus = "error"
)

type State

type State struct {
	SchemaVersion int                       `yaml:"schemaVersion,omitempty"`
	Version       int                       `yaml:"version,omitempty"`
	ProjectURN    URN                       `yaml:"project_urn,omitempty"`
	AppURN        URN                       `yaml:"app_urn,omitempty"`
	Environment   string                    `yaml:"environment,omitempty"`
	DefaultRegion string                    `yaml:"default_region,omitempty"`
	Constructs    map[string]ConstructState `yaml:"constructs,omitempty"`
}

type StateManager

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

func NewStateManager

func NewStateManager(fsys afero.Fs, stateFile string) *StateManager

func (*StateManager) CheckStateFileExists

func (sm *StateManager) CheckStateFileExists() bool

func (*StateManager) GetAllConstructs

func (sm *StateManager) GetAllConstructs() map[string]ConstructState

func (*StateManager) GetConstructState

func (sm *StateManager) GetConstructState(name string) (ConstructState, bool)

func (*StateManager) GetState

func (sm *StateManager) GetState() *State

func (*StateManager) InitState

func (sm *StateManager) InitState(ir *ApplicationEnvironment)

func (*StateManager) IsOperating

func (sm *StateManager) IsOperating(construct *ConstructState) bool

func (*StateManager) LoadState

func (sm *StateManager) LoadState() error

func (*StateManager) RegisterOutputValues

func (sm *StateManager) RegisterOutputValues(ctx context.Context, urn URN, outputs map[string]any) error

RegisterOutputValues registers the resolved output values of a construct in the state manager and resolves any inputs that depend on the provided outputs

func (*StateManager) SaveState

func (sm *StateManager) SaveState() error

func (*StateManager) SetConstructState

func (sm *StateManager) SetConstructState(construct ConstructState)

func (*StateManager) TransitionConstructComplete

func (sm *StateManager) TransitionConstructComplete(construct *ConstructState) error

func (*StateManager) TransitionConstructFailed

func (sm *StateManager) TransitionConstructFailed(construct *ConstructState) error

func (*StateManager) TransitionConstructState

func (sm *StateManager) TransitionConstructState(construct *ConstructState, nextStatus ConstructStatus) error

func (*StateManager) UpdateResourceState

func (sm *StateManager) UpdateResourceState(name string, status ConstructStatus, lastUpdated string) error

type URN

type URN struct {
	AccountID        string `yaml:"accountId"`
	Project          string `yaml:"project"`
	Environment      string `yaml:"environment,omitempty"`
	Application      string `yaml:"application,omitempty"`
	Type             string `yaml:"type,omitempty"`
	Subtype          string `yaml:"subtype,omitempty"`
	ParentResourceID string `yaml:"parentResourceId,omitempty"`
	ResourceID       string `yaml:"resourceId,omitempty"`
	Output           string `yaml:"output,omitempty"`
}

URN represents a Unique Resource Name in the Klotho ecosystem

func ParseURN

func ParseURN(urnString string) (*URN, error)

ParseURN parses a URN string into a URN struct

func (*URN) Compare

func (u *URN) Compare(other URN) int

func (*URN) Equals

func (u *URN) Equals(other any) bool

func (*URN) IsAccount

func (u *URN) IsAccount() bool

func (*URN) IsApplicationEnvironment

func (u *URN) IsApplicationEnvironment() bool

func (*URN) IsEnvironment

func (u *URN) IsEnvironment() bool

func (*URN) IsOutput

func (u *URN) IsOutput() bool

func (*URN) IsProject

func (u *URN) IsProject() bool

func (*URN) IsResource

func (u *URN) IsResource() bool

func (*URN) IsType

func (u *URN) IsType() bool

func (URN) MarshalText

func (u URN) MarshalText() ([]byte, error)

func (URN) String

func (u URN) String() string

String returns the URN as a string

func (*URN) UnmarshalText

func (u *URN) UnmarshalText(text []byte) error

func (*URN) UrnType

func (u *URN) UrnType() UrnType

type UUID

type UUID struct {
	uuid.UUID
}

func (*UUID) UnmarshalYAML

func (u *UUID) UnmarshalYAML(unmarshal func(interface{}) error) error

type UrnType

type UrnType string

URN represents a Unique Resource Name in the Klotho ecosystem

const (
	AccountUrnType                UrnType = "account"
	ProjectUrnType                UrnType = "project"
	EnvironmentUrnType            UrnType = "environment"
	ApplicationEnvironmentUrnType UrnType = "application_environment"
	ResourceUrnType               UrnType = "resource"
	OutputUrnType                 UrnType = "output"
	TypeUrnType                   UrnType = "type"
)

Jump to

Keyboard shortcuts

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