listWorkforces method
Future<ListWorkforcesResponse>
listWorkforces({
- int? maxResults,
- String? nameContains,
- String? nextToken,
- ListWorkforcesSortByOptions? sortBy,
- SortOrder? sortOrder,
Use this operation to list all private and vendor workforces in an AWS Region. Note that you can only have one private workforce per AWS Region.
Parameter maxResults
:
The maximum number of workforces returned in the response.
Parameter nameContains
:
A filter you can use to search for workforces using part of the workforce
name.
Parameter nextToken
:
A token to resume pagination.
Parameter sortBy
:
Sort workforces using the workforce name or creation date.
Parameter sortOrder
:
Sort workforces in ascending or descending order.
Implementation
Future<ListWorkforcesResponse> listWorkforces({
int? maxResults,
String? nameContains,
String? nextToken,
ListWorkforcesSortByOptions? sortBy,
SortOrder? sortOrder,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
100,
);
_s.validateStringLength(
'nameContains',
nameContains,
1,
63,
);
_s.validateStringLength(
'nextToken',
nextToken,
0,
8192,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SageMaker.ListWorkforces'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (maxResults != null) 'MaxResults': maxResults,
if (nameContains != null) 'NameContains': nameContains,
if (nextToken != null) 'NextToken': nextToken,
if (sortBy != null) 'SortBy': sortBy.toValue(),
if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
},
);
return ListWorkforcesResponse.fromJson(jsonResponse.body);
}