All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.apigateway.model.TestInvokeAuthorizerResponse Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon API Gateway module holds the client classes that are used for communicating with Amazon API Gateway

There is a newer version: 2.28.3
Show newest version
/*
 * Copyright 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.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
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 final class TestInvokeAuthorizerResponse extends ApiGatewayResponse implements ToCopyableBuilder { private static final SdkField CLIENT_STATUS_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("clientStatus").getter(getter(TestInvokeAuthorizerResponse::clientStatus)) .setter(setter(Builder::clientStatus)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientStatus").build()).build(); private static final SdkField LOG_FIELD = SdkField. builder(MarshallingType.STRING).memberName("log") .getter(getter(TestInvokeAuthorizerResponse::log)).setter(setter(Builder::log)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("log").build()).build(); private static final SdkField LATENCY_FIELD = SdkField. builder(MarshallingType.LONG).memberName("latency") .getter(getter(TestInvokeAuthorizerResponse::latency)).setter(setter(Builder::latency)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("latency").build()).build(); private static final SdkField PRINCIPAL_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("principalId").getter(getter(TestInvokeAuthorizerResponse::principalId)) .setter(setter(Builder::principalId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("principalId").build()).build(); private static final SdkField POLICY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("policy") .getter(getter(TestInvokeAuthorizerResponse::policy)).setter(setter(Builder::policy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("policy").build()).build(); private static final SdkField>> AUTHORIZATION_FIELD = SdkField .>> builder(MarshallingType.MAP) .memberName("authorization") .getter(getter(TestInvokeAuthorizerResponse::authorization)) .setter(setter(Builder::authorization)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("authorization").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField.> builder(MarshallingType.LIST) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder() .location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()) .build()).build()).build()).build(); private static final SdkField> CLAIMS_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("claims") .getter(getter(TestInvokeAuthorizerResponse::claims)) .setter(setter(Builder::claims)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("claims").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLIENT_STATUS_FIELD, LOG_FIELD, LATENCY_FIELD, PRINCIPAL_ID_FIELD, POLICY_FIELD, AUTHORIZATION_FIELD, CLAIMS_FIELD)); 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 API Gateway execution log for the test authorizer request. *

* * @return The 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 true if the Authorization property was specified by the sender (it may be empty), or false if the sender * did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasAuthorization() { return authorization != null && !(authorization instanceof SdkAutoConstructMap); } /** * Returns the value of the Authorization property for this object. *

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasAuthorization()} to see if a value was sent in this field. *

* * @return The value of the Authorization property for this object. */ public Map> authorization() { return authorization; } /** * Returns true if the Claims property was specified by the sender (it may be empty), or false if the sender did not * specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasClaims() { return claims != null && !(claims instanceof SdkAutoConstructMap); } /** *

* 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. *

*

* You can use {@link #hasClaims()} to see if a value was sent in this field. *

* * @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 + super.hashCode(); 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) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(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()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @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.ofNullable(clazz.cast(clientStatus())); case "log": return Optional.ofNullable(clazz.cast(log())); case "latency": return Optional.ofNullable(clazz.cast(latency())); case "principalId": return Optional.ofNullable(clazz.cast(principalId())); case "policy": return Optional.ofNullable(clazz.cast(policy())); case "authorization": return Optional.ofNullable(clazz.cast(authorization())); case "claims": return Optional.ofNullable(clazz.cast(claims())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((TestInvokeAuthorizerResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends ApiGatewayResponse.Builder, SdkPojo, 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 API Gateway execution log for the test authorizer request. *

* * @param log * The 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 = DefaultSdkAutoConstructMap.getInstance(); private Map claims = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(TestInvokeAuthorizerResponse model) { super(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); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy