Documentation
¶
Index ¶
- Variables
- 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, dp deptypes.Deployer, ...) (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, dp deptypes.Deployer, ...) (model.Resources, error)
- func Destroy(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (err error)
- func GenComputedAttributes(ctx context.Context, modelClient model.ClientSet, entity *model.Resource) (property.Values, error)
- func GetDependencyOutputs(ctx context.Context, client model.ClientSet, dependencyResourceIDs []object.ID, ...) (map[string]parser.OutputState, error)
- func GetSubjectID(entity *model.Resource) (object.ID, error)
- func IsInactive(r *model.Resource) bool
- func IsStatusDeleted(entity *model.Resource) bool
- func IsStatusDeployed(entity *model.Resource) bool
- func IsStatusError(entity *model.Resource) bool
- func IsStatusReady(entity *model.Resource) bool
- func IsStatusStopped(entity *model.Resource) bool
- func IsStoppable(r *model.Resource) bool
- func ReverseTopologicalSortResources(resources model.Resources) (model.Resources, error)
- func SetDefaultLabels(ctx context.Context, mc model.ClientSet, entities ...*model.Resource) error
- func SetEnvResourceDefaultLabels(env *model.Environment, r *model.Resource) error
- func SetResourceStatusScheduled(ctx context.Context, mc model.ClientSet, dp deptypes.Deployer, ...) 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 UpdateResourceSubjectID(ctx context.Context, mc model.ClientSet, resources ...*model.Resource) error
- func UpdateStatus(ctx context.Context, mc model.ClientSet, entity *model.Resource) error
- type Options
- type ResourceNode
Constants ¶
This section is empty.
Variables ¶
var ( // VariableReg is the regexp to match the variable reference in attributes. VariableReg = regexp.MustCompile(`\${var\.([a-zA-Z0-9_-]+)}`) // ResourceReg is the regexp to match the resource output reference in attributes. ResourceReg = regexp.MustCompile(`\${res\.([^.}]+)\.([^.}]+)}`) )
Functions ¶
func CanBeStopped ¶
CanBeStopped tells whether the given resource can be stopped.
func CheckDependencyStatus ¶
func CheckDependencyStatus( ctx context.Context, mc model.ClientSet, dp deptypes.Deployer, 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 un-deployed resources but do no deployment. TODO refactor and coordinate with CreateScheduledResources.
func CreateScheduledResources ¶
func CreateScheduledResources( ctx context.Context, mc model.ClientSet, dp deptypes.Deployer, entities model.Resources, ) (model.Resources, error)
CreateScheduledResources creates scheduled resources.
func GenComputedAttributes ¶ added in v0.5.0
func GenComputedAttributes( ctx context.Context, modelClient model.ClientSet, entity *model.Resource, ) (property.Values, error)
GenComputedAttributes generate computed attributes for resource. Required: entity.EnvironmentID, entity.Attributes entity.TemplateID/entity.ResourceDefinitionMatchingRuleID.
func GetDependencyOutputs ¶ added in v0.5.0
func GetDependencyOutputs( ctx context.Context, client model.ClientSet, dependencyResourceIDs []object.ID, dependOutputs map[string]string, ) (map[string]parser.OutputState, error)
GetDependencyOutputs gets the dependency outputs of the resource.
func IsInactive ¶
IsInactive tells whether the given resource is inactive.
func IsStatusDeleted ¶
IsStatusDeleted returns true if the resource is deleted or to be deleted.
func IsStatusDeployed ¶ added in v0.5.0
IsStatusDeployed returns true if the resource is deployed or to be deployed.
func IsStatusError ¶ added in v0.5.0
IsStatusError returns true if the resource is in error status.
func IsStatusReady ¶
IsStatusReady returns true if the resource is ready.
func IsStatusStopped ¶ added in v0.5.0
IsStatusStopped returns true if the resource is stopped or to be stopped.
func IsStoppable ¶
IsStoppable tells whether the given resource is stoppable.
func ReverseTopologicalSortResources ¶ added in v0.5.0
ReverseTopologicalSortResources sorts the resource by dependencies in reverse order.
func SetDefaultLabels ¶ added in v0.5.0
SetDefaultLabels sets default labels for the provided resources.
func SetEnvResourceDefaultLabels ¶ added in v0.5.0
func SetEnvResourceDefaultLabels(env *model.Environment, r *model.Resource) error
func SetResourceStatusScheduled ¶
func SetResourceStatusScheduled( ctx context.Context, mc model.ClientSet, dp deptypes.Deployer, 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.