software.amazon.awssdk.services.workdocs.model.SearchResourcesRequest 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.workdocs.model;
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.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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class SearchResourcesRequest extends WorkDocsRequest implements
ToCopyableBuilder {
private static final SdkField AUTHENTICATION_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AuthenticationToken").getter(getter(SearchResourcesRequest::authenticationToken))
.setter(setter(Builder::authenticationToken))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Authentication").build()).build();
private static final SdkField QUERY_TEXT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QueryText").getter(getter(SearchResourcesRequest::queryText)).setter(setter(Builder::queryText))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryText").build()).build();
private static final SdkField> QUERY_SCOPES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("QueryScopes")
.getter(getter(SearchResourcesRequest::queryScopesAsStrings))
.setter(setter(Builder::queryScopesWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryScopes").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 SdkField ORGANIZATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OrganizationId").getter(getter(SearchResourcesRequest::organizationId))
.setter(setter(Builder::organizationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrganizationId").build()).build();
private static final SdkField> ADDITIONAL_RESPONSE_FIELDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AdditionalResponseFields")
.getter(getter(SearchResourcesRequest::additionalResponseFieldsAsStrings))
.setter(setter(Builder::additionalResponseFieldsWithStrings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AdditionalResponseFields").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 SdkField FILTERS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Filters").getter(getter(SearchResourcesRequest::filters)).setter(setter(Builder::filters))
.constructor(Filters::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Filters").build()).build();
private static final SdkField> ORDER_BY_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("OrderBy")
.getter(getter(SearchResourcesRequest::orderBy))
.setter(setter(Builder::orderBy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrderBy").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(SearchSortResult::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField LIMIT_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Limit")
.getter(getter(SearchResourcesRequest::limit)).setter(setter(Builder::limit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Limit").build()).build();
private static final SdkField MARKER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Marker")
.getter(getter(SearchResourcesRequest::marker)).setter(setter(Builder::marker))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Marker").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTHENTICATION_TOKEN_FIELD,
QUERY_TEXT_FIELD, QUERY_SCOPES_FIELD, ORGANIZATION_ID_FIELD, ADDITIONAL_RESPONSE_FIELDS_FIELD, FILTERS_FIELD,
ORDER_BY_FIELD, LIMIT_FIELD, MARKER_FIELD));
private final String authenticationToken;
private final String queryText;
private final List queryScopes;
private final String organizationId;
private final List additionalResponseFields;
private final Filters filters;
private final List orderBy;
private final Integer limit;
private final String marker;
private SearchResourcesRequest(BuilderImpl builder) {
super(builder);
this.authenticationToken = builder.authenticationToken;
this.queryText = builder.queryText;
this.queryScopes = builder.queryScopes;
this.organizationId = builder.organizationId;
this.additionalResponseFields = builder.additionalResponseFields;
this.filters = builder.filters;
this.orderBy = builder.orderBy;
this.limit = builder.limit;
this.marker = builder.marker;
}
/**
*
* Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to
* access the API.
*
*
* @return Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator
* credentials to access the API.
*/
public final String authenticationToken() {
return authenticationToken;
}
/**
*
* The String to search for. Searches across different text fields based on request parameters. Use double quotes
* around the query string for exact phrase matches.
*
*
* @return The String to search for. Searches across different text fields based on request parameters. Use double
* quotes around the query string for exact phrase matches.
*/
public final String queryText() {
return queryText;
}
/**
*
* Filter based on the text field type. A Folder has only a name and no content. A Comment has only content and no
* name. A Document or Document Version has a name and content
*
*
* 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 #hasQueryScopes} method.
*
*
* @return Filter based on the text field type. A Folder has only a name and no content. A Comment has only content
* and no name. A Document or Document Version has a name and content
*/
public final List queryScopes() {
return SearchQueryScopeTypeListCopier.copyStringToEnum(queryScopes);
}
/**
* For responses, this returns true if the service returned a value for the QueryScopes 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 hasQueryScopes() {
return queryScopes != null && !(queryScopes instanceof SdkAutoConstructList);
}
/**
*
* Filter based on the text field type. A Folder has only a name and no content. A Comment has only content and no
* name. A Document or Document Version has a name and content
*
*
* 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 #hasQueryScopes} method.
*
*
* @return Filter based on the text field type. A Folder has only a name and no content. A Comment has only content
* and no name. A Document or Document Version has a name and content
*/
public final List queryScopesAsStrings() {
return queryScopes;
}
/**
*
* Filters based on the resource owner OrgId. This is a mandatory parameter when using Admin SigV4 credentials.
*
*
* @return Filters based on the resource owner OrgId. This is a mandatory parameter when using Admin SigV4
* credentials.
*/
public final String organizationId() {
return organizationId;
}
/**
*
* A list of attributes to include in the response. Used to request fields that are not normally returned in a
* standard response.
*
*
* 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 #hasAdditionalResponseFields} method.
*
*
* @return A list of attributes to include in the response. Used to request fields that are not normally returned in
* a standard response.
*/
public final List additionalResponseFields() {
return AdditionalResponseFieldsListCopier.copyStringToEnum(additionalResponseFields);
}
/**
* For responses, this returns true if the service returned a value for the AdditionalResponseFields 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 hasAdditionalResponseFields() {
return additionalResponseFields != null && !(additionalResponseFields instanceof SdkAutoConstructList);
}
/**
*
* A list of attributes to include in the response. Used to request fields that are not normally returned in a
* standard response.
*
*
* 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 #hasAdditionalResponseFields} method.
*
*
* @return A list of attributes to include in the response. Used to request fields that are not normally returned in
* a standard response.
*/
public final List additionalResponseFieldsAsStrings() {
return additionalResponseFields;
}
/**
*
* Filters results based on entity metadata.
*
*
* @return Filters results based on entity metadata.
*/
public final Filters filters() {
return filters;
}
/**
* For responses, this returns true if the service returned a value for the OrderBy 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 hasOrderBy() {
return orderBy != null && !(orderBy instanceof SdkAutoConstructList);
}
/**
*
* Order by results in one or more categories.
*
*
* 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 #hasOrderBy} method.
*
*
* @return Order by results in one or more categories.
*/
public final List orderBy() {
return orderBy;
}
/**
*
* Max results count per page.
*
*
* @return Max results count per page.
*/
public final Integer limit() {
return limit;
}
/**
*
* The marker for the next set of results.
*
*
* @return The marker for the next set of results.
*/
public final String marker() {
return marker;
}
@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(authenticationToken());
hashCode = 31 * hashCode + Objects.hashCode(queryText());
hashCode = 31 * hashCode + Objects.hashCode(hasQueryScopes() ? queryScopesAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(organizationId());
hashCode = 31 * hashCode + Objects.hashCode(hasAdditionalResponseFields() ? additionalResponseFieldsAsStrings() : null);
hashCode = 31 * hashCode + Objects.hashCode(filters());
hashCode = 31 * hashCode + Objects.hashCode(hasOrderBy() ? orderBy() : null);
hashCode = 31 * hashCode + Objects.hashCode(limit());
hashCode = 31 * hashCode + Objects.hashCode(marker());
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 SearchResourcesRequest)) {
return false;
}
SearchResourcesRequest other = (SearchResourcesRequest) obj;
return Objects.equals(authenticationToken(), other.authenticationToken())
&& Objects.equals(queryText(), other.queryText()) && hasQueryScopes() == other.hasQueryScopes()
&& Objects.equals(queryScopesAsStrings(), other.queryScopesAsStrings())
&& Objects.equals(organizationId(), other.organizationId())
&& hasAdditionalResponseFields() == other.hasAdditionalResponseFields()
&& Objects.equals(additionalResponseFieldsAsStrings(), other.additionalResponseFieldsAsStrings())
&& Objects.equals(filters(), other.filters()) && hasOrderBy() == other.hasOrderBy()
&& Objects.equals(orderBy(), other.orderBy()) && Objects.equals(limit(), other.limit())
&& Objects.equals(marker(), other.marker());
}
/**
* 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("SearchResourcesRequest")
.add("AuthenticationToken", authenticationToken() == null ? null : "*** Sensitive Data Redacted ***")
.add("QueryText", queryText() == null ? null : "*** Sensitive Data Redacted ***")
.add("QueryScopes", hasQueryScopes() ? queryScopesAsStrings() : null).add("OrganizationId", organizationId())
.add("AdditionalResponseFields", hasAdditionalResponseFields() ? additionalResponseFieldsAsStrings() : null)
.add("Filters", filters()).add("OrderBy", hasOrderBy() ? orderBy() : null).add("Limit", limit())
.add("Marker", marker()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AuthenticationToken":
return Optional.ofNullable(clazz.cast(authenticationToken()));
case "QueryText":
return Optional.ofNullable(clazz.cast(queryText()));
case "QueryScopes":
return Optional.ofNullable(clazz.cast(queryScopesAsStrings()));
case "OrganizationId":
return Optional.ofNullable(clazz.cast(organizationId()));
case "AdditionalResponseFields":
return Optional.ofNullable(clazz.cast(additionalResponseFieldsAsStrings()));
case "Filters":
return Optional.ofNullable(clazz.cast(filters()));
case "OrderBy":
return Optional.ofNullable(clazz.cast(orderBy()));
case "Limit":
return Optional.ofNullable(clazz.cast(limit()));
case "Marker":
return Optional.ofNullable(clazz.cast(marker()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function