:doc:`CodeBuild <../../codebuild>` / Client / import_source_credentials

*************************
import_source_credentials
*************************



.. py:method:: CodeBuild.Client.import_source_credentials(**kwargs)

  

  Imports the source repository credentials for an CodeBuild project that has its source code stored in a GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket repository.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/codebuild-2016-10-06/ImportSourceCredentials>`_  


  **Request Syntax**
  ::

    response = client.import_source_credentials(
        username='string',
        token='string',
        serverType='GITHUB'|'BITBUCKET'|'GITHUB_ENTERPRISE'|'GITLAB'|'GITLAB_SELF_MANAGED',
        authType='OAUTH'|'BASIC_AUTH'|'PERSONAL_ACCESS_TOKEN'|'CODECONNECTIONS'|'SECRETS_MANAGER',
        shouldOverwrite=True|False
    )
    
  :type username: string
  :param username: 

    The Bitbucket username when the ``authType`` is BASIC_AUTH. This parameter is not valid for other types of source providers or connections.

    

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

    For GitHub or GitHub Enterprise, this is the personal access token. For Bitbucket, this is either the access token or the app password. For the ``authType`` CODECONNECTIONS, this is the ``connectionArn``. For the ``authType`` SECRETS_MANAGER, this is the ``secretArn``.

    

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

    The source provider used for this project.

    

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

    The type of authentication used to connect to a GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket repository. An OAUTH connection is not supported by the API and must be created using the CodeBuild console.

    

  
  :type shouldOverwrite: boolean
  :param shouldOverwrite: 

    Set to ``false`` to prevent overwriting the repository source credentials. Set to ``true`` to overwrite the repository source credentials. The default value is ``true``.

    

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

    
    ::

      {
          'arn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **arn** *(string) --* 

        The Amazon Resource Name (ARN) of the token.

        
  
  **Exceptions**
  
  *   :py:class:`CodeBuild.Client.exceptions.InvalidInputException`

  
  *   :py:class:`CodeBuild.Client.exceptions.AccountLimitExceededException`

  
  *   :py:class:`CodeBuild.Client.exceptions.ResourceAlreadyExistsException`

  