updateEndpoint method

Future<UpdateEndpointOutput> updateEndpoint({
  1. required String endpointConfigName,
  2. required String endpointName,
  3. DeploymentConfig? deploymentConfig,
  4. List<VariantProperty>? excludeRetainedVariantProperties,
  5. bool? retainAllVariantProperties,
})

Deploys the new EndpointConfig specified in the request, switches to using newly created endpoint, and then deletes resources provisioned for the endpoint using the previous EndpointConfig (there is no availability loss).

When Amazon SageMaker receives the request, it 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.

If you delete the EndpointConfig of an endpoint that is active or being created or updated you may lose visibility into the instance type the endpoint is using. The endpoint must be deleted in order to stop incurring charges.

May throw ResourceLimitExceeded.

Parameter endpointConfigName : The name of the new endpoint configuration.

Parameter endpointName : The name of the endpoint whose configuration you want to update.

Parameter deploymentConfig : The deployment configuration for the endpoint to be updated.

Parameter excludeRetainedVariantProperties : When you are updating endpoint resources with UpdateEndpointInput$RetainAllVariantProperties, whose value is set to true, ExcludeRetainedVariantProperties specifies the list of type VariantProperty to override with the values provided by EndpointConfig. If you don't specify a value for ExcludeAllVariantProperties, no variant properties are overridden.

Parameter retainAllVariantProperties : When updating endpoint resources, enables or disables the retention of variant properties, such as the instance count or the variant weight. To retain the variant properties of an endpoint when updating it, set RetainAllVariantProperties to true. To use the variant properties specified in a new EndpointConfig call when updating an endpoint, set RetainAllVariantProperties to false. The default is false.

Implementation

Future<UpdateEndpointOutput> updateEndpoint({
  required String endpointConfigName,
  required String endpointName,
  DeploymentConfig? deploymentConfig,
  List<VariantProperty>? excludeRetainedVariantProperties,
  bool? retainAllVariantProperties,
}) async {
  ArgumentError.checkNotNull(endpointConfigName, 'endpointConfigName');
  _s.validateStringLength(
    'endpointConfigName',
    endpointConfigName,
    0,
    63,
    isRequired: true,
  );
  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.UpdateEndpoint'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EndpointConfigName': endpointConfigName,
      'EndpointName': endpointName,
      if (deploymentConfig != null) 'DeploymentConfig': deploymentConfig,
      if (excludeRetainedVariantProperties != null)
        'ExcludeRetainedVariantProperties': excludeRetainedVariantProperties,
      if (retainAllVariantProperties != null)
        'RetainAllVariantProperties': retainAllVariantProperties,
    },
  );

  return UpdateEndpointOutput.fromJson(jsonResponse.body);
}