Skip to content
v2.278.0

ResourceOptions Struct ​

Example ​

ts
declare const resource: apigateway.Resource;

const subtree = resource.addResource('subtree', {
  defaultCorsPreflightOptions: {
    allowOrigins: [ 'https://amazon.com' ]
  }
});
python
# resource: apigateway.Resource


subtree = resource.add_resource("subtree",
    default_cors_preflight_options=apigateway.CorsOptions(
        allow_origins=["https://amazon.com"]
    )
)
java
Resource resource;


Resource subtree = resource.addResource("subtree", ResourceOptions.builder()
        .defaultCorsPreflightOptions(CorsOptions.builder()
                .allowOrigins(List.of("https://amazon.com"))
                .build())
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Resource resource;


var subtree = resource.AddResource("subtree", new ResourceOptions {
    DefaultCorsPreflightOptions = new CorsOptions {
        AllowOrigins = new [] { "https://amazon.com" }
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var resource Resource


subtree := resource.AddResource(jsii.String("subtree"), &ResourceOptions{
	DefaultCorsPreflightOptions: &CorsOptions{
		AllowOrigins: []*string{
			jsii.String("https://amazon.com"),
		},
	},
})

Properties ​

defaultCorsPreflightOptionsoptionalCorsOptionsdefault_cors_preflight_optionsoptionalCorsOptionsdefaultCorsPreflightOptionsoptionalCorsOptionsDefaultCorsPreflightOptionsoptionalCorsOptionsDefaultCorsPreflightOptionsoptionalCorsOptions #
Adds a CORS preflight OPTIONS method to this resource and all child resources.

Default: CORS is disabled

You can add CORS at the resource-level using addCorsPreflight.

defaultIntegrationoptionalIntegrationdefault_integrationoptionalIntegrationdefaultIntegrationoptionalIntegrationDefaultIntegrationoptionalIntegrationDefaultIntegrationoptionalIntegration #
An integration to use as a default for all methods created within this API unless an integration is specified.

Default: Inherited from parent.

defaultMethodOptionsoptionalMethodOptionsdefault_method_optionsoptionalMethodOptionsdefaultMethodOptionsoptionalMethodOptionsDefaultMethodOptionsoptionalMethodOptionsDefaultMethodOptionsoptionalMethodOptions #
Method options to use as a default for all methods created within this API unless custom options are specified.

Default: Inherited from parent.