action

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 14 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoadOptions = struct {
	Default          LoadOptionFunc
	WithRequirements LoadOptionFunc
	WithParameters   LoadOptionFunc
	WithChildren     LoadOptionFunc
	WithAudits       LoadOptionFunc
	WithGroup        LoadOptionFunc
}{
	Default:          loadDefault,
	WithRequirements: loadRequirements,
	WithParameters:   loadParameters,
	WithChildren:     loadChildren,
	WithAudits:       loadAudits,
	WithGroup:        loadGroup,
}

LoadOptions provides all options on action loads functions.

Functions

func CheckChildrenForGroupIDs

func CheckChildrenForGroupIDs(ctx context.Context, db gorp.SqlExecutor, a *sdk.Action, groupIDs []int64) error

CheckChildrenForGroupIDs returns an error if given children not found.

func CheckChildrenForGroupIDsWithLoop

func CheckChildrenForGroupIDsWithLoop(ctx context.Context, db gorp.SqlExecutor, a *sdk.Action, groupIDs []int64) error

CheckChildrenForGroupIDsWithLoop return an error if given children not found or tree loop detected.

func ComputeAudit

func ComputeAudit(ctx context.Context, DBFunc func() *gorp.DbMap, chanEvent chan sdk.Event)

ComputeAudit compute audit on action.

func CreateAsCodeAction added in v0.53.0

func CreateAsCodeAction(ctx context.Context, db gorpmapper.SqlExecutorWithTx) error

func CreateBuiltinActions

func CreateBuiltinActions(db gorpmapper.SqlExecutorWithTx) error

CreateBuiltinActions add builtin actions in database if needed

func Delete

func Delete(db gorp.SqlExecutor, a *sdk.Action) error

Delete action in database.

func DeleteAllTypeJoinedByIDs

func DeleteAllTypeJoinedByIDs(db gorp.SqlExecutor, ids []int64) error

DeleteAllTypeJoinedByIDs deletes all joined action by ids.

func DeleteRequirementsByActionID

func DeleteRequirementsByActionID(db gorp.SqlExecutor, actionID int64) error

DeleteRequirementsByActionID deletes all requirements related to given action.

func DeleteTypeJoinedByID

func DeleteTypeJoinedByID(db gorp.SqlExecutor, id int64) error

DeleteTypeJoinedByID deletes joined action for id.

func Export

func Export(a sdk.Action, f exportentities.Format, w io.Writer) error

Export given action to writer.

func GetActionUsages

func GetActionUsages(db gorp.SqlExecutor, sharedInfraGroupID, actionID int64) ([]sdk.UsageAction, error)

GetActionUsages returns the list of actions using an action

func GetAuditByActionIDAndID

func GetAuditByActionIDAndID(ctx context.Context, db gorp.SqlExecutor, actionID, auditID int64) (*sdk.AuditAction, error)

GetAuditByActionIDAndID returns audit for given action id and audit id.

func GetAuditLatestByActionID

func GetAuditLatestByActionID(ctx context.Context, db gorp.SqlExecutor, actionID int64) (*sdk.AuditAction, error)

GetAuditLatestByActionID returns action latest audit by action id.

func GetAuditOldestByActionID

func GetAuditOldestByActionID(ctx context.Context, db gorp.SqlExecutor, actionID int64) (*sdk.AuditAction, error)

GetAuditOldestByActionID returns action oldtest audit by action id.

func GetAuditsByActionID

func GetAuditsByActionID(db gorp.SqlExecutor, actionID int64) ([]sdk.AuditAction, error)

GetAuditsByActionID returns all action audits by action ids.

func GetPipelineUsages

func GetPipelineUsages(db gorp.SqlExecutor, sharedInfraGroupID, actionID int64) ([]sdk.UsagePipeline, error)

GetPipelineUsages returns the list of pipelines using an action

func GetRequirementsDistinctBinary

func GetRequirementsDistinctBinary(db gorp.SqlExecutor) (sdk.RequirementList, error)

