updateAgent method

Future<UpdateAgentResponse> updateAgent({
  1. required String agentId,
  2. required String awsAccountId,
  3. required String name,
  4. List<String>? actionConnectorsToAdd,
  5. List<String>? actionConnectorsToRemove,
  6. CustomPromptInput? customPromptInput,
  7. String? description,
  8. String? iconId,
  9. List<String>? spacesToAdd,
  10. List<String>? spacesToRemove,
  11. List<String>? starterPrompts,
  12. String? welcomeMessage,
})

Updates an existing agent.

May throw AccessDeniedException. May throw ConflictException. May throw InternalFailureException. May throw InvalidParameterValueException. May throw LimitExceededException. May throw PreconditionNotMetException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter agentId : The unique identifier for the agent to update.

Parameter awsAccountId : The ID of the Amazon Web Services account that contains the agent.

Parameter name : The name of the agent.

Parameter actionConnectorsToAdd : The Amazon Resource Names (ARNs) of the action connectors to attach to the agent.

Parameter actionConnectorsToRemove : The Amazon Resource Names (ARNs) of the action connectors to detach from the agent.

Parameter customPromptInput : The custom prompt configuration for the agent.

Parameter description : A description of the agent.

Parameter iconId : The icon identifier for the agent.

Parameter spacesToAdd : The Amazon Resource Names (ARNs) of the spaces to attach to the agent.

Parameter spacesToRemove : The Amazon Resource Names (ARNs) of the spaces to detach from the agent.

Parameter starterPrompts : A list of starter prompts that are displayed to users when they begin interacting with the agent.

Parameter welcomeMessage : The welcome message that is displayed when a user starts a conversation with the agent.

Implementation

Future<UpdateAgentResponse> updateAgent({
  required String agentId,
  required String awsAccountId,
  required String name,
  List<String>? actionConnectorsToAdd,
  List<String>? actionConnectorsToRemove,
  CustomPromptInput? customPromptInput,
  String? description,
  String? iconId,
  List<String>? spacesToAdd,
  List<String>? spacesToRemove,
  List<String>? starterPrompts,
  String? welcomeMessage,
}) async {
  final $payload = <String, dynamic>{
    'Name': name,
    if (actionConnectorsToAdd != null)
      'ActionConnectorsToAdd': actionConnectorsToAdd,
    if (actionConnectorsToRemove != null)
      'ActionConnectorsToRemove': actionConnectorsToRemove,
    if (customPromptInput != null) 'CustomPromptInput': customPromptInput,
    if (description != null) 'Description': description,
    if (iconId != null) 'IconId': iconId,
    if (spacesToAdd != null) 'SpacesToAdd': spacesToAdd,
    if (spacesToRemove != null) 'SpacesToRemove': spacesToRemove,
    if (starterPrompts != null) 'StarterPrompts': starterPrompts,
    if (welcomeMessage != null) 'WelcomeMessage': welcomeMessage,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/agents/${Uri.encodeComponent(agentId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAgentResponse.fromJson(response);
}