software.amazon.awssdk.services.apigateway.model.TestInvokeAuthorizerResponse 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.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents the response of the test invoke request for a custom Authorizer
*
*/
@Generated("software.amazon.awssdk:codegen")
public class TestInvokeAuthorizerResponse extends APIGatewayResponse implements
ToCopyableBuilder {
private final Integer clientStatus;
private final String log;
private final Long latency;
private final String principalId;
private final String policy;
private final Map> authorization;
private final Map claims;
private TestInvokeAuthorizerResponse(BuilderImpl builder) {
super(builder);
this.clientStatus = builder.clientStatus;
this.log = builder.log;
this.latency = builder.latency;
this.principalId = builder.principalId;
this.policy = builder.policy;
this.authorization = builder.authorization;
this.claims = builder.claims;
}
/**
*
* The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded.
*
*
* @return The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded.
*/
public Integer clientStatus() {
return clientStatus;
}
/**
*
* The Amazon API Gateway execution log for the test authorizer request.
*
*
* @return The Amazon API Gateway execution log for the test authorizer request.
*/
public String log() {
return log;
}
/**
*
* The execution latency of the test authorizer request.
*
*
* @return The execution latency of the test authorizer request.
*/
public Long latency() {
return latency;
}
/**
*
* The principal identity returned by the Authorizer
*
*
* @return The principal identity returned by the Authorizer
*/
public String principalId() {
return principalId;
}
/**
*
* The JSON policy document returned by the Authorizer
*
*
* @return The JSON policy document returned by the Authorizer
*/
public String policy() {
return policy;
}
/**
* Returns the value of the Authorization property for this object.
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The value of the Authorization property for this object.
*/
public Map> authorization() {
return authorization;
}
/**
*
* The open identity claims, with
* any supported custom attributes, returned from the Cognito Your User Pool configured for the API.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The open identity
* claims, with any supported custom attributes, returned from the Cognito Your User Pool configured for
* the API.
*/
public Map claims() {
return claims;
}
@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(clientStatus());
hashCode = 31 * hashCode + Objects.hashCode(log());
hashCode = 31 * hashCode + Objects.hashCode(latency());
hashCode = 31 * hashCode + Objects.hashCode(principalId());
hashCode = 31 * hashCode + Objects.hashCode(policy());
hashCode = 31 * hashCode + Objects.hashCode(authorization());
hashCode = 31 * hashCode + Objects.hashCode(claims());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TestInvokeAuthorizerResponse)) {
return false;
}
TestInvokeAuthorizerResponse other = (TestInvokeAuthorizerResponse) obj;
return Objects.equals(clientStatus(), other.clientStatus()) && Objects.equals(log(), other.log())
&& Objects.equals(latency(), other.latency()) && Objects.equals(principalId(), other.principalId())
&& Objects.equals(policy(), other.policy()) && Objects.equals(authorization(), other.authorization())
&& Objects.equals(claims(), other.claims());
}
@Override
public String toString() {
return ToString.builder("TestInvokeAuthorizerResponse").add("ClientStatus", clientStatus()).add("Log", log())
.add("Latency", latency()).add("PrincipalId", principalId()).add("Policy", policy())
.add("Authorization", authorization()).add("Claims", claims()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "clientStatus":
return Optional.of(clazz.cast(clientStatus()));
case "log":
return Optional.of(clazz.cast(log()));
case "latency":
return Optional.of(clazz.cast(latency()));
case "principalId":
return Optional.of(clazz.cast(principalId()));
case "policy":
return Optional.of(clazz.cast(policy()));
case "authorization":
return Optional.of(clazz.cast(authorization()));
case "claims":
return Optional.of(clazz.cast(claims()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayResponse.Builder, CopyableBuilder {
/**
*
* The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded.
*
*
* @param clientStatus
* The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clientStatus(Integer clientStatus);
/**
*
* The Amazon API Gateway execution log for the test authorizer request.
*
*
* @param log
* The Amazon API Gateway execution log for the test authorizer request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder log(String log);
/**
*
* The execution latency of the test authorizer request.
*
*
* @param latency
* The execution latency of the test authorizer request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder latency(Long latency);
/**
*
* The principal identity returned by the Authorizer
*
*
* @param principalId
* The principal identity returned by the Authorizer
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder principalId(String principalId);
/**
*
* The JSON policy document returned by the Authorizer
*
*
* @param policy
* The JSON policy document returned by the Authorizer
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder policy(String policy);
/**
* Sets the value of the Authorization property for this object.
*
* @param authorization
* The new value for the Authorization property for this object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder authorization(Map> authorization);
/**
*
* The open identity claims,
* with any supported custom attributes, returned from the Cognito Your User Pool configured for the API.
*
*
* @param claims
* The open identity
* claims, with any supported custom attributes, returned from the Cognito Your User Pool configured
* for the API.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder claims(Map claims);
}
static final class BuilderImpl extends APIGatewayResponse.BuilderImpl implements Builder {
private Integer clientStatus;
private String log;
private Long latency;
private String principalId;
private String policy;
private Map> authorization;
private Map claims;
private BuilderImpl() {
}
private BuilderImpl(TestInvokeAuthorizerResponse model) {
clientStatus(model.clientStatus);
log(model.log);
latency(model.latency);
principalId(model.principalId);
policy(model.policy);
authorization(model.authorization);
claims(model.claims);
}
public final Integer getClientStatus() {
return clientStatus;
}
@Override
public final Builder clientStatus(Integer clientStatus) {
this.clientStatus = clientStatus;
return this;
}
public final void setClientStatus(Integer clientStatus) {
this.clientStatus = clientStatus;
}
public final String getLog() {
return log;
}
@Override
public final Builder log(String log) {
this.log = log;
return this;
}
public final void setLog(String log) {
this.log = log;
}
public final Long getLatency() {
return latency;
}
@Override
public final Builder latency(Long latency) {
this.latency = latency;
return this;
}
public final void setLatency(Long latency) {
this.latency = latency;
}
public final String getPrincipalId() {
return principalId;
}
@Override
public final Builder principalId(String principalId) {
this.principalId = principalId;
return this;
}
public final void setPrincipalId(String principalId) {
this.principalId = principalId;
}
public final String getPolicy() {
return policy;
}
@Override
public final Builder policy(String policy) {
this.policy = policy;
return this;
}
public final void setPolicy(String policy) {
this.policy = policy;
}
public final Map> getAuthorization() {
return authorization;
}
@Override
public final Builder authorization(Map> authorization) {
this.authorization = MapOfStringToListCopier.copy(authorization);
return this;
}
public final void setAuthorization(Map> authorization) {
this.authorization = MapOfStringToListCopier.copy(authorization);
}
public final Map getClaims() {
return claims;
}
@Override
public final Builder claims(Map claims) {
this.claims = MapOfStringToStringCopier.copy(claims);
return this;
}
public final void setClaims(Map claims) {
this.claims = MapOfStringToStringCopier.copy(claims);
}
@Override
public TestInvokeAuthorizerResponse build() {
return new TestInvokeAuthorizerResponse(this);
}
}
}