software.amazon.awssdk.services.lexmodelbuilding.model.KendraConfiguration Maven / Gradle / Ivy
Show all versions of lexmodelbuilding Show documentation
/*
* 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.lexmodelbuilding.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.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;
/**
*
* Provides configuration information for the AMAZON.KendraSearchIntent intent. When you use this intent, Amazon Lex
* searches the specified Amazon Kendra index and returns documents from the index that match the user's utterance. For
* more information, see
* AMAZON.KendraSearchIntent.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class KendraConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField KENDRA_INDEX_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("kendraIndex").getter(getter(KendraConfiguration::kendraIndex)).setter(setter(Builder::kendraIndex))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kendraIndex").build()).build();
private static final SdkField QUERY_FILTER_STRING_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("queryFilterString").getter(getter(KendraConfiguration::queryFilterString))
.setter(setter(Builder::queryFilterString))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("queryFilterString").build()).build();
private static final SdkField ROLE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("role")
.getter(getter(KendraConfiguration::role)).setter(setter(Builder::role))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("role").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(KENDRA_INDEX_FIELD,
QUERY_FILTER_STRING_FIELD, ROLE_FIELD));
private static final long serialVersionUID = 1L;
private final String kendraIndex;
private final String queryFilterString;
private final String role;
private KendraConfiguration(BuilderImpl builder) {
this.kendraIndex = builder.kendraIndex;
this.queryFilterString = builder.queryFilterString;
this.role = builder.role;
}
/**
*
* The Amazon Resource Name (ARN) of the Amazon Kendra index that you want the AMAZON.KendraSearchIntent intent to
* search. The index must be in the same account and Region as the Amazon Lex bot. If the Amazon Kendra index does
* not exist, you get an exception when you call the PutIntent
operation.
*
*
* @return The Amazon Resource Name (ARN) of the Amazon Kendra index that you want the AMAZON.KendraSearchIntent
* intent to search. The index must be in the same account and Region as the Amazon Lex bot. If the Amazon
* Kendra index does not exist, you get an exception when you call the PutIntent
operation.
*/
public final String kendraIndex() {
return kendraIndex;
}
/**
*
* A query filter that Amazon Lex sends to Amazon Kendra to filter the response from the query. The filter is in the
* format defined by Amazon Kendra. For more information, see Filtering queries.
*
*
* You can override this filter string with a new filter string at runtime.
*
*
* @return A query filter that Amazon Lex sends to Amazon Kendra to filter the response from the query. The filter
* is in the format defined by Amazon Kendra. For more information, see Filtering queries.
*
* You can override this filter string with a new filter string at runtime.
*/
public final String queryFilterString() {
return queryFilterString;
}
/**
*
* The Amazon Resource Name (ARN) of an IAM role that has permission to search the Amazon Kendra index. The role
* must be in the same account and Region as the Amazon Lex bot. If the role does not exist, you get an exception
* when you call the PutIntent
operation.
*
*
* @return The Amazon Resource Name (ARN) of an IAM role that has permission to search the Amazon Kendra index. The
* role must be in the same account and Region as the Amazon Lex bot. If the role does not exist, you get an
* exception when you call the PutIntent
operation.
*/
public final String role() {
return role;
}
@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(kendraIndex());
hashCode = 31 * hashCode + Objects.hashCode(queryFilterString());
hashCode = 31 * hashCode + Objects.hashCode(role());
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 KendraConfiguration)) {
return false;
}
KendraConfiguration other = (KendraConfiguration) obj;
return Objects.equals(kendraIndex(), other.kendraIndex())
&& Objects.equals(queryFilterString(), other.queryFilterString()) && Objects.equals(role(), other.role());
}
/**
* 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("KendraConfiguration").add("KendraIndex", kendraIndex())
.add("QueryFilterString", queryFilterString()).add("Role", role()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "kendraIndex":
return Optional.ofNullable(clazz.cast(kendraIndex()));
case "queryFilterString":
return Optional.ofNullable(clazz.cast(queryFilterString()));
case "role":
return Optional.ofNullable(clazz.cast(role()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function