software.amazon.awssdk.services.lexmodelbuilding.model.LogSettingsResponse Maven / Gradle / Ivy
/*
* 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.lexmodelbuilding.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;
/**
*
* The settings for conversation logs.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class LogSettingsResponse implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField LOG_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LogSettingsResponse::logTypeAsString)).setter(setter(Builder::logType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("logType").build()).build();
private static final SdkField DESTINATION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LogSettingsResponse::destinationAsString)).setter(setter(Builder::destination))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destination").build()).build();
private static final SdkField KMS_KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LogSettingsResponse::kmsKeyArn)).setter(setter(Builder::kmsKeyArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kmsKeyArn").build()).build();
private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LogSettingsResponse::resourceArn)).setter(setter(Builder::resourceArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceArn").build()).build();
private static final SdkField RESOURCE_PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(LogSettingsResponse::resourcePrefix)).setter(setter(Builder::resourcePrefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourcePrefix").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOG_TYPE_FIELD,
DESTINATION_FIELD, KMS_KEY_ARN_FIELD, RESOURCE_ARN_FIELD, RESOURCE_PREFIX_FIELD));
private static final long serialVersionUID = 1L;
private final String logType;
private final String destination;
private final String kmsKeyArn;
private final String resourceArn;
private final String resourcePrefix;
private LogSettingsResponse(BuilderImpl builder) {
this.logType = builder.logType;
this.destination = builder.destination;
this.kmsKeyArn = builder.kmsKeyArn;
this.resourceArn = builder.resourceArn;
this.resourcePrefix = builder.resourcePrefix;
}
/**
*
* The type of logging that is enabled.
*
*
* 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 The type of logging that is enabled.
* @see LogType
*/
public LogType logType() {
return LogType.fromValue(logType);
}
/**
*
* The type of logging that is enabled.
*
*
* 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 The type of logging that is enabled.
* @see LogType
*/
public String logTypeAsString() {
return logType;
}
/**
*
* The destination where logs are delivered.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #destination} will
* return {@link Destination#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #destinationAsString}.
*
*
* @return The destination where logs are delivered.
* @see Destination
*/
public Destination destination() {
return Destination.fromValue(destination);
}
/**
*
* The destination where logs are delivered.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #destination} will
* return {@link Destination#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #destinationAsString}.
*
*
* @return The destination where logs are delivered.
* @see Destination
*/
public String destinationAsString() {
return destination;
}
/**
*
* The Amazon Resource Name (ARN) of the key used to encrypt audio logs in an S3 bucket.
*
*
* @return The Amazon Resource Name (ARN) of the key used to encrypt audio logs in an S3 bucket.
*/
public String kmsKeyArn() {
return kmsKeyArn;
}
/**
*
* The Amazon Resource Name (ARN) of the CloudWatch Logs log group or S3 bucket where the logs are delivered.
*
*
* @return The Amazon Resource Name (ARN) of the CloudWatch Logs log group or S3 bucket where the logs are
* delivered.
*/
public String resourceArn() {
return resourceArn;
}
/**
*
* The resource prefix is the first part of the S3 object key within the S3 bucket that you specified to contain
* audio logs. For CloudWatch Logs it is the prefix of the log stream name within the log group that you specified.
*
*
* @return The resource prefix is the first part of the S3 object key within the S3 bucket that you specified to
* contain audio logs. For CloudWatch Logs it is the prefix of the log stream name within the log group that
* you specified.
*/
public String resourcePrefix() {
return resourcePrefix;
}
@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 + Objects.hashCode(logTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(destinationAsString());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyArn());
hashCode = 31 * hashCode + Objects.hashCode(resourceArn());
hashCode = 31 * hashCode + Objects.hashCode(resourcePrefix());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof LogSettingsResponse)) {
return false;
}
LogSettingsResponse other = (LogSettingsResponse) obj;
return Objects.equals(logTypeAsString(), other.logTypeAsString())
&& Objects.equals(destinationAsString(), other.destinationAsString())
&& Objects.equals(kmsKeyArn(), other.kmsKeyArn()) && Objects.equals(resourceArn(), other.resourceArn())
&& Objects.equals(resourcePrefix(), other.resourcePrefix());
}
/**
* 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("LogSettingsResponse").add("LogType", logTypeAsString())
.add("Destination", destinationAsString()).add("KmsKeyArn", kmsKeyArn()).add("ResourceArn", resourceArn())
.add("ResourcePrefix", resourcePrefix()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "logType":
return Optional.ofNullable(clazz.cast(logTypeAsString()));
case "destination":
return Optional.ofNullable(clazz.cast(destinationAsString()));
case "kmsKeyArn":
return Optional.ofNullable(clazz.cast(kmsKeyArn()));
case "resourceArn":
return Optional.ofNullable(clazz.cast(resourceArn()));
case "resourcePrefix":
return Optional.ofNullable(clazz.cast(resourcePrefix()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function