nodestree

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package nodestree is a generated GoMock package.

Index

Constants

View Source
const (
	CRDContentType = iota
	StringContentType
)
View Source
const (
	Product                = "Product"
	Project                = "Project"
	CodeRepo               = "CodeRepo"
	CodeRepoBinding        = "CodeRepoBinding"
	Cluster                = "Cluster"
	Environment            = "Environment"
	DeploymentRuntime      = "DeploymentRuntime"
	ProjectPipelineRuntime = "ProjectPipelineRuntime"
	ArtifactRepo           = "ArtifactRepo"
)
View Source
const Any = "any"
View Source
const (
	ResourceNameCluster = "clusters"
)

Variables

This section is empty.

Functions

func CheckEffectiveResourceLayout

func CheckEffectiveResourceLayout(options CompareOptions, in *nodesTree) error

IsValidResourceLayout testing the valid of resources

func CheckGitHooks

func CheckGitHooks(gitType string, events []string) error

func CheckNumberOfResources

func CheckNumberOfResources(options CompareOptions, in *nodesTree) error

func CheckResouceReference

func CheckResouceReference(options CompareOptions, in *nodesTree) error

CheckResouceReference Detect resource references

func CheckResourceRepeatName

func CheckResourceRepeatName(options CompareOptions, in *nodesTree) error

IsResourceRepeatName Check whether the resource name is duplicate

func CheckResourceSubdirectory

func CheckResourceSubdirectory(nodes, node *Node) error

func GetResourceValue

func GetResourceValue(c interface{}, field, key string) string

func InContainsDir

func InContainsDir(str string, fields []string) (isIn bool)

func IsInSlice

func IsInSlice(slice []string, s string) (isIn bool)

func IsResourceExist

func IsResourceExist(options CompareOptions, targetResourceName, resourceKind string) bool

func NodesToMapping

func NodesToMapping(nodes *Node, mapping map[string]*Node)

Types

type CompareOptions

type CompareOptions struct {
	Nodes       Node
	ProductName string
}

type Config

type Config struct {
	Name     string   `json:"name" yaml:"name"`
	Kind     string   `json:"kind" yaml:"kind"`
	Optional bool     `json:"optional" yaml:"optional"`
	Count    int      `json:"count" yaml:"count"`
	Level    int      `json:"level" yaml:"level"`
	Sub      []Config `json:"sub" yaml:"sub"`
}

func NewConfig

func NewConfig() (*Config, error)

NewConfig generate resources layout config

type FileOptions

type FileOptions struct {
	IgnorePath       []string
	IgnoreFile       []string
	ExclusionsSuffix []string
	MappingResources map[string]interface{}
	ContentType      int
}

type MockNodesOperator

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

MockNodesOperator is a mock of NodesOperator interface.

func NewMockNodesOperator

func NewMockNodesOperator(ctrl *gomock.Controller) *MockNodesOperator

NewMockNodesOperator creates a new mock instance.

func (*MockNodesOperator) CheckReference

func (m *MockNodesOperator) CheckReference(options CompareOptions, node *Node, k8sClient client.Client) (bool, error)

CheckReference mocks base method.

func (*MockNodesOperator) CreateNode

func (m *MockNodesOperator) CreateNode(path string, data interface{}) (*Node, error)

CreateNode mocks base method.

func (*MockNodesOperator) CreateResource

func (m *MockNodesOperator) CreateResource(kind string) interface{}

CreateResource mocks base method.

func (*MockNodesOperator) EXPECT

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

func (*MockNodesOperator) UpdateNode

func (m *MockNodesOperator) UpdateNode(node *Node, data interface{}) (*Node, error)

UpdateNode mocks base method.

type MockNodesOperatorMockRecorder

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

MockNodesOperatorMockRecorder is the mock recorder for MockNodesOperator.

func (*MockNodesOperatorMockRecorder) CheckReference

func (mr *MockNodesOperatorMockRecorder) CheckReference(options, node, k8sClient interface{}) *gomock.Call

CheckReference indicates an expected call of CheckReference.

func (*MockNodesOperatorMockRecorder) CreateNode

func (mr *MockNodesOperatorMockRecorder) CreateNode(path, data interface{}) *gomock.Call

CreateNode indicates an expected call of CreateNode.

func (*MockNodesOperatorMockRecorder) CreateResource

func (mr *MockNodesOperatorMockRecorder) CreateResource(kind interface{}) *gomock.Call

CreateResource indicates an expected call of CreateResource.

func (*MockNodesOperatorMockRecorder) UpdateNode

func (mr *MockNodesOperatorMockRecorder) UpdateNode(node, data interface{}) *gomock.Call

UpdateNode indicates an expected call of UpdateNode.

type MockNodesTree

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

MockNodesTree is a mock of NodesTree interface.

func NewMockNodesTree

