core

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 15 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 IdFromHash added in v0.0.18

func IdFromHash(res any) (string, error)

func NewDefaultStack

func NewDefaultStack(stackID StackID) *defaultStack

NewDefaultStack constructs new stack.

Types

type BackendRef added in v0.0.16

type BackendRef interface {
	Weight() *int32
	Group() *gwv1beta1.Group
	Kind() *gwv1beta1.Kind
	Name() gwv1beta1.ObjectName
	Namespace() *gwv1beta1.Namespace
	Port() *gwv1beta1.PortNumber
	Equals(backendRef BackendRef) bool
}

type EventType added in v0.0.18

type EventType string
const (
	CreateEvent EventType = "Create"
	UpdateEvent EventType = "Update"
	DeleteEvent EventType = "Delete"
)

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 GRPCBackendRef added in v0.0.16

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

func (*GRPCBackendRef) Equals added in v0.0.16

func (r *GRPCBackendRef) Equals(backendRef BackendRef) bool

func (*GRPCBackendRef) Group added in v0.0.16

func (r *GRPCBackendRef) Group() *gwv1beta1.Group

func (*GRPCBackendRef) Kind added in v0.0.16

func (r *GRPCBackendRef) Kind() *gwv1beta1.Kind

func (*GRPCBackendRef) Name added in v0.0.16

func (*GRPCBackendRef) Namespace added in v0.0.16

func (r *GRPCBackendRef) Namespace() *gwv1beta1.Namespace

func (*GRPCBackendRef) Port added in v0.0.16

func (r *GRPCBackendRef) Port() *gwv1beta1.PortNumber

func (*GRPCBackendRef) Weight added in v0.0.16

func (r *GRPCBackendRef) Weight() *int32

type GRPCHeaderMatch added in v0.0.16

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

func (*GRPCHeaderMatch) Equals added in v0.0.16

func (m *GRPCHeaderMatch) Equals(headerMatch HeaderMatch) bool

func (*GRPCHeaderMatch) Name added in v0.0.16

func (m *GRPCHeaderMatch) Name() string

func (*GRPCHeaderMatch) Type added in v0.0.16

func (*GRPCHeaderMatch) Value added in v0.0.16

func (m *GRPCHeaderMatch) Value() string

type GRPCRoute added in v0.0.16

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

func NewGRPCRoute added in v0.0.16

func NewGRPCRoute(route gwv1alpha2.GRPCRoute) *GRPCRoute

func (*GRPCRoute) DeepCopy added in v0.0.16

func (r *GRPCRoute) DeepCopy() Route

func (*GRPCRoute) DeletionTimestamp added in v0.0.16

func (r *GRPCRoute) DeletionTimestamp() *metav1.Time

func (*GRPCRoute) Inner added in v0.0.16

func (r *GRPCRoute) Inner() *gwv1alpha2.GRPCRoute

func (*GRPCRoute) K8sObject added in v0.0.16

func (r *GRPCRoute) K8sObject() client.Object

func (*GRPCRoute) Name added in v0.0.16

func (r *GRPCRoute) Name() string

func (*GRPCRoute) Namespace added in v0.0.16

func (r *GRPCRoute) Namespace() string

func (*GRPCRoute) Spec added in v0.0.16

func (r *GRPCRoute) Spec() RouteSpec

func (*GRPCRoute) Status added in v0.0.16

func (r *GRPCRoute) Status() RouteStatus

type GRPCRouteMatch added in v0.0.16

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

func (*GRPCRouteMatch) Equals added in v0.0.16

func (m *GRPCRouteMatch) Equals(routeMatch RouteMatch) bool

func (*GRPCRouteMatch) Headers added in v0.0.16

func (m *GRPCRouteMatch) Headers() []HeaderMatch

func (*GRPCRouteMatch) Method added in v0.0.16

type GRPCRouteRule added in v0.0.16

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

func (*GRPCRouteRule) BackendRefs added in v0.0.16

func (r *GRPCRouteRule) BackendRefs() []BackendRef

func (*GRPCRouteRule) Equals added in v0.0.16

func (r *GRPCRouteRule) Equals(routeRule RouteRule) bool

func (*GRPCRouteRule) Matches added in v0.0.16

func (r *GRPCRouteRule) Matches() []RouteMatch

type GRPCRouteSpec added in v0.0.16

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

func (*GRPCRouteSpec) Equals added in v0.0.16

func (s *GRPCRouteSpec) Equals(routeSpec RouteSpec) bool

func (*GRPCRouteSpec) Hostnames added in v0.0.16

func (s *GRPCRouteSpec) Hostnames() []gwv1beta1.Hostname

func (*GRPCRouteSpec) ParentRefs added in v0.0.16

func (s *GRPCRouteSpec) ParentRefs() []gwv1beta1.ParentReference

