createAgentSpace method

Future<CreateAgentSpaceOutput> createAgentSpace({
  1. required String name,
  2. String? clientToken,
  3. String? description,
  4. String? kmsKeyArn,
  5. String? locale,
  6. Map<String, String>? tags,
})

Creates a new AgentSpace with the specified name and description. Duplicate space names are allowed.

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

Parameter name : The name of the AgentSpace.

Parameter clientToken : Client-provided token to ensure request idempotency. When the same token is provided in subsequent calls, the same response is returned within a 8-hour window.

Parameter description : The description of the AgentSpace.

Parameter kmsKeyArn : The ARN of the AWS Key Management Service (AWS KMS) customer managed key that's used to encrypt resources.

Parameter locale : The locale for the AgentSpace, which determines the language used in agent responses.

Parameter tags : Tags to add to the AgentSpace at creation time.

Implementation

Future<CreateAgentSpaceOutput> createAgentSpace({
  required String name,
  String? clientToken,
  String? description,
  String? kmsKeyArn,
  String? locale,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (kmsKeyArn != null) 'kmsKeyArn': kmsKeyArn,
    if (locale != null) 'locale': locale,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/agentspaces',
    hostPrefix: 'cp.',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAgentSpaceOutput.fromJson(response);
}