createFolder method

Future<CreateFolderResponse> createFolder({
  1. required String awsAccountId,
  2. required String folderId,
  3. FolderType? folderType,
  4. String? name,
  5. String? parentFolderArn,
  6. List<ResourcePermission>? permissions,
  7. SharingModel? sharingModel,
  8. List<Tag>? tags,
})

Creates an empty shared folder.

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

Parameter awsAccountId : The ID for the Amazon Web Services account where you want to create the folder.

Parameter folderId : The ID of the folder.

Parameter folderType : The type of folder. By default, folderType is SHARED.

Parameter name : The name of the folder.

Parameter parentFolderArn : The Amazon Resource Name (ARN) for the parent folder.

ParentFolderArn can be null. An empty parentFolderArn creates a root-level folder.

Parameter permissions : A structure that describes the principals and the resource-level permissions of a folder.

To specify no permissions, omit Permissions.

Parameter sharingModel : An optional parameter that determines the sharing scope of the folder. The default value for this parameter is ACCOUNT.

Parameter tags : Tags for the folder.

Implementation

Future<CreateFolderResponse> createFolder({
  required String awsAccountId,
  required String folderId,
  FolderType? folderType,
  String? name,
  String? parentFolderArn,
  List<ResourcePermission>? permissions,
  SharingModel? sharingModel,
  List<Tag>? tags,
}) async {
  final $payload = <String, dynamic>{
    if (folderType != null) 'FolderType': folderType.value,
    if (name != null) 'Name': name,
    if (parentFolderArn != null) 'ParentFolderArn': parentFolderArn,
    if (permissions != null) 'Permissions': permissions,
    if (sharingModel != null) 'SharingModel': sharingModel.value,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/folders/${Uri.encodeComponent(folderId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateFolderResponse.fromJson(response);
}