Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultStack ¶
func NewDefaultStack(stackID StackID) *defaultStack
NewDefaultStack constructs new stack.
Types ¶
type FakeResource ¶
type FakeResource struct {
ResourceMeta `json:"-"`
Spec FakeResourceSpec `json:"spec"`
Status *FakeResourceStatus `json:"status,omitempty"`
}
func NewFakeResource ¶
func NewFakeResource(stack Stack, resType string, id string, spec FakeResourceSpec, status *FakeResourceStatus) *FakeResource
func (*FakeResource) FieldB ¶
func (r *FakeResource) FieldB() StringToken
type FakeResourceSpec ¶
type FakeResourceSpec struct {
FieldA []StringToken `json:"fieldA"`
}
type FakeResourceStatus ¶
type FakeResourceStatus struct {
FieldB string `json:"fieldB"`
}
type LiteralStringToken ¶
type LiteralStringToken string
LiteralStringToken represents a literal string value.
func (LiteralStringToken) Dependencies ¶
func (t LiteralStringToken) Dependencies() []Resource
type Resource ¶
type Resource interface {
// resource's stack.
Stack() Stack
// resource's Type.
Type() string
// resource's ID within stack.
ID() string
}
Resource represents a deployment unit.
type ResourceFieldStringToken ¶
type ResourceFieldStringToken struct {
// contains filtered or unexported fields
}
func NewResourceFieldStringToken ¶
func NewResourceFieldStringToken(res Resource, fieldPath string, resolverFunc func(ctx context.Context, res Resource, fieldPath string) (string, error)) *ResourceFieldStringToken
NewResourceFieldStringToken constructs new ResourceFieldStringToken. @TODO: ideally the resolverFunc can be a shared implementation which dump Resource as json and obtain the fieldPath.
func (*ResourceFieldStringToken) Dependencies ¶
func (t *ResourceFieldStringToken) Dependencies() []Resource
func (*ResourceFieldStringToken) MarshalJSON ¶
func (t *ResourceFieldStringToken) MarshalJSON() ([]byte, error)
type ResourceMeta ¶
type ResourceMeta struct {
// contains filtered or unexported fields
}
Metadata for all resources.
func NewResourceMeta ¶
func NewResourceMeta(stack Stack, resType string, id string) ResourceMeta
NewResourceMeta constructs new resource metadata.
func (*ResourceMeta) ID ¶
func (m *ResourceMeta) ID() string
func (*ResourceMeta) Stack ¶
func (m *ResourceMeta) Stack() Stack
func (*ResourceMeta) Type ¶
func (m *ResourceMeta) Type() string
type ResourceVisitor ¶
ResourceVisitor represents a functor that can operate on a resource.
type Stack ¶
type Stack interface {
// stackID returns a unique ID for stack.
StackID() StackID
// Add a resource into stack.
AddResource(res Resource) error
// Add a dependency relationship between resources.
AddDependency(dependee Resource, depender Resource) error
// ListResources list all resources for specific type.
// pResourceSlice must be a pointer to a slice of resources, which will be filled.
ListResources(pResourceSlice interface{}) error
// TopologicalTraversal visits resources in stack in topological order.
TopologicalTraversal(visitor ResourceVisitor) error
}
Stack presents a resource graph, where resources can depend on each other.
type StackID ¶
type StackID types.NamespacedName
stackID is the identifier of a stack, it must be compatible with Kubernetes namespaced name.
type StringToken ¶
StringToken represent a string value that can be resolved at resolution time.