software.amazon.awssdk.services.redshift.model.EnableLoggingRequest Maven / Gradle / Ivy
Show all versions of redshift 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.redshift.model;
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.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EnableLoggingRequest extends RedshiftRequest implements
ToCopyableBuilder {
private static final SdkField CLUSTER_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClusterIdentifier").getter(getter(EnableLoggingRequest::clusterIdentifier))
.setter(setter(Builder::clusterIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterIdentifier").build()).build();
private static final SdkField BUCKET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BucketName").getter(getter(EnableLoggingRequest::bucketName)).setter(setter(Builder::bucketName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BucketName").build()).build();
private static final SdkField S3_KEY_PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("S3KeyPrefix").getter(getter(EnableLoggingRequest::s3KeyPrefix)).setter(setter(Builder::s3KeyPrefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3KeyPrefix").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLUSTER_IDENTIFIER_FIELD,
BUCKET_NAME_FIELD, S3_KEY_PREFIX_FIELD));
private final String clusterIdentifier;
private final String bucketName;
private final String s3KeyPrefix;
private EnableLoggingRequest(BuilderImpl builder) {
super(builder);
this.clusterIdentifier = builder.clusterIdentifier;
this.bucketName = builder.bucketName;
this.s3KeyPrefix = builder.s3KeyPrefix;
}
/**
*
* The identifier of the cluster on which logging is to be started.
*
*
* Example: examplecluster
*
*
* @return The identifier of the cluster on which logging is to be started.
*
* Example: examplecluster
*/
public final String clusterIdentifier() {
return clusterIdentifier;
}
/**
*
* The name of an existing S3 bucket where the log files are to be stored.
*
*
* Constraints:
*
*
* -
*
* Must be in the same region as the cluster
*
*
* -
*
* The cluster must have read bucket and put object permissions
*
*
*
*
* @return The name of an existing S3 bucket where the log files are to be stored.
*
* Constraints:
*
*
* -
*
* Must be in the same region as the cluster
*
*
* -
*
* The cluster must have read bucket and put object permissions
*
*
*/
public final String bucketName() {
return bucketName;
}
/**
*
* The prefix applied to the log file names.
*
*
* Constraints:
*
*
* -
*
* Cannot exceed 512 characters
*
*
* -
*
* Cannot contain spaces( ), double quotes ("), single quotes ('), a backslash (\), or control characters. The
* hexadecimal codes for invalid characters are:
*
*
* -
*
* x00 to x20
*
*
* -
*
* x22
*
*
* -
*
* x27
*
*
* -
*
* x5c
*
*
* -
*
* x7f or larger
*
*
*
*
*
*
* @return The prefix applied to the log file names.
*
* Constraints:
*
*
* -
*
* Cannot exceed 512 characters
*
*
* -
*
* Cannot contain spaces( ), double quotes ("), single quotes ('), a backslash (\), or control characters.
* The hexadecimal codes for invalid characters are:
*
*
* -
*
* x00 to x20
*
*
* -
*
* x22
*
*
* -
*
* x27
*
*
* -
*
* x5c
*
*
* -
*
* x7f or larger
*
*
*
*
*/
public final String s3KeyPrefix() {
return s3KeyPrefix;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(clusterIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(bucketName());
hashCode = 31 * hashCode + Objects.hashCode(s3KeyPrefix());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof EnableLoggingRequest)) {
return false;
}
EnableLoggingRequest other = (EnableLoggingRequest) obj;
return Objects.equals(clusterIdentifier(), other.clusterIdentifier()) && Objects.equals(bucketName(), other.bucketName())
&& Objects.equals(s3KeyPrefix(), other.s3KeyPrefix());
}
/**
* 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("EnableLoggingRequest").add("ClusterIdentifier", clusterIdentifier())
.add("BucketName", bucketName()).add("S3KeyPrefix", s3KeyPrefix()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ClusterIdentifier":
return Optional.ofNullable(clazz.cast(clusterIdentifier()));
case "BucketName":
return Optional.ofNullable(clazz.cast(bucketName()));
case "S3KeyPrefix":
return Optional.ofNullable(clazz.cast(s3KeyPrefix()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function