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.PutGatewayResponseRequest 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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;
/**
*
* Creates a customization of a GatewayResponse of a specified response type and status code on the given
* RestApi .
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PutGatewayResponseRequest extends ApiGatewayRequest implements
ToCopyableBuilder {
private static final SdkField REST_API_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(PutGatewayResponseRequest::restApiId)).setter(setter(Builder::restApiId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("restapi_id").build()).build();
private static final SdkField RESPONSE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(PutGatewayResponseRequest::responseTypeAsString)).setter(setter(Builder::responseType))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("response_type").build()).build();
private static final SdkField STATUS_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(PutGatewayResponseRequest::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(PutGatewayResponseRequest::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(PutGatewayResponseRequest::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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(REST_API_ID_FIELD,
RESPONSE_TYPE_FIELD, STATUS_CODE_FIELD, RESPONSE_PARAMETERS_FIELD, RESPONSE_TEMPLATES_FIELD));
private final String restApiId;
private final String responseType;
private final String statusCodeValue;
private final Map responseParameters;
private final Map responseTemplates;
private PutGatewayResponseRequest(BuilderImpl builder) {
super(builder);
this.restApiId = builder.restApiId;
this.responseType = builder.responseType;
this.statusCodeValue = builder.statusCodeValue;
this.responseParameters = builder.responseParameters;
this.responseTemplates = builder.responseTemplates;
}
/**
*
* [Required] The string identifier of the associated RestApi .
*
*
* @return [Required] The string identifier of the associated RestApi .
*/
public String restApiId() {
return restApiId;
}
/**
*
* [Required]
*
* 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 [Required]
*
* 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);
}
/**
*
* [Required]
*
* 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 [Required]
*
* 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 of the GatewayResponse .
*
* @return The HTTP status code of the 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;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(restApiId());
hashCode = 31 * hashCode + Objects.hashCode(responseTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusCode());
hashCode = 31 * hashCode + Objects.hashCode(responseParameters());
hashCode = 31 * hashCode + Objects.hashCode(responseTemplates());
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 PutGatewayResponseRequest)) {
return false;
}
PutGatewayResponseRequest other = (PutGatewayResponseRequest) obj;
return Objects.equals(restApiId(), other.restApiId())
&& Objects.equals(responseTypeAsString(), other.responseTypeAsString())
&& Objects.equals(statusCode(), other.statusCode())
&& Objects.equals(responseParameters(), other.responseParameters())
&& Objects.equals(responseTemplates(), other.responseTemplates());
}
/**
* 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("PutGatewayResponseRequest").add("RestApiId", restApiId())
.add("ResponseType", responseTypeAsString()).add("StatusCode", statusCode())
.add("ResponseParameters", responseParameters()).add("ResponseTemplates", responseTemplates()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "restApiId":
return Optional.ofNullable(clazz.cast(restApiId()));
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()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((PutGatewayResponseRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends ApiGatewayRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* [Required] The string identifier of the associated RestApi .
*
*
* @param restApiId
* [Required] 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);
/**
*
* [Required]
*
* 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
* [Required]
*
* 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);
/**
*
* [Required]
*
* 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
* [Required]
*
* 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 of the GatewayResponse .
*
* @param statusCodeValue
* The HTTP status code of the 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);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends ApiGatewayRequest.BuilderImpl implements Builder {
private String restApiId;
private String responseType;
private String statusCodeValue;
private Map responseParameters = DefaultSdkAutoConstructMap.getInstance();
private Map responseTemplates = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(PutGatewayResponseRequest model) {
super(model);
restApiId(model.restApiId);
responseType(model.responseType);
statusCode(model.statusCodeValue);
responseParameters(model.responseParameters);
responseTemplates(model.responseTemplates);
}
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 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);
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public PutGatewayResponseRequest build() {
return new PutGatewayResponseRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}