Skip to content

create_function_url_config

create_function_url_config(
    function_name: FunctionUrlFunctionName,
    auth_type: FunctionUrlAuthType,
    *,
    config_overrides: Optional[LambdaClientConfig] = None,
    qualifier: Optional[FunctionUrlQualifier] = None,
    cors: Optional[Cors] = None,
    invoke_mode: Optional[InvokeMode] = None,
) -> CreateFunctionUrlConfigResponse

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.

Parameters:

  • function_name (FunctionUrlFunctionName) –

    The name or ARN of the Lambda function.

    Name formats

    • Function name – my-function.

    • Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function.

    • Partial ARN – 123456789012: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.

  • qualifier (Optional[FunctionUrlQualifier], default: None ) –

    The alias name.

  • auth_type (FunctionUrlAuthType) –

    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.

  • cors (Optional[Cors], default: None ) –

    The cross-origin resource sharing (CORS) settings for your function URL.

  • invoke_mode (Optional[InvokeMode], default: None ) –

    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.

Raises:

Source code in docs_src/capo_lambda/_services/_lambda.py
def create_function_url_config(
    self,
    function_name: "capo_lambda.types.function_url_function_name.FunctionUrlFunctionName",
    auth_type: "capo_lambda.types.function_url_auth_type.FunctionUrlAuthType",
    *,
    config_overrides: Optional[LambdaClientConfig] = None,
    qualifier: Optional[
        "capo_lambda.types.function_url_qualifier.FunctionUrlQualifier"
    ] = None,
    cors: Optional["capo_lambda.types.cors.Cors"] = None,
    invoke_mode: Optional["capo_lambda.types.invoke_mode.InvokeMode"] = None,
) -> "capo_lambda.types.create_function_url_config_response.CreateFunctionUrlConfigResponse":
    """<p>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.</p>

    Args:
        function_name: <p>The name or ARN of the Lambda function.</p> <p class="title"> <b>Name formats</b> </p> <ul> <li> <p> <b>Function name</b> – <code>my-function</code>.</p> </li> <li> <p> <b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p> </li> <li> <p> <b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p> </li> </ul> <p>The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
        qualifier: <p>The alias name.</p>
        auth_type: <p>The type of authentication that your function URL uses. Set to <code>AWS_IAM</code> if you want to restrict access to authenticated users only. Set to <code>NONE</code> if you want to bypass IAM authentication to create a public endpoint. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html">Control access to Lambda function URLs</a>.</p>
        cors: <p>The <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS">cross-origin resource sharing (CORS)</a> settings for your function URL.</p>
        invoke_mode: <p>Use one of the following options:</p> <ul> <li> <p> <code>BUFFERED</code> – This is the default option. Lambda invokes your function using the <code>Invoke</code> API operation. Invocation results are available when the payload is complete. The maximum payload size is 6 MB.</p> </li> <li> <p> <code>RESPONSE_STREAM</code> – Your function streams payload results as they become available. Lambda invokes your function using the <code>InvokeWithResponseStream</code> API operation. The maximum response payload size is 200 MB.</p> </li> </ul>

    Raises:
        capo_lambda.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One of the parameters in the request is not valid.</p>
        capo_lambda.errors.resource_conflict_exception.ResourceConflictException: <p>The resource already exists, or another operation is in progress.</p>
        capo_lambda.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
        capo_lambda.errors.service_exception.ServiceException: <p>The Lambda service encountered an internal error.</p>
        capo_lambda.errors.too_many_requests_exception.TooManyRequestsException: <p>The request throughput limit was exceeded. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html#api-requests">Lambda quotas</a>.</p>
        capo_lambda.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lambda.types.create_function_url_config_request.CreateFunctionUrlConfigRequest]",
    ) -> OperationResponse[
        "capo_lambda.types.create_function_url_config_response.CreateFunctionUrlConfigResponse"
    ]:
        import capo_lambda._operations.aws_gir_api_service.create_function_url_config

        output, http_response = (
            capo_lambda._operations.aws_gir_api_service.create_function_url_config.create_function_url_config(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateFunctionUrlConfig")
    )
    input_: capo_lambda.types.create_function_url_config_request.CreateFunctionUrlConfigRequest = {
        "function_name": function_name,
        "auth_type": auth_type,
    }
    if qualifier is not None:
        input_["qualifier"] = qualifier
    if cors is not None:
        input_["cors"] = cors
    if invoke_mode is not None:
        input_["invoke_mode"] = invoke_mode

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output