listWorkloads method

Future<ListWorkloadsResponse> listWorkloads({
  1. required String componentName,
  2. required String resourceGroupName,
  3. String? accountId,
  4. int? maxResults,
  5. String? nextToken,
})

Lists the workloads that are configured on a given component.

May throw InternalServerException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter componentName : The name of the component.

Parameter resourceGroupName : The name of the resource group.

Parameter accountId : The Amazon Web Services account ID of the owner of the workload.

Parameter maxResults : The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned NextToken value.

Parameter nextToken : The token to request the next page of results.

Implementation

Future<ListWorkloadsResponse> listWorkloads({
  required String componentName,
  required String resourceGroupName,
  String? accountId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    40,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'EC2WindowsBarleyService.ListWorkloads'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ComponentName': componentName,
      'ResourceGroupName': resourceGroupName,
      if (accountId != null) 'AccountId': accountId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListWorkloadsResponse.fromJson(jsonResponse.body);
}