describeMaintenanceWindowsForTarget method

Future<DescribeMaintenanceWindowsForTargetResult> describeMaintenanceWindowsForTarget({
  1. required MaintenanceWindowResourceType resourceType,
  2. required List<Target> targets,
  3. int? maxResults,
  4. String? nextToken,
})

Retrieves information about the maintenance window targets or tasks that an instance is associated with.

May throw InternalServerError.

Parameter resourceType : The type of resource you want to retrieve information about. For example, "INSTANCE".

Parameter targets : The instance ID or key/value pair to retrieve information about.

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<DescribeMaintenanceWindowsForTargetResult>
    describeMaintenanceWindowsForTarget({
  required MaintenanceWindowResourceType resourceType,
  required List<Target> targets,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(resourceType, 'resourceType');
  ArgumentError.checkNotNull(targets, 'targets');
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.DescribeMaintenanceWindowsForTarget'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResourceType': resourceType.toValue(),
      'Targets': targets,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return DescribeMaintenanceWindowsForTargetResult.fromJson(
      jsonResponse.body);
}