Documentation ¶
Index ¶
- Constants
- func CanBeStopped(r *model.Resource) bool
- func CollectionCreate(ctx context.Context, mc model.ClientSet, entities model.Resources, ...) (model.Resources, error)
- func CollectionDelete(ctx context.Context, mc model.ClientSet, entities model.Resources, ...) error
- func CollectionStart(ctx context.Context, mc model.ClientSet, entities model.Resources, ...) error
- func CollectionStop(ctx context.Context, mc model.ClientSet, entities model.Resources, ...) error
- func CollectionUpgrade(ctx context.Context, mc model.ClientSet, entities model.Resources, ...) error
- func Create(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (res *model.Resource, run *model.ResourceRun, err error)
- func Delete(ctx context.Context, mc model.ClientSet, entity *model.Resource, ...) (err error)
- func GenComputedAttributes(ctx context.Context, modelClient model.ClientSet, entity *model.Resource) (property.Values, error)
- func GetSubjectID(entity *model.Resource) (object.ID, error)
- func GroupByEnvironment(ctx context.Context, mc model.ClientSet, entities model.Resources) (map[object.ID]model.Resources, error)
- func IsStoppable(r *model.Resource) bool
- func PerformResource(ctx context.Context, mc model.ClientSet, dp deptypes.Deployer, ...) error
- func PopulateEnvironmentID(ctx context.Context, mc model.ClientSet, entities model.Resources) error
- func ReverseTopologicalSortResources(resources model.Resources) (model.Resources, error)
- func Rollback(ctx context.Context, mc model.ClientSet, resourceID, runID object.ID, ...) error
- func SetDefaultLabels(ctx context.Context, mc model.ClientSet, entities ...*model.Resource) error
- func SetEnvResourceDefaultLabels(env *model.Environment, r *model.Resource) error
- func SetSubjectID(ctx context.Context, resources ...*model.Resource) error
- func Start(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (*model.ResourceRun, 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 Upgrade(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (*model.ResourceRun, error)
- type DeleteOptions
- type Options
- type ResourceNode
Constants ¶
const ( ActionDelete = "delete" ActionStop = "stop" )
Variables ¶
This section is empty.
Functions ¶
func CanBeStopped ¶
CanBeStopped tells whether the given resource can be stopped.
func CollectionCreate ¶
func CollectionCreate( ctx context.Context, mc model.ClientSet, entities model.Resources, opts Options, ) (model.Resources, error)
CollectionCreate creates the resources.
func CollectionDelete ¶
func CollectionDelete(ctx context.Context, mc model.ClientSet, entities model.Resources, opts DeleteOptions) error
CollectionDelete deletes the resources.
func CollectionStart ¶
func CollectionStart(ctx context.Context, mc model.ClientSet, entities model.Resources, opts Options) error
CollectionStart starts the resources.
func CollectionStop ¶
func CollectionStop(ctx context.Context, mc model.ClientSet, entities model.Resources, opts Options) error
CollectionStop stops the resources.
func CollectionUpgrade ¶
func CollectionUpgrade(ctx context.Context, mc model.ClientSet, entities model.Resources, opts Options) error
CollectionUpgrade upgrades the resources.
func GenComputedAttributes ¶
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 GroupByEnvironment ¶
func GroupByEnvironment( ctx context.Context, mc model.ClientSet, entities model.Resources, ) (map[object.ID]model.Resources, error)
GroupByEnvironment groups the resources by environment.
func IsStoppable ¶
IsStoppable tells whether the given resource is stoppable.
func PerformResource ¶
func PerformResource(ctx context.Context, mc model.ClientSet, dp deptypes.Deployer, resourceID object.ID) error
PerformResource get resource latest run and perform run job.
func PopulateEnvironmentID ¶
PopulateEnvironmentID populate the environment id of the resources. As the environment id may not be included in the resource list returned by the query, we need to refill the environment id of the resources in some cases.
func ReverseTopologicalSortResources ¶
ReverseTopologicalSortResources sorts the resource by dependencies in reverse order.
func SetDefaultLabels ¶
SetDefaultLabels sets default labels for the provided resources.
func SetEnvResourceDefaultLabels ¶
func SetEnvResourceDefaultLabels(env *model.Environment, r *model.Resource) error
func Start ¶
func Start(ctx context.Context, mc model.ClientSet, entity *model.Resource, opts Options) (*model.ResourceRun, error)
Start starts the resource.
func TopologicalSortResources ¶
TopologicalSortResources sorts the resources by dependencies.
Types ¶
type DeleteOptions ¶
type Options ¶
type Options struct { // Deployer The deployer type to perform the resource run. Deployer deptypes.Deployer // StorageManager is the storage manager. StorageManager *storage.Manager // Draft if resource is in draft status. Draft bool // RunType The type of the resource run. RunType types.RunType // Preview if the resource run requires preview. Preview bool // ChangeComment of the resource run. ChangeComment string // RunLabels of the resource run. RunLabels map[string]string }
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.