software.amazon.awssdk.services.timestreamquery.model.ExecutionStats Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timestreamquery Show documentation
Show all versions of timestreamquery Show documentation
The AWS Java SDK for Timestream Query module holds the client classes that are used for
communicating with Timestream Query.
/*
* 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.timestreamquery.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;
/**
*
* Statistics for a single scheduled query run.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ExecutionStats implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField EXECUTION_TIME_IN_MILLIS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("ExecutionTimeInMillis").getter(getter(ExecutionStats::executionTimeInMillis))
.setter(setter(Builder::executionTimeInMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutionTimeInMillis").build())
.build();
private static final SdkField DATA_WRITES_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("DataWrites").getter(getter(ExecutionStats::dataWrites)).setter(setter(Builder::dataWrites))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataWrites").build()).build();
private static final SdkField BYTES_METERED_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("BytesMetered").getter(getter(ExecutionStats::bytesMetered)).setter(setter(Builder::bytesMetered))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BytesMetered").build()).build();
private static final SdkField CUMULATIVE_BYTES_SCANNED_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("CumulativeBytesScanned").getter(getter(ExecutionStats::cumulativeBytesScanned))
.setter(setter(Builder::cumulativeBytesScanned))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CumulativeBytesScanned").build())
.build();
private static final SdkField RECORDS_INGESTED_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("RecordsIngested").getter(getter(ExecutionStats::recordsIngested))
.setter(setter(Builder::recordsIngested))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecordsIngested").build()).build();
private static final SdkField QUERY_RESULT_ROWS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("QueryResultRows").getter(getter(ExecutionStats::queryResultRows))
.setter(setter(Builder::queryResultRows))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryResultRows").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
EXECUTION_TIME_IN_MILLIS_FIELD, DATA_WRITES_FIELD, BYTES_METERED_FIELD, CUMULATIVE_BYTES_SCANNED_FIELD,
RECORDS_INGESTED_FIELD, QUERY_RESULT_ROWS_FIELD));
private static final long serialVersionUID = 1L;
private final Long executionTimeInMillis;
private final Long dataWrites;
private final Long bytesMetered;
private final Long cumulativeBytesScanned;
private final Long recordsIngested;
private final Long queryResultRows;
private ExecutionStats(BuilderImpl builder) {
this.executionTimeInMillis = builder.executionTimeInMillis;
this.dataWrites = builder.dataWrites;
this.bytesMetered = builder.bytesMetered;
this.cumulativeBytesScanned = builder.cumulativeBytesScanned;
this.recordsIngested = builder.recordsIngested;
this.queryResultRows = builder.queryResultRows;
}
/**
*
* Total time, measured in milliseconds, that was needed for the scheduled query run to complete.
*
*
* @return Total time, measured in milliseconds, that was needed for the scheduled query run to complete.
*/
public final Long executionTimeInMillis() {
return executionTimeInMillis;
}
/**
*
* Data writes metered for records ingested in a single scheduled query run.
*
*
* @return Data writes metered for records ingested in a single scheduled query run.
*/
public final Long dataWrites() {
return dataWrites;
}
/**
*
* Bytes metered for a single scheduled query run.
*
*
* @return Bytes metered for a single scheduled query run.
*/
public final Long bytesMetered() {
return bytesMetered;
}
/**
*
* Bytes scanned for a single scheduled query run.
*
*
* @return Bytes scanned for a single scheduled query run.
*/
public final Long cumulativeBytesScanned() {
return cumulativeBytesScanned;
}
/**
*
* The number of records ingested for a single scheduled query run.
*
*
* @return The number of records ingested for a single scheduled query run.
*/
public final Long recordsIngested() {
return recordsIngested;
}
/**
*
* Number of rows present in the output from running a query before ingestion to destination data source.
*
*
* @return Number of rows present in the output from running a query before ingestion to destination data source.
*/
public final Long queryResultRows() {
return queryResultRows;
}
@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(executionTimeInMillis());
hashCode = 31 * hashCode + Objects.hashCode(dataWrites());
hashCode = 31 * hashCode + Objects.hashCode(bytesMetered());
hashCode = 31 * hashCode + Objects.hashCode(cumulativeBytesScanned());
hashCode = 31 * hashCode + Objects.hashCode(recordsIngested());
hashCode = 31 * hashCode + Objects.hashCode(queryResultRows());
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 ExecutionStats)) {
return false;
}
ExecutionStats other = (ExecutionStats) obj;
return Objects.equals(executionTimeInMillis(), other.executionTimeInMillis())
&& Objects.equals(dataWrites(), other.dataWrites()) && Objects.equals(bytesMetered(), other.bytesMetered())
&& Objects.equals(cumulativeBytesScanned(), other.cumulativeBytesScanned())
&& Objects.equals(recordsIngested(), other.recordsIngested())
&& Objects.equals(queryResultRows(), other.queryResultRows());
}
/**
* 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("ExecutionStats").add("ExecutionTimeInMillis", executionTimeInMillis())
.add("DataWrites", dataWrites()).add("BytesMetered", bytesMetered())
.add("CumulativeBytesScanned", cumulativeBytesScanned()).add("RecordsIngested", recordsIngested())
.add("QueryResultRows", queryResultRows()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ExecutionTimeInMillis":
return Optional.ofNullable(clazz.cast(executionTimeInMillis()));
case "DataWrites":
return Optional.ofNullable(clazz.cast(dataWrites()));
case "BytesMetered":
return Optional.ofNullable(clazz.cast(bytesMetered()));
case "CumulativeBytesScanned":
return Optional.ofNullable(clazz.cast(cumulativeBytesScanned()));
case "RecordsIngested":
return Optional.ofNullable(clazz.cast(recordsIngested()));
case "QueryResultRows":
return Optional.ofNullable(clazz.cast(queryResultRows()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function