func NewMockNodesTree(ctrl *gomock.Controller) *MockNodesTree

NewMockNodesTree creates a new mock instance.

func (*MockNodesTree) AppendOperators

func (m *MockNodesTree) AppendOperators(operator NodesOperator)

AppendOperators mocks base method.

func (*MockNodesTree) Compare

func (m *MockNodesTree) Compare(options CompareOptions) error

Compare mocks base method.

func (*MockNodesTree) EXPECT

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

func (*MockNodesTree) FilterIgnoreByLayout

func (m *MockNodesTree) FilterIgnoreByLayout(path string) error

FilterIgnoreByLayout mocks base method.

func (*MockNodesTree) GetNode

func (m *MockNodesTree) GetNode(nodes *Node, kind, name string) *Node

GetNode mocks base method.

func (*MockNodesTree) GetNodes

func (m *MockNodesTree) GetNodes() (*Node, error)

GetNodes mocks base method.

func (*MockNodesTree) InsertNodes

func (m *MockNodesTree) InsertNodes(nodes, resource *Node) (*Node, error)

InsertNodes mocks base method.

func (*MockNodesTree) Load

func (m *MockNodesTree) Load(path string) (Node, error)

Load mocks base method.

func (*MockNodesTree) RemoveNode

func (m *MockNodesTree) RemoveNode(nodes, node *Node) (*Node, error)

RemoveNode mocks base method.

type MockNodesTreeMockRecorder

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

MockNodesTreeMockRecorder is the mock recorder for MockNodesTree.

func (*MockNodesTreeMockRecorder) AppendOperators

func (mr *MockNodesTreeMockRecorder) AppendOperators(operator interface{}) *gomock.Call

AppendOperators indicates an expected call of AppendOperators.

func (*MockNodesTreeMockRecorder) Compare

func (mr *MockNodesTreeMockRecorder) Compare(options interface{}) *gomock.Call

Compare indicates an expected call of Compare.

func (*MockNodesTreeMockRecorder) FilterIgnoreByLayout

func (mr *MockNodesTreeMockRecorder) FilterIgnoreByLayout(path interface{}) *gomock.Call

FilterIgnoreByLayout indicates an expected call of FilterIgnoreByLayout.

func (*MockNodesTreeMockRecorder) GetNode

func (mr *MockNodesTreeMockRecorder) GetNode(nodes, kind, name interface{}) *gomock.Call

GetNode indicates an expected call of GetNode.

func (*MockNodesTreeMockRecorder) GetNodes

func (mr *MockNodesTreeMockRecorder) GetNodes() *gomock.Call

GetNodes indicates an expected call of GetNodes.

func (*MockNodesTreeMockRecorder) InsertNodes

func (mr *MockNodesTreeMockRecorder) InsertNodes(nodes, resource interface{}) *gomock.Call

InsertNodes indicates an expected call of InsertNodes.

func (*MockNodesTreeMockRecorder) Load

func (mr *MockNodesTreeMockRecorder) Load(path interface{}) *gomock.Call

Load indicates an expected call of Load.

func (*MockNodesTreeMockRecorder) RemoveNode

func (mr *MockNodesTreeMockRecorder) RemoveNode(nodes, node interface{}) *gomock.Call

RemoveNode indicates an expected call of RemoveNode.

type Node

type Node struct {
	Name     string
	Path     string
	Children []*Node
	IsDir    bool
	Content  interface{}
	Level    int
	Kind     string
}

func ListsResourceNodes

func ListsResourceNodes(nodes Node, kind string, options ...NodeFilterOptions) (list []*Node)

type NodeFilterOptions

type NodeFilterOptions func(node *Node) bool

type NodeInfo

type NodeInfo struct {
	Name     string
	Kind     string
	Path     string
	Category string
	Level    int
}

type NodesOperator

type NodesOperator interface {
	CheckReference(options CompareOptions, node *Node, k8sClient client.Client) (bool, error)
	CreateResource(kind string) interface{}
	CreateNode(path string, data interface{}) (*Node, error)
	UpdateNode(node *Node, data interface{}) (*Node, error)
}

type NodesTree

type NodesTree interface {
	Load(path string) (root Node, err error)
	AppendOperators(operator NodesOperator)
	Compare(options CompareOptions) error
	InsertNodes(nodes, resource *Node) (*Node, error)
	GetNode(nodes *Node, kind, name string) (node *Node)
	GetNodes() (*Node, error)
	RemoveNode(nodes *Node, node *Node) (*Node, error)
	FilterIgnoreByLayout(path string) error
}

func NewNodestree

func NewNodestree(fileOptions *FileOptions, config *Config, k8sClient client.Client) NodesTree

type Resource

type Resource struct {
	metav1.TypeMeta   `json:",inline,omitempty"`
	metav1.ObjectMeta `json:"metadata"`
}

Jump to

Keyboard shortcuts

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