getInventory method

Future<GetInventoryResult> getInventory({
  1. List<InventoryAggregator>? aggregators,
  2. List<InventoryFilter>? filters,
  3. int? maxResults,
  4. String? nextToken,
  5. List<ResultAttribute>? resultAttributes,
})

Query inventory information. This includes managed node status, such as Stopped or Terminated.

May throw InternalServerError. May throw InvalidAggregatorException. May throw InvalidFilter. May throw InvalidInventoryGroupException. May throw InvalidNextToken. May throw InvalidResultAttributeException. May throw InvalidTypeNameException.

Parameter aggregators : Returns counts of inventory types based on one or more expressions. For example, if you aggregate by using an expression that uses the AWS:InstanceInformation.PlatformType type, you can see a count of how many Windows and Linux managed nodes exist in your inventoried fleet.

Parameter filters : One or more filters. Use a filter to return a more specific list of results.

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.)

Parameter resultAttributes : The list of inventory item types to return.

Implementation

Future<GetInventoryResult> getInventory({
  List<InventoryAggregator>? aggregators,
  List<InventoryFilter>? filters,
  int? maxResults,
  String? nextToken,
  List<ResultAttribute>? resultAttributes,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.GetInventory'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (aggregators != null) 'Aggregators': aggregators,
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (resultAttributes != null) 'ResultAttributes': resultAttributes,
    },
  );

  return GetInventoryResult.fromJson(jsonResponse.body);
}