All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.apigateway.model.UpdateGatewayResponseResponse 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
/*
* 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.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.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;
/**
*
* A gateway response of a given response type and status code, with optional response parameters and mapping templates.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateGatewayResponseResponse extends ApiGatewayResponse implements
ToCopyableBuilder {
private static final SdkField RESPONSE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateGatewayResponseResponse::responseTypeAsString)).setter(setter(Builder::responseType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("responseType").build()).build();
private static final SdkField STATUS_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(UpdateGatewayResponseResponse::statusCode)).setter(setter(Builder::statusCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusCode").build()).build();
private static final SdkField> RESPONSE_PARAMETERS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(UpdateGatewayResponseResponse::responseParameters))
.setter(setter(Builder::responseParameters))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("responseParameters").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 SdkField> RESPONSE_TEMPLATES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(UpdateGatewayResponseResponse::responseTemplates))
.setter(setter(Builder::responseTemplates))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("responseTemplates").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 SdkField DEFAULT_RESPONSE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(UpdateGatewayResponseResponse::defaultResponse)).setter(setter(Builder::defaultResponse))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultResponse").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESPONSE_TYPE_FIELD,
STATUS_CODE_FIELD, RESPONSE_PARAMETERS_FIELD, RESPONSE_TEMPLATES_FIELD, DEFAULT_RESPONSE_FIELD));
private final String responseType;
private final String statusCodeValue;
private final Map responseParameters;
private final Map responseTemplates;
private final Boolean defaultResponse;
private UpdateGatewayResponseResponse(BuilderImpl builder) {
super(builder);
this.responseType = builder.responseType;
this.statusCodeValue = builder.statusCodeValue;
this.responseParameters = builder.responseParameters;
this.responseTemplates = builder.responseTemplates;
this.defaultResponse = builder.defaultResponse;
}
/**
*
* The response type of the associated GatewayResponse . Valid values are
*
* ACCESS_DENIED
* API_CONFIGURATION_ERROR
* AUTHORIZER_FAILURE
* AUTHORIZER_CONFIGURATION_ERROR
* BAD_REQUEST_PARAMETERS
* BAD_REQUEST_BODY
* DEFAULT_4XX
* DEFAULT_5XX
* EXPIRED_TOKEN
* INVALID_SIGNATURE
* INTEGRATION_FAILURE
* INTEGRATION_TIMEOUT
* INVALID_API_KEY
* MISSING_AUTHENTICATION_TOKEN
* QUOTA_EXCEEDED
* REQUEST_TOO_LARGE
* RESOURCE_NOT_FOUND
* THROTTLED
* UNAUTHORIZED
* UNSUPPORTED_MEDIA_TYPE
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #responseType} will
* return {@link GatewayResponseType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #responseTypeAsString}.
*
*
* @return The response type of the associated GatewayResponse . Valid values are
*
* ACCESS_DENIED
* API_CONFIGURATION_ERROR
* AUTHORIZER_FAILURE
* AUTHORIZER_CONFIGURATION_ERROR
* BAD_REQUEST_PARAMETERS
* BAD_REQUEST_BODY
* DEFAULT_4XX
* DEFAULT_5XX
* EXPIRED_TOKEN
* INVALID_SIGNATURE
* INTEGRATION_FAILURE
* INTEGRATION_TIMEOUT
* INVALID_API_KEY
* MISSING_AUTHENTICATION_TOKEN
* QUOTA_EXCEEDED
* REQUEST_TOO_LARGE
* RESOURCE_NOT_FOUND
* THROTTLED
* UNAUTHORIZED
* UNSUPPORTED_MEDIA_TYPE
*
* @see GatewayResponseType
*/
public GatewayResponseType responseType() {
return GatewayResponseType.fromValue(responseType);
}
/**
*
* The response type of the associated GatewayResponse . Valid values are
*
* ACCESS_DENIED
* API_CONFIGURATION_ERROR
* AUTHORIZER_FAILURE
* AUTHORIZER_CONFIGURATION_ERROR
* BAD_REQUEST_PARAMETERS
* BAD_REQUEST_BODY
* DEFAULT_4XX
* DEFAULT_5XX
* EXPIRED_TOKEN
* INVALID_SIGNATURE
* INTEGRATION_FAILURE
* INTEGRATION_TIMEOUT
* INVALID_API_KEY
* MISSING_AUTHENTICATION_TOKEN
* QUOTA_EXCEEDED
* REQUEST_TOO_LARGE
* RESOURCE_NOT_FOUND
* THROTTLED
* UNAUTHORIZED
* UNSUPPORTED_MEDIA_TYPE
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #responseType} will
* return {@link GatewayResponseType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #responseTypeAsString}.
*
*
* @return The response type of the associated GatewayResponse . Valid values are
*
* ACCESS_DENIED
* API_CONFIGURATION_ERROR
* AUTHORIZER_FAILURE
* AUTHORIZER_CONFIGURATION_ERROR
* BAD_REQUEST_PARAMETERS
* BAD_REQUEST_BODY
* DEFAULT_4XX
* DEFAULT_5XX
* EXPIRED_TOKEN
* INVALID_SIGNATURE
* INTEGRATION_FAILURE
* INTEGRATION_TIMEOUT
* INVALID_API_KEY
* MISSING_AUTHENTICATION_TOKEN
* QUOTA_EXCEEDED
* REQUEST_TOO_LARGE
* RESOURCE_NOT_FOUND
* THROTTLED
* UNAUTHORIZED
* UNSUPPORTED_MEDIA_TYPE
*
* @see GatewayResponseType
*/
public String responseTypeAsString() {
return responseType;
}
/**
*
* The HTTP status code for this GatewayResponse .
*
*
* @return The HTTP status code for this GatewayResponse .
*/
public String statusCode() {
return statusCodeValue;
}
/**
* Returns true if the ResponseParameters 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 hasResponseParameters() {
return responseParameters != null && !(responseParameters instanceof SdkAutoConstructMap);
}
/**
*
* Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of
* key-value pairs.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasResponseParameters()} to see if a value was sent in this field.
*
*
* @return Response parameters (paths, query strings and headers) of the GatewayResponse as a
* string-to-string map of key-value pairs.
*/
public Map responseParameters() {
return responseParameters;
}
/**
* Returns true if the ResponseTemplates 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 hasResponseTemplates() {
return responseTemplates != null && !(responseTemplates instanceof SdkAutoConstructMap);
}
/**
*
* Response templates of the GatewayResponse as a string-to-string map of key-value pairs.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasResponseTemplates()} to see if a value was sent in this field.
*
*
* @return Response templates of the GatewayResponse as a string-to-string map of key-value pairs.
*/
public Map responseTemplates() {
return responseTemplates;
}
/**
*
* A Boolean flag to indicate whether this GatewayResponse is the default gateway response (true
* ) or not (false
). A default gateway response is one generated by API Gateway without any
* customization by an API developer.
*
*
* @return A Boolean flag to indicate whether this GatewayResponse is the default gateway response (
* true
) or not (false
). A default gateway response is one generated by API
* Gateway without any customization by an API developer.
*/
public Boolean defaultResponse() {
return defaultResponse;
}
@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(responseTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusCode());
hashCode = 31 * hashCode + Objects.hashCode(responseParameters());
hashCode = 31 * hashCode + Objects.hashCode(responseTemplates());
hashCode = 31 * hashCode + Objects.hashCode(defaultResponse());
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 UpdateGatewayResponseResponse)) {
return false;
}
UpdateGatewayResponseResponse other = (UpdateGatewayResponseResponse) obj;
return Objects.equals(responseTypeAsString(), other.responseTypeAsString())
&& Objects.equals(statusCode(), other.statusCode())
&& Objects.equals(responseParameters(), other.responseParameters())
&& Objects.equals(responseTemplates(), other.responseTemplates())
&& Objects.equals(defaultResponse(), other.defaultResponse());
}
/**
* 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("UpdateGatewayResponseResponse").add("ResponseType", responseTypeAsString())
.add("StatusCode", statusCode()).add("ResponseParameters", responseParameters())
.add("ResponseTemplates", responseTemplates()).add("DefaultResponse", defaultResponse()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "responseType":
return Optional.ofNullable(clazz.cast(responseTypeAsString()));
case "statusCode":
return Optional.ofNullable(clazz.cast(statusCode()));
case "responseParameters":
return Optional.ofNullable(clazz.cast(responseParameters()));
case "responseTemplates":
return Optional.ofNullable(clazz.cast(responseTemplates()));
case "defaultResponse":
return Optional.ofNullable(clazz.cast(defaultResponse()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((UpdateGatewayResponseResponse) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends ApiGatewayResponse.Builder, SdkPojo, CopyableBuilder {
/**
*
* The response type of the associated GatewayResponse . Valid values are
*
* ACCESS_DENIED
* API_CONFIGURATION_ERROR
* AUTHORIZER_FAILURE
* AUTHORIZER_CONFIGURATION_ERROR
* BAD_REQUEST_PARAMETERS
* BAD_REQUEST_BODY
* DEFAULT_4XX
* DEFAULT_5XX
* EXPIRED_TOKEN
* INVALID_SIGNATURE
* INTEGRATION_FAILURE
* INTEGRATION_TIMEOUT
* INVALID_API_KEY
* MISSING_AUTHENTICATION_TOKEN
* QUOTA_EXCEEDED
* REQUEST_TOO_LARGE
* RESOURCE_NOT_FOUND
* THROTTLED
* UNAUTHORIZED
* UNSUPPORTED_MEDIA_TYPE
*
*
*
* @param responseType
* The response type of the associated GatewayResponse . Valid values are
*
* ACCESS_DENIED
* API_CONFIGURATION_ERROR
* AUTHORIZER_FAILURE
* AUTHORIZER_CONFIGURATION_ERROR
* BAD_REQUEST_PARAMETERS
* BAD_REQUEST_BODY
* DEFAULT_4XX
* DEFAULT_5XX
* EXPIRED_TOKEN
* INVALID_SIGNATURE
* INTEGRATION_FAILURE
* INTEGRATION_TIMEOUT
* INVALID_API_KEY
* MISSING_AUTHENTICATION_TOKEN
* QUOTA_EXCEEDED
* REQUEST_TOO_LARGE
* RESOURCE_NOT_FOUND
* THROTTLED
* UNAUTHORIZED
* UNSUPPORTED_MEDIA_TYPE
*
* @see GatewayResponseType
* @return Returns a reference to this object so that method calls can be chained together.
* @see GatewayResponseType
*/
Builder responseType(String responseType);
/**
*
* The response type of the associated GatewayResponse . Valid values are
*
* ACCESS_DENIED
* API_CONFIGURATION_ERROR
* AUTHORIZER_FAILURE
* AUTHORIZER_CONFIGURATION_ERROR
* BAD_REQUEST_PARAMETERS
* BAD_REQUEST_BODY
* DEFAULT_4XX
* DEFAULT_5XX
* EXPIRED_TOKEN
* INVALID_SIGNATURE
* INTEGRATION_FAILURE
* INTEGRATION_TIMEOUT
* INVALID_API_KEY
* MISSING_AUTHENTICATION_TOKEN
* QUOTA_EXCEEDED
* REQUEST_TOO_LARGE
* RESOURCE_NOT_FOUND
* THROTTLED
* UNAUTHORIZED
* UNSUPPORTED_MEDIA_TYPE
*
*
*
* @param responseType
* The response type of the associated GatewayResponse . Valid values are
*
* ACCESS_DENIED
* API_CONFIGURATION_ERROR
* AUTHORIZER_FAILURE
* AUTHORIZER_CONFIGURATION_ERROR
* BAD_REQUEST_PARAMETERS
* BAD_REQUEST_BODY
* DEFAULT_4XX
* DEFAULT_5XX
* EXPIRED_TOKEN
* INVALID_SIGNATURE
* INTEGRATION_FAILURE
* INTEGRATION_TIMEOUT
* INVALID_API_KEY
* MISSING_AUTHENTICATION_TOKEN
* QUOTA_EXCEEDED
* REQUEST_TOO_LARGE
* RESOURCE_NOT_FOUND
* THROTTLED
* UNAUTHORIZED
* UNSUPPORTED_MEDIA_TYPE
*
* @see GatewayResponseType
* @return Returns a reference to this object so that method calls can be chained together.
* @see GatewayResponseType
*/
Builder responseType(GatewayResponseType responseType);
/**
*
* The HTTP status code for this GatewayResponse .
*
*
* @param statusCodeValue
* The HTTP status code for this GatewayResponse .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder statusCode(String statusCodeValue);
/**
*
* Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string
* map of key-value pairs.
*
*
* @param responseParameters
* Response parameters (paths, query strings and headers) of the GatewayResponse as a
* string-to-string map of key-value pairs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder responseParameters(Map responseParameters);
/**
*
* Response templates of the GatewayResponse as a string-to-string map of key-value pairs.
*
*
* @param responseTemplates
* Response templates of the GatewayResponse as a string-to-string map of key-value pairs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder responseTemplates(Map responseTemplates);
/**
*
* A Boolean flag to indicate whether this GatewayResponse is the default gateway response (
* true
) or not (false
). A default gateway response is one generated by API Gateway
* without any customization by an API developer.
*
*
* @param defaultResponse
* A Boolean flag to indicate whether this GatewayResponse is the default gateway response (
* true
) or not (false
). A default gateway response is one generated by API
* Gateway without any customization by an API developer.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder defaultResponse(Boolean defaultResponse);
}
static final class BuilderImpl extends ApiGatewayResponse.BuilderImpl implements Builder {
private String responseType;
private String statusCodeValue;
private Map responseParameters = DefaultSdkAutoConstructMap.getInstance();
private Map responseTemplates = DefaultSdkAutoConstructMap.getInstance();
private Boolean defaultResponse;
private BuilderImpl() {
}
private BuilderImpl(UpdateGatewayResponseResponse model) {
super(model);
responseType(model.responseType);
statusCode(model.statusCodeValue);
responseParameters(model.responseParameters);
responseTemplates(model.responseTemplates);
defaultResponse(model.defaultResponse);
}
public final String getResponseType() {
return responseType;
}
@Override
public final Builder responseType(String responseType) {
this.responseType = responseType;
return this;
}
@Override
public final Builder responseType(GatewayResponseType responseType) {
this.responseType(responseType == null ? null : responseType.toString());
return this;
}
public final void setResponseType(String responseType) {
this.responseType = responseType;
}
public final String getStatusCode() {
return statusCodeValue;
}
@Override
public final Builder statusCode(String statusCodeValue) {
this.statusCodeValue = statusCodeValue;
return this;
}
public final void setStatusCode(String statusCodeValue) {
this.statusCodeValue = statusCodeValue;
}
public final Map getResponseParameters() {
return responseParameters;
}
@Override
public final Builder responseParameters(Map responseParameters) {
this.responseParameters = MapOfStringToStringCopier.copy(responseParameters);
return this;
}
public final void setResponseParameters(Map responseParameters) {
this.responseParameters = MapOfStringToStringCopier.copy(responseParameters);
}
public final Map getResponseTemplates() {
return responseTemplates;
}
@Override
public final Builder responseTemplates(Map responseTemplates) {
this.responseTemplates = MapOfStringToStringCopier.copy(responseTemplates);
return this;
}
public final void setResponseTemplates(Map responseTemplates) {
this.responseTemplates = MapOfStringToStringCopier.copy(responseTemplates);
}
public final Boolean getDefaultResponse() {
return defaultResponse;
}
@Override
public final Builder defaultResponse(Boolean defaultResponse) {
this.defaultResponse = defaultResponse;
return this;
}
public final void setDefaultResponse(Boolean defaultResponse) {
this.defaultResponse = defaultResponse;
}
@Override
public UpdateGatewayResponseResponse build() {
return new UpdateGatewayResponseResponse(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}