interface CfnMethodProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.APIGateway.CfnMethodProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#CfnMethodProps |
Java | software.amazon.awscdk.services.apigateway.CfnMethodProps |
Python | aws_cdk.aws_apigateway.CfnMethodProps |
TypeScript | aws-cdk-lib » aws_apigateway » CfnMethodProps |
Properties for defining a CfnMethod
.
See also: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html
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',
}],
passthroughBehavior: 'passthroughBehavior',
requestParameters: {
requestParametersKey: 'requestParameters',
},
requestTemplates: {
requestTemplatesKey: 'requestTemplates',
},
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
Name | Type | Description |
---|---|---|
http | string | The method's HTTP verb. |
resource | string | The Resource identifier for the MethodResponse resource. |
rest | string | The string identifier of the associated RestApi. |
api | boolean | IResolvable | A boolean flag specifying whether a valid ApiKey is required to invoke this method. |
authorization | string[] | A list of authorization scopes configured on the method. |
authorization | string | The method's authorization type. |
authorizer | string | The identifier of an authorizer to use on this method. |
integration? | IResolvable | Integration | Represents an HTTP , HTTP_PROXY , AWS , AWS_PROXY , or Mock integration. |
method | IResolvable | IResolvable | Method [] | Gets a method response associated with a given HTTP status code. |
operation | string | A human-friendly operation identifier for the method. |
request | 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). |
request | IResolvable | { [string]: boolean | IResolvable } | A key-value map defining required or optional method request parameters that can be accepted by API Gateway. |
request | string | The 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, specifyCUSTOM
orCOGNITO_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
|
Integration
(optional)
Represents an HTTP
, HTTP_PROXY
, AWS
, AWS_PROXY
, or Mock integration.
methodResponses?
Type:
IResolvable
|
IResolvable
|
Method
[]
(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.