func (*GRPCRouteSpec) Rules added in v0.0.16

func (s *GRPCRouteSpec) Rules() []RouteRule

type GRPCRouteStatus added in v0.0.16

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

func (*GRPCRouteStatus) Parents added in v0.0.16

func (*GRPCRouteStatus) SetParents added in v0.0.16

func (s *GRPCRouteStatus) SetParents(parents []gwv1beta1.RouteParentStatus)

func (*GRPCRouteStatus) UpdateParentRefs added in v0.0.16

func (s *GRPCRouteStatus) UpdateParentRefs(parent gwv1beta1.ParentReference, controllerName gwv1beta1.GatewayController)

func (*GRPCRouteStatus) UpdateRouteCondition added in v0.0.16

func (s *GRPCRouteStatus) UpdateRouteCondition(condition metav1.Condition)

type HTTPBackendRef added in v0.0.16

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

func NewHTTPBackendRef added in v0.0.18

func NewHTTPBackendRef(r gwv1beta1.HTTPBackendRef) HTTPBackendRef

func (*HTTPBackendRef) Equals added in v0.0.16

func (r *HTTPBackendRef) Equals(backendRef BackendRef) bool

func (*HTTPBackendRef) Group added in v0.0.16

func (r *HTTPBackendRef) Group() *gwv1beta1.Group

func (*HTTPBackendRef) Kind added in v0.0.16

func (r *HTTPBackendRef) Kind() *gwv1beta1.Kind

func (*HTTPBackendRef) Name added in v0.0.16

func (*HTTPBackendRef) Namespace added in v0.0.16

func (r *HTTPBackendRef) Namespace() *gwv1beta1.Namespace

func (*HTTPBackendRef) Port added in v0.0.16

func (r *HTTPBackendRef) Port() *gwv1beta1.PortNumber

func (*HTTPBackendRef) Weight added in v0.0.16

func (r *HTTPBackendRef) Weight() *int32

type HTTPHeaderMatch added in v0.0.16

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

func (*HTTPHeaderMatch) Equals added in v0.0.16

func (m *HTTPHeaderMatch) Equals(headerMatch HeaderMatch) bool

func (*HTTPHeaderMatch) Name added in v0.0.16

func (m *HTTPHeaderMatch) Name() string

func (*HTTPHeaderMatch) Type added in v0.0.16

func (*HTTPHeaderMatch) Value added in v0.0.16

func (m *HTTPHeaderMatch) Value() string

type HTTPRoute added in v0.0.16

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

func NewHTTPRoute added in v0.0.16

func NewHTTPRoute(route gwv1beta1.HTTPRoute) *HTTPRoute

func (*HTTPRoute) DeepCopy added in v0.0.16

func (r *HTTPRoute) DeepCopy() Route

func (*HTTPRoute) DeletionTimestamp added in v0.0.16

func (r *HTTPRoute) DeletionTimestamp() *metav1.Time

func (*HTTPRoute) Inner added in v0.0.16

func (r *HTTPRoute) Inner() *gwv1beta1.HTTPRoute

func (*HTTPRoute) K8sObject added in v0.0.16

func (r *HTTPRoute) K8sObject() client.Object

func (*HTTPRoute) Name added in v0.0.16

func (r *HTTPRoute) Name() string

func (*HTTPRoute) Namespace added in v0.0.16

func (r *HTTPRoute) Namespace() string

func (*HTTPRoute) Spec added in v0.0.16

func (r *HTTPRoute) Spec() RouteSpec

func (*HTTPRoute) Status added in v0.0.16

func (r *HTTPRoute) Status() RouteStatus

type HTTPRouteMatch added in v0.0.16

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

func (*HTTPRouteMatch) Equals added in v0.0.16

func (m *HTTPRouteMatch) Equals(routeMatch RouteMatch) bool

func (*HTTPRouteMatch) Headers added in v0.0.16

func (m *HTTPRouteMatch) Headers() []HeaderMatch

func (*HTTPRouteMatch) Method added in v0.0.16

func (m *HTTPRouteMatch) Method() *gwv1beta1.HTTPMethod

func (*HTTPRouteMatch) Path added in v0.0.16

func (*HTTPRouteMatch) QueryParams added in v0.0.16

func (m *HTTPRouteMatch) QueryParams() []gwv1beta1.HTTPQueryParamMatch

type HTTPRouteRule added in v0.0.16

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

func (*HTTPRouteRule) BackendRefs added in v0.0.16

func (r *HTTPRouteRule) BackendRefs() []BackendRef

func (*HTTPRouteRule) Equals added in v0.0.16

func (r *HTTPRouteRule) Equals(routeRule RouteRule) bool

func (*HTTPRouteRule) Matches added in v0.0.16

func (r *HTTPRouteRule) Matches() []RouteMatch

