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

software.amazon.awssdk.services.mailmanager.model.StartArchiveSearchRequest 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.mailmanager.model;

import java.time.Instant;
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.awscore.AwsRequestOverrideConfiguration;
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 request to initiate a search across emails in an archive. *

*/ @Generated("software.amazon.awssdk:codegen") public final class StartArchiveSearchRequest extends MailManagerRequest implements ToCopyableBuilder { private static final SdkField ARCHIVE_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ArchiveId").getter(getter(StartArchiveSearchRequest::archiveId)).setter(setter(Builder::archiveId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ArchiveId").build()).build(); private static final SdkField FILTERS_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Filters").getter(getter(StartArchiveSearchRequest::filters)).setter(setter(Builder::filters)) .constructor(ArchiveFilters::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Filters").build()).build(); private static final SdkField FROM_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("FromTimestamp").getter(getter(StartArchiveSearchRequest::fromTimestamp)) .setter(setter(Builder::fromTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FromTimestamp").build()).build(); private static final SdkField MAX_RESULTS_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("MaxResults").getter(getter(StartArchiveSearchRequest::maxResults)).setter(setter(Builder::maxResults)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxResults").build()).build(); private static final SdkField TO_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("ToTimestamp").getter(getter(StartArchiveSearchRequest::toTimestamp)) .setter(setter(Builder::toTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ToTimestamp").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARCHIVE_ID_FIELD, FILTERS_FIELD, FROM_TIMESTAMP_FIELD, MAX_RESULTS_FIELD, TO_TIMESTAMP_FIELD)); private final String archiveId; private final ArchiveFilters filters; private final Instant fromTimestamp; private final Integer maxResults; private final Instant toTimestamp; private StartArchiveSearchRequest(BuilderImpl builder) { super(builder); this.archiveId = builder.archiveId; this.filters = builder.filters; this.fromTimestamp = builder.fromTimestamp; this.maxResults = builder.maxResults; this.toTimestamp = builder.toTimestamp; } /** *

* The identifier of the archive to search emails in. *

* * @return The identifier of the archive to search emails in. */ public final String archiveId() { return archiveId; } /** *

* Criteria to filter which emails are included in the search results. *

* * @return Criteria to filter which emails are included in the search results. */ public final ArchiveFilters filters() { return filters; } /** *

* The start timestamp of the range to search emails from. *

* * @return The start timestamp of the range to search emails from. */ public final Instant fromTimestamp() { return fromTimestamp; } /** *

* The maximum number of search results to return. *

* * @return The maximum number of search results to return. */ public final Integer maxResults() { return maxResults; } /** *

* The end timestamp of the range to search emails from. *

* * @return The end timestamp of the range to search emails from. */ public final Instant toTimestamp() { return toTimestamp; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(archiveId()); hashCode = 31 * hashCode + Objects.hashCode(filters()); hashCode = 31 * hashCode + Objects.hashCode(fromTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(maxResults()); hashCode = 31 * hashCode + Objects.hashCode(toTimestamp()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof StartArchiveSearchRequest)) { return false; } StartArchiveSearchRequest other = (StartArchiveSearchRequest) obj; return Objects.equals(archiveId(), other.archiveId()) && Objects.equals(filters(), other.filters()) && Objects.equals(fromTimestamp(), other.fromTimestamp()) && Objects.equals(maxResults(), other.maxResults()) && Objects.equals(toTimestamp(), other.toTimestamp()); } /** * 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("StartArchiveSearchRequest").add("ArchiveId", archiveId()).add("Filters", filters()) .add("FromTimestamp", fromTimestamp()).add("MaxResults", maxResults()).add("ToTimestamp", toTimestamp()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ArchiveId": return Optional.ofNullable(clazz.cast(archiveId())); case "Filters": return Optional.ofNullable(clazz.cast(filters())); case "FromTimestamp": return Optional.ofNullable(clazz.cast(fromTimestamp())); case "MaxResults": return Optional.ofNullable(clazz.cast(maxResults())); case "ToTimestamp": return Optional.ofNullable(clazz.cast(toTimestamp())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((StartArchiveSearchRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends MailManagerRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The identifier of the archive to search emails in. *

* * @param archiveId * The identifier of the archive to search emails in. * @return Returns a reference to this object so that method calls can be chained together. */ Builder archiveId(String archiveId); /** *

* Criteria to filter which emails are included in the search results. *

* * @param filters * Criteria to filter which emails are included in the search results. * @return Returns a reference to this object so that method calls can be chained together. */ Builder filters(ArchiveFilters filters); /** *

* Criteria to filter which emails are included in the search results. *

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

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

* The start timestamp of the range to search emails from. *

* * @param fromTimestamp * The start timestamp of the range to search emails from. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fromTimestamp(Instant fromTimestamp); /** *

* The maximum number of search results to return. *

* * @param maxResults * The maximum number of search results to return. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxResults(Integer maxResults); /** *

* The end timestamp of the range to search emails from. *

* * @param toTimestamp * The end timestamp of the range to search emails from. * @return Returns a reference to this object so that method calls can be chained together. */ Builder toTimestamp(Instant toTimestamp); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends MailManagerRequest.BuilderImpl implements Builder { private String archiveId; private ArchiveFilters filters; private Instant fromTimestamp; private Integer maxResults; private Instant toTimestamp; private BuilderImpl() { } private BuilderImpl(StartArchiveSearchRequest model) { super(model); archiveId(model.archiveId); filters(model.filters); fromTimestamp(model.fromTimestamp); maxResults(model.maxResults); toTimestamp(model.toTimestamp); } public final String getArchiveId() { return archiveId; } public final void setArchiveId(String archiveId) { this.archiveId = archiveId; } @Override public final Builder archiveId(String archiveId) { this.archiveId = archiveId; return this; } public final ArchiveFilters.Builder getFilters() { return filters != null ? filters.toBuilder() : null; } public final void setFilters(ArchiveFilters.BuilderImpl filters) { this.filters = filters != null ? filters.build() : null; } @Override public final Builder filters(ArchiveFilters filters) { this.filters = filters; return this; } public final Instant getFromTimestamp() { return fromTimestamp; } public final void setFromTimestamp(Instant fromTimestamp) { this.fromTimestamp = fromTimestamp; } @Override public final Builder fromTimestamp(Instant fromTimestamp) { this.fromTimestamp = fromTimestamp; return this; } public final Integer getMaxResults() { return maxResults; } public final void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } @Override public final Builder maxResults(Integer maxResults) { this.maxResults = maxResults; return this; } public final Instant getToTimestamp() { return toTimestamp; } public final void setToTimestamp(Instant toTimestamp) { this.toTimestamp = toTimestamp; } @Override public final Builder toTimestamp(Instant toTimestamp) { this.toTimestamp = toTimestamp; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public StartArchiveSearchRequest build() { return new StartArchiveSearchRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy