CfnMethodProps Struct
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: {
type: 'type',
// the properties below are optional
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',
}],
integrationTarget: 'integrationTarget',
passthroughBehavior: 'passthroughBehavior',
requestParameters: {
requestParametersKey: 'requestParameters',
},
requestTemplates: {
requestTemplatesKey: 'requestTemplates',
},
responseTransferMode: 'responseTransferMode',
timeoutInMillis: 123,
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
apiKeyRequiredoptionalboolean | IResolvableapi_key_requiredoptionaltyping.Union[bool, IResolvable]apiKeyRequiredoptionalBooleanApiKeyRequiredoptionalboolApiKeyRequiredoptionalinterface{}#authorizationScopesoptionalstring[]authorization_scopesoptionaltyping.List[str]authorizationScopesoptionalList<String>AuthorizationScopesoptionalstring[]AuthorizationScopesoptional*[]*string#notes
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.
authorizationTypeoptionalstringauthorization_typeoptionalstrauthorizationTypeoptionalStringAuthorizationTypeoptionalstringAuthorizationTypeoptional*string#notes
This parameter is required. For valid values, see Method in the API Gateway API Reference .
If you specify the
AuthorizerIdproperty, specifyCUSTOMorCOGNITO_USER_POOLSfor this property.
authorizerIdoptionalstring | IAuthorizerRefauthorizer_idoptionaltyping.Union[str, IAuthorizerRef]authorizerIdoptionalStringAuthorizerIdoptionalstringAuthorizerIdoptionalinterface{}#The method's authorization type must be CUSTOM or COGNITO_USER_POOLS .
integrationoptionalIResolvable | CfnMethod.IntegrationPropertyintegrationoptionaltyping.Union[IResolvable, IntegrationProperty]integrationoptionalIResolvableIntegrationoptionalIResolvableIntegrationoptionalinterface{}#methodResponsesoptionalIResolvable | IResolvable | CfnMethod.MethodResponseProperty[]method_responsesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MethodResponseProperty]]]methodResponsesoptionalIResolvableMethodResponsesoptionalIResolvableMethodResponsesoptionalinterface{}#operationNameoptionalstringoperation_nameoptionalstroperationNameoptionalStringOperationNameoptionalstringOperationNameoptional*string#For example, you can assign the operationName of ListPets for the GET /pets method in the PetStore example.
requestModelsoptionalIResolvable | { [key: string]: string }request_modelsoptionaltyping.Union[IResolvable, typing.Mapping[str, str]]requestModelsoptionalIResolvableRequestModelsoptionalIResolvableRequestModelsoptionalinterface{}#requestParametersoptionalIResolvable | { [key: string]: boolean | IResolvable }request_parametersoptionaltyping.Union[IResolvable, typing.Mapping[str, typing.Union[bool, IResolvable]]]requestParametersoptionalIResolvableRequestParametersoptionalIResolvableRequestParametersoptionalinterface{}#notes
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.
requestValidatorIdoptionalstring | IRequestValidatorRefrequest_validator_idoptionaltyping.Union[str, IRequestValidatorRef]requestValidatorIdoptionalStringRequestValidatorIdoptionalstringRequestValidatorIdoptionalinterface{}#resourceIdstring | IResourceRefresource_idtyping.Union[str, IResourceRef]resourceIdStringResourceIdstringResourceIdinterface{}required#restApiIdstring | IRestApiRefrest_api_idtyping.Union[str, IRestApiRef]restApiIdStringRestApiIdstringRestApiIdinterface{}required#