describeInstanceInformation method

Future<DescribeInstanceInformationResult> describeInstanceInformation({
  1. List<InstanceInformationStringFilter>? filters,
  2. List<InstanceInformationFilter>? instanceInformationFilterList,
  3. int? maxResults,
  4. String? nextToken,
})

Describes one or more of your instances, including information about the operating system platform, the version of SSM Agent installed on the instance, instance status, and so on.

If you specify one or more instance IDs, it returns information for those instances. If you do not specify instance IDs, it returns information for all your instances. If you specify an instance ID that is not valid or an instance that you do not own, you receive an error.

May throw InternalServerError. May throw InvalidInstanceId. May throw InvalidNextToken. May throw InvalidInstanceInformationFilterValue. May throw InvalidFilterKey.

Parameter filters : One or more filters. Use a filter to return a more specific list of instances. You can filter based on tags applied to EC2 instances. Use this Filters data type instead of InstanceInformationFilterList, which is deprecated.

Parameter instanceInformationFilterList : This is a legacy method. We recommend that you don't use this method. Instead, use the Filters data type. Filters enables you to return instance information by filtering based on tags applied to managed instances.

Parameter maxResults : The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

Parameter nextToken : The token for the next set of items to return. (You received this token from a previous call.)

Implementation

Future<DescribeInstanceInformationResult> describeInstanceInformation({
  List<InstanceInformationStringFilter>? filters,
  List<InstanceInformationFilter>? instanceInformationFilterList,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    5,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.DescribeInstanceInformation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (filters != null) 'Filters': filters,
      if (instanceInformationFilterList != null)
        'InstanceInformationFilterList': instanceInformationFilterList,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return DescribeInstanceInformationResult.fromJson(jsonResponse.body);
}