# FunctionUrlProps

Properties for a FunctionUrl.

Extends: [FunctionUrlOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionUrlOptions.html)
Used as props by: [FunctionUrl](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionUrl.html)

- Source: [`aws-lambda/lib/function-url.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-lambda/lib/function-url.ts#L194)
- Type last changed: v2.21.0 · 22 Apr 2022

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';

declare const function_: lambda.Function;
const functionUrlProps: lambda.FunctionUrlProps = {
  function: function_,

  // the properties below are optional
  authType: lambda.FunctionUrlAuthType.AWS_IAM,
  cors: {
    allowCredentials: false,
    allowedHeaders: ['allowedHeaders'],
    allowedMethods: [lambda.HttpMethod.GET],
    allowedOrigins: ['allowedOrigins'],
    exposedHeaders: ['exposedHeaders'],
    maxAge: cdk.Duration.minutes(30),
  },
  invokeMode: lambda.InvokeMode.BUFFERED,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_lambda as lambda_

# function_: lambda.Function

function_url_props = lambda.FunctionUrlProps(
    function=function_,

    # the properties below are optional
    auth_type=lambda_.FunctionUrlAuthType.AWS_IAM,
    cors=lambda.FunctionUrlCorsOptions(
        allow_credentials=False,
        allowed_headers=["allowedHeaders"],
        allowed_methods=[lambda_.HttpMethod.GET],
        allowed_origins=["allowedOrigins"],
        exposed_headers=["exposedHeaders"],
        max_age=cdk.Duration.minutes(30)
    ),
    invoke_mode=lambda_.InvokeMode.BUFFERED
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.lambda.*;

Function function_;

FunctionUrlProps functionUrlProps = FunctionUrlProps.builder()
        .function(function_)

        // the properties below are optional
        .authType(FunctionUrlAuthType.AWS_IAM)
        .cors(FunctionUrlCorsOptions.builder()
                .allowCredentials(false)
                .allowedHeaders(List.of("allowedHeaders"))
                .allowedMethods(List.of(HttpMethod.GET))
                .allowedOrigins(List.of("allowedOrigins"))
                .exposedHeaders(List.of("exposedHeaders"))
                .maxAge(Duration.minutes(30))
                .build())
        .invokeMode(InvokeMode.BUFFERED)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.Lambda;

Function function_;

var functionUrlProps = new FunctionUrlProps {
    Function = function_,

    // the properties below are optional
    AuthType = FunctionUrlAuthType.AWS_IAM,
    Cors = new FunctionUrlCorsOptions {
        AllowCredentials = false,
        AllowedHeaders = new [] { "allowedHeaders" },
        AllowedMethods = new [] { HttpMethod.GET },
        AllowedOrigins = new [] { "allowedOrigins" },
        ExposedHeaders = new [] { "exposedHeaders" },
        MaxAge = Duration.Minutes(30)
    },
    InvokeMode = InvokeMode.BUFFERED
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var function_ Function

functionUrlProps := &FunctionUrlProps{
	Function: function_,

	// the properties below are optional
	AuthType: awscdk.Aws_lambda.FunctionUrlAuthType_AWS_IAM,
	Cors: &FunctionUrlCorsOptions{
		AllowCredentials: jsii.Boolean(false),
		AllowedHeaders: []*string{
			jsii.String("allowedHeaders"),
		},
		AllowedMethods: []HttpMethod{
			awscdk.*Aws_lambda.HttpMethod_GET,
		},
		AllowedOrigins: []*string{
			jsii.String("allowedOrigins"),
		},
		ExposedHeaders: []*string{
			jsii.String("exposedHeaders"),
		},
		MaxAge: cdk.Duration_Minutes(jsii.Number(30)),
	},
	InvokeMode: awscdk.*Aws_lambda.InvokeMode_BUFFERED,
}
```

## Properties

- `authType`: [FunctionUrlAuthType](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionUrlAuthType.html) = FunctionUrlAuthType.AWS_IAM — The type of authentication that your function URL uses.

- `cors`: [FunctionUrlCorsOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionUrlCorsOptions.html) — The cross-origin resource sharing (CORS) settings for your function URL.

  **Default:** No CORS configuration.

- `function`: [IFunction](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IFunction.html) (required) — The function to which this url refers.

  It can also be an `Alias` but not a `Version`.

- `invokeMode`: [InvokeMode](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.InvokeMode.html) = InvokeMode.BUFFERED — The type of invocation mode that your Lambda function uses.
