:doc:`QConnect <../../qconnect>` / Client / create_assistant_association

****************************
create_assistant_association
****************************



.. py:method:: QConnect.Client.create_assistant_association(**kwargs)

  

  Creates an association between an Amazon Q in Connect assistant and another resource. Currently, the only supported association is with a knowledge base. An assistant can have only a single association.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/qconnect-2020-10-19/CreateAssistantAssociation>`_  


  **Request Syntax**
  ::

    response = client.create_assistant_association(
        assistantId='string',
        associationType='KNOWLEDGE_BASE'|'EXTERNAL_BEDROCK_KNOWLEDGE_BASE',
        association={
            'knowledgeBaseId': 'string',
            'externalBedrockKnowledgeBaseConfig': {
                'bedrockKnowledgeBaseArn': 'string',
                'accessRoleArn': 'string'
            }
        },
        clientToken='string',
        tags={
            'string': 'string'
        }
    )
    
  :type assistantId: string
  :param assistantId: **[REQUIRED]** 

    The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN.

    

  
  :type associationType: string
  :param associationType: **[REQUIRED]** 

    The type of association.

    

  
  :type association: dict
  :param association: **[REQUIRED]** 

    The identifier of the associated resource.

    .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``knowledgeBaseId``, ``externalBedrockKnowledgeBaseConfig``. 

  
    - **knowledgeBaseId** *(string) --* 

      The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base.

      

    
    - **externalBedrockKnowledgeBaseConfig** *(dict) --* 

      The configuration for an external Bedrock knowledge base association.

      

    
      - **bedrockKnowledgeBaseArn** *(string) --* **[REQUIRED]** 

        The Amazon Resource Name (ARN) of the external Bedrock knowledge base.

        

      
      - **accessRoleArn** *(string) --* **[REQUIRED]** 

        The Amazon Resource Name (ARN) of the IAM role used to access the external Bedrock knowledge base.

        

      
    
  
  :type clientToken: string
  :param clientToken: 

    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 <http://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/>`__.

    This field is autopopulated if not provided.

  
  :type tags: dict
  :param tags: 

    The tags used to organize, track, or control access for this resource.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'assistantAssociation': {
              'assistantAssociationId': 'string',
              'assistantAssociationArn': 'string',
              'assistantId': 'string',
              'assistantArn': 'string',
              'associationType': 'KNOWLEDGE_BASE'|'EXTERNAL_BEDROCK_KNOWLEDGE_BASE',
              'associationData': {
                  'knowledgeBaseAssociation': {
                      'knowledgeBaseId': 'string',
                      'knowledgeBaseArn': 'string'
                  },
                  'externalBedrockKnowledgeBaseConfig': {
                      'bedrockKnowledgeBaseArn': 'string',
                      'accessRoleArn': 'string'
                  }
              },
              'tags': {
                  'string': 'string'
              }
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **assistantAssociation** *(dict) --* 

        The assistant association.

        
        

        - **assistantAssociationId** *(string) --* 

          The identifier of the assistant association.

          
        

        - **assistantAssociationArn** *(string) --* 

          The Amazon Resource Name (ARN) of the assistant association.

          
        

        - **assistantId** *(string) --* 

          The identifier of the Amazon Q in Connect assistant.

          
        

        - **assistantArn** *(string) --* 

          The Amazon Resource Name (ARN) of the Amazon Q in Connect assistant.

          
        

        - **associationType** *(string) --* 

          The type of association.

          
        

        - **associationData** *(dict) --* 

          A union type that currently has a single argument, the knowledge base ID.

          .. note::    This is a Tagged Union structure. Only one of the     following top level keys will be set: ``knowledgeBaseAssociation``, ``externalBedrockKnowledgeBaseConfig``.     If a client receives an unknown member it will     set ``SDK_UNKNOWN_MEMBER`` as the top level key,     which maps to the name or tag of the unknown     member. The structure of ``SDK_UNKNOWN_MEMBER`` is     as follows::

                    'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}


        
          

          - **knowledgeBaseAssociation** *(dict) --* 

            The knowledge base where output data is sent.

            
            

            - **knowledgeBaseId** *(string) --* 

              The identifier of the knowledge base.

              
            

            - **knowledgeBaseArn** *(string) --* 

              The Amazon Resource Name (ARN) of the knowledge base.

              
        
          

          - **externalBedrockKnowledgeBaseConfig** *(dict) --* 

            The configuration for an external Bedrock knowledge base association in the output data.

            
            

            - **bedrockKnowledgeBaseArn** *(string) --* 

              The Amazon Resource Name (ARN) of the external Bedrock knowledge base.

              
            

            - **accessRoleArn** *(string) --* 

              The Amazon Resource Name (ARN) of the IAM role used to access the external Bedrock knowledge base.

              
        
      
        

        - **tags** *(dict) --* 

          The tags used to organize, track, or control access for this resource.

          
          

          - *(string) --* 
            

            - *(string) --* 
      
    
    
  
  **Exceptions**
  
  *   :py:class:`QConnect.Client.exceptions.ConflictException`

  
  *   :py:class:`QConnect.Client.exceptions.ValidationException`

  
  *   :py:class:`QConnect.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`QConnect.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`QConnect.Client.exceptions.ResourceNotFoundException`

  