interface ResourceProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGateway.ResourceProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#ResourceProps |
Java | software.amazon.awscdk.services.apigateway.ResourceProps |
Python | aws_cdk.aws_apigateway.ResourceProps |
TypeScript (source) | aws-cdk-lib » aws_apigateway » ResourceProps |
Example
// 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_apigateway as apigateway } from 'aws-cdk-lib';
declare const authorizer: apigateway.Authorizer;
declare const integration: apigateway.Integration;
declare const model: apigateway.Model;
declare const requestValidator: apigateway.RequestValidator;
declare const resource: apigateway.Resource;
const resourceProps: apigateway.ResourceProps = {
parent: resource,
pathPart: 'pathPart',
// the properties below are optional
defaultCorsPreflightOptions: {
allowOrigins: ['allowOrigins'],
// the properties below are optional
allowCredentials: false,
allowHeaders: ['allowHeaders'],
allowMethods: ['allowMethods'],
disableCache: false,
exposeHeaders: ['exposeHeaders'],
maxAge: cdk.Duration.minutes(30),
statusCode: 123,
},
defaultIntegration: integration,
defaultMethodOptions: {
apiKeyRequired: false,
authorizationScopes: ['authorizationScopes'],
authorizationType: apigateway.AuthorizationType.NONE,
authorizer: authorizer,
methodResponses: [{
statusCode: 'statusCode',
// the properties below are optional
responseModels: {
responseModelsKey: model,
},
responseParameters: {
responseParametersKey: false,
},
}],
operationName: 'operationName',
requestModels: {
requestModelsKey: model,
},
requestParameters: {
requestParametersKey: false,
},
requestValidator: requestValidator,
requestValidatorOptions: {
requestValidatorName: 'requestValidatorName',
validateRequestBody: false,
validateRequestParameters: false,
},
},
};
Properties
Name | Type | Description |
---|---|---|
parent | IResource | The parent resource of this resource. |
path | string | A path name for the resource. |
default | Cors | Adds a CORS preflight OPTIONS method to this resource and all child resources. |
default | Integration | An integration to use as a default for all methods created within this API unless an integration is specified. |
default | Method | Method options to use as a default for all methods created within this API unless custom options are specified. |
parent
Type:
IResource
The parent resource of this resource.
You can either pass another
Resource
object or a RestApi
object here.
pathPart
Type:
string
A path name for the resource.
defaultCorsPreflightOptions?
Type:
Cors
(optional, default: CORS is disabled)
Adds a CORS preflight OPTIONS method to this resource and all child resources.
You can add CORS at the resource-level using addCorsPreflight
.
defaultIntegration?
Type:
Integration
(optional, default: Inherited from parent.)
An integration to use as a default for all methods created within this API unless an integration is specified.
defaultMethodOptions?
Type:
Method
(optional, default: Inherited from parent.)
Method options to use as a default for all methods created within this API unless custom options are specified.