getDocument method
Gets the contents of the specified Amazon Web Services Systems Manager document (SSM document).
May throw InternalServerError.
May throw InvalidDocument.
May throw InvalidDocumentVersion.
Parameter name :
The name of the SSM document.
Parameter documentFormat :
Returns the document in the specified format. The document format can be
either JSON or YAML. JSON is the default format.
Parameter documentVersion :
The document version for which you want information.
Parameter versionName :
An optional field specifying the version of the artifact associated with
the document. For example, 12.6. This value is unique across all versions
of a document and can't be changed.
Implementation
Future<GetDocumentResult> getDocument({
required String name,
DocumentFormat? documentFormat,
String? documentVersion,
String? versionName,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonSSM.GetDocument'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
if (documentFormat != null) 'DocumentFormat': documentFormat.value,
if (documentVersion != null) 'DocumentVersion': documentVersion,
if (versionName != null) 'VersionName': versionName,
},
);
return GetDocumentResult.fromJson(jsonResponse.body);
}