software.amazon.awssdk.services.apigateway.model.MethodSetting Maven / Gradle / Ivy
Show all versions of apigateway Show documentation
/*
* 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.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Specifies the method setting properties.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MethodSetting implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField METRICS_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("metricsEnabled").getter(getter(MethodSetting::metricsEnabled)).setter(setter(Builder::metricsEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("metricsEnabled").build()).build();
private static final SdkField LOGGING_LEVEL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("loggingLevel").getter(getter(MethodSetting::loggingLevel)).setter(setter(Builder::loggingLevel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("loggingLevel").build()).build();
private static final SdkField DATA_TRACE_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("dataTraceEnabled").getter(getter(MethodSetting::dataTraceEnabled))
.setter(setter(Builder::dataTraceEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataTraceEnabled").build()).build();
private static final SdkField THROTTLING_BURST_LIMIT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("throttlingBurstLimit").getter(getter(MethodSetting::throttlingBurstLimit))
.setter(setter(Builder::throttlingBurstLimit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("throttlingBurstLimit").build())
.build();
private static final SdkField THROTTLING_RATE_LIMIT_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("throttlingRateLimit").getter(getter(MethodSetting::throttlingRateLimit))
.setter(setter(Builder::throttlingRateLimit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("throttlingRateLimit").build())
.build();
private static final SdkField CACHING_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("cachingEnabled").getter(getter(MethodSetting::cachingEnabled)).setter(setter(Builder::cachingEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cachingEnabled").build()).build();
private static final SdkField CACHE_TTL_IN_SECONDS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("cacheTtlInSeconds").getter(getter(MethodSetting::cacheTtlInSeconds))
.setter(setter(Builder::cacheTtlInSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cacheTtlInSeconds").build()).build();
private static final SdkField CACHE_DATA_ENCRYPTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("cacheDataEncrypted").getter(getter(MethodSetting::cacheDataEncrypted))
.setter(setter(Builder::cacheDataEncrypted))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("cacheDataEncrypted").build())
.build();
private static final SdkField REQUIRE_AUTHORIZATION_FOR_CACHE_CONTROL_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("requireAuthorizationForCacheControl")
.getter(getter(MethodSetting::requireAuthorizationForCacheControl))
.setter(setter(Builder::requireAuthorizationForCacheControl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("requireAuthorizationForCacheControl").build()).build();
private static final SdkField UNAUTHORIZED_CACHE_CONTROL_HEADER_STRATEGY_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("unauthorizedCacheControlHeaderStrategy")
.getter(getter(MethodSetting::unauthorizedCacheControlHeaderStrategyAsString))
.setter(setter(Builder::unauthorizedCacheControlHeaderStrategy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("unauthorizedCacheControlHeaderStrategy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(METRICS_ENABLED_FIELD,
LOGGING_LEVEL_FIELD, DATA_TRACE_ENABLED_FIELD, THROTTLING_BURST_LIMIT_FIELD, THROTTLING_RATE_LIMIT_FIELD,
CACHING_ENABLED_FIELD, CACHE_TTL_IN_SECONDS_FIELD, CACHE_DATA_ENCRYPTED_FIELD,
REQUIRE_AUTHORIZATION_FOR_CACHE_CONTROL_FIELD, UNAUTHORIZED_CACHE_CONTROL_HEADER_STRATEGY_FIELD));
private static final long serialVersionUID = 1L;
private final Boolean metricsEnabled;
private final String loggingLevel;
private final Boolean dataTraceEnabled;
private final Integer throttlingBurstLimit;
private final Double throttlingRateLimit;
private final Boolean cachingEnabled;
private final Integer cacheTtlInSeconds;
private final Boolean cacheDataEncrypted;
private final Boolean requireAuthorizationForCacheControl;
private final String unauthorizedCacheControlHeaderStrategy;
private MethodSetting(BuilderImpl builder) {
this.metricsEnabled = builder.metricsEnabled;
this.loggingLevel = builder.loggingLevel;
this.dataTraceEnabled = builder.dataTraceEnabled;
this.throttlingBurstLimit = builder.throttlingBurstLimit;
this.throttlingRateLimit = builder.throttlingRateLimit;
this.cachingEnabled = builder.cachingEnabled;
this.cacheTtlInSeconds = builder.cacheTtlInSeconds;
this.cacheDataEncrypted = builder.cacheDataEncrypted;
this.requireAuthorizationForCacheControl = builder.requireAuthorizationForCacheControl;
this.unauthorizedCacheControlHeaderStrategy = builder.unauthorizedCacheControlHeaderStrategy;
}
/**
*
* Specifies whether Amazon CloudWatch metrics are enabled for this method. The PATCH path for this setting is
* /{method_setting_key}/metrics/enabled
, and the value is a Boolean.
*
*
* @return Specifies whether Amazon CloudWatch metrics are enabled for this method. The PATCH path for this setting
* is /{method_setting_key}/metrics/enabled
, and the value is a Boolean.
*/
public final Boolean metricsEnabled() {
return metricsEnabled;
}
/**
*
* Specifies the logging level for this method, which affects the log entries pushed to Amazon CloudWatch Logs. The
* PATCH path for this setting is /{method_setting_key}/logging/loglevel
, and the available levels are
* OFF
, ERROR
, and INFO
. Choose ERROR
to write only error-level
* entries to CloudWatch Logs, or choose INFO
to include all ERROR
events as well as extra
* informational events.
*
*
* @return Specifies the logging level for this method, which affects the log entries pushed to Amazon CloudWatch
* Logs. The PATCH path for this setting is /{method_setting_key}/logging/loglevel
, and the
* available levels are OFF
, ERROR
, and INFO
. Choose
* ERROR
to write only error-level entries to CloudWatch Logs, or choose INFO
to
* include all ERROR
events as well as extra informational events.
*/
public final String loggingLevel() {
return loggingLevel;
}
/**
*
* Specifies whether data trace logging is enabled for this method, which affects the log entries pushed to Amazon
* CloudWatch Logs. The PATCH path for this setting is /{method_setting_key}/logging/dataTrace
, and the
* value is a Boolean.
*
*
* @return Specifies whether data trace logging is enabled for this method, which affects the log entries pushed to
* Amazon CloudWatch Logs. The PATCH path for this setting is
* /{method_setting_key}/logging/dataTrace
, and the value is a Boolean.
*/
public final Boolean dataTraceEnabled() {
return dataTraceEnabled;
}
/**
*
* Specifies the throttling burst limit. The PATCH path for this setting is
* /{method_setting_key}/throttling/burstLimit
, and the value is an integer.
*
*
* @return Specifies the throttling burst limit. The PATCH path for this setting is
* /{method_setting_key}/throttling/burstLimit
, and the value is an integer.
*/
public final Integer throttlingBurstLimit() {
return throttlingBurstLimit;
}
/**
*
* Specifies the throttling rate limit. The PATCH path for this setting is
* /{method_setting_key}/throttling/rateLimit
, and the value is a double.
*
*
* @return Specifies the throttling rate limit. The PATCH path for this setting is
* /{method_setting_key}/throttling/rateLimit
, and the value is a double.
*/
public final Double throttlingRateLimit() {
return throttlingRateLimit;
}
/**
*
* Specifies whether responses should be cached and returned for requests. A cache cluster must be enabled on the
* stage for responses to be cached. The PATCH path for this setting is
* /{method_setting_key}/caching/enabled
, and the value is a Boolean.
*
*
* @return Specifies whether responses should be cached and returned for requests. A cache cluster must be enabled
* on the stage for responses to be cached. The PATCH path for this setting is
* /{method_setting_key}/caching/enabled
, and the value is a Boolean.
*/
public final Boolean cachingEnabled() {
return cachingEnabled;
}
/**
*
* Specifies the time to live (TTL), in seconds, for cached responses. The higher the TTL, the longer the response
* will be cached. The PATCH path for this setting is /{method_setting_key}/caching/ttlInSeconds
, and
* the value is an integer.
*
*
* @return Specifies the time to live (TTL), in seconds, for cached responses. The higher the TTL, the longer the
* response will be cached. The PATCH path for this setting is
* /{method_setting_key}/caching/ttlInSeconds
, and the value is an integer.
*/
public final Integer cacheTtlInSeconds() {
return cacheTtlInSeconds;
}
/**
*
* Specifies whether the cached responses are encrypted. The PATCH path for this setting is
* /{method_setting_key}/caching/dataEncrypted
, and the value is a Boolean.
*
*
* @return Specifies whether the cached responses are encrypted. The PATCH path for this setting is
* /{method_setting_key}/caching/dataEncrypted
, and the value is a Boolean.
*/
public final Boolean cacheDataEncrypted() {
return cacheDataEncrypted;
}
/**
*
* Specifies whether authorization is required for a cache invalidation request. The PATCH path for this setting is
* /{method_setting_key}/caching/requireAuthorizationForCacheControl
, and the value is a Boolean.
*
*
* @return Specifies whether authorization is required for a cache invalidation request. The PATCH path for this
* setting is /{method_setting_key}/caching/requireAuthorizationForCacheControl
, and the value
* is a Boolean.
*/
public final Boolean requireAuthorizationForCacheControl() {
return requireAuthorizationForCacheControl;
}
/**
*
* Specifies how to handle unauthorized requests for cache invalidation. The PATCH path for this setting is
* /{method_setting_key}/caching/unauthorizedCacheControlHeaderStrategy
, and the available values are
* FAIL_WITH_403
, SUCCEED_WITH_RESPONSE_HEADER
,
* SUCCEED_WITHOUT_RESPONSE_HEADER
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #unauthorizedCacheControlHeaderStrategy} will return
* {@link UnauthorizedCacheControlHeaderStrategy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #unauthorizedCacheControlHeaderStrategyAsString}.
*
*
* @return Specifies how to handle unauthorized requests for cache invalidation. The PATCH path for this setting is
* /{method_setting_key}/caching/unauthorizedCacheControlHeaderStrategy
, and the available
* values are FAIL_WITH_403
, SUCCEED_WITH_RESPONSE_HEADER
,
* SUCCEED_WITHOUT_RESPONSE_HEADER
.
* @see UnauthorizedCacheControlHeaderStrategy
*/
public final UnauthorizedCacheControlHeaderStrategy unauthorizedCacheControlHeaderStrategy() {
return UnauthorizedCacheControlHeaderStrategy.fromValue(unauthorizedCacheControlHeaderStrategy);
}
/**
*
* Specifies how to handle unauthorized requests for cache invalidation. The PATCH path for this setting is
* /{method_setting_key}/caching/unauthorizedCacheControlHeaderStrategy
, and the available values are
* FAIL_WITH_403
, SUCCEED_WITH_RESPONSE_HEADER
,
* SUCCEED_WITHOUT_RESPONSE_HEADER
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #unauthorizedCacheControlHeaderStrategy} will return
* {@link UnauthorizedCacheControlHeaderStrategy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #unauthorizedCacheControlHeaderStrategyAsString}.
*
*
* @return Specifies how to handle unauthorized requests for cache invalidation. The PATCH path for this setting is
* /{method_setting_key}/caching/unauthorizedCacheControlHeaderStrategy
, and the available
* values are FAIL_WITH_403
, SUCCEED_WITH_RESPONSE_HEADER
,
* SUCCEED_WITHOUT_RESPONSE_HEADER
.
* @see UnauthorizedCacheControlHeaderStrategy
*/
public final String unauthorizedCacheControlHeaderStrategyAsString() {
return unauthorizedCacheControlHeaderStrategy;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(metricsEnabled());
hashCode = 31 * hashCode + Objects.hashCode(loggingLevel());
hashCode = 31 * hashCode + Objects.hashCode(dataTraceEnabled());
hashCode = 31 * hashCode + Objects.hashCode(throttlingBurstLimit());
hashCode = 31 * hashCode + Objects.hashCode(throttlingRateLimit());
hashCode = 31 * hashCode + Objects.hashCode(cachingEnabled());
hashCode = 31 * hashCode + Objects.hashCode(cacheTtlInSeconds());
hashCode = 31 * hashCode + Objects.hashCode(cacheDataEncrypted());
hashCode = 31 * hashCode + Objects.hashCode(requireAuthorizationForCacheControl());
hashCode = 31 * hashCode + Objects.hashCode(unauthorizedCacheControlHeaderStrategyAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MethodSetting)) {
return false;
}
MethodSetting other = (MethodSetting) obj;
return Objects.equals(metricsEnabled(), other.metricsEnabled())
&& Objects.equals(loggingLevel(), other.loggingLevel())
&& Objects.equals(dataTraceEnabled(), other.dataTraceEnabled())
&& Objects.equals(throttlingBurstLimit(), other.throttlingBurstLimit())
&& Objects.equals(throttlingRateLimit(), other.throttlingRateLimit())
&& Objects.equals(cachingEnabled(), other.cachingEnabled())
&& Objects.equals(cacheTtlInSeconds(), other.cacheTtlInSeconds())
&& Objects.equals(cacheDataEncrypted(), other.cacheDataEncrypted())
&& Objects.equals(requireAuthorizationForCacheControl(), other.requireAuthorizationForCacheControl())
&& Objects.equals(unauthorizedCacheControlHeaderStrategyAsString(),
other.unauthorizedCacheControlHeaderStrategyAsString());
}
/**
* 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 final String toString() {
return ToString.builder("MethodSetting").add("MetricsEnabled", metricsEnabled()).add("LoggingLevel", loggingLevel())
.add("DataTraceEnabled", dataTraceEnabled()).add("ThrottlingBurstLimit", throttlingBurstLimit())
.add("ThrottlingRateLimit", throttlingRateLimit()).add("CachingEnabled", cachingEnabled())
.add("CacheTtlInSeconds", cacheTtlInSeconds()).add("CacheDataEncrypted", cacheDataEncrypted())
.add("RequireAuthorizationForCacheControl", requireAuthorizationForCacheControl())
.add("UnauthorizedCacheControlHeaderStrategy", unauthorizedCacheControlHeaderStrategyAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "metricsEnabled":
return Optional.ofNullable(clazz.cast(metricsEnabled()));
case "loggingLevel":
return Optional.ofNullable(clazz.cast(loggingLevel()));
case "dataTraceEnabled":
return Optional.ofNullable(clazz.cast(dataTraceEnabled()));
case "throttlingBurstLimit":
return Optional.ofNullable(clazz.cast(throttlingBurstLimit()));
case "throttlingRateLimit":
return Optional.ofNullable(clazz.cast(throttlingRateLimit()));
case "cachingEnabled":
return Optional.ofNullable(clazz.cast(cachingEnabled()));
case "cacheTtlInSeconds":
return Optional.ofNullable(clazz.cast(cacheTtlInSeconds()));
case "cacheDataEncrypted":
return Optional.ofNullable(clazz.cast(cacheDataEncrypted()));
case "requireAuthorizationForCacheControl":
return Optional.ofNullable(clazz.cast(requireAuthorizationForCacheControl()));
case "unauthorizedCacheControlHeaderStrategy":
return Optional.ofNullable(clazz.cast(unauthorizedCacheControlHeaderStrategyAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function