createBot method

Future<CreateBotResponse> createBot({
  1. required String botName,
  2. required DataPrivacy dataPrivacy,
  3. required int idleSessionTTLInSeconds,
  4. required String roleArn,
  5. List<BotMember>? botMembers,
  6. Map<String, String>? botTags,
  7. BotType? botType,
  8. String? description,
  9. ErrorLogSettings? errorLogSettings,
  10. Map<String, String>? testBotAliasTags,
})

Creates an Amazon Lex conversational bot.

May throw ConflictException. May throw InternalServerException. May throw PreconditionFailedException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter botName : The name of the bot. The bot name must be unique in the account that creates the bot.

Parameter dataPrivacy : Provides information on additional privacy protections Amazon Lex should use with the bot's data.

Parameter idleSessionTTLInSeconds : The time, in seconds, that Amazon Lex should keep information about a user's conversation with the bot.

A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Lex deletes any data provided before the timeout.

You can specify between 60 (1 minute) and 86,400 (24 hours) seconds.

Parameter roleArn : The Amazon Resource Name (ARN) of an IAM role that has permission to access the bot.

Parameter botMembers : The list of bot members in a network to be created.

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

Parameter botType : The type of a bot to create.

Parameter description : A description of the bot. It appears in lists to help you identify a particular bot.

Parameter errorLogSettings : Specifies the configuration for error logging during bot creation.

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

Implementation

Future<CreateBotResponse> createBot({
  required String botName,
  required DataPrivacy dataPrivacy,
  required int idleSessionTTLInSeconds,
  required String roleArn,
  List<BotMember>? botMembers,
  Map<String, String>? botTags,
  BotType? botType,
  String? description,
  ErrorLogSettings? errorLogSettings,
  Map<String, String>? testBotAliasTags,
}) async {
  _s.validateNumRange(
    'idleSessionTTLInSeconds',
    idleSessionTTLInSeconds,
    60,
    86400,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    'botName': botName,
    'dataPrivacy': dataPrivacy,
    'idleSessionTTLInSeconds': idleSessionTTLInSeconds,
    'roleArn': roleArn,
    if (botMembers != null) 'botMembers': botMembers,
    if (botTags != null) 'botTags': botTags,
    if (botType != null) 'botType': botType.value,
    if (description != null) 'description': description,
    if (errorLogSettings != null) 'errorLogSettings': errorLogSettings,
    if (testBotAliasTags != null) 'testBotAliasTags': testBotAliasTags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/bots',
    exceptionFnMap: _exceptionFns,
  );
  return CreateBotResponse.fromJson(response);
}