createAssetRevision method

Future<CreateAssetRevisionOutput> createAssetRevision({
  1. required String domainIdentifier,
  2. required String identifier,
  3. required String name,
  4. String? clientToken,
  5. String? description,
  6. List<FormInput>? formsInput,
  7. List<String>? glossaryTerms,
  8. PredictionConfiguration? predictionConfiguration,
  9. String? typeRevision,
})

Creates a revision of the asset.

Asset revisions represent new versions of existing assets, capturing changes to either the underlying data or its metadata. They maintain a historical record of how assets evolve over time, who made changes, and when those changes occurred. This versioning capability is crucial for governance and compliance, allowing organizations to track changes, understand their impact, and roll back if necessary.

Prerequisites:

  • Asset must already exist in the domain with identifier.
  • formsInput is required when asset has the form type. typeRevision should be the latest version of form type.
  • The form content must include all required fields (e.g., bucketArn for S3ObjectCollectionForm).
  • The owning project of the original asset must still exist and be active.
  • User must have write access to the project and domain.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter domainIdentifier : The unique identifier of the domain where the asset is being revised.

Parameter identifier : The identifier of the asset.

Parameter name : Te revised name of the asset.

Parameter clientToken : A unique, case-sensitive identifier that is provided to ensure the idempotency of the request.

Parameter description : The revised description of the asset.

Parameter formsInput : The metadata forms to be attached to the asset as part of asset revision.

Parameter glossaryTerms : The glossary terms to be attached to the asset as part of asset revision.

Parameter predictionConfiguration : The configuration of the automatically generated business-friendly metadata for the asset.

Parameter typeRevision : The revision type of the asset.

Implementation

Future<CreateAssetRevisionOutput> createAssetRevision({
  required String domainIdentifier,
  required String identifier,
  required String name,
  String? clientToken,
  String? description,
  List<FormInput>? formsInput,
  List<String>? glossaryTerms,
  PredictionConfiguration? predictionConfiguration,
  String? typeRevision,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (formsInput != null) 'formsInput': formsInput,
    if (glossaryTerms != null) 'glossaryTerms': glossaryTerms,
    if (predictionConfiguration != null)
      'predictionConfiguration': predictionConfiguration,
    if (typeRevision != null) 'typeRevision': typeRevision,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v2/domains/${Uri.encodeComponent(domainIdentifier)}/assets/${Uri.encodeComponent(identifier)}/revisions',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAssetRevisionOutput.fromJson(response);
}