software.amazon.awssdk.services.elasticache.model.LogDeliveryConfigurationRequest Maven / Gradle / Ivy
Show all versions of elasticache 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.elasticache.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.Consumer;
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 destination, format and type of the logs.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class LogDeliveryConfigurationRequest implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField LOG_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LogType").getter(getter(LogDeliveryConfigurationRequest::logTypeAsString))
.setter(setter(Builder::logType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogType").build()).build();
private static final SdkField DESTINATION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DestinationType").getter(getter(LogDeliveryConfigurationRequest::destinationTypeAsString))
.setter(setter(Builder::destinationType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationType").build()).build();
private static final SdkField DESTINATION_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DestinationDetails")
.getter(getter(LogDeliveryConfigurationRequest::destinationDetails)).setter(setter(Builder::destinationDetails))
.constructor(DestinationDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationDetails").build())
.build();
private static final SdkField LOG_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LogFormat").getter(getter(LogDeliveryConfigurationRequest::logFormatAsString))
.setter(setter(Builder::logFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogFormat").build()).build();
private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("Enabled").getter(getter(LogDeliveryConfigurationRequest::enabled)).setter(setter(Builder::enabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Enabled").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOG_TYPE_FIELD,
DESTINATION_TYPE_FIELD, DESTINATION_DETAILS_FIELD, LOG_FORMAT_FIELD, ENABLED_FIELD));
private static final long serialVersionUID = 1L;
private final String logType;
private final String destinationType;
private final DestinationDetails destinationDetails;
private final String logFormat;
private final Boolean enabled;
private LogDeliveryConfigurationRequest(BuilderImpl builder) {
this.logType = builder.logType;
this.destinationType = builder.destinationType;
this.destinationDetails = builder.destinationDetails;
this.logFormat = builder.logFormat;
this.enabled = builder.enabled;
}
/**
*
* Refers to slow-log or engine-log..
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #logType} will
* return {@link LogType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #logTypeAsString}.
*
*
* @return Refers to slow-log or engine-log..
* @see LogType
*/
public final LogType logType() {
return LogType.fromValue(logType);
}
/**
*
* Refers to slow-log or engine-log..
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #logType} will
* return {@link LogType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #logTypeAsString}.
*
*
* @return Refers to slow-log or engine-log..
* @see LogType
*/
public final String logTypeAsString() {
return logType;
}
/**
*
* Specify either cloudwatch-logs
or kinesis-firehose
as the destination type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #destinationType}
* will return {@link DestinationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #destinationTypeAsString}.
*
*
* @return Specify either cloudwatch-logs
or kinesis-firehose
as the destination type.
* @see DestinationType
*/
public final DestinationType destinationType() {
return DestinationType.fromValue(destinationType);
}
/**
*
* Specify either cloudwatch-logs
or kinesis-firehose
as the destination type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #destinationType}
* will return {@link DestinationType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #destinationTypeAsString}.
*
*
* @return Specify either cloudwatch-logs
or kinesis-firehose
as the destination type.
* @see DestinationType
*/
public final String destinationTypeAsString() {
return destinationType;
}
/**
*
* Configuration details of either a CloudWatch Logs destination or Kinesis Data Firehose destination.
*
*
* @return Configuration details of either a CloudWatch Logs destination or Kinesis Data Firehose destination.
*/
public final DestinationDetails destinationDetails() {
return destinationDetails;
}
/**
*
* Specifies either JSON or TEXT
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #logFormat} will
* return {@link LogFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #logFormatAsString}.
*
*
* @return Specifies either JSON or TEXT
* @see LogFormat
*/
public final LogFormat logFormat() {
return LogFormat.fromValue(logFormat);
}
/**
*
* Specifies either JSON or TEXT
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #logFormat} will
* return {@link LogFormat#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #logFormatAsString}.
*
*
* @return Specifies either JSON or TEXT
* @see LogFormat
*/
public final String logFormatAsString() {
return logFormat;
}
/**
*
* Specify if log delivery is enabled. Default true
.
*
*
* @return Specify if log delivery is enabled. Default true
.
*/
public final Boolean enabled() {
return enabled;
}
@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(logTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(destinationTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(destinationDetails());
hashCode = 31 * hashCode + Objects.hashCode(logFormatAsString());
hashCode = 31 * hashCode + Objects.hashCode(enabled());
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 LogDeliveryConfigurationRequest)) {
return false;
}
LogDeliveryConfigurationRequest other = (LogDeliveryConfigurationRequest) obj;
return Objects.equals(logTypeAsString(), other.logTypeAsString())
&& Objects.equals(destinationTypeAsString(), other.destinationTypeAsString())
&& Objects.equals(destinationDetails(), other.destinationDetails())
&& Objects.equals(logFormatAsString(), other.logFormatAsString()) && Objects.equals(enabled(), other.enabled());
}
/**
* 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("LogDeliveryConfigurationRequest").add("LogType", logTypeAsString())
.add("DestinationType", destinationTypeAsString()).add("DestinationDetails", destinationDetails())
.add("LogFormat", logFormatAsString()).add("Enabled", enabled()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LogType":
return Optional.ofNullable(clazz.cast(logTypeAsString()));
case "DestinationType":
return Optional.ofNullable(clazz.cast(destinationTypeAsString()));
case "DestinationDetails":
return Optional.ofNullable(clazz.cast(destinationDetails()));
case "LogFormat":
return Optional.ofNullable(clazz.cast(logFormatAsString()));
case "Enabled":
return Optional.ofNullable(clazz.cast(enabled()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function