aws-cdk-lib.aws_apigateway.CfnMethodProps

interface CfnMethodProps

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

Properties for defining a CfnMethod.

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';
const cfnMethodProps: apigateway.CfnMethodProps = {
  httpMethod: 'httpMethod',
  resourceId: 'resourceId',
  restApiId: 'restApiId',

  // the properties below are optional
  apiKeyRequired: false,
  authorizationScopes: ['authorizationScopes'],
  authorizationType: 'authorizationType',
  authorizerId: 'authorizerId',
  integration: {
    cacheKeyParameters: ['cacheKeyParameters'],
    cacheNamespace: 'cacheNamespace',
    connectionId: 'connectionId',
    connectionType: 'connectionType',
    contentHandling: 'contentHandling',
    credentials: 'credentials',
    integrationHttpMethod: 'integrationHttpMethod',
    integrationResponses: [{
      statusCode: 'statusCode',

      // the properties below are optional
      contentHandling: 'contentHandling',
      responseParameters: {
        responseParametersKey: 'responseParameters',
      },
      responseTemplates: {
        responseTemplatesKey: 'responseTemplates',
      },
      selectionPattern: 'selectionPattern',
    }],
    passthroughBehavior: 'passthroughBehavior',
    requestParameters: {
      requestParametersKey: 'requestParameters',
    },
    requestTemplates: {
      requestTemplatesKey: 'requestTemplates',
    },
    timeoutInMillis: 123,
    type: 'type',
    uri: 'uri',
  },
  methodResponses: [{
    statusCode: 'statusCode',

    // the properties below are optional
    responseModels: {
      responseModelsKey: 'responseModels',
    },
    responseParameters: {
      responseParametersKey: false,
    },
  }],
  operationName: 'operationName',
  requestModels: {
    requestModelsKey: 'requestModels',
  },
  requestParameters: {
    requestParametersKey: false,
  },
  requestValidatorId: 'requestValidatorId',
};

Properties

NameTypeDescription
httpMethodstringThe method's HTTP verb.
resourceIdstringThe Resource identifier for the MethodResponse resource.
restApiIdstringThe string identifier of the associated RestApi.
apiKeyRequired?boolean | IResolvableA boolean flag specifying whether a valid ApiKey is required to invoke this method.
authorizationScopes?string[]A list of authorization scopes configured on the method.
authorizationType?stringThe method's authorization type.
authorizerId?stringThe identifier of an authorizer to use on this method.
integration?IResolvable | IntegrationPropertyRepresents an HTTP , HTTP_PROXY , AWS , AWS_PROXY , or Mock integration.
methodResponses?IResolvable | IResolvable | MethodResponseProperty[]Gets a method response associated with a given HTTP status code.
operationName?stringA human-friendly operation identifier for the method.
requestModels?IResolvable | { [string]: string }A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).
requestParameters?IResolvable | { [string]: boolean | IResolvable }A key-value map defining required or optional method request parameters that can be accepted by API Gateway.
requestValidatorId?stringThe identifier of a RequestValidator for request validation.

httpMethod

Type: string

The method's HTTP verb.


resourceId

Type: string

The Resource identifier for the MethodResponse resource.


restApiId

Type: string

The string identifier of the associated RestApi.


apiKeyRequired?

Type: boolean | IResolvable (optional)

A boolean flag specifying whether a valid ApiKey is required to invoke this method.


authorizationScopes?

Type: string[] (optional)

A list of authorization scopes configured on the method.

The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.


authorizationType?

Type: string (optional)

The method's authorization type.

This parameter is required. For valid values, see Method in the API Gateway API Reference .

If you specify the AuthorizerId property, specify CUSTOM or COGNITO_USER_POOLS for this property.


authorizerId?

Type: string (optional)

The identifier of an authorizer to use on this method.

The method's authorization type must be CUSTOM or COGNITO_USER_POOLS .


integration?

Type: IResolvable | IntegrationProperty (optional)

Represents an HTTP , HTTP_PROXY , AWS , AWS_PROXY , or Mock integration.


methodResponses?

Type: IResolvable | IResolvable | MethodResponseProperty[] (optional)

Gets a method response associated with a given HTTP status code.


operationName?

Type: string (optional)

A human-friendly operation identifier for the method.

For example, you can assign the operationName of ListPets for the GET /pets method in the PetStore example.


requestModels?

Type: IResolvable | { [string]: string } (optional)

A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).


requestParameters?

Type: IResolvable | { [string]: boolean | IResolvable } (optional)

A key-value map defining required or optional method request parameters that can be accepted by API Gateway.

A key is a method request parameter name matching the pattern of method.request.{location}.{name} , where location is querystring , path , or header and name is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required ( true ) or optional ( false ). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates.


requestValidatorId?

Type: string (optional)

The identifier of a RequestValidator for request validation.