Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteObjects(sc *config.Config, group string, objs ObjectByScope) (*ObjectSet, *ObjectSet, error)
- func GetObjects(sc *config.Config, group string, objs ObjectByScope, detectChange bool) (unchanged ObjectSet, notFound ObjectSet, changed ObjectSet, err error)
- func GetResourceRun(sc *config.Config, obj Object, getOpt *api.Operation, runID string) (*model.ResourceRunOutput, error)
- func ListResourceRuns(sc *config.Config, obj Object, listOpt *api.Operation, st string) (*collectionGetResourceRun, error)
- func WaitForDelete(typ string, e EventItem, group, name string) bool
- func WaitForStatusReadyOrError(_ string, e EventItem, group, name string) bool
- func WatchObjects(ctx context.Context, sc *config.Config, set ObjectSet, ...) (bool, error)
- type ApplyOperator
- type ApplyOption
- type CommonOption
- type DeleteOperator
- type Event
- type EventItem
- type IDName
- type Loader
- type Object
- type ObjectByGK
- type ObjectByScope
- type ObjectList
- type ObjectLoader
- type ObjectScope
- type ObjectSet
- func ApplyResourceRuns(sc *config.Config, objs ObjectByScope) (success ObjectSet, err error)
- func BatchCreateObjects(sc *config.Config, group string, objs ObjectByScope, ebps extraBodyParams) (success, failed ObjectSet, err error)
- func NewObjectSet(objs ...Object) *ObjectSet
- func PatchObjects(sc *config.Config, group string, objs ObjectByScope, ebps extraBodyParams) (success, failed ObjectSet, err error)
- type ObjectStatus
- type ObjectWaiter
- type OperateResult
- type Operator
- func DefaultApplyOperator(sc *config.Config, wait bool, comment string) Operator
- func DefaultDeleteOperator(sc *config.Config, wait bool) Operator
- func DefaultPreviewApplyOperator(sc *config.Config, wait bool) Operator
- func DefaultPreviewOperator(sc *config.Config, wait bool, comment string, runLabels map[string]string) Operator
- type PreviewApplyOperator
- type PreviewApplyWaiter
- type PreviewOperator
- type PreviewOption
- type PreviewWaiter
- type WaitFor
- type Waiter
Constants ¶
const ( GroupResources = "resources" GroupResourceRuns = "resourceruns" )
const (
FieldResourceRunID = "resourceRunID"
)
Variables ¶
var GroupSequence = []string{ GroupResources, }
GroupSequence defines the sequence of group to create.
Functions ¶
func DeleteObjects ¶
func DeleteObjects(sc *config.Config, group string, objs ObjectByScope) (*ObjectSet, *ObjectSet, error)
DeleteObjects send delete objects request.
func GetObjects ¶
func GetObjects(sc *config.Config, group string, objs ObjectByScope, detectChange bool) ( unchanged ObjectSet, notFound ObjectSet, changed ObjectSet, err error, )
GetObjects send get objects request.
func GetResourceRun ¶ added in v0.6.0
func GetResourceRun(sc *config.Config, obj Object, getOpt *api.Operation, runID string) (*model.ResourceRunOutput, error)
GetResourceRun send get resource run request.
func ListResourceRuns ¶ added in v0.6.0
func ListResourceRuns(sc *config.Config, obj Object, listOpt *api.Operation, st string) (*collectionGetResourceRun, error)
ListResourceRuns send list resource runs request.
func WaitForDelete ¶
WaitForDelete waits for the object to be deleted.
func WaitForStatusReadyOrError ¶
WaitForStatusReadyOrError waits for the object to be ready or error.
Types ¶
type ApplyOperator ¶
type ApplyOperator struct {
// contains filtered or unexported fields
}
ApplyOperator is a type that represents an apply operator.
func (*ApplyOperator) Operate ¶
func (o *ApplyOperator) Operate(set ObjectSet) (OperateResult, error)
Operate applies the provided ObjectSet.
func (*ApplyOperator) PrintResult ¶
func (o *ApplyOperator) PrintResult(r OperateResult)
PrintResult prints the result of an operation.
type ApplyOption ¶ added in v0.6.0
type ApplyOption struct { CommonOption // ChangeComment. ChangeComment string `json:"changeComment,omitempty"` }
ApplyOption is a type that represents the options for the manifest apply.
func (*ApplyOption) AddFlags ¶ added in v0.6.0
func (f *ApplyOption) AddFlags(cmd *cobra.Command)
type CommonOption ¶ added in v0.6.0
type CommonOption struct { // Context flags. config.ScopeContext // File path or folder path. Filenames []string `json:"filenames,omitempty"` // Recursive apply. Recursive bool `json:"recursive,omitempty"` // Wait for the operation to complete. Wait bool `json:"wait,omitempty"` // Timeout in seconds for the wait operation. Timeout int `json:"timeout,omitempty"` // ValidateParameterAllSet is a flag that indicates whether to validate all parameters set. ValidateParametersSet bool `json:"validateParametersSet,omitempty"` }
CommonOption is a type that represents the options for the manifest operation.
func (*CommonOption) AddFlags ¶ added in v0.6.0
func (f *CommonOption) AddFlags(cmd *cobra.Command)
type DeleteOperator ¶
type DeleteOperator struct {
// contains filtered or unexported fields
}
DeleteOperator is a type that represents an delete operator.
func (*DeleteOperator) Operate ¶
func (o *DeleteOperator) Operate(set ObjectSet) (OperateResult, error)
Operate deletes the provided ObjectSet.
func (*DeleteOperator) PrintResult ¶
func (o *DeleteOperator) PrintResult(r OperateResult)
PrintResult prints the result of an operation.
type Loader ¶
type Loader interface { LoadFromFiles(filePaths []string, recursive bool) (ObjectSet, error) LoadFromByte(b []byte) (ObjectSet, error) }
Loader is an interface that defines methods for loading objects from various sources. Objects are loaded either from a list of file paths or from a byte slice.
type Object ¶
type Object struct { ObjectScope IDName Group string Value map[string]any Status ObjectStatus }
Object represents an object with a name, group, and value.
func (Object) MarshalJSON ¶
MarshalJSON returns the JSON encoding of Object.
func (Object) RunLabelQuery ¶ added in v0.6.0
RunLabelQuery returns the query of runLabels.
type ObjectByGK ¶
type ObjectByGK map[string]map[ObjectScope]ObjectList
ObjectByGK represents a map of group to a map of ObjectScope to a slice of Object.
type ObjectByScope ¶
type ObjectByScope map[ObjectScope]ObjectList
ObjectByScope represents a map of ObjectScope to a slice of Object.
func (*ObjectByScope) All ¶
func (s *ObjectByScope) All() ObjectList
All returns all objects in the ObjectByScope.
type ObjectList ¶
type ObjectList []Object
ObjectList is the list of object.
func (ObjectList) IDNameMap ¶
func (l ObjectList) IDNameMap() map[string]string
IDNameMap returns a map of ID to name.
type ObjectLoader ¶
type ObjectLoader struct {
// contains filtered or unexported fields
}
ObjectLoader is a type that represents an object loader.
func (*ObjectLoader) LoadFromByte ¶
func (l *ObjectLoader) LoadFromByte(b []byte) (ObjectSet, error)
LoadFromByte parses the provided YAML byte slice `b` and returns an `ObjectSet` and an error.
func (*ObjectLoader) LoadFromFile ¶
func (l *ObjectLoader) LoadFromFile(filePath string) (ObjectSet, error)
LoadFromFile reads the contents of the file at the given path and loads it as a YAML object set.
func (*ObjectLoader) LoadFromFiles ¶
func (l *ObjectLoader) LoadFromFiles(filePaths []string, recursive bool) (ObjectSet, error)
LoadFromFiles loads object from file paths and a recursive flag indicating whether to search files recursively.
type ObjectScope ¶
ObjectScope represents the scope of an object within a project and environment.
func (*ObjectScope) Map ¶
func (o *ObjectScope) Map() map[string]any
Map returns a map of ObjectScope.
func (*ObjectScope) ScopedName ¶
func (o *ObjectScope) ScopedName(name string) string
ScopedName generate object scoped name.
type ObjectSet ¶
type ObjectSet struct {
// contains filtered or unexported fields
}
ObjectSet represents a set of objects.
func ApplyResourceRuns ¶ added in v0.6.0
func ApplyResourceRuns(sc *config.Config, objs ObjectByScope) (success ObjectSet, err error)
ApplyResourceRuns send preview apply request for the object's last planned run.
func BatchCreateObjects ¶
func BatchCreateObjects(sc *config.Config, group string, objs ObjectByScope, ebps extraBodyParams) ( success, failed ObjectSet, err error, )
BatchCreateObjects send batch create objects request.
func NewObjectSet ¶
NewObjectSet returns a new ObjectSet.
func PatchObjects ¶
func PatchObjects(sc *config.Config, group string, objs ObjectByScope, ebps extraBodyParams) (success, failed ObjectSet, err error)
PatchObjects send patches objects request.
func (*ObjectSet) ByGroup ¶
func (s *ObjectSet) ByGroup(group string) ObjectByScope
ByGroup returns a map of ObjectScope to a slice of Object for the given group.
func (*ObjectSet) ObjectByGroup ¶
func (s *ObjectSet) ObjectByGroup() ObjectByGK
ObjectByGroup returns a map of ObjectScope to a slice of Object for the given group.
type ObjectStatus ¶
type ObjectStatus uint
type ObjectWaiter ¶
type ObjectWaiter struct {
// contains filtered or unexported fields
}
ObjectWaiter is a type that represents an object waiter.
func DeleteWaiter ¶
func DeleteWaiter(sc *config.Config, timeoutSecond int) *ObjectWaiter
DeleteWaiter creates a Waiter wait for delete.
type OperateResult ¶
type OperateResult struct { Success ObjectSet Failed ObjectSet NotFound ObjectSet UnChanged ObjectSet }
OperateResult is a type that represents the result of an operation.
type Operator ¶
type Operator interface { Operate(set ObjectSet) (r OperateResult, err error) PrintResult(r OperateResult) }
Operator is an interface for applying and deleting objects.
func DefaultApplyOperator ¶
DefaultApplyOperator returns an apply Operator.
func DefaultDeleteOperator ¶
DefaultDeleteOperator returns a delete Operator.
func DefaultPreviewApplyOperator ¶ added in v0.6.0
DefaultPreviewApplyOperator returns preview apply Operator.
type PreviewApplyOperator ¶ added in v0.6.0
type PreviewApplyOperator struct {
// contains filtered or unexported fields
}
PreviewApplyOperator is a type that represents preview apply operator.
func (*PreviewApplyOperator) Operate ¶ added in v0.6.0
func (o *PreviewApplyOperator) Operate(set ObjectSet) (OperateResult, error)
Operate apply previews of the provided ObjectSet.
func (*PreviewApplyOperator) PrintResult ¶ added in v0.6.0
func (o *PreviewApplyOperator) PrintResult(r OperateResult)
type PreviewApplyWaiter ¶ added in v0.6.0
type PreviewApplyWaiter struct {
// contains filtered or unexported fields
}
PreviewApplyWaiter is a type that represents preview apply waiter.
func DefaultPreviewApplyWaiter ¶ added in v0.6.0
func DefaultPreviewApplyWaiter(sc *config.Config, timeoutSecond int) *PreviewApplyWaiter
DefaultPreviewApplyWaiter wait for preview apply finished.
type PreviewOperator ¶ added in v0.6.0
type PreviewOperator struct {
// contains filtered or unexported fields
}
PreviewOperator is a type that represents preview operator.
func (*PreviewOperator) Operate ¶ added in v0.6.0
func (o *PreviewOperator) Operate(set ObjectSet) (OperateResult, error)
Operate generate preview changes of the provided ObjectSet.
func (*PreviewOperator) PrintResult ¶ added in v0.6.0
func (o *PreviewOperator) PrintResult(r OperateResult)
type PreviewOption ¶ added in v0.6.0
type PreviewOption struct { CommonOption // Apply. Apply bool `json:"apply,omitempty"` // ChangeComment. ChangeComment string `json:"changeComment,omitempty"` // RunLabels. RunLabels map[string]string `json:"runLabels,omitempty"` }
PreviewOption is a type that represents the options for the manifest preview.
func (*PreviewOption) AddFlags ¶ added in v0.6.0
func (f *PreviewOption) AddFlags(cmd *cobra.Command)
type PreviewWaiter ¶ added in v0.6.0
type PreviewWaiter struct {
// contains filtered or unexported fields
}
PreviewWaiter is a type that represents preview object waiter.
func DefaultPreviewWaiter ¶ added in v0.6.0
func DefaultPreviewWaiter(sc *config.Config, timeoutSecond int) *PreviewWaiter
DefaultPreviewWaiter wait for preview planned.