createProject method
Creates a project, including project resources. This action creates a project based on a submitted project request. A set of source code files and a toolchain template file can be included with the project request. If these are not provided, an empty project is created.
May throw ProjectAlreadyExistsException. May throw LimitExceededException. May throw ValidationException. May throw ProjectCreationFailedException. May throw InvalidServiceRoleException. May throw ProjectConfigurationException. May throw ConcurrentModificationException.
Parameter id
:
The ID of the project to be created in AWS CodeStar.
Parameter name
:
The display name for the project to be created in AWS CodeStar.
Parameter clientRequestToken
:
A user- or system-generated token that identifies the entity that
requested project creation. This token can be used to repeat the request.
Parameter description
:
The description of the project, if any.
Parameter sourceCode
:
A list of the Code objects submitted with the project request. If this
parameter is specified, the request must also include the toolchain
parameter.
Parameter tags
:
The tags created for the project.
Parameter toolchain
:
The name of the toolchain template file submitted with the project
request. If this parameter is specified, the request must also include the
sourceCode parameter.
Implementation
Future<CreateProjectResult> createProject({
required String id,
required String name,
String? clientRequestToken,
String? description,
List<Code>? sourceCode,
Map<String, String>? tags,
Toolchain? toolchain,
}) async {
ArgumentError.checkNotNull(id, 'id');
_s.validateStringLength(
'id',
id,
2,
15,
isRequired: true,
);
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
100,
isRequired: true,
);
_s.validateStringLength(
'clientRequestToken',
clientRequestToken,
1,
256,
);
_s.validateStringLength(
'description',
description,
0,
1024,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeStar_20170419.CreateProject'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'id': id,
'name': name,
if (clientRequestToken != null)
'clientRequestToken': clientRequestToken,
if (description != null) 'description': description,
if (sourceCode != null) 'sourceCode': sourceCode,
if (tags != null) 'tags': tags,
if (toolchain != null) 'toolchain': toolchain,
},
);
return CreateProjectResult.fromJson(jsonResponse.body);
}