createResource method
Future<CreateResourceResponse>
createResource({
- required String name,
- required String organizationId,
- required ResourceType type,
Creates a new Amazon WorkMail resource.
May throw DirectoryServiceAuthenticationFailedException. May throw DirectoryUnavailableException. May throw InvalidParameterException. May throw NameAvailabilityException. May throw OrganizationNotFoundException. May throw OrganizationStateException. May throw ReservedNameException.
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
.
Implementation
Future<CreateResourceResponse> createResource({
required String name,
required String organizationId,
required ResourceType type,
}) async {
ArgumentError.checkNotNull(name, 'name');
_s.validateStringLength(
'name',
name,
1,
20,
isRequired: true,
);
ArgumentError.checkNotNull(organizationId, 'organizationId');
_s.validateStringLength(
'organizationId',
organizationId,
34,
34,
isRequired: true,
);
ArgumentError.checkNotNull(type, 'type');
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.toValue(),
},
);
return CreateResourceResponse.fromJson(jsonResponse.body);
}