putBotAlias method

Future<PutBotAliasResponse> putBotAlias({
  1. required String botName,
  2. required String botVersion,
  3. required String name,
  4. String? checksum,
  5. ConversationLogsRequest? conversationLogs,
  6. String? description,
  7. List<Tag>? tags,
})

Creates an alias for the specified version of the bot or replaces an alias for the specified bot. To change the version of the bot that the alias points to, replace the alias. For more information about aliases, see versioning-aliases.

This operation requires permissions for the lex:PutBotAlias action.

May throw ConflictException. May throw LimitExceededException. May throw InternalFailureException. May throw BadRequestException. May throw PreconditionFailedException.

Parameter botName : The name of the bot.

Parameter botVersion : The version of the bot.

Parameter name : The name of the alias. The name is not case sensitive.

Parameter checksum : Identifies a specific revision of the $LATEST version.

When you create a new bot alias, leave the checksum field blank. If you specify a checksum you get a BadRequestException exception.

When you want to update a bot alias, set the checksum field to the checksum of the most recent revision of the $LATEST version. If you don't specify the checksum field, or if the checksum does not match the $LATEST version, you get a PreconditionFailedException exception.

Parameter conversationLogs : Settings for conversation logs for the alias.

Parameter description : A description of the alias.

Parameter tags : A list of tags to add to the bot alias. You can only add tags when you create an alias, you can't use the PutBotAlias operation to update the tags on a bot alias. To update tags, use the TagResource operation.

Implementation

Future<PutBotAliasResponse> putBotAlias({
  required String botName,
  required String botVersion,
  required String name,
  String? checksum,
  ConversationLogsRequest? conversationLogs,
  String? description,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(botName, 'botName');
  _s.validateStringLength(
    'botName',
    botName,
    2,
    50,
    isRequired: true,
  );
  ArgumentError.checkNotNull(botVersion, 'botVersion');
  _s.validateStringLength(
    'botVersion',
    botVersion,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    200,
  );
  final $payload = <String, dynamic>{
    'botVersion': botVersion,
    if (checksum != null) 'checksum': checksum,
    if (conversationLogs != null) 'conversationLogs': conversationLogs,
    if (description != null) 'description': description,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/bots/${Uri.encodeComponent(botName)}/aliases/${Uri.encodeComponent(name)}',
    exceptionFnMap: _exceptionFns,
  );
  return PutBotAliasResponse.fromJson(response);
}