createAIAgent method

Future<CreateAIAgentResponse> createAIAgent({
  1. required String assistantId,
  2. required AIAgentConfiguration configuration,
  3. required String name,
  4. required AIAgentType type,
  5. required VisibilityStatus visibilityStatus,
  6. String? clientToken,
  7. String? description,
  8. Map<String, String>? tags,
})

Creates an Amazon Q in Connect AI Agent.

May throw AccessDeniedException. May throw ConflictException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw UnauthorizedException. May throw ValidationException.

Parameter assistantId : The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.

Parameter configuration : The configuration of the AI Agent.

Parameter name : The name of the AI Agent.

Parameter type : The type of the AI Agent.

Parameter visibilityStatus : The visibility status of the AI Agent.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs..

Parameter description : The description of the AI Agent.

Parameter tags : The tags used to organize, track, or control access for this resource.

Implementation

Future<CreateAIAgentResponse> createAIAgent({
  required String assistantId,
  required AIAgentConfiguration configuration,
  required String name,
  required AIAgentType type,
  required VisibilityStatus visibilityStatus,
  String? clientToken,
  String? description,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'configuration': configuration,
    'name': name,
    'type': type.value,
    'visibilityStatus': visibilityStatus.value,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/assistants/${Uri.encodeComponent(assistantId)}/aiagents',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAIAgentResponse.fromJson(response);
}