
software.amazon.awssdk.services.fsx.model.S3DataRepositoryConfiguration 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.fsx.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.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;
/**
*
* The configuration for an Amazon S3 data repository linked to an Amazon FSx for Lustre file system with a data
* repository association. The configuration consists of an AutoImportPolicy
that defines which file events
* on the data repository are automatically imported to the file system and an AutoExportPolicy
that
* defines which file events on the file system are automatically exported to the data repository. File events are when
* files or directories are added, changed, or deleted on the file system or the data repository.
*
*
*
* Data repository associations on Amazon File Cache don't use S3DataRepositoryConfiguration
because they
* don't support automatic import or automatic export.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class S3DataRepositoryConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AUTO_IMPORT_POLICY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AutoImportPolicy")
.getter(getter(S3DataRepositoryConfiguration::autoImportPolicy)).setter(setter(Builder::autoImportPolicy))
.constructor(AutoImportPolicy::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoImportPolicy").build()).build();
private static final SdkField AUTO_EXPORT_POLICY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AutoExportPolicy")
.getter(getter(S3DataRepositoryConfiguration::autoExportPolicy)).setter(setter(Builder::autoExportPolicy))
.constructor(AutoExportPolicy::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoExportPolicy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTO_IMPORT_POLICY_FIELD,
AUTO_EXPORT_POLICY_FIELD));
private static final long serialVersionUID = 1L;
private final AutoImportPolicy autoImportPolicy;
private final AutoExportPolicy autoExportPolicy;
private S3DataRepositoryConfiguration(BuilderImpl builder) {
this.autoImportPolicy = builder.autoImportPolicy;
this.autoExportPolicy = builder.autoExportPolicy;
}
/**
*
* Specifies the type of updated objects (new, changed, deleted) that will be automatically imported from the linked
* S3 bucket to your file system.
*
*
* @return Specifies the type of updated objects (new, changed, deleted) that will be automatically imported from
* the linked S3 bucket to your file system.
*/
public final AutoImportPolicy autoImportPolicy() {
return autoImportPolicy;
}
/**
*
* Specifies the type of updated objects (new, changed, deleted) that will be automatically exported from your file
* system to the linked S3 bucket.
*
*
* @return Specifies the type of updated objects (new, changed, deleted) that will be automatically exported from
* your file system to the linked S3 bucket.
*/
public final AutoExportPolicy autoExportPolicy() {
return autoExportPolicy;
}
@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(autoImportPolicy());
hashCode = 31 * hashCode + Objects.hashCode(autoExportPolicy());
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 S3DataRepositoryConfiguration)) {
return false;
}
S3DataRepositoryConfiguration other = (S3DataRepositoryConfiguration) obj;
return Objects.equals(autoImportPolicy(), other.autoImportPolicy())
&& Objects.equals(autoExportPolicy(), other.autoExportPolicy());
}
/**
* 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("S3DataRepositoryConfiguration").add("AutoImportPolicy", autoImportPolicy())
.add("AutoExportPolicy", autoExportPolicy()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AutoImportPolicy":
return Optional.ofNullable(clazz.cast(autoImportPolicy()));
case "AutoExportPolicy":
return Optional.ofNullable(clazz.cast(autoExportPolicy()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function