createServiceEnvironment method
Creates a service environment for running service jobs. Service environments define capacity limits for specific service types such as SageMaker Training jobs.
May throw ClientException.
May throw ServerException.
Parameter capacityLimits :
The capacity limits for the service environment. The number of instances a
job consumes is the total number of instances requested in the submit
training job request resource configuration.
Parameter serviceEnvironmentName :
The name for the service environment. It can be up to 128 characters long
and can contain letters, numbers, hyphens (-), and underscores (_).
Parameter serviceEnvironmentType :
The type of service environment. For SageMaker Training jobs, specify
SAGEMAKER_TRAINING.
Parameter state :
The state of the service environment. Valid values are
ENABLED and DISABLED. The default value is
ENABLED.
Parameter tags :
The tags that you apply to the service environment to help you categorize
and organize your resources. Each tag consists of a key and an optional
value. For more information, see Tagging
your Batch resources.
Implementation
Future<CreateServiceEnvironmentResponse> createServiceEnvironment({
required List<CapacityLimit> capacityLimits,
required String serviceEnvironmentName,
required ServiceEnvironmentType serviceEnvironmentType,
ServiceEnvironmentState? state,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'capacityLimits': capacityLimits,
'serviceEnvironmentName': serviceEnvironmentName,
'serviceEnvironmentType': serviceEnvironmentType.value,
if (state != null) 'state': state.value,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/createserviceenvironment',
exceptionFnMap: _exceptionFns,
);
return CreateServiceEnvironmentResponse.fromJson(response);
}