software.amazon.awssdk.services.rds.model.DownloadDbLogFilePortionRequest Maven / Gradle / Ivy
Show all versions of rds 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.rds.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 DownloadDbLogFilePortionRequest extends RdsRequest implements
ToCopyableBuilder {
private static final SdkField DB_INSTANCE_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DownloadDbLogFilePortionRequest::dbInstanceIdentifier)).setter(setter(Builder::dbInstanceIdentifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DBInstanceIdentifier").build())
.build();
private static final SdkField LOG_FILE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DownloadDbLogFilePortionRequest::logFileName)).setter(setter(Builder::logFileName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogFileName").build()).build();
private static final SdkField MARKER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DownloadDbLogFilePortionRequest::marker)).setter(setter(Builder::marker))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Marker").build()).build();
private static final SdkField NUMBER_OF_LINES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(DownloadDbLogFilePortionRequest::numberOfLines)).setter(setter(Builder::numberOfLines))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NumberOfLines").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DB_INSTANCE_IDENTIFIER_FIELD,
LOG_FILE_NAME_FIELD, MARKER_FIELD, NUMBER_OF_LINES_FIELD));
private final String dbInstanceIdentifier;
private final String logFileName;
private final String marker;
private final Integer numberOfLines;
private DownloadDbLogFilePortionRequest(BuilderImpl builder) {
super(builder);
this.dbInstanceIdentifier = builder.dbInstanceIdentifier;
this.logFileName = builder.logFileName;
this.marker = builder.marker;
this.numberOfLines = builder.numberOfLines;
}
/**
*
* The customer-assigned name of the DB instance that contains the log files you want to list.
*
*
* Constraints:
*
*
* -
*
* Must match the identifier of an existing DBInstance.
*
*
*
*
* @return The customer-assigned name of the DB instance that contains the log files you want to list.
*
* Constraints:
*
*
* -
*
* Must match the identifier of an existing DBInstance.
*
*
*/
public String dbInstanceIdentifier() {
return dbInstanceIdentifier;
}
/**
*
* The name of the log file to be downloaded.
*
*
* @return The name of the log file to be downloaded.
*/
public String logFileName() {
return logFileName;
}
/**
*
* The pagination token provided in the previous request or "0". If the Marker parameter is specified the response
* includes only records beyond the marker until the end of the file or up to NumberOfLines.
*
*
* @return The pagination token provided in the previous request or "0". If the Marker parameter is specified the
* response includes only records beyond the marker until the end of the file or up to NumberOfLines.
*/
public String marker() {
return marker;
}
/**
*
* The number of lines to download. If the number of lines specified results in a file over 1 MB in size, the file
* is truncated at 1 MB in size.
*
*
* If the NumberOfLines parameter is specified, then the block of lines returned can be from the beginning or the
* end of the log file, depending on the value of the Marker parameter.
*
*
* -
*
* If neither Marker or NumberOfLines are specified, the entire log file is returned up to a maximum of 10000 lines,
* starting with the most recent log entries first.
*
*
* -
*
* If NumberOfLines is specified and Marker isn't specified, then the most recent lines from the end of the log file
* are returned.
*
*
* -
*
* If Marker is specified as "0", then the specified number of lines from the beginning of the log file are
* returned.
*
*
* -
*
* You can download the log file in blocks of lines by specifying the size of the block using the NumberOfLines
* parameter, and by specifying a value of "0" for the Marker parameter in your first request. Include the Marker
* value returned in the response as the Marker value for the next request, continuing until the
* AdditionalDataPending response element returns false.
*
*
*
*
* @return The number of lines to download. If the number of lines specified results in a file over 1 MB in size,
* the file is truncated at 1 MB in size.
*
* If the NumberOfLines parameter is specified, then the block of lines returned can be from the beginning
* or the end of the log file, depending on the value of the Marker parameter.
*
*
* -
*
* If neither Marker or NumberOfLines are specified, the entire log file is returned up to a maximum of
* 10000 lines, starting with the most recent log entries first.
*
*
* -
*
* If NumberOfLines is specified and Marker isn't specified, then the most recent lines from the end of the
* log file are returned.
*
*
* -
*
* If Marker is specified as "0", then the specified number of lines from the beginning of the log file are
* returned.
*
*
* -
*
* You can download the log file in blocks of lines by specifying the size of the block using the
* NumberOfLines parameter, and by specifying a value of "0" for the Marker parameter in your first request.
* Include the Marker value returned in the response as the Marker value for the next request, continuing
* until the AdditionalDataPending response element returns false.
*
*
*/
public Integer numberOfLines() {
return numberOfLines;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(dbInstanceIdentifier());
hashCode = 31 * hashCode + Objects.hashCode(logFileName());
hashCode = 31 * hashCode + Objects.hashCode(marker());
hashCode = 31 * hashCode + Objects.hashCode(numberOfLines());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DownloadDbLogFilePortionRequest)) {
return false;
}
DownloadDbLogFilePortionRequest other = (DownloadDbLogFilePortionRequest) obj;
return Objects.equals(dbInstanceIdentifier(), other.dbInstanceIdentifier())
&& Objects.equals(logFileName(), other.logFileName()) && Objects.equals(marker(), other.marker())
&& Objects.equals(numberOfLines(), other.numberOfLines());
}
/**
* 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("DownloadDbLogFilePortionRequest").add("DBInstanceIdentifier", dbInstanceIdentifier())
.add("LogFileName", logFileName()).add("Marker", marker()).add("NumberOfLines", numberOfLines()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DBInstanceIdentifier":
return Optional.ofNullable(clazz.cast(dbInstanceIdentifier()));
case "LogFileName":
return Optional.ofNullable(clazz.cast(logFileName()));
case "Marker":
return Optional.ofNullable(clazz.cast(marker()));
case "NumberOfLines":
return Optional.ofNullable(clazz.cast(numberOfLines()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function