Skip to content

import_source_credentials async

import_source_credentials(
    token: SensitiveNonEmptyString,
    server_type: ServerType,
    auth_type: AuthType,
    *,
    config_overrides: Optional[AsyncCodeBuildClientConfig] = None,
    username: Optional[NonEmptyString] = None,
    should_overwrite: Optional[WrapperBoolean] = None,
) -> ImportSourceCredentialsOutput

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.

Parameters:

  • username (Optional[NonEmptyString], default: None ) –

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

  • token (SensitiveNonEmptyString) –

    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.

  • server_type (ServerType) –

    The source provider used for this project.

  • auth_type (AuthType) –

    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.

  • should_overwrite (Optional[WrapperBoolean], default: None ) –

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

Raises:

Source code in docs_src/capo_codebuild/_services/async_code_build.py
async def import_source_credentials(
    self,
    token: "capo_codebuild.types.sensitive_non_empty_string.SensitiveNonEmptyString",
    server_type: "capo_codebuild.types.server_type.ServerType",
    auth_type: "capo_codebuild.types.auth_type.AuthType",
    *,
    config_overrides: Optional[AsyncCodeBuildClientConfig] = None,
    username: Optional[
        "capo_codebuild.types.non_empty_string.NonEmptyString"
    ] = None,
    should_overwrite: Optional[
        "capo_codebuild.types.wrapper_boolean.WrapperBoolean"
    ] = None,
) -> "capo_codebuild.types.import_source_credentials_output.ImportSourceCredentialsOutput":
    """<p> 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. </p>

    Args:
        username: <p> The Bitbucket username when the <code>authType</code> is BASIC_AUTH. This parameter is not valid for other types of source providers or connections. </p>
        token: <p> 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 <code>authType</code> CODECONNECTIONS, this is the <code>connectionArn</code>. For the <code>authType</code> SECRETS_MANAGER, this is the <code>secretArn</code>.</p>
        server_type: <p> The source provider used for this project. </p>
        auth_type: <p> 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.</p>
        should_overwrite: <p> Set to <code>false</code> to prevent overwriting the repository source credentials. Set to <code>true</code> to overwrite the repository source credentials. The default value is <code>true</code>. </p>

    Raises:
        capo_codebuild.errors.account_limit_exceeded_exception.AccountLimitExceededException: <p>An Amazon Web Services service limit was exceeded for the calling Amazon Web Services account.</p>
        capo_codebuild.errors.invalid_input_exception.InvalidInputException: <p>The input value that was provided is not valid.</p>
        capo_codebuild.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified Amazon Web Services resource cannot be created, because an Amazon Web Services resource with the same settings already exists.</p>
        capo_codebuild.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codebuild.types.import_source_credentials_input.ImportSourceCredentialsInput]",
    ) -> AsyncOperationResponse[
        "capo_codebuild.types.import_source_credentials_output.ImportSourceCredentialsOutput"
    ]:
        import capo_codebuild._operations.code_build_20161006.import_source_credentials

        (
            output,
            http_response,
        ) = await capo_codebuild._operations.code_build_20161006.import_source_credentials.async_import_source_credentials(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_codebuild.types.import_source_credentials_input.ImportSourceCredentialsInput",
    ) -> dict[str, Any]:
        import capo_codebuild.types.import_source_credentials_input

        return (
            capo_codebuild.types.import_source_credentials_input.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ImportSourceCredentials", redact_input=_redact_input),
    )
    input_: capo_codebuild.types.import_source_credentials_input.ImportSourceCredentialsInput = {
        "token": token,
        "server_type": server_type,
        "auth_type": auth_type,
    }
    if username is not None:
        input_["username"] = username
    if should_overwrite is not None:
        input_["should_overwrite"] = should_overwrite

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output