All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.s3control.model.StorageLensGroupAndOperator 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.s3control.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;

/**
 * 

* A logical operator that allows multiple filter conditions to be joined for more complex comparisons of Storage Lens * group data. *

*/ @Generated("software.amazon.awssdk:codegen") public final class StorageLensGroupAndOperator implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> MATCH_ANY_PREFIX_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("MatchAnyPrefix") .getter(getter(StorageLensGroupAndOperator::matchAnyPrefix)) .setter(setter(Builder::matchAnyPrefix)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MatchAnyPrefix") .unmarshallLocationName("MatchAnyPrefix").build(), ListTrait .builder() .memberLocationName("Prefix") .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Prefix").unmarshallLocationName("Prefix").build()).build()) .build()).build(); private static final SdkField> MATCH_ANY_SUFFIX_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("MatchAnySuffix") .getter(getter(StorageLensGroupAndOperator::matchAnySuffix)) .setter(setter(Builder::matchAnySuffix)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MatchAnySuffix") .unmarshallLocationName("MatchAnySuffix").build(), ListTrait .builder() .memberLocationName("Suffix") .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Suffix").unmarshallLocationName("Suffix").build()).build()) .build()).build(); private static final SdkField> MATCH_ANY_TAG_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("MatchAnyTag") .getter(getter(StorageLensGroupAndOperator::matchAnyTag)) .setter(setter(Builder::matchAnyTag)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MatchAnyTag") .unmarshallLocationName("MatchAnyTag").build(), ListTrait .builder() .memberLocationName("Tag") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(S3Tag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Tag").unmarshallLocationName("Tag").build()).build()).build()) .build(); private static final SdkField MATCH_OBJECT_AGE_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("MatchObjectAge") .getter(getter(StorageLensGroupAndOperator::matchObjectAge)) .setter(setter(Builder::matchObjectAge)) .constructor(MatchObjectAge::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MatchObjectAge") .unmarshallLocationName("MatchObjectAge").build()).build(); private static final SdkField MATCH_OBJECT_SIZE_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("MatchObjectSize") .getter(getter(StorageLensGroupAndOperator::matchObjectSize)) .setter(setter(Builder::matchObjectSize)) .constructor(MatchObjectSize::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MatchObjectSize") .unmarshallLocationName("MatchObjectSize").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MATCH_ANY_PREFIX_FIELD, MATCH_ANY_SUFFIX_FIELD, MATCH_ANY_TAG_FIELD, MATCH_OBJECT_AGE_FIELD, MATCH_OBJECT_SIZE_FIELD)); private static final long serialVersionUID = 1L; private final List matchAnyPrefix; private final List matchAnySuffix; private final List matchAnyTag; private final MatchObjectAge matchObjectAge; private final MatchObjectSize matchObjectSize; private StorageLensGroupAndOperator(BuilderImpl builder) { this.matchAnyPrefix = builder.matchAnyPrefix; this.matchAnySuffix = builder.matchAnySuffix; this.matchAnyTag = builder.matchAnyTag; this.matchObjectAge = builder.matchObjectAge; this.matchObjectSize = builder.matchObjectSize; } /** * For responses, this returns true if the service returned a value for the MatchAnyPrefix 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 hasMatchAnyPrefix() { return matchAnyPrefix != null && !(matchAnyPrefix instanceof SdkAutoConstructList); } /** *

* Contains a list of prefixes. At least one prefix must be specified. Up to 10 prefixes are allowed. *

*

* 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 #hasMatchAnyPrefix} method. *

* * @return Contains a list of prefixes. At least one prefix must be specified. Up to 10 prefixes are allowed. */ public final List matchAnyPrefix() { return matchAnyPrefix; } /** * For responses, this returns true if the service returned a value for the MatchAnySuffix 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 hasMatchAnySuffix() { return matchAnySuffix != null && !(matchAnySuffix instanceof SdkAutoConstructList); } /** *

* Contains a list of suffixes. At least one suffix must be specified. Up to 10 suffixes are allowed. *

*

* 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 #hasMatchAnySuffix} method. *

* * @return Contains a list of suffixes. At least one suffix must be specified. Up to 10 suffixes are allowed. */ public final List matchAnySuffix() { return matchAnySuffix; } /** * For responses, this returns true if the service returned a value for the MatchAnyTag 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 hasMatchAnyTag() { return matchAnyTag != null && !(matchAnyTag instanceof SdkAutoConstructList); } /** *

* Contains the list of object tags. At least one object tag must be specified. Up to 10 object tags are allowed. *

*

* 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 #hasMatchAnyTag} method. *

* * @return Contains the list of object tags. At least one object tag must be specified. Up to 10 object tags are * allowed. */ public final List matchAnyTag() { return matchAnyTag; } /** *

* Contains DaysGreaterThan and DaysLessThan to define the object age range (minimum and * maximum number of days). *

* * @return Contains DaysGreaterThan and DaysLessThan to define the object age range * (minimum and maximum number of days). */ public final MatchObjectAge matchObjectAge() { return matchObjectAge; } /** *

* Contains BytesGreaterThan and BytesLessThan to define the object size range (minimum * and maximum number of Bytes). *

* * @return Contains BytesGreaterThan and BytesLessThan to define the object size range * (minimum and maximum number of Bytes). */ public final MatchObjectSize matchObjectSize() { return matchObjectSize; } @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(hasMatchAnyPrefix() ? matchAnyPrefix() : null); hashCode = 31 * hashCode + Objects.hashCode(hasMatchAnySuffix() ? matchAnySuffix() : null); hashCode = 31 * hashCode + Objects.hashCode(hasMatchAnyTag() ? matchAnyTag() : null); hashCode = 31 * hashCode + Objects.hashCode(matchObjectAge()); hashCode = 31 * hashCode + Objects.hashCode(matchObjectSize()); 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 StorageLensGroupAndOperator)) { return false; } StorageLensGroupAndOperator other = (StorageLensGroupAndOperator) obj; return hasMatchAnyPrefix() == other.hasMatchAnyPrefix() && Objects.equals(matchAnyPrefix(), other.matchAnyPrefix()) && hasMatchAnySuffix() == other.hasMatchAnySuffix() && Objects.equals(matchAnySuffix(), other.matchAnySuffix()) && hasMatchAnyTag() == other.hasMatchAnyTag() && Objects.equals(matchAnyTag(), other.matchAnyTag()) && Objects.equals(matchObjectAge(), other.matchObjectAge()) && Objects.equals(matchObjectSize(), other.matchObjectSize()); } /** * 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("StorageLensGroupAndOperator") .add("MatchAnyPrefix", hasMatchAnyPrefix() ? matchAnyPrefix() : null) .add("MatchAnySuffix", hasMatchAnySuffix() ? matchAnySuffix() : null) .add("MatchAnyTag", hasMatchAnyTag() ? matchAnyTag() : null).add("MatchObjectAge", matchObjectAge()) .add("MatchObjectSize", matchObjectSize()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "MatchAnyPrefix": return Optional.ofNullable(clazz.cast(matchAnyPrefix())); case "MatchAnySuffix": return Optional.ofNullable(clazz.cast(matchAnySuffix())); case "MatchAnyTag": return Optional.ofNullable(clazz.cast(matchAnyTag())); case "MatchObjectAge": return Optional.ofNullable(clazz.cast(matchObjectAge())); case "MatchObjectSize": return Optional.ofNullable(clazz.cast(matchObjectSize())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StorageLensGroupAndOperator) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Contains a list of prefixes. At least one prefix must be specified. Up to 10 prefixes are allowed. *

* * @param matchAnyPrefix * Contains a list of prefixes. At least one prefix must be specified. Up to 10 prefixes are allowed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchAnyPrefix(Collection matchAnyPrefix); /** *

* Contains a list of prefixes. At least one prefix must be specified. Up to 10 prefixes are allowed. *

* * @param matchAnyPrefix * Contains a list of prefixes. At least one prefix must be specified. Up to 10 prefixes are allowed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchAnyPrefix(String... matchAnyPrefix); /** *

* Contains a list of suffixes. At least one suffix must be specified. Up to 10 suffixes are allowed. *

* * @param matchAnySuffix * Contains a list of suffixes. At least one suffix must be specified. Up to 10 suffixes are allowed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchAnySuffix(Collection matchAnySuffix); /** *

* Contains a list of suffixes. At least one suffix must be specified. Up to 10 suffixes are allowed. *

* * @param matchAnySuffix * Contains a list of suffixes. At least one suffix must be specified. Up to 10 suffixes are allowed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchAnySuffix(String... matchAnySuffix); /** *

* Contains the list of object tags. At least one object tag must be specified. Up to 10 object tags are * allowed. *

* * @param matchAnyTag * Contains the list of object tags. At least one object tag must be specified. Up to 10 object tags are * allowed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchAnyTag(Collection matchAnyTag); /** *

* Contains the list of object tags. At least one object tag must be specified. Up to 10 object tags are * allowed. *

* * @param matchAnyTag * Contains the list of object tags. At least one object tag must be specified. Up to 10 object tags are * allowed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchAnyTag(S3Tag... matchAnyTag); /** *

* Contains the list of object tags. At least one object tag must be specified. Up to 10 object tags are * allowed. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.s3control.model.S3Tag.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.s3control.model.S3Tag#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.s3control.model.S3Tag.Builder#build()} is called immediately and its * result is passed to {@link #matchAnyTag(List)}. * * @param matchAnyTag * a consumer that will call methods on * {@link software.amazon.awssdk.services.s3control.model.S3Tag.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #matchAnyTag(java.util.Collection) */ Builder matchAnyTag(Consumer... matchAnyTag); /** *

* Contains DaysGreaterThan and DaysLessThan to define the object age range (minimum * and maximum number of days). *

* * @param matchObjectAge * Contains DaysGreaterThan and DaysLessThan to define the object age range * (minimum and maximum number of days). * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchObjectAge(MatchObjectAge matchObjectAge); /** *

* Contains DaysGreaterThan and DaysLessThan to define the object age range (minimum * and maximum number of days). *

* This is a convenience method that creates an instance of the {@link MatchObjectAge.Builder} avoiding the need * to create one manually via {@link MatchObjectAge#builder()}. * *

* When the {@link Consumer} completes, {@link MatchObjectAge.Builder#build()} is called immediately and its * result is passed to {@link #matchObjectAge(MatchObjectAge)}. * * @param matchObjectAge * a consumer that will call methods on {@link MatchObjectAge.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #matchObjectAge(MatchObjectAge) */ default Builder matchObjectAge(Consumer matchObjectAge) { return matchObjectAge(MatchObjectAge.builder().applyMutation(matchObjectAge).build()); } /** *

* Contains BytesGreaterThan and BytesLessThan to define the object size range * (minimum and maximum number of Bytes). *

* * @param matchObjectSize * Contains BytesGreaterThan and BytesLessThan to define the object size range * (minimum and maximum number of Bytes). * @return Returns a reference to this object so that method calls can be chained together. */ Builder matchObjectSize(MatchObjectSize matchObjectSize); /** *

* Contains BytesGreaterThan and BytesLessThan to define the object size range * (minimum and maximum number of Bytes). *

* This is a convenience method that creates an instance of the {@link MatchObjectSize.Builder} avoiding the * need to create one manually via {@link MatchObjectSize#builder()}. * *

* When the {@link Consumer} completes, {@link MatchObjectSize.Builder#build()} is called immediately and its * result is passed to {@link #matchObjectSize(MatchObjectSize)}. * * @param matchObjectSize * a consumer that will call methods on {@link MatchObjectSize.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #matchObjectSize(MatchObjectSize) */ default Builder matchObjectSize(Consumer matchObjectSize) { return matchObjectSize(MatchObjectSize.builder().applyMutation(matchObjectSize).build()); } } static final class BuilderImpl implements Builder { private List matchAnyPrefix = DefaultSdkAutoConstructList.getInstance(); private List matchAnySuffix = DefaultSdkAutoConstructList.getInstance(); private List matchAnyTag = DefaultSdkAutoConstructList.getInstance(); private MatchObjectAge matchObjectAge; private MatchObjectSize matchObjectSize; private BuilderImpl() { } private BuilderImpl(StorageLensGroupAndOperator model) { matchAnyPrefix(model.matchAnyPrefix); matchAnySuffix(model.matchAnySuffix); matchAnyTag(model.matchAnyTag); matchObjectAge(model.matchObjectAge); matchObjectSize(model.matchObjectSize); } public final Collection getMatchAnyPrefix() { if (matchAnyPrefix instanceof SdkAutoConstructList) { return null; } return matchAnyPrefix; } public final void setMatchAnyPrefix(Collection matchAnyPrefix) { this.matchAnyPrefix = MatchAnyPrefixCopier.copy(matchAnyPrefix); } @Override public final Builder matchAnyPrefix(Collection matchAnyPrefix) { this.matchAnyPrefix = MatchAnyPrefixCopier.copy(matchAnyPrefix); return this; } @Override @SafeVarargs public final Builder matchAnyPrefix(String... matchAnyPrefix) { matchAnyPrefix(Arrays.asList(matchAnyPrefix)); return this; } public final Collection getMatchAnySuffix() { if (matchAnySuffix instanceof SdkAutoConstructList) { return null; } return matchAnySuffix; } public final void setMatchAnySuffix(Collection matchAnySuffix) { this.matchAnySuffix = MatchAnySuffixCopier.copy(matchAnySuffix); } @Override public final Builder matchAnySuffix(Collection matchAnySuffix) { this.matchAnySuffix = MatchAnySuffixCopier.copy(matchAnySuffix); return this; } @Override @SafeVarargs public final Builder matchAnySuffix(String... matchAnySuffix) { matchAnySuffix(Arrays.asList(matchAnySuffix)); return this; } public final List getMatchAnyTag() { List result = MatchAnyTagCopier.copyToBuilder(this.matchAnyTag); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setMatchAnyTag(Collection matchAnyTag) { this.matchAnyTag = MatchAnyTagCopier.copyFromBuilder(matchAnyTag); } @Override public final Builder matchAnyTag(Collection matchAnyTag) { this.matchAnyTag = MatchAnyTagCopier.copy(matchAnyTag); return this; } @Override @SafeVarargs public final Builder matchAnyTag(S3Tag... matchAnyTag) { matchAnyTag(Arrays.asList(matchAnyTag)); return this; } @Override @SafeVarargs public final Builder matchAnyTag(Consumer... matchAnyTag) { matchAnyTag(Stream.of(matchAnyTag).map(c -> S3Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final MatchObjectAge.Builder getMatchObjectAge() { return matchObjectAge != null ? matchObjectAge.toBuilder() : null; } public final void setMatchObjectAge(MatchObjectAge.BuilderImpl matchObjectAge) { this.matchObjectAge = matchObjectAge != null ? matchObjectAge.build() : null; } @Override public final Builder matchObjectAge(MatchObjectAge matchObjectAge) { this.matchObjectAge = matchObjectAge; return this; } public final MatchObjectSize.Builder getMatchObjectSize() { return matchObjectSize != null ? matchObjectSize.toBuilder() : null; } public final void setMatchObjectSize(MatchObjectSize.BuilderImpl matchObjectSize) { this.matchObjectSize = matchObjectSize != null ? matchObjectSize.build() : null; } @Override public final Builder matchObjectSize(MatchObjectSize matchObjectSize) { this.matchObjectSize = matchObjectSize; return this; } @Override public StorageLensGroupAndOperator build() { return new StorageLensGroupAndOperator(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy