
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 extends Builder> 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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy