describeAssociation method

Future<DescribeAssociationResult> describeAssociation({
  1. String? associationId,
  2. String? associationVersion,
  3. String? instanceId,
  4. String? name,
})

Describes the association for the specified target or instance. If you created the association by using the Targets parameter, then you must retrieve the association by using the association ID. If you created the association by specifying an instance ID and a Systems Manager document, then you retrieve the association by specifying the document name and the instance ID.

May throw AssociationDoesNotExist. May throw InvalidAssociationVersion. May throw InternalServerError. May throw InvalidDocument. May throw InvalidInstanceId.

Parameter associationId : The association ID for which you want information.

Parameter associationVersion : Specify the association version to retrieve. To view the latest version, either specify $LATEST for this parameter, or omit this parameter. To view a list of all associations for an instance, use ListAssociations. To get a list of versions for a specific association, use ListAssociationVersions.

Parameter instanceId : The instance ID.

Parameter name : The name of the Systems Manager document.

Implementation

Future<DescribeAssociationResult> describeAssociation({
  String? associationId,
  String? associationVersion,
  String? instanceId,
  String? name,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.DescribeAssociation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (associationId != null) 'AssociationId': associationId,
      if (associationVersion != null)
        'AssociationVersion': associationVersion,
      if (instanceId != null) 'InstanceId': instanceId,
      if (name != null) 'Name': name,
    },
  );

  return DescribeAssociationResult.fromJson(jsonResponse.body);
}