createAsset method

Future<CreateAssetOutput> createAsset({
  1. required String domainIdentifier,
  2. required String name,
  3. required String owningProjectIdentifier,
  4. required String typeIdentifier,
  5. String? clientToken,
  6. String? description,
  7. String? externalIdentifier,
  8. List<FormInput>? formsInput,
  9. List<String>? glossaryTerms,
  10. PredictionConfiguration? predictionConfiguration,
  11. String? typeRevision,
})

Creates an asset in Amazon DataZone catalog.

Before creating assets, make sure that the following requirements are met:

  • --domain-identifier must refer to an existing domain.
  • --owning-project-identifier must be a valid project within the domain.
  • Asset type must be created beforehand using create-asset-type, or be a supported system-defined type. For more information, see create-asset-type.
  • --type-revision (if used) must match a valid revision of the asset type.
  • formsInput is required when it is associated as required in the asset-type. For more information, see create-form-type.
  • Form content must include all required fields as per the form schema (e.g., bucketArn).
You must invoke the following pre-requisite commands before invoking this API:

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

Parameter domainIdentifier : Amazon DataZone domain where the asset is created.

Parameter name : Asset name.

Parameter owningProjectIdentifier : The unique identifier of the project that owns this asset.

Parameter typeIdentifier : The unique identifier of this asset's type.

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

Parameter description : Asset description.

Parameter externalIdentifier : The external identifier of the asset.

If the value for the externalIdentifier parameter is specified, it must be a unique value.

Parameter formsInput : Metadata forms attached to the asset.

Parameter glossaryTerms : Glossary terms attached to the asset.

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

Parameter typeRevision : The revision of this asset's type.

Implementation

Future<CreateAssetOutput> createAsset({
  required String domainIdentifier,
  required String name,
  required String owningProjectIdentifier,
  required String typeIdentifier,
  String? clientToken,
  String? description,
  String? externalIdentifier,
  List<FormInput>? formsInput,
  List<String>? glossaryTerms,
  PredictionConfiguration? predictionConfiguration,
  String? typeRevision,
}) async {
  final $payload = <String, dynamic>{
    'name': name,
    'owningProjectIdentifier': owningProjectIdentifier,
    'typeIdentifier': typeIdentifier,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'description': description,
    if (externalIdentifier != null) 'externalIdentifier': externalIdentifier,
    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',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAssetOutput.fromJson(response);
}