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 ¶
- Variables
- type Change
- type ChangeSet
- type Event
- type Output
- type Param
- type Resource
- type Service
- func (s *Service) CreateResource(account, region, typ string, props map[string]any) (string, map[string]any, error)
- func (s *Service) DeleteResource(account, region, typ, physical string, props map[string]any) error
- func (s *Service) HasHandler(typ string) bool
- func (s *Service) Info() core.Info
- func (s *Service) Inspect(table, id string) any
- func (s *Service) ListResources(account, region, typ string) (res map[string]map[string]any, ok bool)
- func (s *Service) Load(b []byte) error
- func (s *Service) Provision(account, region, typ, logical string, props map[string]any) (physical string, attrs map[string]any, err error)
- func (s *Service) Reset()
- func (s *Service) Resources() []core.Table
- func (s *Service) Save() ([]byte, error)
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Service) UpdateResource(account, region, typ, physical string, old, props map[string]any) (attrs map[string]any, replace bool, err error)
- type Stack
- type Tag
Constants ¶
This section is empty.
Variables ¶
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 (*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 ¶
DeleteResource deletes a resource by its physical id.
func (*Service) HasHandler ¶
HasHandler says whether pogi deploys the resource type for real (not a placeholder).
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) 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) 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.
Source Files
¶
- cfn.go
- deploy.go
- handlers.go
- providers.go
- providers_appsync.go
- providers_cache.go
- providers_cloudfront.go
- providers_data.go
- providers_ec2.go
- providers_ec2b.go
- providers_ec2c.go
- providers_ecs.go
- providers_engine.go
- providers_infra.go
- providers_lb.go
- providers_misc.go
- providers_misc2.go
- providers_more.go
- providers_more2.go
- providers_query.go
- providers_rds.go
- providers_rest.go
- providers_route53.go
- providers_scheduler.go
- providers_search.go
- providers_ses.go
- providers_simple.go
- providers_warehouse.go
- provision.go
- sam.go
- sam_api.go
- sam_policies.go
- template.go