create_code_repository¶
- CodeRepositoriesApi.create_code_repository(role_id, code_repository_post, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Create a SageMaker-linked code repository
Creates a code repository (GitHub, GitLab, Bitbucket, or CodeCommit), optionally stores git credentials as a SecureString parameter, creates the SageMaker repository, and grants the caller owner access. CodeCommit can be created via CodeCommitRepositoryName or linked via RepositoryUrl. External code-commit + Credentials is rejected.
- Parameters:
role_id (str) – Amorphic role ID sent for authorization. Missing this header returns AUTH-1001. (required)
code_repository_post (CodeRepositoryPost) – (required)
content_type (str)
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: POST /code-repositories
Request¶
GitHub repository with new credentials
{
"RepositoryName": "feature-store-utils",
"RepositoryType": "github",
"Description": "Shared ML utility scripts",
"RepositoryUrl": "https://github.com/org/feature-store-utils.git",
"DefaultRepositoryBranch": "main",
"Keywords": [
"ml",
"utils"
],
"Credentials": {
"CredentialsName": "github-creds",
"Username": "gituser",
"Password": "ghp_exampletoken",
"CredentialsDescription": "GitHub PAT"
}
}
Create a new CodeCommit repository
{
"RepositoryName": "internal-utils",
"RepositoryType": "code-commit",
"CodeCommitRepositoryName": "amp-internal-utils",
"CodeCommitRepositoryDescription": "Created by Amorphic"
}
Link an existing CodeCommit URL
{
"RepositoryName": "existing-cc",
"RepositoryType": "code-commit",
"RepositoryUrl": "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-repo"
}
Success (HTTP 200)¶
Repository created. Body includes Message “Successfully created code repository” and RepositoryName.
Request / response example
{
"Message": "Successfully created code repository",
"RepositoryName": "feature-store-utils"
}
Errors¶
Documented error codes: IPV-1008, IPV-1045, IPV-1043, IPV-1018, DB-1002.
HTTP 400
Missing required fields, invalid name/URL/type, duplicate name or URL, missing Username/Password for new credentials, or SageMaker create failure.
Required fields omitted
{
"Message": "IPV-1008 - Invalid request body, missing key(s) - {'RepositoryName', 'RepositoryType'}"
}
RepositoryType is not allowed
{
"Message": "IPV-1045 - Unsupported code repository type - 'svn'"
}
URL does not match RepositoryType
{
"Message": "IPV-1043 - The Repository URL does not match the repository type"
}
RepositoryName already exists
{
"Message": "IPV-1018 - Invalid parameter - RepositoryName, parameter value already exists, use different value."
}
HTTP 500
DynamoDB write failure. Typical Message is “DB-1002 - Failed to update entry in the dynamoDB table, please check for errors”.
Request / response example
{
"Message": "DB-1002 - Failed to update entry in the dynamoDB table, please check for errors"
}