software.amazon.awssdk.services.fsx.model.OpenZFSClientConfiguration 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.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.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;
/**
*
* Specifies who can mount an OpenZFS file system and the options available while mounting the file system.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OpenZFSClientConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CLIENTS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Clients")
.getter(getter(OpenZFSClientConfiguration::clients)).setter(setter(Builder::clients))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Clients").build()).build();
private static final SdkField> OPTIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Options")
.getter(getter(OpenZFSClientConfiguration::options))
.setter(setter(Builder::options))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Options").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLIENTS_FIELD, OPTIONS_FIELD));
private static final long serialVersionUID = 1L;
private final String clients;
private final List options;
private OpenZFSClientConfiguration(BuilderImpl builder) {
this.clients = builder.clients;
this.options = builder.options;
}
/**
*
* A value that specifies who can mount the file system. You can provide a wildcard character (*
), an
* IP address (0.0.0.0
), or a CIDR address (192.0.2.0/24
). By default, Amazon FSx uses the
* wildcard character when specifying the client.
*
*
* @return A value that specifies who can mount the file system. You can provide a wildcard character (
* *
), an IP address (0.0.0.0
), or a CIDR address (192.0.2.0/24
). By
* default, Amazon FSx uses the wildcard character when specifying the client.
*/
public final String clients() {
return clients;
}
/**
* For responses, this returns true if the service returned a value for the Options 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 hasOptions() {
return options != null && !(options instanceof SdkAutoConstructList);
}
/**
*
* The options to use when mounting the file system. For a list of options that you can use with Network File System
* (NFS), see the exports(5) - Linux man page. When choosing your
* options, consider the following:
*
*
* -
*
* crossmnt
is used by default. If you don't specify crossmnt
when changing the client
* configuration, you won't be able to see or access snapshots in your file system's snapshot directory.
*
*
* -
*
* sync
is used by default. If you instead specify async
, the system acknowledges writes
* before writing to disk. If the system crashes before the writes are finished, you lose the unwritten data.
*
*
*
*
* 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 #hasOptions} method.
*
*
* @return The options to use when mounting the file system. For a list of options that you can use with Network
* File System (NFS), see the exports(5) - Linux man page.
* When choosing your options, consider the following:
*
* -
*
* crossmnt
is used by default. If you don't specify crossmnt
when changing the
* client configuration, you won't be able to see or access snapshots in your file system's snapshot
* directory.
*
*
* -
*
* sync
is used by default. If you instead specify async
, the system acknowledges
* writes before writing to disk. If the system crashes before the writes are finished, you lose the
* unwritten data.
*
*
*/
public final List options() {
return options;
}
@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(clients());
hashCode = 31 * hashCode + Objects.hashCode(hasOptions() ? options() : null);
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 OpenZFSClientConfiguration)) {
return false;
}
OpenZFSClientConfiguration other = (OpenZFSClientConfiguration) obj;
return Objects.equals(clients(), other.clients()) && hasOptions() == other.hasOptions()
&& Objects.equals(options(), other.options());
}
/**
* 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("OpenZFSClientConfiguration").add("Clients", clients())
.add("Options", hasOptions() ? options() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Clients":
return Optional.ofNullable(clazz.cast(clients()));
case "Options":
return Optional.ofNullable(clazz.cast(options()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function