createTrigger method
Creates a new trigger.
May throw AlreadyExistsException. May throw EntityNotFoundException. May throw InvalidInputException. May throw IdempotentParameterMismatchException. May throw InternalServiceException. May throw OperationTimeoutException. May throw ResourceNumberLimitExceededException. May throw ConcurrentModificationException.
Parameter actions
:
The actions initiated by this trigger when it fires.
Parameter name
:
The name of the trigger.
Parameter type
:
The type of the new trigger.
Parameter description
:
A description of the new trigger.
Parameter predicate
:
A predicate to specify when the new trigger should fire.
This field is required when the trigger type is CONDITIONAL
.
Parameter schedule
:
A cron
expression used to specify the schedule (see Time-Based
Schedules for Jobs and Crawlers. For example, to run something every
day at 12:15 UTC, you would specify: cron(15 12 * * ? *)
.
This field is required when the trigger type is SCHEDULED.
Parameter startOnCreation
:
Set to true
to start SCHEDULED
and
CONDITIONAL
triggers when created. True is not supported for
ON_DEMAND
triggers.
Parameter tags
:
The tags to use with this trigger. You may use tags to limit access to the
trigger. For more information about tags in AWS Glue, see AWS
Tags in AWS Glue in the developer guide.
Parameter workflowName
:
The name of the workflow associated with the trigger.
Implementation
Future<CreateTriggerResponse> createTrigger({
required List<Action> actions,
required String name,
required TriggerType type,
String? description,
Predicate? predicate,
String? schedule,
bool? startOnCreation,
Map<String, String>? tags,
String? workflowName,
}) async {
ArgumentError.checkNotNull(actions, 'actions');
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(type, 'type');
_s.validateStringLength(
'description',
description,
0,
2048,
);
_s.validateStringLength(
'workflowName',
workflowName,
1,
255,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSGlue.CreateTrigger'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Actions': actions,
'Name': name,
'Type': type.toValue(),
if (description != null) 'Description': description,
if (predicate != null) 'Predicate': predicate,
if (schedule != null) 'Schedule': schedule,
if (startOnCreation != null) 'StartOnCreation': startOnCreation,
if (tags != null) 'Tags': tags,
if (workflowName != null) 'WorkflowName': workflowName,
},
);
return CreateTriggerResponse.fromJson(jsonResponse.body);
}