Documentation ¶
Index ¶
Constants ¶
const ( Apply models.ActionName = "apply" AlertDiscord models.ActionName = "alert-discord" AlertEmail models.ActionName = "alert-email" )
Variables ¶
var ( // ErrActionNotFound is returned when an action is not found ErrActionNotFound = errors.New("action not found") // ErrEmptyNewTag is returned when the new tag is empty ErrEmptyNewTag = errors.New("new tag is empty") )
Functions ¶
func ParseActionName ¶
func ParseActionName(name string) (models.ActionName, error)
GetAction retrieves the ActionInterface associated with the given name. It takes a models.ActionName type as an argument and returns the corresponding ActionInterface. If the name does not exist in the actions map, the behavior is undefined.
Parameters:
- name: The name of the action to retrieve.
Returns:// - ActionInterface: The action associated with the provided name.n error indicating whether the action name was found or not. `ErrActionNotFound` is returned if the action name was not found.
Types ¶
type ActionInterface ¶ added in v0.1.0
type ActionInterface interface { Init(kubeClient kubeclient.Interface, tags models.Tags, image *v1alpha1.Image, data v1alpha1.ValueOrValueFrom) Execute(context.Context) error GetName() models.ActionName GetActualTag() string GetNewTag() string GetAvailableTags() []string }
func GetAction ¶
func GetAction(name models.ActionName) (ActionInterface, error)
GetAction retrieves an action by its name. It returns the corresponding ActionInterface and an error if the action is not found.
Parameters:
- name: The name of the action to retrieve.
Returns:
- ActionInterface: The action associated with the given name.
- error: An error indicating if the action was not found (ErrActionNotFound).
func GetActionWithUntypedName ¶
func GetActionWithUntypedName(name string) (ActionInterface, error)
GetActionWithUntypedName retrieves an action based on the provided untyped name. It parses the action name and returns the corresponding ActionInterface. If the name cannot be parsed, it returns an error.
Parameters:
- name: A string representing the untyped name of the action.
Returns:
- An ActionInterface corresponding to the parsed action name, or nil if not found.
- An error if the action name could not be parsed.