updateDocument method
Updates one or more values for an SSM document.
May throw DocumentVersionLimitExceeded.
May throw DuplicateDocumentContent.
May throw DuplicateDocumentVersionName.
May throw InternalServerError.
May throw InvalidDocument.
May throw InvalidDocumentContent.
May throw InvalidDocumentOperation.
May throw InvalidDocumentSchemaVersion.
May throw InvalidDocumentVersion.
May throw MaxDocumentSizeExceeded.
Parameter content :
A valid JSON or YAML string.
Parameter name :
The name of the SSM document that you want to update.
Parameter attachments :
A list of key-value pairs that describe attachments to a version of a
document.
Parameter displayName :
The friendly name of the SSM document that you want to update. This value
can differ for each version of the document. If you don't specify a value
for this parameter in your request, the existing value is applied to the
new document version.
Parameter documentFormat :
Specify the document format for the new document version. Systems Manager
supports JSON and YAML documents. JSON is the default format.
Parameter documentVersion :
The version of the document that you want to update. Currently, Systems
Manager supports updating only the latest version of the document. You can
specify the version number of the latest version or use the
$LATEST variable.
Parameter targetType :
Specify a new target type for the document.
Parameter versionName :
An optional field specifying the version of the artifact you are updating
with the document. For example, 12.6. This value is unique across all
versions of a document, and can't be changed.
Implementation
Future<UpdateDocumentResult> updateDocument({
required String content,
required String name,
List<AttachmentsSource>? attachments,
String? displayName,
DocumentFormat? documentFormat,
String? documentVersion,
String? targetType,
String? versionName,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonSSM.UpdateDocument'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Content': content,
'Name': name,
if (attachments != null) 'Attachments': attachments,
if (displayName != null) 'DisplayName': displayName,
if (documentFormat != null) 'DocumentFormat': documentFormat.value,
if (documentVersion != null) 'DocumentVersion': documentVersion,
if (targetType != null) 'TargetType': targetType,
if (versionName != null) 'VersionName': versionName,
},
);
return UpdateDocumentResult.fromJson(jsonResponse.body);
}