deleteDocument method
Deletes the Systems Manager document and all instance associations to the document.
Before you delete the document, we recommend that you use DeleteAssociation to disassociate all instances that are associated with the document.
May throw InternalServerError. May throw InvalidDocument. May throw InvalidDocumentOperation. May throw AssociatedInstances.
Parameter name
:
The name of the document.
Parameter documentVersion
:
The version of the document that you want to delete. If not provided, all
versions of the document are deleted.
Parameter force
:
Some SSM document types require that you specify a Force
flag
before you can delete the document. For example, you must specify a
Force
flag to delete a document of type
ApplicationConfigurationSchema
. You can restrict access to
the Force
flag in an AWS Identity and Access Management (IAM)
policy.
Parameter versionName
:
The version name of the document that you want to delete. If not provided,
all versions of the document are deleted.
Implementation
Future<void> deleteDocument({
required String name,
String? documentVersion,
bool? force,
String? versionName,
}) async {
ArgumentError.checkNotNull(name, 'name');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonSSM.DeleteDocument'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
if (documentVersion != null) 'DocumentVersion': documentVersion,
if (force != null) 'Force': force,
if (versionName != null) 'VersionName': versionName,
},
);
}