Creates an access configuration for your documents. This includes user and group access information for your documents. This is useful for user context filtering, where search results are filtered based on the user or their group access to documents.
You can use this to re-configure your existing document level access control without indexing all of your documents again. For example, your index contains top-secret company documents that only certain employees or users should access. One of these users leaves the company or switches to a team that should be blocked from accessing top-secret documents. The user still has access to top-secret documents because the user had access when your documents were previously indexed. You can create a specific access control configuration for the user with deny access. You can later update the access control configuration to allow access if the user returns to the company and re-joins the 'top-secret' team. You can re-configure access control for your documents as circumstances change.
To apply your access control configuration to certain documents, you call the BatchPutDocument API with the AccessControlConfigurationId included in the Document object. If you use an S3 bucket as a data source, you update the .metadata.json with the AccessControlConfigurationId and synchronize your data source. Amazon Kendra currently only supports access control configuration for S3 data sources and documents indexed using the BatchPutDocument API.
You can't configure access control using CreateAccessControlConfiguration for an Amazon Kendra Gen AI Enterprise Edition index. Amazon Kendra will return a ValidationException error for a Gen_AI_ENTERPRISE_EDITION index.
Parameters:
-
index_id
(IndexId)
–
The identifier of the index to create an access control configuration for your documents.
-
name
(AccessControlConfigurationName)
–
A name for the access control configuration.
-
description
(Optional[Description], default:
None
)
–
A description for the access control configuration.
-
access_control_list
(Optional[PrincipalList], default:
None
)
–
Information on principals (users and/or groups) and which documents they should have access to. This is useful for user context filtering, where search results are filtered based on the user or their group access to documents.
-
hierarchical_access_control_list
(Optional[HierarchicalPrincipalList], default:
None
)
–
The list of principal lists that define the hierarchy for which documents users should have access to.
-
client_token
(Optional[ClientTokenName], default:
None
)
–
A token that you provide to identify the request to create an access control configuration. Multiple calls to the CreateAccessControlConfiguration API with the same client token will create only one access control configuration.
Raises:
-
AccessDeniedException
–
You don't have sufficient access to perform this action. Please ensure you have the required permission policies and user accounts and try again.
-
ConflictException
–
A conflict occurred with the request. Please fix any inconsistences with your resources and try again.
-
InternalServerException
–
An issue occurred with the internal server used for your Amazon Kendra service. Please wait a few minutes and try again, or contact Support for help.
-
ResourceNotFoundException
–
The resource you want to use doesn’t exist. Please check you have provided the correct resource and try again.
-
ServiceQuotaExceededException
–
You have exceeded the set limits for your Amazon Kendra service. Please see Quotas for more information, or contact Support to inquire about an increase of limits.
-
ThrottlingException
–
The request was denied due to request throttling. Please reduce the number of requests and try again.
-
ValidationException
–
The input fails to satisfy the constraints set by the Amazon Kendra service. Please provide the correct input and try again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_kendra/_services/kendra.py
| def create_access_control_configuration(
self,
index_id: "capo_kendra.types.index_id.IndexId",
name: "capo_kendra.types.access_control_configuration_name.AccessControlConfigurationName",
*,
config_overrides: Optional[kendraClientConfig] = None,
description: Optional["capo_kendra.types.description.Description"] = None,
access_control_list: Optional[
"capo_kendra.types.principal_list.PrincipalList"
] = None,
hierarchical_access_control_list: Optional[
"capo_kendra.types.hierarchical_principal_list.HierarchicalPrincipalList"
] = None,
client_token: Optional[
"capo_kendra.types.client_token_name.ClientTokenName"
] = None,
) -> "capo_kendra.types.create_access_control_configuration_response.CreateAccessControlConfigurationResponse":
"""<p>Creates an access configuration for your documents. This includes user and group access information for your documents. This is useful for user context filtering, where search results are filtered based on the user or their group access to documents.</p> <p>You can use this to re-configure your existing document level access control without indexing all of your documents again. For example, your index contains top-secret company documents that only certain employees or users should access. One of these users leaves the company or switches to a team that should be blocked from accessing top-secret documents. The user still has access to top-secret documents because the user had access when your documents were previously indexed. You can create a specific access control configuration for the user with deny access. You can later update the access control configuration to allow access if the user returns to the company and re-joins the 'top-secret' team. You can re-configure access control for your documents as circumstances change.</p> <p>To apply your access control configuration to certain documents, you call the <a href="https://docs.aws.amazon.com/kendra/latest/dg/API_BatchPutDocument.html">BatchPutDocument</a> API with the <code>AccessControlConfigurationId</code> included in the <a href="https://docs.aws.amazon.com/kendra/latest/dg/API_Document.html">Document</a> object. If you use an S3 bucket as a data source, you update the <code>.metadata.json</code> with the <code>AccessControlConfigurationId</code> and synchronize your data source. Amazon Kendra currently only supports access control configuration for S3 data sources and documents indexed using the <code>BatchPutDocument</code> API.</p> <important> <p>You can't configure access control using <code>CreateAccessControlConfiguration</code> for an Amazon Kendra Gen AI Enterprise Edition index. Amazon Kendra will return a <code>ValidationException</code> error for a <code>Gen_AI_ENTERPRISE_EDITION</code> index.</p> </important>
Args:
index_id: <p>The identifier of the index to create an access control configuration for your documents.</p>
name: <p>A name for the access control configuration.</p>
description: <p>A description for the access control configuration.</p>
access_control_list: <p>Information on principals (users and/or groups) and which documents they should have access to. This is useful for user context filtering, where search results are filtered based on the user or their group access to documents.</p>
hierarchical_access_control_list: <p>The list of <a href="https://docs.aws.amazon.com/kendra/latest/dg/API_Principal.html">principal</a> lists that define the hierarchy for which documents users should have access to.</p>
client_token: <p>A token that you provide to identify the request to create an access control configuration. Multiple calls to the <code>CreateAccessControlConfiguration</code> API with the same client token will create only one access control configuration.</p>
Raises:
capo_kendra.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action. Please ensure you have the required permission policies and user accounts and try again.</p>
capo_kendra.errors.conflict_exception.ConflictException: <p>A conflict occurred with the request. Please fix any inconsistences with your resources and try again.</p>
capo_kendra.errors.internal_server_exception.InternalServerException: <p>An issue occurred with the internal server used for your Amazon Kendra service. Please wait a few minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>
capo_kendra.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource you want to use doesn’t exist. Please check you have provided the correct resource and try again.</p>
capo_kendra.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded the set limits for your Amazon Kendra service. Please see <a href="https://docs.aws.amazon.com/kendra/latest/dg/quotas.html">Quotas</a> for more information, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> to inquire about an increase of limits.</p>
capo_kendra.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Please reduce the number of requests and try again.</p>
capo_kendra.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints set by the Amazon Kendra service. Please provide the correct input and try again.</p>
capo_kendra.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_kendra.types.create_access_control_configuration_request.CreateAccessControlConfigurationRequest]",
) -> OperationResponse[
"capo_kendra.types.create_access_control_configuration_response.CreateAccessControlConfigurationResponse"
]:
import capo_kendra._operations.aws_kendra_frontend_service.create_access_control_configuration
output, http_response = (
capo_kendra._operations.aws_kendra_frontend_service.create_access_control_configuration.create_access_control_configuration(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateAccessControlConfiguration")
)
input_: capo_kendra.types.create_access_control_configuration_request.CreateAccessControlConfigurationRequest = {
"index_id": index_id,
"name": name,
}
if description is not None:
input_["description"] = description
if access_control_list is not None:
input_["access_control_list"] = access_control_list
if hierarchical_access_control_list is not None:
input_["hierarchical_access_control_list"] = (
hierarchical_access_control_list
)
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|