Snippetリポジトリストレージ移動API
- プラン: Free、Premium、Ultimate
- 提供形態: GitLab Self-Managed、GitLab Dedicated
このAPIを使用して、スニペットのリポジトリストレージの移動を管理します。このAPIは、例えばGitalyクラスターへの移行 (Praefect)を支援します。
スニペットのリポジトリストレージ移動が処理されると、異なる状態へ移行します。stateの値は次のとおりです:
initial: レコードは作成されましたが、バックグラウンドジョブはまだスケジュールされていません。scheduled: バックグラウンドジョブがスケジュールされました。started: スニペットリポジトリは、宛先ストレージにコピーされています。replicated: スニペットが移動されました。failed: スニペットリポジトリのコピーに失敗したか、チェックサムが一致しませんでした。finished: スニペットは移動され、ソースストレージ上のリポジトリは削除されました。cleanup failed: スニペットは移動されましたが、ソースストレージ上のリポジトリを削除できませんでした。
データ整合性を確保するため、移動中はスニペットが一時的に読み取り専用状態になります。この期間中、ユーザーが新しいコミットをプッシュしようとすると、The repository is temporarily read-only. Please try again later.メッセージを受け取ります。
このAPIを使用するには、管理者として認証する必要があります。
他のリポジトリの種類については、以下を参照してください:
すべてのスニペットリポジトリストレージ移動を一覧表示
すべてのスニペットリポジトリストレージ移動を一覧表示します。
GET /snippet_repository_storage_movesAPIの結果はページネーションされるため、デフォルトでは、GETリクエストは一度に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_movesAPIの結果はページネーションされるため、デフォルトでは、GETリクエストは一度に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": "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/: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": "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"
}
}スニペットのリポジトリストレージ移動をスケジュールする
指定したスニペットのリポジトリストレージ移動をスケジュールします。
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": "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"
}
}ストレージシャード上のすべてのスニペットのリポジトリストレージ移動をスケジュールする
ソースストレージシャードに保存されている各スニペットリポジトリのリポジトリストレージ移動をスケジュールします。このエンドポイントは、すべてのスニペットを一度に移行します。
POST /snippet_repository_storage_movesサポートされている属性は以下のとおりです:
| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
source_storage_name | 文字列 | はい | ソースストレージのシャードの名前。 |
destination_storage_name | 文字列 | いいえ | 移行先ストレージのシャードの名前。指定されない場合、ストレージはストレージのウェイトに基づいて自動的に選択されます。 |
リクエスト例:
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"
}