createQueueEnvironment method
Creates an environment for a queue that defines how jobs in the queue run.
May throw AccessDeniedException.
May throw InternalServerErrorException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter farmId :
The farm ID of the farm to connect to the environment.
Parameter priority :
Sets the priority of the environments in the queue from 0 to 10,000, where
0 is the highest priority (activated first and deactivated last). If two
environments share the same priority value, the environment created first
takes higher priority.
Parameter queueId :
The queue ID to connect the queue and environment.
Parameter template :
The environment template to use in the queue.
Parameter templateType :
The template's file type, JSON or YAML.
Parameter clientToken :
The unique token which the server uses to recognize retries of the same
request.
Implementation
Future<CreateQueueEnvironmentResponse> createQueueEnvironment({
required String farmId,
required int priority,
required String queueId,
required String template,
required EnvironmentTemplateType templateType,
String? clientToken,
}) async {
_s.validateNumRange(
'priority',
priority,
0,
10000,
isRequired: true,
);
final headers = <String, String>{
if (clientToken != null) 'X-Amz-Client-Token': clientToken.toString(),
};
final $payload = <String, dynamic>{
'priority': priority,
'template': template,
'templateType': templateType.value,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/2023-10-12/farms/${Uri.encodeComponent(farmId)}/queues/${Uri.encodeComponent(queueId)}/environments',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateQueueEnvironmentResponse.fromJson(response);
}