software.amazon.awssdk.services.fsx.model.UpdateOpenZFSVolumeConfiguration Maven / Gradle / Ivy
Show all versions of fsx 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.fsx.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Used to specify changes to the OpenZFS configuration for the volume that you are updating.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateOpenZFSVolumeConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField STORAGE_CAPACITY_RESERVATION_GIB_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("StorageCapacityReservationGiB")
.getter(getter(UpdateOpenZFSVolumeConfiguration::storageCapacityReservationGiB))
.setter(setter(Builder::storageCapacityReservationGiB))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageCapacityReservationGiB")
.build()).build();
private static final SdkField STORAGE_CAPACITY_QUOTA_GIB_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("StorageCapacityQuotaGiB").getter(getter(UpdateOpenZFSVolumeConfiguration::storageCapacityQuotaGiB))
.setter(setter(Builder::storageCapacityQuotaGiB))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageCapacityQuotaGiB").build())
.build();
private static final SdkField RECORD_SIZE_KIB_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("RecordSizeKiB").getter(getter(UpdateOpenZFSVolumeConfiguration::recordSizeKiB))
.setter(setter(Builder::recordSizeKiB))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecordSizeKiB").build()).build();
private static final SdkField DATA_COMPRESSION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DataCompressionType").getter(getter(UpdateOpenZFSVolumeConfiguration::dataCompressionTypeAsString))
.setter(setter(Builder::dataCompressionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataCompressionType").build())
.build();
private static final SdkField> NFS_EXPORTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("NfsExports")
.getter(getter(UpdateOpenZFSVolumeConfiguration::nfsExports))
.setter(setter(Builder::nfsExports))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NfsExports").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(OpenZFSNfsExport::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> USER_AND_GROUP_QUOTAS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("UserAndGroupQuotas")
.getter(getter(UpdateOpenZFSVolumeConfiguration::userAndGroupQuotas))
.setter(setter(Builder::userAndGroupQuotas))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserAndGroupQuotas").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(OpenZFSUserOrGroupQuota::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField READ_ONLY_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("ReadOnly").getter(getter(UpdateOpenZFSVolumeConfiguration::readOnly)).setter(setter(Builder::readOnly))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReadOnly").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
STORAGE_CAPACITY_RESERVATION_GIB_FIELD, STORAGE_CAPACITY_QUOTA_GIB_FIELD, RECORD_SIZE_KIB_FIELD,
DATA_COMPRESSION_TYPE_FIELD, NFS_EXPORTS_FIELD, USER_AND_GROUP_QUOTAS_FIELD, READ_ONLY_FIELD));
private static final long serialVersionUID = 1L;
private final Integer storageCapacityReservationGiB;
private final Integer storageCapacityQuotaGiB;
private final Integer recordSizeKiB;
private final String dataCompressionType;
private final List nfsExports;
private final List userAndGroupQuotas;
private final Boolean readOnly;
private UpdateOpenZFSVolumeConfiguration(BuilderImpl builder) {
this.storageCapacityReservationGiB = builder.storageCapacityReservationGiB;
this.storageCapacityQuotaGiB = builder.storageCapacityQuotaGiB;
this.recordSizeKiB = builder.recordSizeKiB;
this.dataCompressionType = builder.dataCompressionType;
this.nfsExports = builder.nfsExports;
this.userAndGroupQuotas = builder.userAndGroupQuotas;
this.readOnly = builder.readOnly;
}
/**
*
* The amount of storage in gibibytes (GiB) to reserve from the parent volume. You can't reserve more storage than
* the parent volume has reserved. You can specify a value of -1
to unset a volume's storage capacity
* reservation.
*
*
* @return The amount of storage in gibibytes (GiB) to reserve from the parent volume. You can't reserve more
* storage than the parent volume has reserved. You can specify a value of -1
to unset a
* volume's storage capacity reservation.
*/
public final Integer storageCapacityReservationGiB() {
return storageCapacityReservationGiB;
}
/**
*
* The maximum amount of storage in gibibytes (GiB) that the volume can use from its parent. You can specify a quota
* larger than the storage on the parent volume. You can specify a value of -1
to unset a volume's
* storage capacity quota.
*
*
* @return The maximum amount of storage in gibibytes (GiB) that the volume can use from its parent. You can specify
* a quota larger than the storage on the parent volume. You can specify a value of -1
to unset
* a volume's storage capacity quota.
*/
public final Integer storageCapacityQuotaGiB() {
return storageCapacityQuotaGiB;
}
/**
*
* Specifies the record size of an OpenZFS volume, in kibibytes (KiB). Valid values are 4, 8, 16, 32, 64, 128, 256,
* 512, or 1024 KiB. The default is 128 KiB. Most workloads should use the default record size. Database workflows
* can benefit from a smaller record size, while streaming workflows can benefit from a larger record size. For
* additional guidance on when to set a custom record size, see Tips for
* maximizing performance in the Amazon FSx for OpenZFS User Guide.
*
*
* @return Specifies the record size of an OpenZFS volume, in kibibytes (KiB). Valid values are 4, 8, 16, 32, 64,
* 128, 256, 512, or 1024 KiB. The default is 128 KiB. Most workloads should use the default record size.
* Database workflows can benefit from a smaller record size, while streaming workflows can benefit from a
* larger record size. For additional guidance on when to set a custom record size, see Tips
* for maximizing performance in the Amazon FSx for OpenZFS User Guide.
*/
public final Integer recordSizeKiB() {
return recordSizeKiB;
}
/**
*
* Specifies the method used to compress the data on the volume. The compression type is NONE
by
* default.
*
*
* -
*
* NONE
- Doesn't compress the data on the volume. NONE
is the default.
*
*
* -
*
* ZSTD
- Compresses the data in the volume using the Zstandard (ZSTD) compression algorithm. Compared
* to LZ4, Z-Standard provides a better compression ratio to minimize on-disk storage utilization.
*
*
* -
*
* LZ4
- Compresses the data in the volume using the LZ4 compression algorithm. Compared to Z-Standard,
* LZ4 is less compute-intensive and delivers higher write throughput speeds.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dataCompressionType} will return {@link OpenZFSDataCompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dataCompressionTypeAsString}.
*
*
* @return Specifies the method used to compress the data on the volume. The compression type is NONE
* by default.
*
* -
*
* NONE
- Doesn't compress the data on the volume. NONE
is the default.
*
*
* -
*
* ZSTD
- Compresses the data in the volume using the Zstandard (ZSTD) compression algorithm.
* Compared to LZ4, Z-Standard provides a better compression ratio to minimize on-disk storage utilization.
*
*
* -
*
* LZ4
- Compresses the data in the volume using the LZ4 compression algorithm. Compared to
* Z-Standard, LZ4 is less compute-intensive and delivers higher write throughput speeds.
*
*
* @see OpenZFSDataCompressionType
*/
public final OpenZFSDataCompressionType dataCompressionType() {
return OpenZFSDataCompressionType.fromValue(dataCompressionType);
}
/**
*
* Specifies the method used to compress the data on the volume. The compression type is NONE
by
* default.
*
*
* -
*
* NONE
- Doesn't compress the data on the volume. NONE
is the default.
*
*
* -
*
* ZSTD
- Compresses the data in the volume using the Zstandard (ZSTD) compression algorithm. Compared
* to LZ4, Z-Standard provides a better compression ratio to minimize on-disk storage utilization.
*
*
* -
*
* LZ4
- Compresses the data in the volume using the LZ4 compression algorithm. Compared to Z-Standard,
* LZ4 is less compute-intensive and delivers higher write throughput speeds.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dataCompressionType} will return {@link OpenZFSDataCompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dataCompressionTypeAsString}.
*
*
* @return Specifies the method used to compress the data on the volume. The compression type is NONE
* by default.
*
* -
*
* NONE
- Doesn't compress the data on the volume. NONE
is the default.
*
*
* -
*
* ZSTD
- Compresses the data in the volume using the Zstandard (ZSTD) compression algorithm.
* Compared to LZ4, Z-Standard provides a better compression ratio to minimize on-disk storage utilization.
*
*
* -
*
* LZ4
- Compresses the data in the volume using the LZ4 compression algorithm. Compared to
* Z-Standard, LZ4 is less compute-intensive and delivers higher write throughput speeds.
*
*
* @see OpenZFSDataCompressionType
*/
public final String dataCompressionTypeAsString() {
return dataCompressionType;
}
/**
* For responses, this returns true if the service returned a value for the NfsExports property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasNfsExports() {
return nfsExports != null && !(nfsExports instanceof SdkAutoConstructList);
}
/**
*
* The configuration object for mounting a Network File System (NFS) file system.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasNfsExports} method.
*
*
* @return The configuration object for mounting a Network File System (NFS) file system.
*/
public final List nfsExports() {
return nfsExports;
}
/**
* For responses, this returns true if the service returned a value for the UserAndGroupQuotas property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasUserAndGroupQuotas() {
return userAndGroupQuotas != null && !(userAndGroupQuotas instanceof SdkAutoConstructList);
}
/**
*
* An object specifying how much storage users or groups can use on the volume.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasUserAndGroupQuotas} method.
*
*
* @return An object specifying how much storage users or groups can use on the volume.
*/
public final List userAndGroupQuotas() {
return userAndGroupQuotas;
}
/**
*
* A Boolean value indicating whether the volume is read-only.
*
*
* @return A Boolean value indicating whether the volume is read-only.
*/
public final Boolean readOnly() {
return readOnly;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(storageCapacityReservationGiB());
hashCode = 31 * hashCode + Objects.hashCode(storageCapacityQuotaGiB());
hashCode = 31 * hashCode + Objects.hashCode(recordSizeKiB());
hashCode = 31 * hashCode + Objects.hashCode(dataCompressionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasNfsExports() ? nfsExports() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasUserAndGroupQuotas() ? userAndGroupQuotas() : null);
hashCode = 31 * hashCode + Objects.hashCode(readOnly());
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 UpdateOpenZFSVolumeConfiguration)) {
return false;
}
UpdateOpenZFSVolumeConfiguration other = (UpdateOpenZFSVolumeConfiguration) obj;
return Objects.equals(storageCapacityReservationGiB(), other.storageCapacityReservationGiB())
&& Objects.equals(storageCapacityQuotaGiB(), other.storageCapacityQuotaGiB())
&& Objects.equals(recordSizeKiB(), other.recordSizeKiB())
&& Objects.equals(dataCompressionTypeAsString(), other.dataCompressionTypeAsString())
&& hasNfsExports() == other.hasNfsExports() && Objects.equals(nfsExports(), other.nfsExports())
&& hasUserAndGroupQuotas() == other.hasUserAndGroupQuotas()
&& Objects.equals(userAndGroupQuotas(), other.userAndGroupQuotas())
&& Objects.equals(readOnly(), other.readOnly());
}
/**
* 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("UpdateOpenZFSVolumeConfiguration")
.add("StorageCapacityReservationGiB", storageCapacityReservationGiB())
.add("StorageCapacityQuotaGiB", storageCapacityQuotaGiB()).add("RecordSizeKiB", recordSizeKiB())
.add("DataCompressionType", dataCompressionTypeAsString())
.add("NfsExports", hasNfsExports() ? nfsExports() : null)
.add("UserAndGroupQuotas", hasUserAndGroupQuotas() ? userAndGroupQuotas() : null).add("ReadOnly", readOnly())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StorageCapacityReservationGiB":
return Optional.ofNullable(clazz.cast(storageCapacityReservationGiB()));
case "StorageCapacityQuotaGiB":
return Optional.ofNullable(clazz.cast(storageCapacityQuotaGiB()));
case "RecordSizeKiB":
return Optional.ofNullable(clazz.cast(recordSizeKiB()));
case "DataCompressionType":
return Optional.ofNullable(clazz.cast(dataCompressionTypeAsString()));
case "NfsExports":
return Optional.ofNullable(clazz.cast(nfsExports()));
case "UserAndGroupQuotas":
return Optional.ofNullable(clazz.cast(userAndGroupQuotas()));
case "ReadOnly":
return Optional.ofNullable(clazz.cast(readOnly()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function