createExportImageTask method
Creates a task to export a WorkSpaces Applications image to an EC2 AMI. This allows you to use your customized WorkSpaces Applications images with other AWS services or for backup purposes.
May throw ConcurrentModificationException.
May throw InvalidAccountStatusException.
May throw InvalidRoleException.
May throw LimitExceededException.
May throw OperationNotPermittedException.
May throw ResourceNotAvailableException.
May throw ResourceNotFoundException.
Parameter amiName :
The name for the exported EC2 AMI. This is a required field that must be
unique within your account and region.
Parameter iamRoleArn :
The ARN of the IAM role that allows WorkSpaces Applications to create the
AMI. The role must have permissions to copy images, describe images, and
create tags, with a trust relationship allowing appstream.amazonaws.com to
assume the role.
Parameter imageName :
The name of the WorkSpaces Applications image to export. The image must be
in an available state and owned by your account.
Parameter amiDescription :
An optional description for the exported AMI. This description will be
applied to the resulting EC2 AMI.
Parameter tagSpecifications :
The tags to apply to the exported AMI. These tags help you organize and
manage your EC2 AMIs.
Implementation
Future<CreateExportImageTaskResult> createExportImageTask({
required String amiName,
required String iamRoleArn,
required String imageName,
String? amiDescription,
Map<String, String>? tagSpecifications,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'PhotonAdminProxyService.CreateExportImageTask'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AmiName': amiName,
'IamRoleArn': iamRoleArn,
'ImageName': imageName,
if (amiDescription != null) 'AmiDescription': amiDescription,
if (tagSpecifications != null) 'TagSpecifications': tagSpecifications,
},
);
return CreateExportImageTaskResult.fromJson(jsonResponse.body);
}