Skip to content
v2.273.0

MethodProps Struct ​

Example ​

ts
// 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 ​

httpMethodstringhttp_methodstrhttpMethodStringHttpMethodstringHttpMethod*stringrequired#
The HTTP method ("GET", "POST", "PUT", ...) that clients use to call this method.
integrationIntegrationintegrationIntegrationintegrationIntegrationIntegrationIntegrationIntegrationIntegration= a new `MockIntegration`.#
The backend system that the method calls when it receives a request.
optionsMethodOptionsoptionsMethodOptionsoptionsMethodOptionsOptionsMethodOptionsOptionsMethodOptions= No options.#
Method options.
resourceIResourceresourceIResourceresourceIResourceResourceIResourceResourceIResourcerequired#
The resource this method is associated with.

For root resource methods, specify the RestApi object.

Used as props by ​