createCustomAction method
Creates a custom action that can be invoked as an alias or as a button on a notification.
May throw ConflictException.
May throw InternalServiceError.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw UnauthorizedException.
Parameter actionName :
The name of the custom action. This name is included in the Amazon
Resource Name (ARN).
Parameter definition :
The definition of the command to run when invoked as an alias or as an
action button.
Parameter aliasName :
The name used to invoke this action in a chat channel. For example,
@aws run my-alias.
Parameter attachments :
Defines when this custom action button should be attached to a
notification.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. Idempotency ensures that an API request
completes only once. With an idempotent request, if the original request
completes successfully, subsequent retries with the same client token
returns the result from the original successful request.
If you do not specify a client token, one is automatically generated by the SDK.
Parameter tags :
A map of tags assigned to a resource. A tag is a string-to-string map of
key-value pairs.
Implementation
Future<CreateCustomActionResult> createCustomAction({
required String actionName,
required CustomActionDefinition definition,
String? aliasName,
List<CustomActionAttachment>? attachments,
String? clientToken,
List<Tag>? tags,
}) async {
final $payload = <String, dynamic>{
'ActionName': actionName,
'Definition': definition,
if (aliasName != null) 'AliasName': aliasName,
if (attachments != null) 'Attachments': attachments,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/create-custom-action',
exceptionFnMap: _exceptionFns,
);
return CreateCustomActionResult.fromJson(response);
}