Class CfnMethod
- All Implemented Interfaces:
IConstruct,IDependable,IInspectable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
AWS::ApiGateway::Method.
The AWS::ApiGateway::Method resource creates API Gateway methods that define the parameters and body that clients must send in their requests.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigateway.*;
CfnMethod cfnMethod = CfnMethod.Builder.create(this, "MyCfnMethod")
.httpMethod("httpMethod")
.resourceId("resourceId")
.restApiId("restApiId")
// the properties below are optional
.apiKeyRequired(false)
.authorizationScopes(List.of("authorizationScopes"))
.authorizationType("authorizationType")
.authorizerId("authorizerId")
.integration(IntegrationProperty.builder()
.cacheKeyParameters(List.of("cacheKeyParameters"))
.cacheNamespace("cacheNamespace")
.connectionId("connectionId")
.connectionType("connectionType")
.contentHandling("contentHandling")
.credentials("credentials")
.integrationHttpMethod("integrationHttpMethod")
.integrationResponses(List.of(IntegrationResponseProperty.builder()
.statusCode("statusCode")
// the properties below are optional
.contentHandling("contentHandling")
.responseParameters(Map.of(
"responseParametersKey", "responseParameters"))
.responseTemplates(Map.of(
"responseTemplatesKey", "responseTemplates"))
.selectionPattern("selectionPattern")
.build()))
.passthroughBehavior("passthroughBehavior")
.requestParameters(Map.of(
"requestParametersKey", "requestParameters"))
.requestTemplates(Map.of(
"requestTemplatesKey", "requestTemplates"))
.timeoutInMillis(123)
.type("type")
.uri("uri")
.build())
.methodResponses(List.of(MethodResponseProperty.builder()
.statusCode("statusCode")
// the properties below are optional
.responseModels(Map.of(
"responseModelsKey", "responseModels"))
.responseParameters(Map.of(
"responseParametersKey", false))
.build()))
.operationName("operationName")
.requestModels(Map.of(
"requestModelsKey", "requestModels"))
.requestParameters(Map.of(
"requestParametersKey", false))
.requestValidatorId("requestValidatorId")
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnMethod.static interfaceIntegrationis a property of the AWS::ApiGateway::Method resource that specifies information about the target backend that a method calls.static interfaceIntegrationResponseis a property of the Amazon API Gateway Method Integration property type that specifies the response that API Gateway sends after a method's backend finishes processing a request.static interfaceRepresents a method response of a given HTTP status code returned to the client.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA boolean flag specifying whether a valid ApiKey is required to invoke this method.A list of authorization scopes configured on the method.The method's authorization type.The identifier of an authorizer to use on this method.The method's HTTP verb.Represents anHTTP,HTTP_PROXY,AWS,AWS_PROXY, or Mock integration.Gets a method response associated with a given HTTP status code.A human-friendly operation identifier for the method.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).A key-value map defining required or optional method request parameters that can be accepted by API Gateway.The identifier of a RequestValidator for request validation.The Resource identifier for the MethodResponse resource.The string identifier of the associated RestApi.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetApiKeyRequired(Boolean value) A boolean flag specifying whether a valid ApiKey is required to invoke this method.voidsetApiKeyRequired(IResolvable value) A boolean flag specifying whether a valid ApiKey is required to invoke this method.voidsetAuthorizationScopes(List<String> value) A list of authorization scopes configured on the method.voidsetAuthorizationType(String value) The method's authorization type.voidsetAuthorizerId(String value) The identifier of an authorizer to use on this method.voidsetHttpMethod(String value) The method's HTTP verb.voidsetIntegration(IResolvable value) Represents anHTTP,HTTP_PROXY,AWS,AWS_PROXY, or Mock integration.voidRepresents anHTTP,HTTP_PROXY,AWS,AWS_PROXY, or Mock integration.voidsetMethodResponses(List<Object> value) Gets a method response associated with a given HTTP status code.voidsetMethodResponses(IResolvable value) Gets a method response associated with a given HTTP status code.voidsetOperationName(String value) A human-friendly operation identifier for the method.voidsetRequestModels(Map<String, String> value) 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).voidsetRequestModels(IResolvable value) 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).voidsetRequestParameters(Map<String, Object> value) A key-value map defining required or optional method request parameters that can be accepted by API Gateway.voidsetRequestParameters(IResolvable value) A key-value map defining required or optional method request parameters that can be accepted by API Gateway.voidsetRequestValidatorId(String value) The identifier of a RequestValidator for request validation.voidsetResourceId(String value) The Resource identifier for the MethodResponse resource.voidsetRestApiId(String value) The string identifier of the associated RestApi.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.core.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnMethod
protected CfnMethod(software.amazon.jsii.JsiiObjectRef objRef) -
CfnMethod
protected CfnMethod(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnMethod
@Stability(Stable) public CfnMethod(@NotNull Construct scope, @NotNull String id, @NotNull CfnMethodProps props) Create a newAWS::ApiGateway::Method.- Parameters:
scope-- scope in which this resource is defined.
id-- scoped id of the resource.
props-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getHttpMethod
The method's HTTP verb. -
setHttpMethod
The method's HTTP verb. -
getResourceId
The Resource identifier for the MethodResponse resource. -
setResourceId
The Resource identifier for the MethodResponse resource. -
getRestApiId
The string identifier of the associated RestApi. -
setRestApiId
The string identifier of the associated RestApi. -
getApiKeyRequired
A boolean flag specifying whether a valid ApiKey is required to invoke this method. -
setApiKeyRequired
A boolean flag specifying whether a valid ApiKey is required to invoke this method. -
setApiKeyRequired
A boolean flag specifying whether a valid ApiKey is required to invoke this method. -
getAuthorizationScopes
A list of authorization scopes configured on the method.The scopes are used with a
COGNITO_USER_POOLSauthorizer 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. -
setAuthorizationScopes
A list of authorization scopes configured on the method.The scopes are used with a
COGNITO_USER_POOLSauthorizer 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. -
getAuthorizationType
The method's authorization type.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. -
setAuthorizationType
The method's authorization type.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. -
getAuthorizerId
The identifier of an authorizer to use on this method.The method's authorization type must be
CUSTOMorCOGNITO_USER_POOLS. -
setAuthorizerId
The identifier of an authorizer to use on this method.The method's authorization type must be
CUSTOMorCOGNITO_USER_POOLS. -
getIntegration
Represents anHTTP,HTTP_PROXY,AWS,AWS_PROXY, or Mock integration. -
setIntegration
Represents anHTTP,HTTP_PROXY,AWS,AWS_PROXY, or Mock integration. -
setIntegration
Represents anHTTP,HTTP_PROXY,AWS,AWS_PROXY, or Mock integration. -
getMethodResponses
Gets a method response associated with a given HTTP status code. -
setMethodResponses
Gets a method response associated with a given HTTP status code. -
setMethodResponses
Gets a method response associated with a given HTTP status code. -
getOperationName
A human-friendly operation identifier for the method.For example, you can assign the
operationNameofListPetsfor theGET /petsmethod in thePetStoreexample. -
setOperationName
A human-friendly operation identifier for the method.For example, you can assign the
operationNameofListPetsfor theGET /petsmethod in thePetStoreexample. -
getRequestModels
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). -
setRequestModels
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). -
setRequestModels
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). -
getRequestParameters
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}, wherelocationisquerystring,path, orheaderandnameis 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. -
setRequestParameters
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}, wherelocationisquerystring,path, orheaderandnameis 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. -
setRequestParameters
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}, wherelocationisquerystring,path, orheaderandnameis 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. -
getRequestValidatorId
The identifier of a RequestValidator for request validation. -
setRequestValidatorId
The identifier of a RequestValidator for request validation.
-