Documentation
¶
Index ¶
- func Apply(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (err error)
- func CanBeStopped(r *model.Resource) bool
- func CheckDependencyStatus(ctx context.Context, mc model.ClientSet, entity *model.Resource) (bool, error)
- func Create(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (*model.ResourceOutput, error)
- func CreateDraftResources(ctx context.Context, mc model.ClientSet, entities ...*model.Resource) (model.Resources, error)
- func CreateScheduledResources(ctx context.Context, mc model.ClientSet, entities model.Resources) (model.Resources, error)
- func Destroy(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (err error)
- func GetSubjectID(entity *model.Resource) (object.ID, error)
- func IsInactive(r *model.Resource) bool
- func IsService(r *model.Resource) bool
- func IsStatusDeleted(entity *model.Resource) bool
- func IsStatusFalse(entity *model.Resource) bool
- func IsStatusReady(entity *model.Resource) bool
- func IsStoppable(r *model.Resource) bool
- func SetResourceStatusScheduled(ctx context.Context, mc model.ClientSet, entities ...*model.Resource) error
- func SetSubjectID(ctx context.Context, resources ...*model.Resource) error
- func Stop(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (err error)
- func TopologicalSortResources(resources model.Resources) (model.Resources, error)
- func UpdateStatus(ctx context.Context, mc model.ClientSet, entity *model.Resource) error
- type Options
- type ResourceNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanBeStopped ¶
CanBeStopped tells whether the given resource can be stopped.
func CheckDependencyStatus ¶
func CheckDependencyStatus(ctx context.Context, mc model.ClientSet, entity *model.Resource) (bool, error)
CheckDependencyStatus check resource dependencies status is ready to apply.
func CreateDraftResources ¶
func CreateDraftResources( ctx context.Context, mc model.ClientSet, entities ...*model.Resource, ) (model.Resources, error)
CreateDraftResources creates undeployed resources but do no deployment. TODO refactor and coordinate with CreateScheduledResources.
func CreateScheduledResources ¶
func CreateScheduledResources( ctx context.Context, mc model.ClientSet, entities model.Resources, ) (model.Resources, error)
CreateScheduledResources creates scheduled resources.
func IsInactive ¶
IsInactive tells whether the given resource is inactive.
func IsStatusDeleted ¶
IsStatusDeleted returns true if the resource is deleted.
func IsStatusFalse ¶
IsStatusFalse returns true if the resource is in error status.
func IsStatusReady ¶
IsStatusReady returns true if the resource is ready.
func IsStoppable ¶
IsStoppable tells whether the given resource is stoppable.
func SetResourceStatusScheduled ¶
func SetResourceStatusScheduled(ctx context.Context, mc model.ClientSet, entities ...*model.Resource) error
SetResourceStatusScheduled sets the status of the resources to scheduled.
func Stop ¶
func Stop( ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options, ) (err error)
Stop stops given resource.
func TopologicalSortResources ¶
TopologicalSortResources sorts the resources by dependencies.
Types ¶
type ResourceNode ¶
type ResourceNode struct {
ID object.ID `json:"id"`
Name string `json:"name"`
Resource *model.Resource `json:"resource"`
Children []*ResourceNode `json:"children"`
}
func NewResourceNodes ¶
func NewResourceNodes(resources model.Resources) ([]*ResourceNode, error)
NewResourceNodes returns a list of resource nodes from the given resources.
func TopologicalSortResourceNodes ¶
func TopologicalSortResourceNodes(nodes []*ResourceNode) []*ResourceNode
TopologicalSortResourceNodes sorts the resource nodes by dependencies.