스니펫 저장소 이동 API
Offering: Self-managed, GitLab Dedicated
스니펫 저장소는 저장소 간에 이동할 수 있습니다. 이 API는
기탈리 클러스터로 마이그레이션하는 데 도움이 될 수 있습니다, 예를 들어.
스니펫 저장소 이동은 다양한 상태를 거칩니다. state
의 값은 다음과 같습니다:
-
initial
: 레코드가 생성되었지만 백그라운드 작업이 아직 예약되지 않았습니다. -
scheduled
: 백그라운드 작업이 예약되었습니다. -
started
: 스니펫 저장소가 대상 저장소로 복사되고 있습니다. -
replicated
: 스니펫이 이동되었습니다. -
failed
: 스니펫 저장소 복사에 실패했거나 체크섬이 일치하지 않았습니다. -
finished
: 스니펫이 이동되었고 소스 저장소의 저장소가 삭제되었습니다. -
cleanup failed
: 스니펫이 이동되었지만 소스 저장소의 저장소를 삭제할 수 없습니다.
데이터 무결성을 보장하기 위해 스니펫은 이동 기간 동안 임시 읽기 전용 상태로 설정됩니다.
이 기간 동안 사용자가 새로운 커밋을 푸시하려고 시도하면 저장소는 일시적으로 읽기 전용입니다. 나중에 다시 시도해 주세요.
라는 메시지를 받게 됩니다.
이 API는 관리자로서 인증이 필요합니다.
다른 저장소 유형은 다음을 참조하세요:
모든 스니펫 저장소 이동 정보 검색
GET /snippet_repository_storage_moves
기본적으로 GET
요청은 API 결과가 페이지네이션 되기 때문에 한 번에 20개의 결과를 반환합니다.
예제 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/snippet_repository_storage_moves"
예제 응답:
[
{
"id": 1,
"created_at": "2020-05-07T04:27:17.234Z",
"state": "scheduled",
"source_storage_name": "default",
"destination_storage_name": "storage2",
"snippet": {
"id": 65,
"title": "Test Snippet",
"description": null,
"visibility": "internal",
"updated_at": "2020-12-01T11:15:50.385Z",
"created_at": "2020-12-01T11:15:50.385Z",
"project_id": null,
"web_url": "https://gitlab.example.com/-/snippets/65",
"raw_url": "https://gitlab.example.com/-/snippets/65/raw",
"ssh_url_to_repo": "ssh://user@gitlab.example.com/snippets/65.git",
"http_url_to_repo": "https://gitlab.example.com/snippets/65.git"
}
}
]
스니펫에 대한 모든 저장소 이동 정보 검색
GET /snippets/:snippet_id/repository_storage_moves
기본적으로 GET
요청은 API 결과가 페이지네이션 되기 때문에 한 번에 20개의 결과를 반환합니다.
지원되는 속성:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
snippet_id |
정수 | 예 | 스니펫의 ID. |
예제 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/snippets/1/repository_storage_moves"
예제 응답:
[
{
"id": 1,
"created_at": "2020-05-07T04:27:17.234Z",
"state": "scheduled",
"source_storage_name": "default",
"destination_storage_name": "storage2",
"snippet": {
"id": 65,
"title": "Test Snippet",
"description": null,
"visibility": "internal",
"updated_at": "2020-12-01T11:15:50.385Z",
"created_at": "2020-12-01T11:15:50.385Z",
"project_id": null,
"web_url": "https://gitlab.example.com/-/snippets/65",
"raw_url": "https://gitlab.example.com/-/snippets/65/raw",
"ssh_url_to_repo": "ssh://user@gitlab.example.com/snippets/65.git",
"http_url_to_repo": "https://gitlab.example.com/snippets/65.git"
}
}
]
단일 스니펫 리포지토리 저장소 이동 가져오기
GET /snippet_repository_storage_moves/:repository_storage_id
지원되는 속성:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
repository_storage_id |
정수 | 예 | 스니펫 리포지토리 저장소 이동의 ID입니다. |
예제 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/snippet_repository_storage_moves/1"
예제 응답:
{
"id": 1,
"created_at": "2020-05-07T04:27:17.234Z",
"state": "scheduled",
"source_storage_name": "default",
"destination_storage_name": "storage2",
"snippet": {
"id": 65,
"title": "테스트 스니펫",
"description": null,
"visibility": "internal",
"updated_at": "2020-12-01T11:15:50.385Z",
"created_at": "2020-12-01T11:15:50.385Z",
"project_id": null,
"web_url": "https://gitlab.example.com/-/snippets/65",
"raw_url": "https://gitlab.example.com/-/snippets/65/raw",
"ssh_url_to_repo": "ssh://user@gitlab.example.com/snippets/65.git",
"http_url_to_repo": "https://gitlab.example.com/snippets/65.git"
}
}
스니펫에 대한 단일 리포지토리 저장소 이동 가져오기
GET /snippets/:snippet_id/repository_storage_moves/:repository_storage_id
지원되는 속성:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
snippet_id |
정수 | 예 | 스니펫의 ID입니다. |
repository_storage_id |
정수 | 예 | 스니펫 리포지토리 저장소 이동의 ID입니다. |
예제 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/snippets/1/repository_storage_moves/1"
예제 응답:
{
"id": 1,
"created_at": "2020-05-07T04:27:17.234Z",
"state": "scheduled",
"source_storage_name": "default",
"destination_storage_name": "storage2",
"snippet": {
"id": 65,
"title": "테스트 스니펫",
"description": null,
"visibility": "internal",
"updated_at": "2020-12-01T11:15:50.385Z",
"created_at": "2020-12-01T11:15:50.385Z",
"project_id": null,
"web_url": "https://gitlab.example.com/-/snippets/65",
"raw_url": "https://gitlab.example.com/-/snippets/65/raw",
"ssh_url_to_repo": "ssh://user@gitlab.example.com/snippets/65.git",
"http_url_to_repo": "https://gitlab.example.com/snippets/65.git"
}
}
스니펫에 대한 리포지토리 저장소 이동 예약
POST /snippets/:snippet_id/repository_storage_moves
지원되는 속성:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
snippet_id |
정수 | 예 | 스니펫의 ID입니다. |
destination_storage_name |
문자열 | 아니오 | 대상 저장소 샤드의 이름입니다. 제공되지 않으면 저장소 가중치에 따라 자동으로 선택됩니다. |
예제 요청:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type: application/json" \
--data '{"destination_storage_name":"storage2"}' \
--url "https://gitlab.example.com/api/v4/snippets/1/repository_storage_moves"
예제 응답:
{
"id": 1,
"created_at": "2020-05-07T04:27:17.234Z",
"state": "scheduled",
"source_storage_name": "default",
"destination_storage_name": "storage2",
"snippet": {
"id": 65,
"title": "테스트 스니펫",
"description": null,
"visibility": "internal",
"updated_at": "2020-12-01T11:15:50.385Z",
"created_at": "2020-12-01T11:15:50.385Z",
"project_id": null,
"web_url": "https://gitlab.example.com/-/snippets/65",
"raw_url": "https://gitlab.example.com/-/snippets/65/raw",
"ssh_url_to_repo": "ssh://user@gitlab.example.com/snippets/65.git",
"http_url_to_repo": "https://gitlab.example.com/snippets/65.git"
}
}
모든 스니펫의 저장소 이동을 위한 스케줄 설정
소스 저장소 샤드에 저장된 각 스니펫 저장소에 대한 이동을 스케줄합니다.
이 엔드포인트는 모든 스니펫을 한 번에 마이그레이션합니다. 더 많은 정보는 모든 스니펫 이동을 참조하세요.
POST /snippet_repository_storage_moves
지원되는 속성:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
source_storage_name |
string | 예 | 소스 저장소 샤드의 이름. |
destination_storage_name |
string | 아니오 | 대상 저장소 샤드의 이름. 제공되지 않으면 저장소 가중치 기반으로 자동 선택됩니다. |
예제 요청:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type: application/json" \
--data '{"source_storage_name":"default"}' \
--url "https://gitlab.example.com/api/v4/snippet_repository_storage_moves"
예제 응답:
{
"message": "202 Accepted"
}