updateContext method

Future<UpdateContextResponse> updateContext({
  1. required String contextName,
  2. String? description,
  3. Map<String, String>? properties,
  4. List<String>? propertiesToRemove,
})

Updates a context.

May throw ConflictException. May throw ResourceNotFound.

Parameter contextName : The name of the context to update.

Parameter description : The new description for the context.

Parameter properties : The new list of properties. Overwrites the current property list.

Parameter propertiesToRemove : A list of properties to remove.

Implementation

Future<UpdateContextResponse> updateContext({
  required String contextName,
  String? description,
  Map<String, String>? properties,
  List<String>? propertiesToRemove,
}) async {
  ArgumentError.checkNotNull(contextName, 'contextName');
  _s.validateStringLength(
    'contextName',
    contextName,
    1,
    120,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    3072,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.UpdateContext'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ContextName': contextName,
      if (description != null) 'Description': description,
      if (properties != null) 'Properties': properties,
      if (propertiesToRemove != null)
        'PropertiesToRemove': propertiesToRemove,
    },
  );

  return UpdateContextResponse.fromJson(jsonResponse.body);
}