createContext method

Future<CreateContextResponse> createContext({
  1. required String contextName,
  2. required String contextType,
  3. required ContextSource source,
  4. String? description,
  5. Map<String, String>? properties,
  6. List<Tag>? tags,
})

Creates a context. A context is a lineage tracking entity that represents a logical grouping of other tracking or experiment entities. Some examples are an endpoint and a model package. For more information, see Amazon SageMaker ML Lineage Tracking.

May throw ResourceLimitExceeded.

Parameter contextName : The name of the context. Must be unique to your account in an AWS Region.

Parameter contextType : The context type.

Parameter source : The source type, ID, and URI.

Parameter description : The description of the context.

Parameter properties : A list of properties to add to the context.

Parameter tags : A list of tags to apply to the context.

Implementation

Future<CreateContextResponse> createContext({
  required String contextName,
  required String contextType,
  required ContextSource source,
  String? description,
  Map<String, String>? properties,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(contextName, 'contextName');
  _s.validateStringLength(
    'contextName',
    contextName,
    1,
    120,
    isRequired: true,
  );
  ArgumentError.checkNotNull(contextType, 'contextType');
  _s.validateStringLength(
    'contextType',
    contextType,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(source, 'source');
  _s.validateStringLength(
    'description',
    description,
    0,
    3072,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateContext'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ContextName': contextName,
      'ContextType': contextType,
      'Source': source,
      if (description != null) 'Description': description,
      if (properties != null) 'Properties': properties,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateContextResponse.fromJson(jsonResponse.body);
}