updateEndpointWeightsAndCapacities method

Future<UpdateEndpointWeightsAndCapacitiesOutput> updateEndpointWeightsAndCapacities({
  1. required List<DesiredWeightAndCapacity> desiredWeightsAndCapacities,
  2. required String endpointName,
})

Updates variant weight of one or more variants associated with an existing endpoint, or capacity of one variant associated with an existing endpoint. When it receives the request, Amazon SageMaker sets the endpoint status to Updating. After updating the endpoint, it sets the status to InService. To check the status of an endpoint, use the DescribeEndpoint API.

May throw ResourceLimitExceeded.

Parameter desiredWeightsAndCapacities : An object that provides new capacity and weight values for a variant.

Parameter endpointName : The name of an existing Amazon SageMaker endpoint.

Implementation

Future<UpdateEndpointWeightsAndCapacitiesOutput>
    updateEndpointWeightsAndCapacities({
  required List<DesiredWeightAndCapacity> desiredWeightsAndCapacities,
  required String endpointName,
}) async {
  ArgumentError.checkNotNull(
      desiredWeightsAndCapacities, 'desiredWeightsAndCapacities');
  ArgumentError.checkNotNull(endpointName, 'endpointName');
  _s.validateStringLength(
    'endpointName',
    endpointName,
    0,
    63,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.UpdateEndpointWeightsAndCapacities'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DesiredWeightsAndCapacities': desiredWeightsAndCapacities,
      'EndpointName': endpointName,
    },
  );

  return UpdateEndpointWeightsAndCapacitiesOutput.fromJson(jsonResponse.body);
}