listVersionsByFunction method

Future<ListVersionsByFunctionResponse> listVersionsByFunction({
  1. required String functionName,
  2. String? marker,
  3. int? maxItems,
})

Returns a list of versions, with the version-specific configuration of each. Lambda returns up to 50 versions per call.

May throw ServiceException. May throw ResourceNotFoundException. May throw InvalidParameterValueException. May throw TooManyRequestsException.

Parameter functionName : The name of the Lambda function.

Name formats

  • Function name - MyFunction.
  • Function ARN - arn:aws:lambda:us-west-2:123456789012:function:MyFunction.
  • Partial ARN - 123456789012:function:MyFunction.
The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.

Parameter marker : Specify the pagination token that's returned by a previous request to retrieve the next page of results.

Parameter maxItems : The maximum number of versions to return.

Implementation

Future<ListVersionsByFunctionResponse> listVersionsByFunction({
  required String functionName,
  String? marker,
  int? maxItems,
}) async {
  ArgumentError.checkNotNull(functionName, 'functionName');
  _s.validateStringLength(
    'functionName',
    functionName,
    1,
    170,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxItems',
    maxItems,
    1,
    10000,
  );
  final $query = <String, List<String>>{
    if (marker != null) 'Marker': [marker],
    if (maxItems != null) 'MaxItems': [maxItems.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/2015-03-31/functions/${Uri.encodeComponent(functionName)}/versions',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListVersionsByFunctionResponse.fromJson(response);
}