Skip to content

register_knowledge_base_replica_key

register_knowledge_base_replica_key(
    knowledge_base_id: UuidOrArn,
    replica_kms_key: ReplicaKmsKey,
    *,
    config_overrides: Optional[QConnectClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> RegisterKnowledgeBaseReplicaKeyResponse

Registers a replica Region KMS key for an Amazon Q in Connect knowledge base. To use this operation, you must have kms:GenerateDataKey permission on the replica key. You must also have kms:CreateGrant permission on the primary key.

Parameters:

  • knowledge_base_id (UuidOrArn) –

    The identifier of the knowledge base.

  • replica_kms_key (ReplicaKmsKey) –

    The replica Region KMS key to register for the knowledge base.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs..

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The request could not be processed because of conflict in the current state of the resource. For example, if you're using a Create API (such as CreateAssistant) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • ThrottlingException –

    The throttling limit has been exceeded.

  • UnauthorizedException –

    You do not have permission to perform this action.

  • ValidationException –

    The input fails to satisfy the constraints specified by a service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_qconnect/_services/q_connect.py
def register_knowledge_base_replica_key(
    self,
    knowledge_base_id: "capo_qconnect.types.uuid_or_arn.UuidOrArn",
    replica_kms_key: "capo_qconnect.types.replica_kms_key.ReplicaKmsKey",
    *,
    config_overrides: Optional[QConnectClientConfig] = None,
    client_token: Optional["capo_qconnect.types.client_token.ClientToken"] = None,
) -> "capo_qconnect.types.register_knowledge_base_replica_key_response.RegisterKnowledgeBaseReplicaKeyResponse":
    """<p>Registers a replica Region KMS key for an Amazon Q in Connect knowledge base. To use this operation, you must have <code>kms:GenerateDataKey</code> permission on the replica key. You must also have <code>kms:CreateGrant</code> permission on the primary key.</p>

    Args:
        knowledge_base_id: <p>The identifier of the knowledge base.</p>
        replica_kms_key: <p>The replica Region KMS key to register for the knowledge base.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="http://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>..</p>

    Raises:
        capo_qconnect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_qconnect.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource. For example, if you're using a <code>Create</code> API (such as <code>CreateAssistant</code>) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.</p>
        capo_qconnect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_qconnect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_qconnect.errors.unauthorized_exception.UnauthorizedException: <p>You do not have permission to perform this action.</p>
        capo_qconnect.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by a service.</p>
        capo_qconnect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_qconnect.types.register_knowledge_base_replica_key_request.RegisterKnowledgeBaseReplicaKeyRequest]",
    ) -> OperationResponse[
        "capo_qconnect.types.register_knowledge_base_replica_key_response.RegisterKnowledgeBaseReplicaKeyResponse"
    ]:
        import capo_qconnect._operations.wisdom_service.register_knowledge_base_replica_key

        output, http_response = (
            capo_qconnect._operations.wisdom_service.register_knowledge_base_replica_key.register_knowledge_base_replica_key(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_qconnect.types.register_knowledge_base_replica_key_response.RegisterKnowledgeBaseReplicaKeyResponse",
    ) -> dict[str, Any]:
        import capo_qconnect.types.register_knowledge_base_replica_key_response

        return capo_qconnect.types.register_knowledge_base_replica_key_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "RegisterKnowledgeBaseReplicaKey", redact_output=_redact_output
        ),
    )
    input_: capo_qconnect.types.register_knowledge_base_replica_key_request.RegisterKnowledgeBaseReplicaKeyRequest = {
        "knowledge_base_id": knowledge_base_id,
        "replica_kms_key": replica_kms_key,
    }
    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