updateEndpoint method

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

Deploys the EndpointConfig specified in the request to a new fleet of instances. SageMaker shifts endpoint traffic to the new instances with the updated endpoint configuration and then deletes the old instances using the previous EndpointConfig (there is no availability loss). For more information about how to control the update and traffic shifting process, see Update models in production.

When 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 an endpoint, which contains the desired deployment strategy and rollback configurations.

Parameter excludeRetainedVariantProperties : When you are updating endpoint resources with 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 ExcludeRetainedVariantProperties, 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.

Parameter retainDeploymentConfig : Specifies whether to reuse the last deployment configuration. The default value is false (the configuration is not reused).

Implementation

Future<UpdateEndpointOutput> updateEndpoint({
  required String endpointConfigName,
  required String endpointName,
  DeploymentConfig? deploymentConfig,
  List<VariantProperty>? excludeRetainedVariantProperties,
  bool? retainAllVariantProperties,
  bool? retainDeploymentConfig,
}) async {
  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,
      if (retainDeploymentConfig != null)
        'RetainDeploymentConfig': retainDeploymentConfig,
    },
  );

  return UpdateEndpointOutput.fromJson(jsonResponse.body);
}