createWorkspaceInstance method
Launches a new WorkSpace Instance with specified configuration parameters, enabling programmatic workspace deployment.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter managedInstance :
Comprehensive configuration settings for the WorkSpaces Instance,
including network, compute, and storage parameters.
Parameter billingConfiguration :
Optional billing configuration for the WorkSpace Instance. Allows
customers to specify their preferred billing mode when creating a new
instance. Defaults to hourly billing if not specified.
Parameter clientToken :
Unique token to ensure idempotent instance creation, preventing duplicate
workspace launches.
Parameter tags :
Optional metadata tags for categorizing and managing WorkSpaces Instances.
Implementation
Future<CreateWorkspaceInstanceResponse> createWorkspaceInstance({
required ManagedInstanceRequest managedInstance,
BillingConfiguration? billingConfiguration,
String? clientToken,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'EUCMIFrontendAPIService.CreateWorkspaceInstance'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ManagedInstance': managedInstance,
if (billingConfiguration != null)
'BillingConfiguration': billingConfiguration,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'Tags': tags,
},
);
return CreateWorkspaceInstanceResponse.fromJson(jsonResponse.body);
}