software.amazon.awssdk.services.iotfleetwise.model.DataPartitionStorageOptions Maven / Gradle / Ivy
Show all versions of iotfleetwise 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.iotfleetwise.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Size, time, and location options for the data partition.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DataPartitionStorageOptions implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField MAXIMUM_SIZE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("maximumSize")
.getter(getter(DataPartitionStorageOptions::maximumSize)).setter(setter(Builder::maximumSize))
.constructor(StorageMaximumSize::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maximumSize").build()).build();
private static final SdkField STORAGE_LOCATION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("storageLocation").getter(getter(DataPartitionStorageOptions::storageLocation))
.setter(setter(Builder::storageLocation))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("storageLocation").build()).build();
private static final SdkField MINIMUM_TIME_TO_LIVE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("minimumTimeToLive")
.getter(getter(DataPartitionStorageOptions::minimumTimeToLive)).setter(setter(Builder::minimumTimeToLive))
.constructor(StorageMinimumTimeToLive::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("minimumTimeToLive").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MAXIMUM_SIZE_FIELD,
STORAGE_LOCATION_FIELD, MINIMUM_TIME_TO_LIVE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final StorageMaximumSize maximumSize;
private final String storageLocation;
private final StorageMinimumTimeToLive minimumTimeToLive;
private DataPartitionStorageOptions(BuilderImpl builder) {
this.maximumSize = builder.maximumSize;
this.storageLocation = builder.storageLocation;
this.minimumTimeToLive = builder.minimumTimeToLive;
}
/**
*
* The maximum storage size of the data stored in the data partition.
*
*
*
* Newer data overwrites older data when the partition reaches the maximum size.
*
*
*
* @return The maximum storage size of the data stored in the data partition.
*
* Newer data overwrites older data when the partition reaches the maximum size.
*
*/
public final StorageMaximumSize maximumSize() {
return maximumSize;
}
/**
*
* The folder name for the data partition under the campaign storage folder.
*
*
* @return The folder name for the data partition under the campaign storage folder.
*/
public final String storageLocation() {
return storageLocation;
}
/**
*
* The amount of time that data in this partition will be kept on disk.
*
*
* -
*
* After the designated amount of time passes, the data can be removed, but it's not guaranteed to be removed.
*
*
* -
*
* Before the time expires, data in this partition can still be deleted if the partition reaches its configured
* maximum size.
*
*
* -
*
* Newer data will overwrite older data when the partition reaches the maximum size.
*
*
*
*
* @return The amount of time that data in this partition will be kept on disk.
*
* -
*
* After the designated amount of time passes, the data can be removed, but it's not guaranteed to be
* removed.
*
*
* -
*
* Before the time expires, data in this partition can still be deleted if the partition reaches its
* configured maximum size.
*
*
* -
*
* Newer data will overwrite older data when the partition reaches the maximum size.
*
*
*/
public final StorageMinimumTimeToLive minimumTimeToLive() {
return minimumTimeToLive;
}
@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(maximumSize());
hashCode = 31 * hashCode + Objects.hashCode(storageLocation());
hashCode = 31 * hashCode + Objects.hashCode(minimumTimeToLive());
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 DataPartitionStorageOptions)) {
return false;
}
DataPartitionStorageOptions other = (DataPartitionStorageOptions) obj;
return Objects.equals(maximumSize(), other.maximumSize()) && Objects.equals(storageLocation(), other.storageLocation())
&& Objects.equals(minimumTimeToLive(), other.minimumTimeToLive());
}
/**
* 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("DataPartitionStorageOptions").add("MaximumSize", maximumSize())
.add("StorageLocation", storageLocation() == null ? null : "*** Sensitive Data Redacted ***")
.add("MinimumTimeToLive", minimumTimeToLive()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "maximumSize":
return Optional.ofNullable(clazz.cast(maximumSize()));
case "storageLocation":
return Optional.ofNullable(clazz.cast(storageLocation()));
case "minimumTimeToLive":
return Optional.ofNullable(clazz.cast(minimumTimeToLive()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("maximumSize", MAXIMUM_SIZE_FIELD);
map.put("storageLocation", STORAGE_LOCATION_FIELD);
map.put("minimumTimeToLive", MINIMUM_TIME_TO_LIVE_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function