resource

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(
	ctx context.Context,
	mc model.ClientSet,
	entity *model.Resource,
	opts Options,
) (err error)

func CanBeStopped

func CanBeStopped(r *model.Resource) bool

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 Create

func Create(
	ctx context.Context,
	mc model.ClientSet,
	entity *model.Resource,
	opts Options,
) (*model.ResourceOutput, error)

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 Destroy

func Destroy(
	ctx context.Context,
	mc model.ClientSet,
	entity *model.Resource,
	opts Options,
) (err error)

func GetSubjectID

func GetSubjectID(entity *model.Resource) (object.ID, error)

func IsInactive

func IsInactive(r *model.Resource) bool

IsInactive tells whether the given resource is inactive.

func IsService

func IsService(r *model.Resource) bool

IsService tells if the given resource is of service type.

func IsStatusDeleted

func IsStatusDeleted(entity *model.Resource) bool

IsStatusDeleted returns true if the resource is deleted.

func IsStatusFalse

func IsStatusFalse(entity *model.Resource) bool

IsStatusFalse returns true if the resource is in error status.

func IsStatusReady

func IsStatusReady(entity *model.Resource) bool

IsStatusReady returns true if the resource is ready.

func IsStoppable

func IsStoppable(r *model.Resource) bool

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 SetSubjectID

func SetSubjectID(ctx context.Context, resources ...*model.Resource) error

func Stop

func Stop(
	ctx context.Context,
	mc model.ClientSet,
	entity *model.Resource,
	opts Options,
) (err error)

Stop stops given resource.

func TopologicalSortResources

func TopologicalSortResources(resources model.Resources) (model.Resources, error)

TopologicalSortResources sorts the resources by dependencies.

func UpdateStatus

func UpdateStatus(
	ctx context.Context,
	mc model.ClientSet,
	entity *model.Resource,
) error

Types

type Options

type Options struct {
	Deployer deptypes.Deployer
}

Options for deploy or destroy.

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.

Jump to

Keyboard shortcuts

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