createTopic method

Future<CreateTopicResponse> createTopic({
  1. required String awsAccountId,
  2. required TopicDetails topic,
  3. required String topicId,
  4. CustomInstructions? customInstructions,
  5. List<String>? folderArns,
  6. List<Tag>? tags,
})

Creates a new Q topic.

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

Parameter awsAccountId : The ID of the Amazon Web Services account that you want to create a topic in.

Parameter topic : The definition of a topic to create.

Parameter topicId : The ID for the topic that you want to create. This ID is unique per Amazon Web Services Region for each Amazon Web Services account.

Parameter customInstructions : Custom instructions for the topic.

Parameter folderArns : The Folder ARN of the folder that you want the topic to reside in.

Parameter tags : Contains a map of the key-value pairs for the resource tag or tags that are assigned to the dataset.

Implementation

Future<CreateTopicResponse> createTopic({
  required String awsAccountId,
  required TopicDetails topic,
  required String topicId,
  CustomInstructions? customInstructions,
  List<String>? folderArns,
  List<Tag>? tags,
}) async {
  final $payload = <String, dynamic>{
    'Topic': topic,
    'TopicId': topicId,
    if (customInstructions != null) 'CustomInstructions': customInstructions,
    if (folderArns != null) 'FolderArns': folderArns,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/accounts/${Uri.encodeComponent(awsAccountId)}/topics',
    exceptionFnMap: _exceptionFns,
  );
  return CreateTopicResponse.fromJson(response);
}