Skip to main content

NewTriggerModel

NewTriggerModel builds a models.Trigger from a deploy request. The caller supplies the TriggerIdentifier (including the expected revision for optimistic locking).

def NewTriggerModel(
ctx: context.Context,
id: *common.TriggerIdentifier,
spec: *triggerpb.TriggerSpec,
automationSpec: *taskpb.TriggerAutomationSpec
) - > *models.Trigger, error

Builds a models.Trigger from a deploy request. The caller supplies the TriggerIdentifier (including the expected revision for optimistic locking).

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, typically used for cancellation and deadlines.
id*common.TriggerIdentifierThe identifier for the trigger, including its name and the expected revision for optimistic locking.
spec*triggerpb.TriggerSpecThe specification for the trigger, defining its behavior and configuration.
automationSpec*taskpb.TriggerAutomationSpecThe specification for trigger automation, such as scheduling. If nil, it defaults to no automation.

Returns

TypeDescription
*models.Trigger, errorA new Trigger model and an error if the operation failed.