createAction method

Future<CreateActionResponse> createAction({
  1. required String actionName,
  2. required String actionType,
  3. required ActionSource source,
  4. String? description,
  5. MetadataProperties? metadataProperties,
  6. Map<String, String>? properties,
  7. ActionStatus? status,
  8. List<Tag>? tags,
})

Creates an action. An action is a lineage tracking entity that represents an action or activity. For example, a model deployment or an HPO job. Generally, an action involves at least one input or output artifact. For more information, see Amazon SageMaker ML Lineage Tracking.

May throw ResourceLimitExceeded.

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

Parameter actionType : The action type.

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

Parameter description : The description of the action.

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

Parameter status : The status of the action.

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

Implementation

Future<CreateActionResponse> createAction({
  required String actionName,
  required String actionType,
  required ActionSource source,
  String? description,
  MetadataProperties? metadataProperties,
  Map<String, String>? properties,
  ActionStatus? status,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(actionName, 'actionName');
  _s.validateStringLength(
    'actionName',
    actionName,
    1,
    120,
    isRequired: true,
  );
  ArgumentError.checkNotNull(actionType, 'actionType');
  _s.validateStringLength(
    'actionType',
    actionType,
    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.CreateAction'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ActionName': actionName,
      'ActionType': actionType,
      'Source': source,
      if (description != null) 'Description': description,
      if (metadataProperties != null)
        'MetadataProperties': metadataProperties,
      if (properties != null) 'Properties': properties,
      if (status != null) 'Status': status.toValue(),
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateActionResponse.fromJson(jsonResponse.body);
}