Skip to content
v2.278.0

CorsConfigurationProperty Struct ​

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_sam as sam } from 'aws-cdk-lib';
const corsConfigurationProperty: sam.CfnFunction.CorsConfigurationProperty = {
  allowOrigin: 'allowOrigin',

  // the properties below are optional
  allowCredentials: false,
  allowHeaders: 'allowHeaders',
  allowMethods: 'allowMethods',
  maxAge: 'maxAge',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_sam as sam

cors_configuration_property = sam.CfnFunction.CorsConfigurationProperty(
    allow_origin="allowOrigin",

    # the properties below are optional
    allow_credentials=False,
    allow_headers="allowHeaders",
    allow_methods="allowMethods",
    max_age="maxAge"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.sam.*;

CorsConfigurationProperty corsConfigurationProperty = CorsConfigurationProperty.builder()
        .allowOrigin("allowOrigin")

        // the properties below are optional
        .allowCredentials(false)
        .allowHeaders("allowHeaders")
        .allowMethods("allowMethods")
        .maxAge("maxAge")
        .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.AWS.SAM;

var corsConfigurationProperty = new CorsConfigurationProperty {
    AllowOrigin = "allowOrigin",

    // the properties below are optional
    AllowCredentials = false,
    AllowHeaders = "allowHeaders",
    AllowMethods = "allowMethods",
    MaxAge = "maxAge"
};
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 "github.com/aws/aws-cdk-go/awscdk"

corsConfigurationProperty := &CorsConfigurationProperty{
	AllowOrigin: jsii.String("allowOrigin"),

	// the properties below are optional
	AllowCredentials: jsii.Boolean(false),
	AllowHeaders: jsii.String("allowHeaders"),
	AllowMethods: jsii.String("allowMethods"),
	MaxAge: jsii.String("maxAge"),
}

Properties ​

allowCredentialsoptionalboolean | IResolvableallow_credentialsoptionaltyping.Union[bool, IResolvable]allowCredentialsoptionalBooleanAllowCredentialsoptionalboolAllowCredentialsoptionalinterface{} #
allowHeadersoptionalstringallow_headersoptionalstrallowHeadersoptionalStringAllowHeadersoptionalstringAllowHeadersoptional*string #
allowMethodsoptionalstringallow_methodsoptionalstrallowMethodsoptionalStringAllowMethodsoptionalstringAllowMethodsoptional*string #
allowOriginstringallow_originstrallowOriginStringAllowOriginstringAllowOrigin*string required #
maxAgeoptionalstringmax_ageoptionalstrmaxAgeoptionalStringMaxAgeoptionalstringMaxAgeoptional*string #