software.amazon.awssdk.services.apigateway.model.TestInvokeAuthorizerRequest Maven / Gradle / Ivy
Show all versions of api-gateway Show documentation
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.apigateway.model;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import javax.annotation.Generated;
import software.amazon.awssdk.core.AwsRequestOverrideConfig;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Make a request to simulate the execution of an Authorizer.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class TestInvokeAuthorizerRequest extends APIGatewayRequest implements
ToCopyableBuilder {
private final String restApiId;
private final String authorizerId;
private final Map headers;
private final String pathWithQueryString;
private final String body;
private final Map stageVariables;
private final Map additionalContext;
private TestInvokeAuthorizerRequest(BuilderImpl builder) {
super(builder);
this.restApiId = builder.restApiId;
this.authorizerId = builder.authorizerId;
this.headers = builder.headers;
this.pathWithQueryString = builder.pathWithQueryString;
this.body = builder.body;
this.stageVariables = builder.stageVariables;
this.additionalContext = builder.additionalContext;
}
/**
*
* The string identifier of the associated RestApi.
*
*
* @return The string identifier of the associated RestApi.
*/
public String restApiId() {
return restApiId;
}
/**
*
* Specifies a test invoke authorizer request's Authorizer ID.
*
*
* @return Specifies a test invoke authorizer request's Authorizer ID.
*/
public String authorizerId() {
return authorizerId;
}
/**
*
* [Required] A key-value map of headers to simulate an incoming invocation request. This is where the incoming
* authorization token, or identity source, should be specified.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return [Required] A key-value map of headers to simulate an incoming invocation request. This is where the
* incoming authorization token, or identity source, should be specified.
*/
public Map headers() {
return headers;
}
/**
*
* [Optional] The URI path, including query string, of the simulated invocation request. Use this to specify path
* parameters and query string parameters.
*
*
* @return [Optional] The URI path, including query string, of the simulated invocation request. Use this to specify
* path parameters and query string parameters.
*/
public String pathWithQueryString() {
return pathWithQueryString;
}
/**
*
* [Optional] The simulated request body of an incoming invocation request.
*
*
* @return [Optional] The simulated request body of an incoming invocation request.
*/
public String body() {
return body;
}
/**
*
* A key-value map of stage variables to simulate an invocation on a deployed Stage.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A key-value map of stage variables to simulate an invocation on a deployed Stage.
*/
public Map stageVariables() {
return stageVariables;
}
/**
*
* [Optional] A key-value map of additional context variables.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return [Optional] A key-value map of additional context variables.
*/
public Map additionalContext() {
return additionalContext;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(restApiId());
hashCode = 31 * hashCode + Objects.hashCode(authorizerId());
hashCode = 31 * hashCode + Objects.hashCode(headers());
hashCode = 31 * hashCode + Objects.hashCode(pathWithQueryString());
hashCode = 31 * hashCode + Objects.hashCode(body());
hashCode = 31 * hashCode + Objects.hashCode(stageVariables());
hashCode = 31 * hashCode + Objects.hashCode(additionalContext());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TestInvokeAuthorizerRequest)) {
return false;
}
TestInvokeAuthorizerRequest other = (TestInvokeAuthorizerRequest) obj;
return Objects.equals(restApiId(), other.restApiId()) && Objects.equals(authorizerId(), other.authorizerId())
&& Objects.equals(headers(), other.headers())
&& Objects.equals(pathWithQueryString(), other.pathWithQueryString()) && Objects.equals(body(), other.body())
&& Objects.equals(stageVariables(), other.stageVariables())
&& Objects.equals(additionalContext(), other.additionalContext());
}
@Override
public String toString() {
return ToString.builder("TestInvokeAuthorizerRequest").add("RestApiId", restApiId()).add("AuthorizerId", authorizerId())
.add("Headers", headers()).add("PathWithQueryString", pathWithQueryString()).add("Body", body())
.add("StageVariables", stageVariables()).add("AdditionalContext", additionalContext()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "restApiId":
return Optional.of(clazz.cast(restApiId()));
case "authorizerId":
return Optional.of(clazz.cast(authorizerId()));
case "headers":
return Optional.of(clazz.cast(headers()));
case "pathWithQueryString":
return Optional.of(clazz.cast(pathWithQueryString()));
case "body":
return Optional.of(clazz.cast(body()));
case "stageVariables":
return Optional.of(clazz.cast(stageVariables()));
case "additionalContext":
return Optional.of(clazz.cast(additionalContext()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayRequest.Builder, CopyableBuilder {
/**
*
* The string identifier of the associated RestApi.
*
*
* @param restApiId
* The string identifier of the associated RestApi.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder restApiId(String restApiId);
/**
*
* Specifies a test invoke authorizer request's Authorizer ID.
*
*
* @param authorizerId
* Specifies a test invoke authorizer request's Authorizer ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder authorizerId(String authorizerId);
/**
*
* [Required] A key-value map of headers to simulate an incoming invocation request. This is where the incoming
* authorization token, or identity source, should be specified.
*
*
* @param headers
* [Required] A key-value map of headers to simulate an incoming invocation request. This is where the
* incoming authorization token, or identity source, should be specified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder headers(Map headers);
/**
*
* [Optional] The URI path, including query string, of the simulated invocation request. Use this to specify
* path parameters and query string parameters.
*
*
* @param pathWithQueryString
* [Optional] The URI path, including query string, of the simulated invocation request. Use this to
* specify path parameters and query string parameters.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder pathWithQueryString(String pathWithQueryString);
/**
*
* [Optional] The simulated request body of an incoming invocation request.
*
*
* @param body
* [Optional] The simulated request body of an incoming invocation request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder body(String body);
/**
*
* A key-value map of stage variables to simulate an invocation on a deployed Stage.
*
*
* @param stageVariables
* A key-value map of stage variables to simulate an invocation on a deployed Stage.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stageVariables(Map stageVariables);
/**
*
* [Optional] A key-value map of additional context variables.
*
*
* @param additionalContext
* [Optional] A key-value map of additional context variables.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder additionalContext(Map additionalContext);
@Override
Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig);
}
static final class BuilderImpl extends APIGatewayRequest.BuilderImpl implements Builder {
private String restApiId;
private String authorizerId;
private Map headers;
private String pathWithQueryString;
private String body;
private Map stageVariables;
private Map additionalContext;
private BuilderImpl() {
}
private BuilderImpl(TestInvokeAuthorizerRequest model) {
restApiId(model.restApiId);
authorizerId(model.authorizerId);
headers(model.headers);
pathWithQueryString(model.pathWithQueryString);
body(model.body);
stageVariables(model.stageVariables);
additionalContext(model.additionalContext);
}
public final String getRestApiId() {
return restApiId;
}
@Override
public final Builder restApiId(String restApiId) {
this.restApiId = restApiId;
return this;
}
public final void setRestApiId(String restApiId) {
this.restApiId = restApiId;
}
public final String getAuthorizerId() {
return authorizerId;
}
@Override
public final Builder authorizerId(String authorizerId) {
this.authorizerId = authorizerId;
return this;
}
public final void setAuthorizerId(String authorizerId) {
this.authorizerId = authorizerId;
}
public final Map getHeaders() {
return headers;
}
@Override
public final Builder headers(Map headers) {
this.headers = MapOfHeaderValuesCopier.copy(headers);
return this;
}
public final void setHeaders(Map headers) {
this.headers = MapOfHeaderValuesCopier.copy(headers);
}
public final String getPathWithQueryString() {
return pathWithQueryString;
}
@Override
public final Builder pathWithQueryString(String pathWithQueryString) {
this.pathWithQueryString = pathWithQueryString;
return this;
}
public final void setPathWithQueryString(String pathWithQueryString) {
this.pathWithQueryString = pathWithQueryString;
}
public final String getBody() {
return body;
}
@Override
public final Builder body(String body) {
this.body = body;
return this;
}
public final void setBody(String body) {
this.body = body;
}
public final Map getStageVariables() {
return stageVariables;
}
@Override
public final Builder stageVariables(Map stageVariables) {
this.stageVariables = MapOfStringToStringCopier.copy(stageVariables);
return this;
}
public final void setStageVariables(Map stageVariables) {
this.stageVariables = MapOfStringToStringCopier.copy(stageVariables);
}
public final Map getAdditionalContext() {
return additionalContext;
}
@Override
public final Builder additionalContext(Map additionalContext) {
this.additionalContext = MapOfStringToStringCopier.copy(additionalContext);
return this;
}
public final void setAdditionalContext(Map additionalContext) {
this.additionalContext = MapOfStringToStringCopier.copy(additionalContext);
}
@Override
public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) {
super.requestOverrideConfig(awsRequestOverrideConfig);
return this;
}
@Override
public Builder requestOverrideConfig(Consumer builderConsumer) {
super.requestOverrideConfig(builderConsumer);
return this;
}
@Override
public TestInvokeAuthorizerRequest build() {
return new TestInvokeAuthorizerRequest(this);
}
}
}