createProject method

Future<CreateProjectResponse> createProject({
  1. required String portalId,
  2. required String projectName,
  3. String? clientToken,
  4. String? projectDescription,
  5. Map<String, String>? tags,
})

Creates a project in the specified portal.

May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter portalId : The ID of the portal in which to create the project.

Parameter projectName : A friendly name for the project.

Parameter clientToken : A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

Parameter projectDescription : A description for the project.

Parameter tags : A list of key-value pairs that contain metadata for the project. For more information, see Tagging your IoT SiteWise resources in the IoT SiteWise User Guide.

Implementation

Future<CreateProjectResponse> createProject({
  required String portalId,
  required String projectName,
  String? clientToken,
  String? projectDescription,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'portalId': portalId,
    'projectName': projectName,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (projectDescription != null) 'projectDescription': projectDescription,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/projects',
    exceptionFnMap: _exceptionFns,
  );
  return CreateProjectResponse.fromJson(response);
}