Help us shape the future of Go! Take the 2026 Go Developer Survey

cloudformation

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package cloudformation emulates AWS CloudFormation (Query protocol): stacks, change sets, YAML/JSON templates with intrinsic functions, conditions, mappings, rules and SSM-typed parameters, exports, nested stacks and custom resources, deploying through pogi's own services. It is what `cdk bootstrap` and `cdk deploy` talk to.

Index

Constants

This section is empty.

Variables

View Source
var CustomTimeout = 5 * time.Minute

CustomTimeout bounds how long a custom resource may take to answer.

Functions

This section is empty.

Types

type Change

type Change struct {
	Action, LogicalID, PhysicalID, Type, Replacement string
}

Change is one resource change in a change set.

type ChangeSet

type ChangeSet struct {
	ID           string       `json:"id"`
	Name         string       `json:"name"`
	Type         string       `json:"type"` // CREATE | UPDATE
	Status       string       `json:"status"`
	ExecStatus   string       `json:"execStatus"`
	Reason       string       `json:"reason,omitempty"`
	Description  string       `json:"description,omitempty"`
	Body         string       `json:"body"`
	Inputs       []paramInput `json:"inputs,omitempty"`
	Tags         []Tag        `json:"tags,omitempty"`
	Capabilities []string     `json:"capabilities,omitempty"`
	Changes      []Change     `json:"changes,omitempty"`
	Created      time.Time    `json:"created"`
}

ChangeSet is a reviewed set of changes.

type Event

type Event struct {
	ID         string    `json:"id"`
	LogicalID  string    `json:"logicalId"`
	PhysicalID string    `json:"physicalId,omitempty"`
	Type       string    `json:"type"`
	Status     string    `json:"status"`
	Reason     string    `json:"reason,omitempty"`
	Time       time.Time `json:"time"`
}

Event is a stack event.

type Output

type Output struct {
	Key         string `json:"key"`
	Value       string `json:"value"`
	Description string `json:"description,omitempty"`
	Export      string `json:"export,omitempty"`
}

Output is a stack output.

type Param

type Param struct {
	Key      string `json:"key"`
	Value    string `json:"value"`
	Resolved string `json:"resolved,omitempty"` // SSM-typed parameters
	NoEcho   bool   `json:"noEcho,omitempty"`
}

Param is a resolved stack parameter.

type Resource

type Resource struct {
	LogicalID  string         `json:"logicalId"`
	Type       string         `json:"type"`
	PhysicalID string         `json:"physicalId,omitempty"`
	Status     string         `json:"status"`
	Reason     string         `json:"reason,omitempty"`
	Props      map[string]any `json:"props,omitempty"`
	Attrs      map[string]any `json:"attrs,omitempty"`
	Updated    time.Time      `json:"updated"`
}

Resource is a deployed (or deploying) resource.

type Service

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

Service is the CloudFormation emulator.

func New

func New(hub *core.Hub) *Service

New creates the CloudFormation service.

func (*Service) CreateResource

func (s *Service) CreateResource(account, region, typ string, props map[string]any) (string, map[string]any, error)

CreateResource creates a resource of a type from its properties and returns its physical id and attributes.

func (*Service) DeleteResource

func (s *Service) DeleteResource(account, region, typ, physical string, props map[string]any) error

DeleteResource deletes a resource by its physical id.

func (*Service) HasHandler

func (s *Service) HasHandler(typ string) bool

HasHandler says whether pogi deploys the resource type for real (not a placeholder).

func (*Service) Info

func (s *Service) Info() core.Info

func (*Service) Inspect

func (s *Service) Inspect(table, id string) any

Inspect returns a stack with its resources, outputs and recent events.

func (*Service) ListResources

func (s *Service) ListResources(account, region, typ string) (res map[string]map[string]any, ok bool)

ListResources lists the resources of a type found in their own service. ok is false when pogi cannot list the type that way.

func (*Service) Load

func (s *Service) Load(b []byte) error

func (*Service) Provision

func (s *Service) Provision(account, region, typ, logical string, props map[string]any) (physical string, attrs map[string]any, err error)

Provision creates one resource through its provider, outside any real stack (pogi.yaml seeding). Generated names are stable (see pctx.name), so seeding again hits "already exists" instead of making a copy.

func (*Service) Reset

func (s *Service) Reset()

func (*Service) Resources

func (s *Service) Resources() []core.Table

Resources lists stacks.

func (*Service) Save

func (s *Service) Save() ([]byte, error)

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Service) UpdateResource

func (s *Service) UpdateResource(account, region, typ, physical string, old, props map[string]any) (attrs map[string]any, replace bool, err error)

UpdateResource applies new properties to a resource. replace says it cannot be updated in place: the caller creates a new one and deletes this one.

type Stack

type Stack struct {
	ID              string               `json:"id"`
	Name            string               `json:"name"`
	Account         string               `json:"account"`
	Region          string               `json:"region"`
	Status          string               `json:"status"`
	Reason          string               `json:"reason,omitempty"`
	Description     string               `json:"description,omitempty"`
	Body            string               `json:"body"`
	Params          []Param              `json:"params,omitempty"`
	Tags            []Tag                `json:"tags,omitempty"`
	Capabilities    []string             `json:"capabilities,omitempty"`
	DisableRollback bool                 `json:"disableRollback,omitempty"`
	OnFailure       string               `json:"onFailure,omitempty"`
	Protected       bool                 `json:"protected,omitempty"`
	Policy          string               `json:"policy,omitempty"`
	Parent          string               `json:"parent,omitempty"` // nested stacks
	Created         time.Time            `json:"created"`
	Updated         time.Time            `json:"updated,omitzero"`
	Deleted         time.Time            `json:"deleted,omitzero"`
	Resources       map[string]*Resource `json:"resources"`
	Outputs         []Output             `json:"outputs,omitempty"`
	Events          []Event              `json:"events,omitempty"`
	ChangeSets      []*ChangeSet         `json:"changeSets,omitempty"`
}

Stack is one stack and everything it deployed.

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag is a stack tag.

Jump to

Keyboard shortcuts

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