GetRequirementsDistinctBinary retrieves all binary requirements in database. Used by worker to automatically declare most capabilities, this func returns denormalized values.

func GetRequirementsTypeModelAndValueStartBy

func GetRequirementsTypeModelAndValueStartBy(ctx context.Context, db gorp.SqlExecutor, value string) ([]sdk.Requirement, error)

GetRequirementsTypeModelAndValueStartBy returns action requirements from database for given criteria.

func Insert

func Insert(db gorp.SqlExecutor, a *sdk.Action) error

Insert given action and its components in database.

func InsertAudit

func InsertAudit(db gorp.SqlExecutor, aa *sdk.AuditAction) error

InsertAudit in database.

func InsertRequirement

func InsertRequirement(db gorp.SqlExecutor, r *sdk.Requirement) error

InsertRequirement in database.

func LoadAllByIDs

func LoadAllByIDs(ctx context.Context, db gorp.SqlExecutor, ids []int64, opts ...LoadOptionFunc) ([]sdk.Action, error)

LoadAllByIDs retrieves in database action with given ids.

func LoadAllByIDsWithTypeBuiltinOrPluginOrDefaultInGroupIDs

func LoadAllByIDsWithTypeBuiltinOrPluginOrDefaultInGroupIDs(ctx context.Context, db gorp.SqlExecutor, ids, groupIDs []int64, opts ...LoadOptionFunc) ([]sdk.Action, error)

LoadAllByIDsWithTypeBuiltinOrPluginOrDefaultInGroupIDs returns all actions for given ids. Action should be of type builtin, plugin or default. Default action should be in given group ids list.

func LoadAllByTypes

func LoadAllByTypes(ctx context.Context, db gorp.SqlExecutor, types []string, opts ...LoadOptionFunc) ([]sdk.Action, error)

LoadAllByTypes actions from database.

func LoadAllTypeBuiltInOrPluginOrDefaultForGroupIDs

func LoadAllTypeBuiltInOrPluginOrDefaultForGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, opts ...LoadOptionFunc) ([]sdk.Action, error)

LoadAllTypeBuiltInOrPluginOrDefaultForGroupIDs actions from database.

func LoadAllTypeDefaultByGroupIDs

func LoadAllTypeDefaultByGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, opts ...LoadOptionFunc) ([]sdk.Action, error)

LoadAllTypeDefaultByGroupIDs actions from database.

func LoadByID

func LoadByID(ctx context.Context, db gorp.SqlExecutor, id int64, opts ...LoadOptionFunc) (*sdk.Action, error)

LoadByID retrieves in database the action with given id.

func LoadByTypesAndName

func LoadByTypesAndName(ctx context.Context, db gorp.SqlExecutor, types []string, name string, opts ...LoadOptionFunc) (*sdk.Action, error)

LoadByTypesAndName returns an action from database with given name and type in list.

func LoadTypeDefaultByNameAndGroupID

func LoadTypeDefaultByNameAndGroupID(ctx context.Context, db gorp.SqlExecutor, name string, groupID int64, opts ...LoadOptionFunc) (*sdk.Action, error)

LoadTypeDefaultByNameAndGroupID returns an action from database with given name and group id.

func RetrieveForGroupAndName

func RetrieveForGroupAndName(ctx context.Context, db gorp.SqlExecutor, g *sdk.Group, name string) (*sdk.Action, error)

RetrieveForGroupAndName try to find an action for given group and name.

func Update

func Update(db gorp.SqlExecutor, a *sdk.Action) error

Update given action and its components in database.

func UpdateRequirement

func UpdateRequirement(db gorp.SqlExecutor, r *sdk.Requirement) error

UpdateRequirement in database.

func Used

func Used(db gorp.SqlExecutor, actionID int64) (bool, error)

Used checks if action is used in another action or in a pipeline.

Types

type LoadOptionFunc

type LoadOptionFunc func(context.Context, gorp.SqlExecutor, ...*sdk.Action) error

LoadOptionFunc for action.

Jump to

Keyboard shortcuts

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