createEnvironmentHost method
Creates an ESX host and adds it to an Amazon EVS environment. Amazon EVS supports 4-32 hosts per environment.
This action can only be used after the Amazon EVS environment is deployed.
You can use the dedicatedHostId parameter to specify an
Amazon EC2 Dedicated Host for ESX host creation.
You can use the placementGroupId parameter to specify a
cluster or partition placement group to launch EC2 instances into.
May throw ThrottlingException.
May throw ValidationException.
Parameter environmentId :
A unique ID for the environment that the host is added to.
Parameter host :
The host that is created and added to the environment.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the host creation request. If you do not specify a client
token, a randomly generated token is used for the request to ensure
idempotency.
Parameter esxVersion :
The ESX version to use for the host.
Implementation
Future<CreateEnvironmentHostResponse> createEnvironmentHost({
required String environmentId,
required HostInfoForCreate host,
String? clientToken,
String? esxVersion,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AmazonElasticVMwareService.CreateEnvironmentHost'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'environmentId': environmentId,
'host': host,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (esxVersion != null) 'esxVersion': esxVersion,
},
);
return CreateEnvironmentHostResponse.fromJson(jsonResponse.body);
}