createFunctionUrlConfig method

Future<CreateFunctionUrlConfigResponse> createFunctionUrlConfig({
  1. required FunctionUrlAuthType authType,
  2. required String functionName,
  3. Cors? cors,
  4. InvokeMode? invokeMode,
  5. String? qualifier,
})

Creates a Lambda function URL with the specified configuration parameters. A function URL is a dedicated HTTP(S) endpoint that you can use to invoke your function.

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

Parameter authType : The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Control access to Lambda function URLs.

Parameter functionName : The name or ARN of the Lambda function.

Name formats

  • Function namemy-function.
  • Function ARNarn:aws:lambda:us-west-2:123456789012:function:my-function.
  • Partial ARN123456789012:function:my-function.
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 cors : The cross-origin resource sharing (CORS) settings for your function URL.

Parameter invokeMode : Use one of the following options:

  • BUFFERED – This is the default option. Lambda invokes your function using the Invoke API operation. Invocation results are available when the payload is complete. The maximum payload size is 6 MB.
  • RESPONSE_STREAM – Your function streams payload results as they become available. Lambda invokes your function using the InvokeWithResponseStream API operation. The maximum response payload size is 200 MB.

Parameter qualifier : The alias name.

Implementation

Future<CreateFunctionUrlConfigResponse> createFunctionUrlConfig({
  required FunctionUrlAuthType authType,
  required String functionName,
  Cors? cors,
  InvokeMode? invokeMode,
  String? qualifier,
}) async {
  final $query = <String, List<String>>{
    if (qualifier != null) 'Qualifier': [qualifier],
  };
  final $payload = <String, dynamic>{
    'AuthType': authType.value,
    if (cors != null) 'Cors': cors,
    if (invokeMode != null) 'InvokeMode': invokeMode.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/2021-10-31/functions/${Uri.encodeComponent(functionName)}/url',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return CreateFunctionUrlConfigResponse.fromJson(response);
}