software.amazon.awssdk.services.elasticache.model.LogDeliveryConfiguration 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;
/**
*
* Returns the destination, format and type of the logs.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class LogDeliveryConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField LOG_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LogType").getter(getter(LogDeliveryConfiguration::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(LogDeliveryConfiguration::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(LogDeliveryConfiguration::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(LogDeliveryConfiguration::logFormatAsString))
.setter(setter(Builder::logFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogFormat").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(LogDeliveryConfiguration::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Message")
.getter(getter(LogDeliveryConfiguration::message)).setter(setter(Builder::message))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Message").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOG_TYPE_FIELD,
DESTINATION_TYPE_FIELD, DESTINATION_DETAILS_FIELD, LOG_FORMAT_FIELD, STATUS_FIELD, MESSAGE_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 String status;
private final String message;
private LogDeliveryConfiguration(BuilderImpl builder) {
this.logType = builder.logType;
this.destinationType = builder.destinationType;
this.destinationDetails = builder.destinationDetails;
this.logFormat = builder.logFormat;
this.status = builder.status;
this.message = builder.message;
}
/**
*
* 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;
}
/**
*
* Returns the destination type, either cloudwatch-logs
or kinesis-firehose
.
*
*
* 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 Returns the destination type, either cloudwatch-logs
or kinesis-firehose
.
* @see DestinationType
*/
public final DestinationType destinationType() {
return DestinationType.fromValue(destinationType);
}
/**
*
* Returns the destination type, either cloudwatch-logs
or kinesis-firehose
.
*
*
* 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 Returns the destination type, either cloudwatch-logs
or kinesis-firehose
.
* @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;
}
/**
*
* Returns the log format, 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 Returns the log format, either JSON or TEXT.
* @see LogFormat
*/
public final LogFormat logFormat() {
return LogFormat.fromValue(logFormat);
}
/**
*
* Returns the log format, 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 Returns the log format, either JSON or TEXT.
* @see LogFormat
*/
public final String logFormatAsString() {
return logFormat;
}
/**
*
* Returns the log delivery configuration status. Values are one of enabling
| disabling
|
* modifying
| active
| error
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link LogDeliveryConfigurationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return Returns the log delivery configuration status. Values are one of enabling
|
* disabling
| modifying
| active
| error
* @see LogDeliveryConfigurationStatus
*/
public final LogDeliveryConfigurationStatus status() {
return LogDeliveryConfigurationStatus.fromValue(status);
}
/**
*
* Returns the log delivery configuration status. Values are one of enabling
| disabling
|
* modifying
| active
| error
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link LogDeliveryConfigurationStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return Returns the log delivery configuration status. Values are one of enabling
|
* disabling
| modifying
| active
| error
* @see LogDeliveryConfigurationStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* Returns an error message for the log delivery configuration.
*
*
* @return Returns an error message for the log delivery configuration.
*/
public final String message() {
return message;
}
@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(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(message());
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 LogDeliveryConfiguration)) {
return false;
}
LogDeliveryConfiguration other = (LogDeliveryConfiguration) obj;
return Objects.equals(logTypeAsString(), other.logTypeAsString())
&& Objects.equals(destinationTypeAsString(), other.destinationTypeAsString())
&& Objects.equals(destinationDetails(), other.destinationDetails())
&& Objects.equals(logFormatAsString(), other.logFormatAsString())
&& Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(message(), other.message());
}
/**
* 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("LogDeliveryConfiguration").add("LogType", logTypeAsString())
.add("DestinationType", destinationTypeAsString()).add("DestinationDetails", destinationDetails())
.add("LogFormat", logFormatAsString()).add("Status", statusAsString()).add("Message", message()).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 "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "Message":
return Optional.ofNullable(clazz.cast(message()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function