createArtifact method
Future<CreateArtifactResponse>
createArtifact({
- required String artifactType,
- required ArtifactSource source,
- String? artifactName,
- MetadataProperties? metadataProperties,
- Map<
String, String> ? properties, - List<
Tag> ? tags,
Creates an artifact. An artifact is a lineage tracking entity that represents a URI addressable object or data. Some examples are the S3 URI of a dataset and the ECR registry path of an image. For more information, see Amazon SageMaker ML Lineage Tracking.
May throw ResourceLimitExceeded.
Parameter artifactType
:
The artifact type.
Parameter source
:
The ID, ID type, and URI of the source.
Parameter artifactName
:
The name of the artifact. Must be unique to your account in an AWS Region.
Parameter properties
:
A list of properties to add to the artifact.
Parameter tags
:
A list of tags to apply to the artifact.
Implementation
Future<CreateArtifactResponse> createArtifact({
required String artifactType,
required ArtifactSource source,
String? artifactName,
MetadataProperties? metadataProperties,
Map<String, String>? properties,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(artifactType, 'artifactType');
_s.validateStringLength(
'artifactType',
artifactType,
0,
256,
isRequired: true,
);
ArgumentError.checkNotNull(source, 'source');
_s.validateStringLength(
'artifactName',
artifactName,
1,
120,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SageMaker.CreateArtifact'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ArtifactType': artifactType,
'Source': source,
if (artifactName != null) 'ArtifactName': artifactName,
if (metadataProperties != null)
'MetadataProperties': metadataProperties,
if (properties != null) 'Properties': properties,
if (tags != null) 'Tags': tags,
},
);
return CreateArtifactResponse.fromJson(jsonResponse.body);
}