/* * Copyright 2018-2023 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 com.amazonaws.services.kendra.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* Provides information about the user context for an Amazon Kendra index. *
** User context filtering is a kind of personalized search with the benefit of controlling access to documents. For * example, not all teams that search the company portal for information should access top-secret company documents, nor * are these documents relevant to all users. Only specific users or groups of teams given access to top-secret * documents should see these documents in their search results. *
** You provide one of the following: *
** User token *
** User ID, the groups the user belongs to, and any data sources the groups can access. *
** If you provide both, an exception is thrown. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class UserContext implements Serializable, Cloneable, StructuredPojo { /** ** The user context token for filtering search results for a user. It must be a JWT or a JSON token. *
*/ private String token; /** ** The identifier of the user you want to filter search results based on their access to documents. *
*/ private String userId; /** ** The list of groups you want to filter search results based on the groups' access to documents. *
*/ private java.util.List* The list of data source groups you want to filter search results based on groups' access to documents in that * data source. *
*/ private java.util.List* The user context token for filtering search results for a user. It must be a JWT or a JSON token. *
* * @param token * The user context token for filtering search results for a user. It must be a JWT or a JSON token. */ public void setToken(String token) { this.token = token; } /** ** The user context token for filtering search results for a user. It must be a JWT or a JSON token. *
* * @return The user context token for filtering search results for a user. It must be a JWT or a JSON token. */ public String getToken() { return this.token; } /** ** The user context token for filtering search results for a user. It must be a JWT or a JSON token. *
* * @param token * The user context token for filtering search results for a user. It must be a JWT or a JSON token. * @return Returns a reference to this object so that method calls can be chained together. */ public UserContext withToken(String token) { setToken(token); return this; } /** ** The identifier of the user you want to filter search results based on their access to documents. *
* * @param userId * The identifier of the user you want to filter search results based on their access to documents. */ public void setUserId(String userId) { this.userId = userId; } /** ** The identifier of the user you want to filter search results based on their access to documents. *
* * @return The identifier of the user you want to filter search results based on their access to documents. */ public String getUserId() { return this.userId; } /** ** The identifier of the user you want to filter search results based on their access to documents. *
* * @param userId * The identifier of the user you want to filter search results based on their access to documents. * @return Returns a reference to this object so that method calls can be chained together. */ public UserContext withUserId(String userId) { setUserId(userId); return this; } /** ** The list of groups you want to filter search results based on the groups' access to documents. *
* * @return The list of groups you want to filter search results based on the groups' access to documents. */ public java.util.List* The list of groups you want to filter search results based on the groups' access to documents. *
* * @param groups * The list of groups you want to filter search results based on the groups' access to documents. */ public void setGroups(java.util.Collection* The list of groups you want to filter search results based on the groups' access to documents. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setGroups(java.util.Collection)} or {@link #withGroups(java.util.Collection)} if you want to override the * existing values. *
* * @param groups * The list of groups you want to filter search results based on the groups' access to documents. * @return Returns a reference to this object so that method calls can be chained together. */ public UserContext withGroups(String... groups) { if (this.groups == null) { setGroups(new java.util.ArrayList* The list of groups you want to filter search results based on the groups' access to documents. *
* * @param groups * The list of groups you want to filter search results based on the groups' access to documents. * @return Returns a reference to this object so that method calls can be chained together. */ public UserContext withGroups(java.util.Collection* The list of data source groups you want to filter search results based on groups' access to documents in that * data source. *
* * @return The list of data source groups you want to filter search results based on groups' access to documents in * that data source. */ public java.util.List* The list of data source groups you want to filter search results based on groups' access to documents in that * data source. *
* * @param dataSourceGroups * The list of data source groups you want to filter search results based on groups' access to documents in * that data source. */ public void setDataSourceGroups(java.util.Collection* The list of data source groups you want to filter search results based on groups' access to documents in that * data source. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setDataSourceGroups(java.util.Collection)} or {@link #withDataSourceGroups(java.util.Collection)} if you * want to override the existing values. *
* * @param dataSourceGroups * The list of data source groups you want to filter search results based on groups' access to documents in * that data source. * @return Returns a reference to this object so that method calls can be chained together. */ public UserContext withDataSourceGroups(DataSourceGroup... dataSourceGroups) { if (this.dataSourceGroups == null) { setDataSourceGroups(new java.util.ArrayList* The list of data source groups you want to filter search results based on groups' access to documents in that * data source. *
* * @param dataSourceGroups * The list of data source groups you want to filter search results based on groups' access to documents in * that data source. * @return Returns a reference to this object so that method calls can be chained together. */ public UserContext withDataSourceGroups(java.util.Collection