putAsset method

Future<PutAssetResponse> putAsset({
  1. required String assetTypeId,
  2. required Map<String, AssetFormEntry> forms,
  3. required String identifier,
  4. required String name,
  5. String? clientToken,
  6. String? description,
})

Creates or updates an asset in Glue Data Catalog. If the asset already exists, this operation updates it; otherwise, a new asset is created.

May throw AccessDeniedException. May throw ConcurrentModificationException. May throw EntityNotFoundException. May throw InternalServiceException. May throw InvalidInputException. May throw ThrottlingException.

Parameter assetTypeId : The identifier of the asset type for the asset.

Parameter forms : The forms to set on the asset, keyed by form name. Each entry specifies the form type and its JSON content.

Parameter identifier : The unique identifier of the asset. If an asset with this identifier already exists, it is updated.

Parameter name : The name of the asset.

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

Parameter description : The description of the asset.

Implementation

Future<PutAssetResponse> putAsset({
  required String assetTypeId,
  required Map<String, AssetFormEntry> forms,
  required String identifier,
  required String name,
  String? clientToken,
  String? description,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.PutAsset'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AssetTypeId': assetTypeId,
      'Forms': forms,
      'Identifier': identifier,
      'Name': name,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'Description': description,
    },
  );

  return PutAssetResponse.fromJson(jsonResponse.body);
}