ImportSourceCredentials - AWS CodeBuild

ImportSourceCredentials

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

Request Syntax

{ "authType": "string", "serverType": "string", "shouldOverwrite": boolean, "token": "string", "username": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

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 AWS CodeBuild console. Note that CODECONNECTIONS is only valid for GitLab and GitLab Self Managed.

Type: String

Valid Values: OAUTH | BASIC_AUTH | PERSONAL_ACCESS_TOKEN | CODECONNECTIONS

Required: Yes

serverType

The source provider used for this project.

Type: String

Valid Values: GITHUB | BITBUCKET | GITHUB_ENTERPRISE | GITLAB | GITLAB_SELF_MANAGED

Required: Yes

token

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.

Type: String

Length Constraints: Minimum length of 1.

Required: Yes

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.

Type: Boolean

Required: No

username

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

Type: String

Length Constraints: Minimum length of 1.

Required: No

Response Syntax

{ "arn": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

arn

The Amazon Resource Name (ARN) of the token.

Type: String

Length Constraints: Minimum length of 1.

Errors

For information about the errors that are common to all actions, see Common Errors.

AccountLimitExceededException

An AWS service limit was exceeded for the calling AWS account.

HTTP Status Code: 400

InvalidInputException

The input value that was provided is not valid.

HTTP Status Code: 400

ResourceAlreadyExistsException

The specified AWS resource cannot be created, because an AWS resource with the same settings already exists.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: