createResource method
Creates a new WorkMail resource.
May throw DirectoryServiceAuthenticationFailedException.
May throw DirectoryUnavailableException.
May throw InvalidParameterException.
May throw NameAvailabilityException.
May throw OrganizationNotFoundException.
May throw OrganizationStateException.
May throw ReservedNameException.
May throw UnsupportedOperationException.
Parameter name :
The name of the new resource.
Parameter organizationId :
The identifier associated with the organization for which the resource is
created.
Parameter type :
The type of the new resource. The available types are
equipment and room.
Parameter description :
Resource description.
Parameter hiddenFromGlobalAddressList :
If this parameter is enabled, the resource will be hidden from the address
book.
Implementation
Future<CreateResourceResponse> createResource({
required String name,
required String organizationId,
required ResourceType type,
String? description,
bool? hiddenFromGlobalAddressList,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'WorkMailService.CreateResource'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
'OrganizationId': organizationId,
'Type': type.value,
if (description != null) 'Description': description,
if (hiddenFromGlobalAddressList != null)
'HiddenFromGlobalAddressList': hiddenFromGlobalAddressList,
},
);
return CreateResourceResponse.fromJson(jsonResponse.body);
}