createTrigger method
Creates a new Trigger in the specified agent space
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter action :
The action the new Trigger performs when it fires
Parameter agentSpaceId :
The unique identifier for the agent space where the Trigger will be
created
Parameter condition :
The condition that fires the new Trigger
Parameter type :
How the new Trigger fires
Parameter clientToken :
A unique, case-sensitive identifier used for idempotent Trigger creation
Parameter status :
The initial status of the Trigger
Implementation
Future<CreateTriggerResponse> createTrigger({
required Object action,
required String agentSpaceId,
required TriggerCondition condition,
required String type,
String? clientToken,
String? status,
}) async {
final $payload = <String, dynamic>{
'action': action,
'condition': condition,
'type': type,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (status != null) 'status': status,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/trigger/agent-space/${Uri.encodeComponent(agentSpaceId)}/triggers',
hostPrefix: 'dp.',
exceptionFnMap: _exceptionFns,
);
return CreateTriggerResponse.fromJson(response);
}