listAliases method

Future<ListAliasesResponse> listAliases({
  1. required String imageName,
  2. String? alias,
  3. int? maxResults,
  4. String? nextToken,
  5. int? version,
})

Lists the aliases of a specified image or image version.

May throw ResourceNotFound.

Parameter imageName : The name of the image.

Parameter alias : The alias of the image version.

Parameter maxResults : The maximum number of aliases to return.

Parameter nextToken : If the previous call to ListAliases didn't return the full set of aliases, the call returns a token for retrieving the next set of aliases.

Parameter version : The version of the image. If image version is not specified, the aliases of all versions of the image are listed.

Implementation

Future<ListAliasesResponse> listAliases({
  required String imageName,
  String? alias,
  int? maxResults,
  String? nextToken,
  int? version,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateNumRange(
    'version',
    version,
    0,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.ListAliases'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ImageName': imageName,
      if (alias != null) 'Alias': alias,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (version != null) 'Version': version,
    },
  );

  return ListAliasesResponse.fromJson(jsonResponse.body);
}