Class MethodOptions.Builder
java.lang.Object
software.amazon.awscdk.services.apigateway.MethodOptions.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<MethodOptions>
- Enclosing interface:
MethodOptions
@Stability(Stable)
public static final class MethodOptions.Builder
extends Object
implements software.amazon.jsii.Builder<MethodOptions>
A builder for
MethodOptions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapiKeyRequired
(Boolean apiKeyRequired) Sets the value ofMethodOptions.getApiKeyRequired()
authorizationScopes
(List<String> authorizationScopes) Sets the value ofMethodOptions.getAuthorizationScopes()
authorizationType
(AuthorizationType authorizationType) Sets the value ofMethodOptions.getAuthorizationType()
authorizer
(IAuthorizer authorizer) Sets the value ofMethodOptions.getAuthorizer()
build()
Builds the configured instance.methodResponses
(List<? extends MethodResponse> methodResponses) Sets the value ofMethodOptions.getMethodResponses()
operationName
(String operationName) Sets the value ofMethodOptions.getOperationName()
requestModels
(Map<String, ? extends IModel> requestModels) Sets the value ofMethodOptions.getRequestModels()
requestParameters
(Map<String, ? extends Boolean> requestParameters) Sets the value ofMethodOptions.getRequestParameters()
requestValidator
(IRequestValidator requestValidator) Sets the value ofMethodOptions.getRequestValidator()
requestValidatorOptions
(RequestValidatorOptions requestValidatorOptions) Sets the value ofMethodOptions.getRequestValidatorOptions()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
apiKeyRequired
Sets the value ofMethodOptions.getApiKeyRequired()
- Parameters:
apiKeyRequired
- Indicates whether the method requires clients to submit a valid API key.- Returns:
this
-
authorizationScopes
@Stability(Stable) public MethodOptions.Builder authorizationScopes(List<String> authorizationScopes) Sets the value ofMethodOptions.getAuthorizationScopes()
- Parameters:
authorizationScopes
- A list of authorization scopes configured on the method. The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation.- Returns:
this
-
authorizationType
@Stability(Stable) public MethodOptions.Builder authorizationType(AuthorizationType authorizationType) Sets the value ofMethodOptions.getAuthorizationType()
- Parameters:
authorizationType
- Method authorization. If the value is set ofCustom
, anauthorizer
must also be specified. If you're using one of the authorizers that are available via theAuthorizer
class, such asinvalid @link
Authorizer#token()
Authorizer
will result in an error.- Returns:
this
-
authorizer
Sets the value ofMethodOptions.getAuthorizer()
- Parameters:
authorizer
- IfauthorizationType
isCustom
, this specifies the ID of the method authorizer resource. If specified, the value ofauthorizationType
must be set toCustom
- Returns:
this
-
methodResponses
@Stability(Stable) public MethodOptions.Builder methodResponses(List<? extends MethodResponse> methodResponses) Sets the value ofMethodOptions.getMethodResponses()
- Parameters:
methodResponses
- The responses that can be sent to the client who calls the method.- Returns:
this
-
operationName
Sets the value ofMethodOptions.getOperationName()
- Parameters:
operationName
- A friendly operation name for the method. For example, you can assign the OperationName of ListPets for the GET /pets method.- Returns:
this
-
requestModels
@Stability(Stable) public MethodOptions.Builder requestModels(Map<String, ? extends IModel> requestModels) Sets the value ofMethodOptions.getRequestModels()
- Parameters:
requestModels
- The models which describe data structure of request payload. When combined withrequestValidator
orrequestValidatorOptions
, the service will validate the API request payload before it reaches the API's Integration (including proxies). SpecifyrequestModels
as key-value pairs, with a content type (e.g.'application/json'
) as the key and an API Gateway Model as the value.- Returns:
this
-
requestParameters
@Stability(Stable) public MethodOptions.Builder requestParameters(Map<String, ? extends Boolean> requestParameters) Sets the value ofMethodOptions.getRequestParameters()
- Parameters:
requestParameters
- The request parameters that API Gateway accepts. 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.- Returns:
this
-
requestValidator
@Stability(Stable) public MethodOptions.Builder requestValidator(IRequestValidator requestValidator) Sets the value ofMethodOptions.getRequestValidator()
- Parameters:
requestValidator
- The ID of the associated request validator. Only one ofrequestValidator
orrequestValidatorOptions
must be specified. Works together withrequestModels
orrequestParameters
to validate the request before it reaches integration like Lambda Proxy Integration.- Returns:
this
-
requestValidatorOptions
@Stability(Stable) public MethodOptions.Builder requestValidatorOptions(RequestValidatorOptions requestValidatorOptions) Sets the value ofMethodOptions.getRequestValidatorOptions()
- Parameters:
requestValidatorOptions
- Request validator options to create new validator Only one ofrequestValidator
orrequestValidatorOptions
must be specified. Works together withrequestModels
orrequestParameters
to validate the request before it reaches integration like Lambda Proxy Integration.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<MethodOptions>
- Returns:
- a new instance of
MethodOptions
- Throws:
NullPointerException
- if any required attribute was not provided
-