interface ProxyResourceProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGateway.ProxyResourceProps |
Java | software.amazon.awscdk.services.apigateway.ProxyResourceProps |
Python | aws_cdk.aws_apigateway.ProxyResourceProps |
TypeScript (source) | @aws-cdk/aws-apigateway » ProxyResourceProps |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as apigateway from '@aws-cdk/aws-apigateway';
import * as cdk from '@aws-cdk/core';
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 proxyResourceProps: apigateway.ProxyResourceProps = {
parent: resource,
// the properties below are optional
anyMethod: false,
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. |
any | boolean | Adds an "ANY" method to this 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.
anyMethod?
Type:
boolean
(optional, default: true)
Adds an "ANY" method to this resource.
If set to false
, you will have to explicitly
add methods to this resource after it's created.
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.