type HTTPRouteSpec added in v0.0.16

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

func (*HTTPRouteSpec) Equals added in v0.0.16

func (s *HTTPRouteSpec) Equals(routeSpec RouteSpec) bool

func (*HTTPRouteSpec) Hostnames added in v0.0.16

func (s *HTTPRouteSpec) Hostnames() []gwv1beta1.Hostname

func (*HTTPRouteSpec) ParentRefs added in v0.0.16

func (s *HTTPRouteSpec) ParentRefs() []gwv1beta1.ParentReference

func (*HTTPRouteSpec) Rules added in v0.0.16

func (s *HTTPRouteSpec) Rules() []RouteRule

type HTTPRouteStatus added in v0.0.16

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

func (*HTTPRouteStatus) Parents added in v0.0.16

func (*HTTPRouteStatus) SetParents added in v0.0.16

func (s *HTTPRouteStatus) SetParents(parents []gwv1beta1.RouteParentStatus)

func (*HTTPRouteStatus) UpdateParentRefs added in v0.0.16

func (s *HTTPRouteStatus) UpdateParentRefs(parent gwv1beta1.ParentReference, controllerName gwv1beta1.GatewayController)

func (*HTTPRouteStatus) UpdateRouteCondition added in v0.0.16

func (s *HTTPRouteStatus) UpdateRouteCondition(condition metav1.Condition)

type HeaderMatch added in v0.0.16

type HeaderMatch interface {
	Type() *gwv1beta1.HeaderMatchType
	Name() string
	Value() string
	Equals(headerMatch HeaderMatch) bool
}

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) GetResource added in v0.0.18

func (m *MockStack) GetResource(id string, res Resource) error

GetResource mocks base method.

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) GetResource added in v0.0.18

func (mr *MockStackMockRecorder) GetResource(id, res interface{}) *gomock.Call

GetResource indicates an expected call of GetResource.

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 Policy added in v0.0.17

type Policy interface {
	GetNamespacedName() types.NamespacedName
	GetTargetRef() *gwv1alpha2.PolicyTargetReference
	GetStatusConditions() []apimachineryv1.Condition
	SetStatusConditions(conditions []apimachineryv1.Condition)
}

type PolicyList added in v0.0.17

type PolicyList interface {
	GetItems() []Policy
}

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 Route added in v0.0.16

type Route interface {
	Spec() RouteSpec
	Status() RouteStatus
	Name() string
	Namespace() string
	DeletionTimestamp() *metav1.Time
	DeepCopy() Route
	K8sObject() client.Object
}

func GetGRPCRoute added in v0.0.16

func GetGRPCRoute(ctx context.Context, client client.Client, routeNamespacedName types.NamespacedName) (Route, error)

func GetHTTPRoute added in v0.0.16

func GetHTTPRoute(ctx context.Context, client client.Client, routeNamespacedName types.NamespacedName) (Route, error)

func ListAllRoutes added in v0.0.16

func ListAllRoutes(context context.Context, client client.Client) ([]Route, error)

func ListGRPCRoutes added in v0.0.16

func ListGRPCRoutes(context context.Context, client client.Client) ([]Route, error)

func ListHTTPRoutes added in v0.0.16

func ListHTTPRoutes(context context.Context, client client.Client) ([]Route, error)

func NewRoute added in v0.0.16

func NewRoute(object client.Object) (Route, error)

type RouteMatch added in v0.0.16

type RouteMatch interface {
	Headers() []HeaderMatch
	Equals(routeMatch RouteMatch) bool
}

type RouteRule added in v0.0.16

type RouteRule interface {
	BackendRefs() []BackendRef
	Matches() []RouteMatch
	Equals(routeRule RouteRule) bool
}

type RouteSpec added in v0.0.16

type RouteSpec interface {
	ParentRefs() []gwv1beta1.ParentReference
	Hostnames() []gwv1beta1.Hostname
	Rules() []RouteRule
	Equals(routeSpec RouteSpec) bool
}

type RouteStatus added in v0.0.16

type RouteStatus interface {
	Parents() []gwv1beta1.RouteParentStatus
	SetParents(parents []gwv1beta1.RouteParentStatus)
	UpdateParentRefs(parent gwv1beta1.ParentReference, controllerName gwv1beta1.GatewayController)
	UpdateRouteCondition(condition metav1.Condition)
}

type RouteType added in v0.0.16

type RouteType string
const (
	GrpcRouteType RouteType = "grpc"
)
const (
	HttpRouteType RouteType = "http"
)

type Stack

type Stack interface {
	// stackID returns a unique ID for stack.
	StackID() StackID

	// Add a resource into stack.
	AddResource(res Resource) error

	// Get a resource by its id and type, pointer will be populated after call
	GetResource(id string, 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