FunctionUrlProps Struct
Properties for a FunctionUrl.
| Source | aws-lambda/lib/function-url.ts |
|---|---|
| Type last changed |
Example
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
# 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
// 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();
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
};
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
authTypeoptionalFunctionUrlAuthTypeauth_typeoptionalFunctionUrlAuthTypeauthTypeoptionalFunctionUrlAuthTypeAuthTypeoptionalFunctionUrlAuthTypeAuthTypeoptionalFunctionUrlAuthType = FunctionUrlAuthType.AWS_IAM #The type of authentication that your function URL uses.
corsoptionalFunctionUrlCorsOptionscorsoptionalFunctionUrlCorsOptionscorsoptionalFunctionUrlCorsOptionsCorsoptionalFunctionUrlCorsOptionsCorsoptionalFunctionUrlCorsOptions #The cross-origin resource sharing (CORS) settings for your function URL.
Default: No CORS configuration.
The function to which this url refers.
It can also be an Alias but not a Version.
invokeModeoptionalInvokeModeinvoke_modeoptionalInvokeModeinvokeModeoptionalInvokeModeInvokeModeoptionalInvokeModeInvokeModeoptionalInvokeMode = InvokeMode.BUFFERED #The type of invocation mode that your Lambda function uses.