createWorkspace method
Creates a workspace in IoT SiteWise. A workspace isolates its resources,
such as datasets, time series, pipelines, and tasks, and their data from
other workspaces, and has its own quotas and throttling limits. You must
specify an encryption configuration when you create a workspace. The
operation returns immediately with the workspace in the
CREATING state. Provisioning completes asynchronously, after
which the workspace state is ACTIVE, or FAILED
if provisioning doesn't complete.
May throw AccessDeniedException.
May throw ConflictingOperationException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ThrottlingException.
Parameter encryptionConfiguration :
The encryption configuration for the workspace.
Parameter workspaceName :
The name of the workspace to create.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure that the
request is idempotent. If you retry a request that completed successfully
using the same client token, the retry succeeds without performing any
further actions.
Parameter tags :
A list of key-value pairs that contain metadata for the workspace. For
more information, see Tagging
your IoT SiteWise resources in the IoT SiteWise User Guide.
Parameter workspaceDescription :
A description for the workspace.
Implementation
Future<CreateWorkspaceResponse> createWorkspace({
required WorkspaceEncryptionConfiguration encryptionConfiguration,
required String workspaceName,
String? clientToken,
Map<String, String>? tags,
String? workspaceDescription,
}) async {
final $payload = <String, dynamic>{
'encryptionConfiguration': encryptionConfiguration,
'workspaceName': workspaceName,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'tags': tags,
if (workspaceDescription != null)
'workspaceDescription': workspaceDescription,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/workspaces',
hostPrefix: 'api.',
exceptionFnMap: _exceptionFns,
);
return CreateWorkspaceResponse.fromJson(response);
}