plan

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructResourceName added in v0.14.3

func ConstructResourceName(datastore, name string) string

func DistinctDirectory

func DistinctDirectory(directories []string) []string

func GetValidJobDirectory

func GetValidJobDirectory(directories []string) []string

func GetValidResourceDirectory

func GetValidResourceDirectory(directories []string) []string

Types

type DirectoryParser

type DirectoryParser interface {
	ValidDirectory(directory string) bool
	ParseDirectory(directory string) string
}

type Getter

type Getter interface {
	GetName() string
}

type JobPlan

type JobPlan struct {
	Name         string  `json:"name"`
	OldNamespace *string `json:"old_namespace"`
}

func (JobPlan) FileSuffix

func (JobPlan) FileSuffix() string

func (JobPlan) GetName

func (p JobPlan) GetName() string

func (JobPlan) ParseDirectory

func (p JobPlan) ParseDirectory(directory string) string

func (*JobPlan) SetName

func (p *JobPlan) SetName(name string)

func (*JobPlan) SetOldNamespace

func (p *JobPlan) SetOldNamespace(oldNamespace string)

func (JobPlan) ValidDirectory

func (p JobPlan) ValidDirectory(directory string) bool

type Kind

type Kind interface {
	Getter
	Setter
}

type KindList

type KindList[kind Kind] []kind

func (KindList[Kind]) GetNames

func (kinds KindList[Kind]) GetNames() []string

type ListByNamespace

type ListByNamespace[plan Kind] map[string][]plan

func NewListByNamespace

func NewListByNamespace[kind Kind]() ListByNamespace[kind]

func (*ListByNamespace[Kind]) Append

func (p *ListByNamespace[Kind]) Append(namespace string, newPlan Kind)

func (ListByNamespace[Kind]) DeletePlansByNames

func (p ListByNamespace[Kind]) DeletePlansByNames(names ...string) ListByNamespace[Kind]

func (*ListByNamespace[Kind]) GetAll

func (p *ListByNamespace[Kind]) GetAll() []Kind

func (*ListByNamespace[Kind]) GetAllNamespaces

func (p *ListByNamespace[Kind]) GetAllNamespaces() []string

func (*ListByNamespace[Kind]) GetByNamespace

func (p *ListByNamespace[Kind]) GetByNamespace(namespace string) []Kind

func (*ListByNamespace[Kind]) GetPlansByNamespaceName

func (p *ListByNamespace[Kind]) GetPlansByNamespaceName() map[string][]string

func (*ListByNamespace[Kind]) IsZero

func (p *ListByNamespace[Kind]) IsZero() bool

type OperationByNamespaces

type OperationByNamespaces[kind Kind] struct {
	Create  ListByNamespace[kind] `json:"create"`
	Delete  ListByNamespace[kind] `json:"delete"`
	Update  ListByNamespace[kind] `json:"update"`
	Migrate ListByNamespace[kind] `json:"migrate"`
}

func NewOperationByNamespace

func NewOperationByNamespace[T Kind]() OperationByNamespaces[T]

func (*OperationByNamespaces[Kind]) Add

func (o *OperationByNamespaces[Kind]) Add(namespace, sourceName, targetName string, plan Kind)

Add will decide where to add the plan, sourceName: latest state, targetName: current state

func (OperationByNamespaces[kind]) GetAllNamespaces

func (o OperationByNamespaces[kind]) GetAllNamespaces() []string

func (OperationByNamespaces[Kind]) IsZero

func (o OperationByNamespaces[Kind]) IsZero() bool

type Plan

type Plan struct {
	ProjectName string                               `json:"project_name"`
	Job         OperationByNamespaces[*JobPlan]      `json:"job"`
	Resource    OperationByNamespaces[*ResourcePlan] `json:"resource"`
}

func NewPlan

func NewPlan(projectName string) Plan

func (Plan) GetResult

func (p Plan) GetResult() Plan

func (Plan) IsEmpty

func (p Plan) IsEmpty() bool

func (Plan) Merge

func (p Plan) Merge(otherPlan Plan) Plan

func (Plan) SameProjectName

func (p Plan) SameProjectName(compare Plan) bool

type ResourcePlan

type ResourcePlan struct {
	Name         string  `json:"name"`
	Datastore    string  `json:"datastore"`
	OldNamespace *string `json:"old_namespace"` // OldNamespace will be used on migrate operation
}

func (ResourcePlan) FileSuffix

func (ResourcePlan) FileSuffix() string

func (ResourcePlan) GetName

func (p ResourcePlan) GetName() string

func (ResourcePlan) ParseDirectory

func (p ResourcePlan) ParseDirectory(directory string) string

func (*ResourcePlan) SetName

func (p *ResourcePlan) SetName(name string)

func (*ResourcePlan) SetOldNamespace

func (p *ResourcePlan) SetOldNamespace(oldNamespace string)

func (ResourcePlan) ValidDirectory

func (p ResourcePlan) ValidDirectory(directory string) bool

type Setter

type Setter interface {
	SetName(string)
	SetOldNamespace(oldNamespace string)
}

Jump to

Keyboard shortcuts

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