core

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package core is a generated GoMock package.

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

func (LiteralStringToken) Resolve

func (t LiteralStringToken) Resolve(ctx context.Context) (string, error)

type MockStack

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

MockStack is a mock of Stack interface.

func NewMockStack

func NewMockStack(ctrl *gomock.Controller) *MockStack

NewMockStack creates a new mock instance.

func (*MockStack) AddDependency

func (m *MockStack) AddDependency(dependee, depender Resource) error

AddDependency mocks base method.

func (*MockStack) AddResource

func (m *MockStack) AddResource(res Resource) error

AddResource mocks base method.

func (*MockStack) EXPECT

func (m *MockStack) EXPECT() *MockStackMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStack) ListResources

func (m *MockStack) ListResources(pResourceSlice interface{}) error

ListResources mocks base method.

func (*MockStack) StackID

func (m *MockStack) StackID() StackID

StackID mocks base method.

func (*MockStack) TopologicalTraversal

func (m *MockStack) TopologicalTraversal(visitor ResourceVisitor) error

TopologicalTraversal mocks base method.

type MockStackMockRecorder

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

MockStackMockRecorder is the mock recorder for MockStack.

func (*MockStackMockRecorder) AddDependency

func (mr *MockStackMockRecorder) AddDependency(dependee, depender interface{}) *gomock.Call

AddDependency indicates an expected call of AddDependency.

func (*MockStackMockRecorder) AddResource

func (mr *MockStackMockRecorder) AddResource(res interface{}) *gomock.Call

AddResource indicates an expected call of AddResource.

func (*MockStackMockRecorder) ListResources

func (mr *MockStackMockRecorder) ListResources(pResourceSlice interface{}) *gomock.Call

ListResources indicates an expected call of ListResources.

func (*MockStackMockRecorder) StackID

func (mr *MockStackMockRecorder) StackID() *gomock.Call

StackID indicates an expected call of StackID.

func (*MockStackMockRecorder) TopologicalTraversal

func (mr *MockStackMockRecorder) TopologicalTraversal(visitor interface{}) *gomock.Call

TopologicalTraversal indicates an expected call of TopologicalTraversal.

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)

func (*ResourceFieldStringToken) Resolve

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

type ResourceVisitor interface {
	Visit(res Resource) error
}

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.

func (StackID) String

func (stackID StackID) String() string

String returns the string representation of a StackID. It will be used as AWS resource tags for resources provisioned for this stack.

type StringToken

type StringToken interface {
	Token
	Resolve(ctx context.Context) (string, error)
}

StringToken represent a string value that can be resolved at resolution time.

type Token

type Token interface {
	// token's value resolution may depends on 0 or more Resources.
	Dependencies() []Resource
}

Token represent a value that can be resolved at resolution time.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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