@Generated(value="jsii-pacmak/1.60.0 (build ebcefe6)", date="2022-06-22T23:27:59.478Z") public class CfnMethod extends CfnResource implements IInspectable
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();
Modifier and Type | Class and Description |
---|---|
static class |
CfnMethod.Builder
A fluent builder for
CfnMethod . |
static interface |
CfnMethod.IntegrationProperty
`Integration` is a property of the [AWS::ApiGateway::Method](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html) resource that specifies information about the target backend that a method calls.
|
static interface |
CfnMethod.IntegrationResponseProperty
`IntegrationResponse` is a property of the [Amazon API Gateway Method Integration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apitgateway-method-integration.html) property type that specifies the response that API Gateway sends after a method's backend finishes processing a request.
|
static interface |
CfnMethod.MethodResponseProperty
`MethodResponse` is a property of the [AWS::ApiGateway::Method](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html) resource that defines the responses that can be sent to the client that calls a method.
|
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnMethod(Construct scope,
java.lang.String id,
CfnMethodProps props)
Create a new `AWS::ApiGateway::Method`.
|
protected |
CfnMethod(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnMethod(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getApiKeyRequired()
Indicates whether the method requires clients to submit a valid API key.
|
java.util.List<java.lang.String> |
getAuthorizationScopes()
A list of authorization scopes configured on the method.
|
java.lang.String |
getAuthorizationType()
The method's authorization type.
|
java.lang.String |
getAuthorizerId()
The identifier of the [authorizer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html) to use on this method.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getHttpMethod()
The HTTP method that clients use to call this method.
|
java.lang.Object |
getIntegration()
The backend system that the method calls when it receives a request.
|
java.lang.Object |
getMethodResponses()
The responses that can be sent to the client who calls the method.
|
java.lang.String |
getOperationName()
A friendly operation name for the method.
|
java.lang.Object |
getRequestModels()
The resources that are used for the request's content type.
|
java.lang.Object |
getRequestParameters()
The request parameters that API Gateway accepts.
|
java.lang.String |
getRequestValidatorId()
The ID of the associated request validator.
|
java.lang.String |
getResourceId()
The ID of an API Gateway [resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html) .
|
java.lang.String |
getRestApiId()
The ID of the [RestApi](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html) resource in which API Gateway creates the method.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setApiKeyRequired(java.lang.Boolean value)
Indicates whether the method requires clients to submit a valid API key.
|
void |
setApiKeyRequired(IResolvable value)
Indicates whether the method requires clients to submit a valid API key.
|
void |
setAuthorizationScopes(java.util.List<java.lang.String> value)
A list of authorization scopes configured on the method.
|
void |
setAuthorizationType(java.lang.String value)
The method's authorization type.
|
void |
setAuthorizerId(java.lang.String value)
The identifier of the [authorizer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html) to use on this method.
|
void |
setHttpMethod(java.lang.String value)
The HTTP method that clients use to call this method.
|
void |
setIntegration(CfnMethod.IntegrationProperty value)
The backend system that the method calls when it receives a request.
|
void |
setIntegration(IResolvable value)
The backend system that the method calls when it receives a request.
|
void |
setMethodResponses(IResolvable value)
The responses that can be sent to the client who calls the method.
|
void |
setMethodResponses(java.util.List<java.lang.Object> value)
The responses that can be sent to the client who calls the method.
|
void |
setOperationName(java.lang.String value)
A friendly operation name for the method.
|
void |
setRequestModels(IResolvable value)
The resources that are used for the request's content type.
|
void |
setRequestModels(java.util.Map<java.lang.String,java.lang.String> value)
The resources that are used for the request's content type.
|
void |
setRequestParameters(IResolvable value)
The request parameters that API Gateway accepts.
|
void |
setRequestParameters(java.util.Map<java.lang.String,java.lang.Object> value)
The request parameters that API Gateway accepts.
|
void |
setRequestValidatorId(java.lang.String value)
The ID of the associated request validator.
|
void |
setResourceId(java.lang.String value)
The ID of an API Gateway [resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-resource.html) .
|
void |
setRestApiId(java.lang.String value)
The ID of the [RestApi](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html) resource in which API Gateway creates the method.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnMethod(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnMethod(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnMethod(Construct scope, java.lang.String id, CfnMethodProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.String getHttpMethod()
public void setHttpMethod(java.lang.String value)
public java.lang.String getResourceId()
public void setResourceId(java.lang.String value)
public java.lang.String getRestApiId()
public void setRestApiId(java.lang.String value)
public java.lang.Object getApiKeyRequired()
public void setApiKeyRequired(java.lang.Boolean value)
public void setApiKeyRequired(IResolvable value)
public java.util.List<java.lang.String> getAuthorizationScopes()
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 match 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.
public void setAuthorizationScopes(java.util.List<java.lang.String> value)
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 match 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.
public java.lang.String getAuthorizationType()
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.
public void setAuthorizationType(java.lang.String value)
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.
public java.lang.String getAuthorizerId()
public void setAuthorizerId(java.lang.String value)
public java.lang.Object getIntegration()
public void setIntegration(IResolvable value)
public void setIntegration(CfnMethod.IntegrationProperty value)
public java.lang.Object getMethodResponses()
public void setMethodResponses(IResolvable value)
public void setMethodResponses(java.util.List<java.lang.Object> value)
public java.lang.String getOperationName()
For example, you can assign the OperationName
of ListPets
for the GET /pets
method.
public void setOperationName(java.lang.String value)
For example, you can assign the OperationName
of ListPets
for the GET /pets
method.
public java.lang.Object getRequestModels()
Specify request models as key-value pairs (string-to-string mapping), with a content type as the key and a Model
resource name as the value. To use the same model regardless of the content type, specify $default
as the key.
public void setRequestModels(IResolvable value)
Specify request models as key-value pairs (string-to-string mapping), with a content type as the key and a Model
resource name as the value. To use the same model regardless of the content type, specify $default
as the key.
public void setRequestModels(java.util.Map<java.lang.String,java.lang.String> value)
Specify request models as key-value pairs (string-to-string mapping), with a content type as the key and a Model
resource name as the value. To use the same model regardless of the content type, specify $default
as the key.
public java.lang.Object getRequestParameters()
Specify request parameters as key-value pairs (string-to-Boolean mapping), with a source as the key and a Boolean as the value. The Boolean specifies whether a parameter is required. A source must match the format method.request. *location* . *name*
, where the location is querystring, path, or header, and name is a valid, unique parameter name.
public void setRequestParameters(IResolvable value)
Specify request parameters as key-value pairs (string-to-Boolean mapping), with a source as the key and a Boolean as the value. The Boolean specifies whether a parameter is required. A source must match the format method.request. *location* . *name*
, where the location is querystring, path, or header, and name is a valid, unique parameter name.
public void setRequestParameters(java.util.Map<java.lang.String,java.lang.Object> value)
Specify request parameters as key-value pairs (string-to-Boolean mapping), with a source as the key and a Boolean as the value. The Boolean specifies whether a parameter is required. A source must match the format method.request. *location* . *name*
, where the location is querystring, path, or header, and name is a valid, unique parameter name.
public java.lang.String getRequestValidatorId()
public void setRequestValidatorId(java.lang.String value)