putAttachment method
Attaches a form to an asset or an iterable form item in Glue Data Catalog. If an attachment with the same name already exists, it is overwritten.
May throw AccessDeniedException.
May throw ConcurrentModificationException.
May throw EntityNotFoundException.
May throw InternalServiceException.
May throw InvalidInputException.
May throw ThrottlingException.
Parameter assetIdentifier :
The unique identifier of the asset to attach the form to.
Parameter attachmentName :
The name of the attachment.
Parameter content :
The JSON content of the form, conforming to the schema of the specified
form type.
Parameter formTypeId :
The identifier of the form type for this attachment.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request.
Parameter itemIdentifier :
The identifier of the item within the iterable form. Required when
iterableFormName is specified.
Parameter iterableFormName :
The name of the iterable form. When specified along with
itemIdentifier, the attachment targets an item within the
iterable form rather than the asset itself.
Implementation
Future<PutAttachmentResponse> putAttachment({
required String assetIdentifier,
required String attachmentName,
required String content,
required String formTypeId,
String? clientToken,
String? itemIdentifier,
String? iterableFormName,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSGlue.PutAttachment'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'AssetIdentifier': assetIdentifier,
'AttachmentName': attachmentName,
'Content': content,
'FormTypeId': formTypeId,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (itemIdentifier != null) 'ItemIdentifier': itemIdentifier,
if (iterableFormName != null) 'IterableFormName': iterableFormName,
},
);
return PutAttachmentResponse.fromJson(jsonResponse.body);
}