listCustomModels method
Returns a list of the custom models that you have created with the
CreateModelCustomizationJob operation.
For more information, see Custom models in the Amazon Bedrock User Guide.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ThrottlingException.
May throw ValidationException.
Parameter baseModelArnEquals :
Return custom models only if the base model Amazon Resource Name (ARN)
matches this parameter.
Parameter creationTimeAfter :
Return custom models created after the specified time.
Parameter creationTimeBefore :
Return custom models created before the specified time.
Parameter foundationModelArnEquals :
Return custom models only if the foundation model Amazon Resource Name
(ARN) matches this parameter.
Parameter isOwned :
Return custom models depending on if the current account owns them
(true) or if they were shared with the current account
(false).
Parameter maxResults :
The maximum number of results to return in the response. If the total
number of results is greater than this value, use the token returned in
the response in the nextToken field when making another
request to return the next batch of results.
Parameter modelStatus :
The status of them model to filter results by. Possible values include:
-
Creating- Include only models that are currently being created and validated. -
Active- Include only models that have been successfully created and are ready for use. -
Failed- Include only models where the creation process failed.
Parameter nameContains :
Return custom models only if the job name contains these characters.
Parameter nextToken :
If the total number of results is greater than the maxResults
value provided in the request, enter the token returned in the
nextToken field in the response in this field to return the
next batch of results.
Parameter sortBy :
The field to sort by in the returned list of models.
Parameter sortOrder :
The sort order of the results.
Implementation
Future<ListCustomModelsResponse> listCustomModels({
String? baseModelArnEquals,
DateTime? creationTimeAfter,
DateTime? creationTimeBefore,
String? foundationModelArnEquals,
bool? isOwned,
int? maxResults,
ModelStatus? modelStatus,
String? nameContains,
String? nextToken,
SortModelsBy? sortBy,
SortOrder? sortOrder,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
1000,
);
final $query = <String, List<String>>{
if (baseModelArnEquals != null)
'baseModelArnEquals': [baseModelArnEquals],
if (creationTimeAfter != null)
'creationTimeAfter': [_s.iso8601ToJson(creationTimeAfter).toString()],
if (creationTimeBefore != null)
'creationTimeBefore': [_s.iso8601ToJson(creationTimeBefore).toString()],
if (foundationModelArnEquals != null)
'foundationModelArnEquals': [foundationModelArnEquals],
if (isOwned != null) 'isOwned': [isOwned.toString()],
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (modelStatus != null) 'modelStatus': [modelStatus.value],
if (nameContains != null) 'nameContains': [nameContains],
if (nextToken != null) 'nextToken': [nextToken],
if (sortBy != null) 'sortBy': [sortBy.value],
if (sortOrder != null) 'sortOrder': [sortOrder.value],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/custom-models',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListCustomModelsResponse.fromJson(response);
}