aws-cdk-lib.aws_apigateway.ResourceProps

interface ResourceProps

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.ResourceProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#ResourceProps
Javasoftware.amazon.awscdk.services.apigateway.ResourceProps
Pythonaws_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

NameTypeDescription
parentIResourceThe parent resource of this resource.
pathPartstringA path name for the resource.
defaultCorsPreflightOptions?CorsOptionsAdds a CORS preflight OPTIONS method to this resource and all child resources.
defaultIntegration?IntegrationAn integration to use as a default for all methods created within this API unless an integration is specified.
defaultMethodOptions?MethodOptionsMethod 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: CorsOptions (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: MethodOptions (optional, default: Inherited from parent.)

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