
software.amazon.awssdk.services.iotanalytics.model.DatastoreSummary 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.iotanalytics.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* A summary of information about a data store.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DatastoreSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DATASTORE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("datastoreName").getter(getter(DatastoreSummary::datastoreName)).setter(setter(Builder::datastoreName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("datastoreName").build()).build();
private static final SdkField DATASTORE_STORAGE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("datastoreStorage")
.getter(getter(DatastoreSummary::datastoreStorage)).setter(setter(Builder::datastoreStorage))
.constructor(DatastoreStorageSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("datastoreStorage").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(DatastoreSummary::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationTime").getter(getter(DatastoreSummary::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build()).build();
private static final SdkField LAST_UPDATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastUpdateTime").getter(getter(DatastoreSummary::lastUpdateTime))
.setter(setter(Builder::lastUpdateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdateTime").build()).build();
private static final SdkField LAST_MESSAGE_ARRIVAL_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastMessageArrivalTime").getter(getter(DatastoreSummary::lastMessageArrivalTime))
.setter(setter(Builder::lastMessageArrivalTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastMessageArrivalTime").build())
.build();
private static final SdkField FILE_FORMAT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("fileFormatType").getter(getter(DatastoreSummary::fileFormatTypeAsString))
.setter(setter(Builder::fileFormatType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("fileFormatType").build()).build();
private static final SdkField DATASTORE_PARTITIONS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("datastorePartitions")
.getter(getter(DatastoreSummary::datastorePartitions)).setter(setter(Builder::datastorePartitions))
.constructor(DatastorePartitions::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("datastorePartitions").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DATASTORE_NAME_FIELD,
DATASTORE_STORAGE_FIELD, STATUS_FIELD, CREATION_TIME_FIELD, LAST_UPDATE_TIME_FIELD, LAST_MESSAGE_ARRIVAL_TIME_FIELD,
FILE_FORMAT_TYPE_FIELD, DATASTORE_PARTITIONS_FIELD));
private static final long serialVersionUID = 1L;
private final String datastoreName;
private final DatastoreStorageSummary datastoreStorage;
private final String status;
private final Instant creationTime;
private final Instant lastUpdateTime;
private final Instant lastMessageArrivalTime;
private final String fileFormatType;
private final DatastorePartitions datastorePartitions;
private DatastoreSummary(BuilderImpl builder) {
this.datastoreName = builder.datastoreName;
this.datastoreStorage = builder.datastoreStorage;
this.status = builder.status;
this.creationTime = builder.creationTime;
this.lastUpdateTime = builder.lastUpdateTime;
this.lastMessageArrivalTime = builder.lastMessageArrivalTime;
this.fileFormatType = builder.fileFormatType;
this.datastorePartitions = builder.datastorePartitions;
}
/**
*
* The name of the data store.
*
*
* @return The name of the data store.
*/
public final String datastoreName() {
return datastoreName;
}
/**
*
* Where data in a data store is stored.
*
*
* @return Where data in a data store is stored.
*/
public final DatastoreStorageSummary datastoreStorage() {
return datastoreStorage;
}
/**
*
* The status of the data store.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DatastoreStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the data store.
* @see DatastoreStatus
*/
public final DatastoreStatus status() {
return DatastoreStatus.fromValue(status);
}
/**
*
* The status of the data store.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DatastoreStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the data store.
* @see DatastoreStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* When the data store was created.
*
*
* @return When the data store was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The last time the data store was updated.
*
*
* @return The last time the data store was updated.
*/
public final Instant lastUpdateTime() {
return lastUpdateTime;
}
/**
*
* The last time when a new message arrived in the data store.
*
*
* IoT Analytics updates this value at most once per minute for Amazon Simple Storage Service one data store. Hence,
* the lastMessageArrivalTime
value is an approximation.
*
*
* This feature only applies to messages that arrived in the data store after October 23, 2020.
*
*
* @return The last time when a new message arrived in the data store.
*
* IoT Analytics updates this value at most once per minute for Amazon Simple Storage Service one data
* store. Hence, the lastMessageArrivalTime
value is an approximation.
*
*
* This feature only applies to messages that arrived in the data store after October 23, 2020.
*/
public final Instant lastMessageArrivalTime() {
return lastMessageArrivalTime;
}
/**
*
* The file format of the data in the data store.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #fileFormatType}
* will return {@link FileFormatType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #fileFormatTypeAsString}.
*
*
* @return The file format of the data in the data store.
* @see FileFormatType
*/
public final FileFormatType fileFormatType() {
return FileFormatType.fromValue(fileFormatType);
}
/**
*
* The file format of the data in the data store.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #fileFormatType}
* will return {@link FileFormatType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #fileFormatTypeAsString}.
*
*
* @return The file format of the data in the data store.
* @see FileFormatType
*/
public final String fileFormatTypeAsString() {
return fileFormatType;
}
/**
*
* Contains information about the partition dimensions in a data store.
*
*
* @return Contains information about the partition dimensions in a data store.
*/
public final DatastorePartitions datastorePartitions() {
return datastorePartitions;
}
@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(datastoreName());
hashCode = 31 * hashCode + Objects.hashCode(datastoreStorage());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdateTime());
hashCode = 31 * hashCode + Objects.hashCode(lastMessageArrivalTime());
hashCode = 31 * hashCode + Objects.hashCode(fileFormatTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(datastorePartitions());
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 DatastoreSummary)) {
return false;
}
DatastoreSummary other = (DatastoreSummary) obj;
return Objects.equals(datastoreName(), other.datastoreName())
&& Objects.equals(datastoreStorage(), other.datastoreStorage())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastUpdateTime(), other.lastUpdateTime())
&& Objects.equals(lastMessageArrivalTime(), other.lastMessageArrivalTime())
&& Objects.equals(fileFormatTypeAsString(), other.fileFormatTypeAsString())
&& Objects.equals(datastorePartitions(), other.datastorePartitions());
}
/**
* 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("DatastoreSummary").add("DatastoreName", datastoreName())
.add("DatastoreStorage", datastoreStorage()).add("Status", statusAsString()).add("CreationTime", creationTime())
.add("LastUpdateTime", lastUpdateTime()).add("LastMessageArrivalTime", lastMessageArrivalTime())
.add("FileFormatType", fileFormatTypeAsString()).add("DatastorePartitions", datastorePartitions()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "datastoreName":
return Optional.ofNullable(clazz.cast(datastoreName()));
case "datastoreStorage":
return Optional.ofNullable(clazz.cast(datastoreStorage()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "creationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "lastUpdateTime":
return Optional.ofNullable(clazz.cast(lastUpdateTime()));
case "lastMessageArrivalTime":
return Optional.ofNullable(clazz.cast(lastMessageArrivalTime()));
case "fileFormatType":
return Optional.ofNullable(clazz.cast(fileFormatTypeAsString()));
case "datastorePartitions":
return Optional.ofNullable(clazz.cast(datastorePartitions()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function