aws-cdk-lib.aws_apigateway.MethodProps

interface MethodProps

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.MethodProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#MethodProps
Javasoftware.amazon.awscdk.services.apigateway.MethodProps
Pythonaws_cdk.aws_apigateway.MethodProps
TypeScript (source)aws-cdk-lib » aws_apigateway » MethodProps

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
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 methodProps: apigateway.MethodProps = {
  httpMethod: 'httpMethod',
  resource: resource,

  // the properties below are optional
  integration: integration,
  options: {
    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
httpMethodstringThe HTTP method ("GET", "POST", "PUT", ...) that clients use to call this method.
resourceIResourceThe resource this method is associated with.
integration?IntegrationThe backend system that the method calls when it receives a request.
options?MethodOptionsMethod options.

httpMethod

Type: string

The HTTP method ("GET", "POST", "PUT", ...) that clients use to call this method.


resource

Type: IResource

The resource this method is associated with.

For root resource methods, specify the RestApi object.


integration?

Type: Integration (optional, default: a new MockIntegration.)

The backend system that the method calls when it receives a request.


options?

Type: MethodOptions (optional, default: No options.)

Method options.