diff --git a/Cargo.lock b/Cargo.lock
index b0ac9bf0..20820f7d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1288,6 +1288,7 @@ dependencies = [
"tokio",
"tracing",
"tracing-subscriber",
+ "utoipa",
]
[[package]]
@@ -1318,6 +1319,7 @@ dependencies = [
"tokio",
"tracing",
"url",
+ "utoipa",
]
[[package]]
@@ -2272,6 +2274,7 @@ checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652"
dependencies = [
"equivalent",
"hashbrown 0.15.2",
+ "serde",
]
[[package]]
@@ -4768,6 +4771,29 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+[[package]]
+name = "utoipa"
+version = "5.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "435c6f69ef38c9017b4b4eea965dfb91e71e53d869e896db40d1cf2441dd75c0"
+dependencies = [
+ "indexmap 2.7.1",
+ "serde",
+ "serde_json",
+ "utoipa-gen",
+]
+
+[[package]]
+name = "utoipa-gen"
+version = "5.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a77d306bc75294fd52f3e99b13ece67c02c1a2789190a6f31d32f736624326f7"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.98",
+]
+
[[package]]
name = "uuid"
version = "1.4.1"
diff --git a/Cargo.toml b/Cargo.toml
index 4808cf1d..d1cae350 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -101,6 +101,7 @@ serde = { version = "1.0", default-features = false, features = ["derive", "rc"]
serde_bytes = "0.11"
serde_json = "1.0"
toml = { version = "0.8", default-features = false, features = ["parse"] }
+utoipa = "5.3.1"
# newer version requires rust edition 2021
k8s-openapi = { version = "0.21", features = ["v1_24"] }
diff --git a/doc/api/garage-admin-v0.html b/doc/api/garage-admin-v0.html
index dbdd9e1c..4949cc37 100644
--- a/doc/api/garage-admin-v0.html
+++ b/doc/api/garage-admin-v0.html
@@ -1,7 +1,7 @@
- Garage Adminstration API v0
+ Garage adminstration API v0
diff --git a/doc/api/garage-admin-v1.html b/doc/api/garage-admin-v1.html
index 783d459e..a9708e92 100644
--- a/doc/api/garage-admin-v1.html
+++ b/doc/api/garage-admin-v1.html
@@ -1,7 +1,7 @@
- Garage Adminstration API v0
+ Garage adminstration API v1
diff --git a/doc/api/garage-admin-v2.html b/doc/api/garage-admin-v2.html
index d93c2e7d..0911f205 100644
--- a/doc/api/garage-admin-v2.html
+++ b/doc/api/garage-admin-v2.html
@@ -1,7 +1,7 @@
- Garage Adminstration API v0
+ Garage adminstration API v2
@@ -18,7 +18,7 @@
-
+
diff --git a/doc/api/garage-admin-v2.json b/doc/api/garage-admin-v2.json
new file mode 100644
index 00000000..e7b42620
--- /dev/null
+++ b/doc/api/garage-admin-v2.json
@@ -0,0 +1,3306 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "title": "Garage administration API",
+ "description": "Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.\n\n*Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is early stage and can contain bugs, so be careful and please report any issues on our issue tracker.*",
+ "contact": {
+ "name": "The Garage team",
+ "url": "https://garagehq.deuxfleurs.fr/",
+ "email": "garagehq@deuxfleurs.fr"
+ },
+ "license": {
+ "name": "AGPL-3.0",
+ "identifier": "AGPL-3.0"
+ },
+ "version": "v2.0.0"
+ },
+ "servers": [
+ {
+ "url": "http://localhost:3903/",
+ "description": "A local server"
+ }
+ ],
+ "paths": {
+ "/v2/AddBucketAlias": {
+ "post": {
+ "tags": [
+ "Bucket alias"
+ ],
+ "description": "Add an alias for the target bucket. This can be either a global or a local alias, depending on which fields are specified.",
+ "operationId": "AddBucketAlias",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AddBucketAliasRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Returns exhaustive information about the bucket",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AddBucketAliasResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/AllowBucketKey": {
+ "post": {
+ "tags": [
+ "Permission"
+ ],
+ "description": "\n⚠️ **DISCLAIMER**: Garage's developers are aware that this endpoint has an unconventional semantic. Be extra careful when implementing it, its behavior is not obvious.\n\nAllows a key to do read/write/owner operations on a bucket.\n\nFlags in permissions which have the value true will be activated. Other flags will remain unchanged (ie. they will keep their internal value).\n\nFor example, if you set read to true, the key will be allowed to read the bucket.\nIf you set it to false, the key will keeps its previous read permission.\nIf you want to disallow read for the key, check the DenyBucketKey operation.\n ",
+ "operationId": "AllowBucketKey",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AllowBucketKeyRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Returns exhaustive information about the bucket",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AllowBucketKeyResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/ApplyClusterLayout": {
+ "post": {
+ "tags": [
+ "Cluster layout"
+ ],
+ "description": "\nApplies to the cluster the layout changes currently registered as staged layout changes.\n\n*Note: do not try to parse the `message` field of the response, it is given as an array of string specifically because its format is not stable.*\n ",
+ "operationId": "ApplyClusterLayout",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApplyClusterLayoutRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "The updated cluster layout has been applied in the cluster",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ApplyClusterLayoutResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/CleanupIncompleteUploads": {
+ "post": {
+ "tags": [
+ "Bucket"
+ ],
+ "description": "Removes all incomplete multipart uploads that are older than the specified number of seconds.",
+ "operationId": "CleanupIncompleteUploads",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CleanupIncompleteUploadsRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "The bucket was cleaned up successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CleanupIncompleteUploadsResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/ConnectClusterNodes": {
+ "post": {
+ "tags": [
+ "Cluster"
+ ],
+ "description": "Instructs this Garage node to connect to other Garage nodes at specified `@`. `node_id` is generated automatically on node start.",
+ "operationId": "ConnectClusterNodes",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ConnectClusterNodesRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "The request has been handled correctly but it does not mean that all connection requests succeeded; some might have fail, you need to check the body!",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ConnectClusterNodesResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/CreateBucket": {
+ "post": {
+ "tags": [
+ "Bucket"
+ ],
+ "description": "\nCreates a new bucket, either with a global alias, a local one, or no alias at all.\nTechnically, you can also specify both `globalAlias` and `localAlias` and that would create two aliases.\n ",
+ "operationId": "CreateBucket",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateBucketRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Returns exhaustive information about the bucket",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateBucketResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/CreateKey": {
+ "post": {
+ "tags": [
+ "Access key"
+ ],
+ "description": "Creates a new API access key.",
+ "operationId": "CreateKey",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateKeyRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Access key has been created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/CreateKeyResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/CreateMetadataSnapshot": {
+ "post": {
+ "tags": [
+ "Node"
+ ],
+ "description": "\nInstruct one or several nodes to take a snapshot of their metadata databases.\n ",
+ "operationId": "CreateMetadataSnapshot",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalCreateMetadataSnapshotResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/DeleteBucket": {
+ "post": {
+ "tags": [
+ "Bucket"
+ ],
+ "description": "\nDeletes a storage bucket. A bucket cannot be deleted if it is not empty.\n\n**Warning:** this will delete all aliases associated with the bucket!\n ",
+ "operationId": "DeleteBucket",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "ID of the bucket to delete",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Bucket has been deleted"
+ },
+ "400": {
+ "description": "Bucket is not empty"
+ },
+ "404": {
+ "description": "Bucket not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/DeleteKey": {
+ "post": {
+ "tags": [
+ "Access key"
+ ],
+ "description": "Delete a key from the cluster. Its access will be removed from all the buckets. Buckets are not automatically deleted and can be dangling. You should manually delete them before. ",
+ "operationId": "DeleteKey",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "Access key ID",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Access key has been deleted"
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/DenyBucketKey": {
+ "post": {
+ "tags": [
+ "Permission"
+ ],
+ "description": "\n⚠️ **DISCLAIMER**: Garage's developers are aware that this endpoint has an unconventional semantic. Be extra careful when implementing it, its behavior is not obvious.\n\nDenies a key from doing read/write/owner operations on a bucket.\n\nFlags in permissions which have the value true will be deactivated. Other flags will remain unchanged.\n\nFor example, if you set read to true, the key will be denied from reading.\nIf you set read to false, the key will keep its previous permissions.\nIf you want the key to have the reading permission, check the AllowBucketKey operation.\n ",
+ "operationId": "DenyBucketKey",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DenyBucketKeyRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Returns exhaustive information about the bucket",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DenyBucketKeyResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetBlockInfo": {
+ "post": {
+ "tags": [
+ "Block"
+ ],
+ "description": "\nGet detailed information about a data block stored on a Garage node, including all object versions and in-progress multipart uploads that contain a reference to this block.\n ",
+ "operationId": "GetBlockInfo",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LocalGetBlockInfoRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Detailed block information",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalGetBlockInfoResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetBucketInfo": {
+ "get": {
+ "tags": [
+ "Bucket"
+ ],
+ "description": "\nGiven a bucket identifier (`id`) or a global alias (`alias`), get its information.\nIt includes its aliases, its web configuration, keys that have some permissions\non it, some statistics (number of objects, size), number of dangling multipart uploads,\nand its quotas (if any).\n ",
+ "operationId": "GetBucketInfo",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "Exact bucket ID to look up",
+ "required": true
+ },
+ {
+ "name": "globalAlias",
+ "in": "path",
+ "description": "Global alias of bucket to look up",
+ "required": true
+ },
+ {
+ "name": "search",
+ "in": "path",
+ "description": "Partial ID or alias to search for",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Returns exhaustive information about the bucket",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetBucketInfoResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetClusterHealth": {
+ "get": {
+ "tags": [
+ "Cluster"
+ ],
+ "description": "Returns the global status of the cluster, the number of connected nodes (over the number of known ones), the number of healthy storage nodes (over the declared ones), and the number of healthy partitions (over the total).",
+ "operationId": "GetClusterHealth",
+ "responses": {
+ "200": {
+ "description": "Cluster health report",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetClusterHealthResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/v2/GetClusterLayout": {
+ "get": {
+ "tags": [
+ "Cluster layout"
+ ],
+ "description": "\nReturns the cluster's current layout, including:\n\n- Currently configured cluster layout\n- Staged changes to the cluster layout\n\n*Capacity is given in bytes*\n ",
+ "operationId": "GetClusterLayout",
+ "responses": {
+ "200": {
+ "description": "Current cluster layout",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetClusterLayoutResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetClusterStatistics": {
+ "get": {
+ "tags": [
+ "Cluster"
+ ],
+ "description": "\nFetch global cluster statistics.\n\n*Note: do not try to parse the `freeform` field of the response, it is given as a string specifically because its format is not stable.*\n ",
+ "operationId": "GetClusterStatistics",
+ "responses": {
+ "200": {
+ "description": "Global cluster statistics",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetClusterStatisticsResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetClusterStatus": {
+ "get": {
+ "tags": [
+ "Cluster"
+ ],
+ "description": "\nReturns the cluster's current status, including:\n\n- ID of the node being queried and its version of the Garage daemon\n- Live nodes\n- Currently configured cluster layout\n- Staged changes to the cluster layout\n\n*Capacity is given in bytes*\n ",
+ "operationId": "GetClusterStatus",
+ "responses": {
+ "200": {
+ "description": "Cluster status report",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetClusterStatusResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetKeyInfo": {
+ "get": {
+ "tags": [
+ "Access key"
+ ],
+ "description": "\nReturn information about a specific key like its identifiers, its permissions and buckets on which it has permissions.\nYou can search by specifying the exact key identifier (`id`) or by specifying a pattern (`search`).\n\nFor confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it.\n ",
+ "operationId": "GetKeyInfo",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "Access key ID",
+ "required": true
+ },
+ {
+ "name": "search",
+ "in": "path",
+ "description": "Partial key ID or name to search for",
+ "required": true
+ },
+ {
+ "name": "showSecretKey",
+ "in": "path",
+ "description": "Whether to return the secret access key",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Information about the access key",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/GetKeyInfoResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetNodeInfo": {
+ "get": {
+ "tags": [
+ "Node"
+ ],
+ "description": "\nReturn information about the Garage daemon running on one or several nodes.\n ",
+ "operationId": "GetNodeInfo",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalGetNodeInfoResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetNodeStatistics": {
+ "get": {
+ "tags": [
+ "Node"
+ ],
+ "description": "\nFetch statistics for one or several Garage nodes.\n\n*Note: do not try to parse the `freeform` field of the response, it is given as a string specifically because its format is not stable.*\n ",
+ "operationId": "GetNodeStatistics",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalGetNodeStatisticsResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetWorkerInfo": {
+ "post": {
+ "tags": [
+ "Worker"
+ ],
+ "description": "\nGet information about the specified background worker on one or several cluster nodes.\n ",
+ "operationId": "GetWorkerInfo",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LocalGetWorkerInfoRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalGetWorkerInfoResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/GetWorkerVariable": {
+ "post": {
+ "tags": [
+ "Worker"
+ ],
+ "description": "\nFetch values of one or several worker variables, from one or several cluster nodes.\n ",
+ "operationId": "GetWorkerVariable",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LocalGetWorkerVariableRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalGetWorkerVariableResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/ImportKey": {
+ "post": {
+ "tags": [
+ "Access key"
+ ],
+ "description": "\nImports an existing API key. This feature must only be used for migrations and backup restore.\n\n**Do not use it to generate custom key identifiers or you will break your Garage cluster.**\n ",
+ "operationId": "ImportKey",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ImportKeyRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Access key has been imported",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ImportKeyResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/LaunchRepairOperation": {
+ "post": {
+ "tags": [
+ "Node"
+ ],
+ "description": "\nLaunch a repair operation on one or several cluster nodes.\n ",
+ "operationId": "LaunchRepairOperation",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LocalLaunchRepairOperationRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalLaunchRepairOperationResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/ListBlockErrors": {
+ "get": {
+ "tags": [
+ "Block"
+ ],
+ "description": "\nList data blocks that are currently in an errored state on one or several Garage nodes.\n ",
+ "operationId": "ListBlockErrors",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalListBlockErrorsResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/ListBuckets": {
+ "get": {
+ "tags": [
+ "Bucket"
+ ],
+ "description": "List all the buckets on the cluster with their UUID and their global and local aliases.",
+ "operationId": "ListBuckets",
+ "responses": {
+ "200": {
+ "description": "Returns the UUID of all the buckets and all their aliases",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ListBucketsResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/ListKeys": {
+ "get": {
+ "tags": [
+ "Access key"
+ ],
+ "description": "Returns all API access keys in the cluster.",
+ "operationId": "ListKeys",
+ "responses": {
+ "200": {
+ "description": "Returns the key identifier (aka `AWS_ACCESS_KEY_ID`) and its associated, human friendly, name if any (otherwise return an empty string)",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ListKeysResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/ListWorkers": {
+ "post": {
+ "tags": [
+ "Worker"
+ ],
+ "description": "\nList background workers currently running on one or several cluster nodes.\n ",
+ "operationId": "ListWorkers",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LocalListWorkersRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalListWorkersResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/PurgeBlocks": {
+ "post": {
+ "tags": [
+ "Block"
+ ],
+ "description": "\nPurge references to one or several missing data blocks.\n\nThis will remove all objects and in-progress multipart uploads that contain the specified data block(s). The objects will be permanently deleted from the buckets in which they appear. Use with caution.\n ",
+ "operationId": "PurgeBlocks",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LocalPurgeBlocksRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalPurgeBlocksResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/RemoveBucketAlias": {
+ "post": {
+ "tags": [
+ "Bucket alias"
+ ],
+ "description": "Remove an alias for the target bucket. This can be either a global or a local alias, depending on which fields are specified.",
+ "operationId": "RemoveBucketAlias",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RemoveBucketAliasRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Returns exhaustive information about the bucket",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RemoveBucketAliasResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/RetryBlockResync": {
+ "post": {
+ "tags": [
+ "Block"
+ ],
+ "description": "\nInstruct Garage node(s) to retry the resynchronization of one or several missing data block(s).\n ",
+ "operationId": "RetryBlockResync",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LocalRetryBlockResyncRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalRetryBlockResyncResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/RevertClusterLayout": {
+ "post": {
+ "tags": [
+ "Cluster layout"
+ ],
+ "description": "Clear staged layout changes",
+ "operationId": "RevertClusterLayout",
+ "responses": {
+ "200": {
+ "description": "All pending changes to the cluster layout have been erased",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/RevertClusterLayoutResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/SetWorkerVariable": {
+ "post": {
+ "tags": [
+ "Worker"
+ ],
+ "description": "\nSet the value for a worker variable, on one or several cluster nodes.\n ",
+ "operationId": "SetWorkerVariable",
+ "parameters": [
+ {
+ "name": "node",
+ "in": "path",
+ "description": "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/LocalSetWorkerVariableRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Responses from individual cluster nodes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/MultiResponse_LocalSetWorkerVariableResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/UpdateBucket": {
+ "post": {
+ "tags": [
+ "Bucket"
+ ],
+ "description": "\nAll fields (`websiteAccess` and `quotas`) are optional.\nIf they are present, the corresponding modifications are applied to the bucket, otherwise nothing is changed.\n\nIn `websiteAccess`: if `enabled` is `true`, `indexDocument` must be specified.\nThe field `errorDocument` is optional, if no error document is set a generic\nerror message is displayed when errors happen. Conversely, if `enabled` is\n`false`, neither `indexDocument` nor `errorDocument` must be specified.\n\nIn `quotas`: new values of `maxSize` and `maxObjects` must both be specified, or set to `null`\nto remove the quotas. An absent value will be considered the same as a `null`. It is not possible\nto change only one of the two quotas.\n ",
+ "operationId": "UpdateBucket",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "ID of the bucket to update",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateBucketRequestBody"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Bucket has been updated",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateBucketResponse"
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Bucket not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/UpdateClusterLayout": {
+ "post": {
+ "tags": [
+ "Cluster layout"
+ ],
+ "description": "\nSend modifications to the cluster layout. These modifications will be included in the staged role changes, visible in subsequent calls of `GET /GetClusterHealth`. Once the set of staged changes is satisfactory, the user may call `POST /ApplyClusterLayout` to apply the changed changes, or `POST /RevertClusterLayout` to clear all of the staged changes in the layout.\n\nSetting the capacity to `null` will configure the node as a gateway.\nOtherwise, capacity must be now set in bytes (before Garage 0.9 it was arbitrary weights).\nFor example to declare 100GB, you must set `capacity: 100000000000`.\n\nGarage uses internally the International System of Units (SI), it assumes that 1kB = 1000 bytes, and displays storage as kB, MB, GB (and not KiB, MiB, GiB that assume 1KiB = 1024 bytes).\n ",
+ "operationId": "UpdateClusterLayout",
+ "requestBody": {
+ "description": "\nTo add a new node to the layout or to change the configuration of an existing node, simply set the values you want (`zone`, `capacity`, and `tags`).\nTo remove a node, simply pass the `remove: true` field.\nThis logic is represented in OpenAPI with a 'One Of' object.\n\nContrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.\n ",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateClusterLayoutRequest"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Proposed changes have been added to the list of pending changes",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateClusterLayoutResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/v2/UpdateKey": {
+ "post": {
+ "tags": [
+ "Access key"
+ ],
+ "description": "\nUpdates information about the specified API access key.\n\n*Note: the secret key is not returned in the response, `null` is sent instead.*\n ",
+ "operationId": "UpdateKey",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "description": "Access key ID",
+ "required": true
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateKeyRequestBody"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "Access key has been updated",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/UpdateKeyResponse"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "AddBucketAliasRequest": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BucketAliasEnum"
+ },
+ {
+ "type": "object",
+ "required": [
+ "bucketId"
+ ],
+ "properties": {
+ "bucketId": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ },
+ "AddBucketAliasResponse": {
+ "$ref": "#/components/schemas/GetBucketInfoResponse"
+ },
+ "AllowBucketKeyRequest": {
+ "$ref": "#/components/schemas/BucketKeyPermChangeRequest"
+ },
+ "AllowBucketKeyResponse": {
+ "$ref": "#/components/schemas/GetBucketInfoResponse"
+ },
+ "ApiBucketKeyPerm": {
+ "type": "object",
+ "properties": {
+ "owner": {
+ "type": "boolean"
+ },
+ "read": {
+ "type": "boolean"
+ },
+ "write": {
+ "type": "boolean"
+ }
+ }
+ },
+ "ApiBucketQuotas": {
+ "type": "object",
+ "properties": {
+ "maxObjects": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "int64",
+ "minimum": 0
+ },
+ "maxSize": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "ApplyClusterLayoutRequest": {
+ "type": "object",
+ "required": [
+ "version"
+ ],
+ "properties": {
+ "version": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "ApplyClusterLayoutResponse": {
+ "type": "object",
+ "required": [
+ "message",
+ "layout"
+ ],
+ "properties": {
+ "layout": {
+ "$ref": "#/components/schemas/GetClusterLayoutResponse"
+ },
+ "message": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "BlockError": {
+ "type": "object",
+ "required": [
+ "blockHash",
+ "refcount",
+ "errorCount",
+ "lastTrySecsAgo",
+ "nextTryInSecs"
+ ],
+ "properties": {
+ "blockHash": {
+ "type": "string"
+ },
+ "errorCount": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "lastTrySecsAgo": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "nextTryInSecs": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "refcount": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "BlockVersion": {
+ "type": "object",
+ "required": [
+ "versionId",
+ "deleted",
+ "garbageCollected"
+ ],
+ "properties": {
+ "backlink": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/BlockVersionBacklink"
+ }
+ ]
+ },
+ "deleted": {
+ "type": "boolean"
+ },
+ "garbageCollected": {
+ "type": "boolean"
+ },
+ "versionId": {
+ "type": "string"
+ }
+ }
+ },
+ "BlockVersionBacklink": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "object"
+ ],
+ "properties": {
+ "object": {
+ "type": "object",
+ "required": [
+ "bucketId",
+ "key"
+ ],
+ "properties": {
+ "bucketId": {
+ "type": "string"
+ },
+ "key": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "upload"
+ ],
+ "properties": {
+ "upload": {
+ "type": "object",
+ "required": [
+ "uploadId",
+ "uploadDeleted",
+ "uploadGarbageCollected"
+ ],
+ "properties": {
+ "bucketId": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "key": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "uploadDeleted": {
+ "type": "boolean"
+ },
+ "uploadGarbageCollected": {
+ "type": "boolean"
+ },
+ "uploadId": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ "BucketAliasEnum": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "globalAlias"
+ ],
+ "properties": {
+ "globalAlias": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "localAlias",
+ "accessKeyId"
+ ],
+ "properties": {
+ "accessKeyId": {
+ "type": "string"
+ },
+ "localAlias": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ },
+ "BucketKeyPermChangeRequest": {
+ "type": "object",
+ "required": [
+ "bucketId",
+ "accessKeyId",
+ "permissions"
+ ],
+ "properties": {
+ "accessKeyId": {
+ "type": "string"
+ },
+ "bucketId": {
+ "type": "string"
+ },
+ "permissions": {
+ "$ref": "#/components/schemas/ApiBucketKeyPerm"
+ }
+ }
+ },
+ "BucketLocalAlias": {
+ "type": "object",
+ "required": [
+ "accessKeyId",
+ "alias"
+ ],
+ "properties": {
+ "accessKeyId": {
+ "type": "string"
+ },
+ "alias": {
+ "type": "string"
+ }
+ }
+ },
+ "CleanupIncompleteUploadsRequest": {
+ "type": "object",
+ "required": [
+ "bucketId",
+ "olderThanSecs"
+ ],
+ "properties": {
+ "bucketId": {
+ "type": "string"
+ },
+ "olderThanSecs": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "CleanupIncompleteUploadsResponse": {
+ "type": "object",
+ "required": [
+ "uploadsDeleted"
+ ],
+ "properties": {
+ "uploadsDeleted": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "ConnectClusterNodesRequest": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ConnectClusterNodesResponse": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ConnectNodeResponse"
+ }
+ },
+ "ConnectNodeResponse": {
+ "type": "object",
+ "required": [
+ "success"
+ ],
+ "properties": {
+ "error": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "description": "An error message if Garage did not manage to connect to this node"
+ },
+ "success": {
+ "type": "boolean",
+ "description": "`true` if Garage managed to connect to this node"
+ }
+ }
+ },
+ "CreateBucketLocalAlias": {
+ "type": "object",
+ "required": [
+ "accessKeyId",
+ "alias"
+ ],
+ "properties": {
+ "accessKeyId": {
+ "type": "string"
+ },
+ "alias": {
+ "type": "string"
+ },
+ "allow": {
+ "$ref": "#/components/schemas/ApiBucketKeyPerm"
+ }
+ }
+ },
+ "CreateBucketRequest": {
+ "type": "object",
+ "properties": {
+ "globalAlias": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "localAlias": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/CreateBucketLocalAlias"
+ }
+ ]
+ }
+ }
+ },
+ "CreateBucketResponse": {
+ "$ref": "#/components/schemas/GetBucketInfoResponse"
+ },
+ "CreateKeyRequest": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ }
+ },
+ "CreateKeyResponse": {
+ "$ref": "#/components/schemas/GetKeyInfoResponse"
+ },
+ "DenyBucketKeyRequest": {
+ "$ref": "#/components/schemas/BucketKeyPermChangeRequest"
+ },
+ "DenyBucketKeyResponse": {
+ "$ref": "#/components/schemas/GetBucketInfoResponse"
+ },
+ "FreeSpaceResp": {
+ "type": "object",
+ "required": [
+ "available",
+ "total"
+ ],
+ "properties": {
+ "available": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "total": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "GetBucketInfoKey": {
+ "type": "object",
+ "required": [
+ "accessKeyId",
+ "name",
+ "permissions",
+ "bucketLocalAliases"
+ ],
+ "properties": {
+ "accessKeyId": {
+ "type": "string"
+ },
+ "bucketLocalAliases": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "name": {
+ "type": "string"
+ },
+ "permissions": {
+ "$ref": "#/components/schemas/ApiBucketKeyPerm"
+ }
+ }
+ },
+ "GetBucketInfoResponse": {
+ "type": "object",
+ "required": [
+ "id",
+ "globalAliases",
+ "websiteAccess",
+ "keys",
+ "objects",
+ "bytes",
+ "unfinishedUploads",
+ "unfinishedMultipartUploads",
+ "unfinishedMultipartUploadParts",
+ "unfinishedMultipartUploadBytes",
+ "quotas"
+ ],
+ "properties": {
+ "bytes": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Total number of bytes used by objects in this bucket"
+ },
+ "globalAliases": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "List of global aliases for this bucket"
+ },
+ "id": {
+ "type": "string",
+ "description": "Identifier of the bucket"
+ },
+ "keys": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/GetBucketInfoKey"
+ },
+ "description": "List of access keys that have permissions granted on this bucket"
+ },
+ "objects": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Number of objects in this bucket"
+ },
+ "quotas": {
+ "$ref": "#/components/schemas/ApiBucketQuotas",
+ "description": "Quotas that apply to this bucket"
+ },
+ "unfinishedMultipartUploadBytes": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Total number of bytes used by unfinished multipart uploads in this bucket"
+ },
+ "unfinishedMultipartUploadParts": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Number of parts in unfinished multipart uploads in this bucket"
+ },
+ "unfinishedMultipartUploads": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Number of unfinished multipart uploads in this bucket"
+ },
+ "unfinishedUploads": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Number of unfinished uploads in this bucket"
+ },
+ "websiteAccess": {
+ "type": "boolean",
+ "description": "Whether website acces is enabled for this bucket"
+ },
+ "websiteConfig": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/GetBucketInfoWebsiteResponse",
+ "description": "Website configuration for this bucket"
+ }
+ ]
+ }
+ }
+ },
+ "GetBucketInfoWebsiteResponse": {
+ "type": "object",
+ "required": [
+ "indexDocument"
+ ],
+ "properties": {
+ "errorDocument": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "indexDocument": {
+ "type": "string"
+ }
+ }
+ },
+ "GetClusterHealthResponse": {
+ "type": "object",
+ "required": [
+ "status",
+ "knownNodes",
+ "connectedNodes",
+ "storageNodes",
+ "storageNodesOk",
+ "partitions",
+ "partitionsQuorum",
+ "partitionsAllOk"
+ ],
+ "properties": {
+ "connectedNodes": {
+ "type": "integer",
+ "description": "the nubmer of nodes this Garage node currently has an open connection to",
+ "minimum": 0
+ },
+ "knownNodes": {
+ "type": "integer",
+ "description": "the number of nodes this Garage node has had a TCP connection to since the daemon started",
+ "minimum": 0
+ },
+ "partitions": {
+ "type": "integer",
+ "description": "the total number of partitions of the data (currently always 256)",
+ "minimum": 0
+ },
+ "partitionsAllOk": {
+ "type": "integer",
+ "description": "the number of partitions for which we are connected to all storage nodes responsible of storing it",
+ "minimum": 0
+ },
+ "partitionsQuorum": {
+ "type": "integer",
+ "description": "the number of partitions for which a quorum of write nodes is available",
+ "minimum": 0
+ },
+ "status": {
+ "type": "string",
+ "description": "One of `healthy`, `degraded` or `unavailable`:\n- `healthy`: Garage node is connected to all storage nodes\n- `degraded`: Garage node is not connected to all storage nodes, but a quorum of write nodes is available for all partitions\n- `unavailable`: a quorum of write nodes is not available for some partitions"
+ },
+ "storageNodes": {
+ "type": "integer",
+ "description": "the number of storage nodes currently registered in the cluster layout",
+ "minimum": 0
+ },
+ "storageNodesOk": {
+ "type": "integer",
+ "description": "the number of storage nodes to which a connection is currently open",
+ "minimum": 0
+ }
+ }
+ },
+ "GetClusterLayoutResponse": {
+ "type": "object",
+ "required": [
+ "version",
+ "roles",
+ "stagedRoleChanges"
+ ],
+ "properties": {
+ "roles": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/NodeRoleResp"
+ }
+ },
+ "stagedRoleChanges": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/NodeRoleChange"
+ }
+ },
+ "version": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "GetClusterStatisticsResponse": {
+ "type": "object",
+ "required": [
+ "freeform"
+ ],
+ "properties": {
+ "freeform": {
+ "type": "string"
+ }
+ }
+ },
+ "GetClusterStatusResponse": {
+ "type": "object",
+ "required": [
+ "layoutVersion",
+ "nodes"
+ ],
+ "properties": {
+ "layoutVersion": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "nodes": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/NodeResp"
+ }
+ }
+ }
+ },
+ "GetKeyInfoResponse": {
+ "type": "object",
+ "required": [
+ "name",
+ "accessKeyId",
+ "permissions",
+ "buckets"
+ ],
+ "properties": {
+ "accessKeyId": {
+ "type": "string"
+ },
+ "buckets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/KeyInfoBucketResponse"
+ }
+ },
+ "name": {
+ "type": "string"
+ },
+ "permissions": {
+ "$ref": "#/components/schemas/KeyPerm"
+ },
+ "secretAccessKey": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ }
+ },
+ "ImportKeyRequest": {
+ "type": "object",
+ "required": [
+ "accessKeyId",
+ "secretAccessKey"
+ ],
+ "properties": {
+ "accessKeyId": {
+ "type": "string"
+ },
+ "name": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "secretAccessKey": {
+ "type": "string"
+ }
+ }
+ },
+ "ImportKeyResponse": {
+ "$ref": "#/components/schemas/GetKeyInfoResponse"
+ },
+ "KeyInfoBucketResponse": {
+ "type": "object",
+ "required": [
+ "id",
+ "globalAliases",
+ "localAliases",
+ "permissions"
+ ],
+ "properties": {
+ "globalAliases": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "id": {
+ "type": "string"
+ },
+ "localAliases": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "permissions": {
+ "$ref": "#/components/schemas/ApiBucketKeyPerm"
+ }
+ }
+ },
+ "KeyPerm": {
+ "type": "object",
+ "properties": {
+ "createBucket": {
+ "type": "boolean"
+ }
+ }
+ },
+ "ListBucketsResponse": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ListBucketsResponseItem"
+ }
+ },
+ "ListBucketsResponseItem": {
+ "type": "object",
+ "required": [
+ "id",
+ "globalAliases",
+ "localAliases"
+ ],
+ "properties": {
+ "globalAliases": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "id": {
+ "type": "string"
+ },
+ "localAliases": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/BucketLocalAlias"
+ }
+ }
+ }
+ },
+ "ListKeysResponse": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/ListKeysResponseItem"
+ }
+ },
+ "ListKeysResponseItem": {
+ "type": "object",
+ "required": [
+ "id",
+ "name"
+ ],
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ },
+ "LocalCreateMetadataSnapshotResponse": {
+ "default": null
+ },
+ "LocalGetBlockInfoRequest": {
+ "type": "object",
+ "required": [
+ "blockHash"
+ ],
+ "properties": {
+ "blockHash": {
+ "type": "string"
+ }
+ }
+ },
+ "LocalGetBlockInfoResponse": {
+ "type": "object",
+ "required": [
+ "blockHash",
+ "refcount",
+ "versions"
+ ],
+ "properties": {
+ "blockHash": {
+ "type": "string"
+ },
+ "refcount": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "versions": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/BlockVersion"
+ }
+ }
+ }
+ },
+ "LocalGetNodeInfoResponse": {
+ "type": "object",
+ "required": [
+ "nodeId",
+ "garageVersion",
+ "rustVersion",
+ "dbEngine"
+ ],
+ "properties": {
+ "dbEngine": {
+ "type": "string"
+ },
+ "garageFeatures": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "type": "string"
+ }
+ },
+ "garageVersion": {
+ "type": "string"
+ },
+ "nodeId": {
+ "type": "string"
+ },
+ "rustVersion": {
+ "type": "string"
+ }
+ }
+ },
+ "LocalGetNodeStatisticsResponse": {
+ "type": "object",
+ "required": [
+ "freeform"
+ ],
+ "properties": {
+ "freeform": {
+ "type": "string"
+ }
+ }
+ },
+ "LocalGetWorkerInfoRequest": {
+ "type": "object",
+ "required": [
+ "id"
+ ],
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "LocalGetWorkerInfoResponse": {
+ "$ref": "#/components/schemas/WorkerInfoResp"
+ },
+ "LocalGetWorkerVariableRequest": {
+ "type": "object",
+ "properties": {
+ "variable": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ }
+ },
+ "LocalGetWorkerVariableResponse": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "LocalLaunchRepairOperationRequest": {
+ "type": "object",
+ "required": [
+ "repairType"
+ ],
+ "properties": {
+ "repairType": {
+ "$ref": "#/components/schemas/RepairType"
+ }
+ }
+ },
+ "LocalLaunchRepairOperationResponse": {
+ "default": null
+ },
+ "LocalListBlockErrorsResponse": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/BlockError"
+ }
+ },
+ "LocalListWorkersRequest": {
+ "type": "object",
+ "properties": {
+ "busyOnly": {
+ "type": "boolean"
+ },
+ "errorOnly": {
+ "type": "boolean"
+ }
+ }
+ },
+ "LocalListWorkersResponse": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/WorkerInfoResp"
+ }
+ },
+ "LocalPurgeBlocksRequest": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "LocalPurgeBlocksResponse": {
+ "type": "object",
+ "required": [
+ "blocksPurged",
+ "objectsDeleted",
+ "uploadsDeleted",
+ "versionsDeleted"
+ ],
+ "properties": {
+ "blocksPurged": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "objectsDeleted": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "uploadsDeleted": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "versionsDeleted": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "LocalRetryBlockResyncRequest": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "all"
+ ],
+ "properties": {
+ "all": {
+ "type": "boolean"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "blockHashes"
+ ],
+ "properties": {
+ "blockHashes": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ ]
+ },
+ "LocalRetryBlockResyncResponse": {
+ "type": "object",
+ "required": [
+ "count"
+ ],
+ "properties": {
+ "count": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "LocalSetWorkerVariableRequest": {
+ "type": "object",
+ "required": [
+ "variable",
+ "value"
+ ],
+ "properties": {
+ "value": {
+ "type": "string"
+ },
+ "variable": {
+ "type": "string"
+ }
+ }
+ },
+ "LocalSetWorkerVariableResponse": {
+ "type": "object",
+ "required": [
+ "variable",
+ "value"
+ ],
+ "properties": {
+ "value": {
+ "type": "string"
+ },
+ "variable": {
+ "type": "string"
+ }
+ }
+ },
+ "MultiResponse_LocalCreateMetadataSnapshotResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "default": null
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalGetBlockInfoResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "object",
+ "required": [
+ "blockHash",
+ "refcount",
+ "versions"
+ ],
+ "properties": {
+ "blockHash": {
+ "type": "string"
+ },
+ "refcount": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "versions": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/BlockVersion"
+ }
+ }
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalGetNodeInfoResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "object",
+ "required": [
+ "nodeId",
+ "garageVersion",
+ "rustVersion",
+ "dbEngine"
+ ],
+ "properties": {
+ "dbEngine": {
+ "type": "string"
+ },
+ "garageFeatures": {
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "type": "string"
+ }
+ },
+ "garageVersion": {
+ "type": "string"
+ },
+ "nodeId": {
+ "type": "string"
+ },
+ "rustVersion": {
+ "type": "string"
+ }
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalGetNodeStatisticsResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "object",
+ "required": [
+ "freeform"
+ ],
+ "properties": {
+ "freeform": {
+ "type": "string"
+ }
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalGetWorkerInfoResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "$ref": "#/components/schemas/WorkerInfoResp"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalGetWorkerVariableResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalLaunchRepairOperationResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "default": null
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalListBlockErrorsResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/BlockError"
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalListWorkersResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/WorkerInfoResp"
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalPurgeBlocksResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "object",
+ "required": [
+ "blocksPurged",
+ "objectsDeleted",
+ "uploadsDeleted",
+ "versionsDeleted"
+ ],
+ "properties": {
+ "blocksPurged": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "objectsDeleted": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "uploadsDeleted": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "versionsDeleted": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalRetryBlockResyncResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "object",
+ "required": [
+ "count"
+ ],
+ "properties": {
+ "count": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "MultiResponse_LocalSetWorkerVariableResponse": {
+ "type": "object",
+ "required": [
+ "success",
+ "error"
+ ],
+ "properties": {
+ "error": {
+ "type": "object",
+ "description": "Map of node id to error message, for nodes that were unable to complete the API\ncall",
+ "additionalProperties": {
+ "type": "string"
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ },
+ "success": {
+ "type": "object",
+ "description": "Map of node id to response returned by this node, for nodes that were able to\nsuccessfully complete the API call",
+ "additionalProperties": {
+ "type": "object",
+ "required": [
+ "variable",
+ "value"
+ ],
+ "properties": {
+ "value": {
+ "type": "string"
+ },
+ "variable": {
+ "type": "string"
+ }
+ }
+ },
+ "propertyNames": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "NodeResp": {
+ "type": "object",
+ "required": [
+ "id",
+ "isUp",
+ "draining"
+ ],
+ "properties": {
+ "addr": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "dataPartition": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/FreeSpaceResp"
+ }
+ ]
+ },
+ "draining": {
+ "type": "boolean"
+ },
+ "hostname": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "id": {
+ "type": "string"
+ },
+ "isUp": {
+ "type": "boolean"
+ },
+ "lastSeenSecsAgo": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "int64",
+ "minimum": 0
+ },
+ "metadataPartition": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/FreeSpaceResp"
+ }
+ ]
+ },
+ "role": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/NodeRoleResp"
+ }
+ ]
+ }
+ }
+ },
+ "NodeRoleChange": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/NodeRoleChangeEnum"
+ },
+ {
+ "type": "object",
+ "required": [
+ "id"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "ID of the node for which this change applies"
+ }
+ }
+ }
+ ]
+ },
+ "NodeRoleChangeEnum": {
+ "oneOf": [
+ {
+ "type": "object",
+ "required": [
+ "remove"
+ ],
+ "properties": {
+ "remove": {
+ "type": "boolean",
+ "description": "Set `remove` to `true` to remove the node from the layout"
+ }
+ }
+ },
+ {
+ "type": "object",
+ "required": [
+ "zone",
+ "tags"
+ ],
+ "properties": {
+ "capacity": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "int64",
+ "description": "New capacity (in bytes) of the node",
+ "minimum": 0
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "New tags of the node"
+ },
+ "zone": {
+ "type": "string",
+ "description": "New zone of the node"
+ }
+ }
+ }
+ ]
+ },
+ "NodeRoleResp": {
+ "type": "object",
+ "required": [
+ "id",
+ "zone",
+ "tags"
+ ],
+ "properties": {
+ "capacity": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "int64",
+ "minimum": 0
+ },
+ "id": {
+ "type": "string"
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "zone": {
+ "type": "string"
+ }
+ }
+ },
+ "RemoveBucketAliasRequest": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/BucketAliasEnum"
+ },
+ {
+ "type": "object",
+ "required": [
+ "bucketId"
+ ],
+ "properties": {
+ "bucketId": {
+ "type": "string"
+ }
+ }
+ }
+ ]
+ },
+ "RemoveBucketAliasResponse": {
+ "$ref": "#/components/schemas/GetBucketInfoResponse"
+ },
+ "RepairType": {
+ "oneOf": [
+ {
+ "type": "string",
+ "enum": [
+ "tables"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "blocks"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "versions"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "multipartUploads"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "blockRefs"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "blockRc"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "rebalance"
+ ]
+ },
+ {
+ "type": "object",
+ "required": [
+ "scrub"
+ ],
+ "properties": {
+ "scrub": {
+ "$ref": "#/components/schemas/ScrubCommand"
+ }
+ }
+ }
+ ]
+ },
+ "RevertClusterLayoutResponse": {
+ "$ref": "#/components/schemas/GetClusterLayoutResponse"
+ },
+ "ScrubCommand": {
+ "type": "string",
+ "enum": [
+ "start",
+ "pause",
+ "resume",
+ "cancel"
+ ]
+ },
+ "UpdateBucketRequestBody": {
+ "type": "object",
+ "properties": {
+ "quotas": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/ApiBucketQuotas"
+ }
+ ]
+ },
+ "websiteAccess": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/UpdateBucketWebsiteAccess"
+ }
+ ]
+ }
+ }
+ },
+ "UpdateBucketResponse": {
+ "$ref": "#/components/schemas/GetBucketInfoResponse"
+ },
+ "UpdateBucketWebsiteAccess": {
+ "type": "object",
+ "required": [
+ "enabled"
+ ],
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ },
+ "errorDocument": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "indexDocument": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ }
+ },
+ "UpdateClusterLayoutRequest": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/NodeRoleChange"
+ }
+ },
+ "UpdateClusterLayoutResponse": {
+ "$ref": "#/components/schemas/GetClusterLayoutResponse"
+ },
+ "UpdateKeyRequestBody": {
+ "type": "object",
+ "properties": {
+ "allow": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/KeyPerm"
+ }
+ ]
+ },
+ "deny": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/KeyPerm"
+ }
+ ]
+ },
+ "name": {
+ "type": [
+ "string",
+ "null"
+ ]
+ }
+ }
+ },
+ "UpdateKeyResponse": {
+ "$ref": "#/components/schemas/GetKeyInfoResponse"
+ },
+ "WorkerInfoResp": {
+ "type": "object",
+ "required": [
+ "id",
+ "name",
+ "state",
+ "errors",
+ "consecutiveErrors",
+ "freeform"
+ ],
+ "properties": {
+ "consecutiveErrors": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "errors": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "freeform": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "id": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ },
+ "lastError": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/WorkerLastError"
+ }
+ ]
+ },
+ "name": {
+ "type": "string"
+ },
+ "persistentErrors": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "int64",
+ "minimum": 0
+ },
+ "progress": {
+ "type": [
+ "string",
+ "null"
+ ]
+ },
+ "queueLength": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "int64",
+ "minimum": 0
+ },
+ "state": {
+ "$ref": "#/components/schemas/WorkerStateResp"
+ },
+ "tranquility": {
+ "type": [
+ "integer",
+ "null"
+ ],
+ "format": "int32",
+ "minimum": 0
+ }
+ }
+ },
+ "WorkerLastError": {
+ "type": "object",
+ "required": [
+ "message",
+ "secsAgo"
+ ],
+ "properties": {
+ "message": {
+ "type": "string"
+ },
+ "secsAgo": {
+ "type": "integer",
+ "format": "int64",
+ "minimum": 0
+ }
+ }
+ },
+ "WorkerStateResp": {
+ "oneOf": [
+ {
+ "type": "string",
+ "enum": [
+ "busy"
+ ]
+ },
+ {
+ "type": "object",
+ "required": [
+ "throttled"
+ ],
+ "properties": {
+ "throttled": {
+ "type": "object",
+ "required": [
+ "durationSecs"
+ ],
+ "properties": {
+ "durationSecs": {
+ "type": "number",
+ "format": "float"
+ }
+ }
+ }
+ }
+ },
+ {
+ "type": "string",
+ "enum": [
+ "idle"
+ ]
+ },
+ {
+ "type": "string",
+ "enum": [
+ "done"
+ ]
+ }
+ ]
+ }
+ },
+ "securitySchemes": {
+ "bearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ }
+ }
+ },
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ]
+}
diff --git a/doc/api/garage-admin-v2.yml b/doc/api/garage-admin-v2.yml
deleted file mode 100644
index 739b4166..00000000
--- a/doc/api/garage-admin-v2.yml
+++ /dev/null
@@ -1,1312 +0,0 @@
-openapi: 3.0.0
-info:
- version: v2.0.0
- title: Garage Administration API v0+garage-v2.0.0
- description: |
- Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.
-
- *Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!*
-paths:
- /GetClusterHealth:
- get:
- tags:
- - Nodes
- operationId: "GetClusterHealth"
- summary: "Cluster health report"
- description: |
- Returns the global status of the cluster, the number of connected nodes (over the number of known ones), the number of healthy storage nodes (over the declared ones), and the number of healthy partitions (over the total).
- responses:
- '500':
- description: |
- The server can not answer your request because it is in a bad state
- '200':
- description: |
- Information about the queried node, its environment and the current layout
- content:
- application/json:
- schema:
- type: object
- required: [ status, knownNodes, connectedNodes, storageNodes, storageNodesOk, partitions, partitionsQuorum, partitionsAllOk ]
- properties:
- status:
- type: string
- example: "healthy"
- knownNodes:
- type: integer
- format: int64
- example: 4
- connectedNodes:
- type: integer
- format: int64
- example: 4
- storageNodes:
- type: integer
- format: int64
- example: 3
- storageNodesOk:
- type: integer
- format: int64
- example: 3
- partitions:
- type: integer
- format: int64
- example: 256
- partitionsQuorum:
- type: integer
- format: int64
- example: 256
- partitionsAllOk:
- type: integer
- format: int64
- example: 256
- /GetClusterStatus:
- get:
- tags:
- - Nodes
- operationId: "GetClusterStatus"
- summary: "Describe cluster"
- description: |
- Returns the cluster's current status, including:
- - ID of the node being queried and its version of the Garage daemon
- - Live nodes
- - Currently configured cluster layout
- - Staged changes to the cluster layout
-
- *Capacity is given in bytes*
- responses:
- '500':
- description: |
- The server can not answer your request because it is in a bad state
- '200':
- description: |
- Information about the queried node, its environment and the current layout
- content:
- application/json:
- schema:
- type: object
- required: [ layoutVersion, nodes ]
- properties:
- layoutVersion:
- type: integer
- example: 1
- nodes:
- type: array
- example:
- - id: "ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f"
- addr: "10.0.0.11:3901"
- isUp: true
- lastSeenSecsAgo: 9
- hostname: orion
- - id: "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff"
- addr: "10.0.0.12:3901"
- isUp: true
- lastSeenSecsAgo: 13
- hostname: pegasus
- - id: "e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b"
- addr: "10.0.0.13:3901"
- isUp: true
- lastSeenSecsAgo: 2
- hostname: neptune
- items:
- $ref: '#/components/schemas/NodeNetworkInfo'
-
- /ConnectClusterNodes:
- post:
- tags:
- - Nodes
- operationId: "ConnectClusterNodes"
- summary: "Connect a new node"
- description: |
- Instructs this Garage node to connect to other Garage nodes at specified `@`. `node_id` is generated automatically on node start.
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: array
- example:
- - "ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f@10.0.0.11:3901"
- - "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff@10.0.0.12:3901"
- items:
- type: string
-
- responses:
- '500':
- description: |
- The server can not answer your request because it is in a bad state
- '400':
- description: |
- Your request is malformed, check your JSON
- '200':
- description: |
- The request has been handled correctly but it does not mean that all connection requests succeeded; some might have fail, you need to check the body!
- content:
- application/json:
- schema:
- type: array
- example:
- - success: true
- error:
- - success: false
- error: "Handshake error"
- items:
- type: object
- properties:
- success:
- type: boolean
- example: true
- error:
- type: string
- nullable: true
- example: null
-
- /GetClusterLayout:
- get:
- tags:
- - Layout
- operationId: "GetClusterLayout"
- summary: "Details on the current and staged layout"
- description: |
- Returns the cluster's current layout, including:
- - Currently configured cluster layout
- - Staged changes to the cluster layout
-
- *Capacity is given in bytes*
- *The info returned by this endpoint is a subset of the info returned by `GET /GetClusterStatus`.*
- responses:
- '500':
- description: |
- The server can not answer your request because it is in a bad state
- '200':
- description: |
- Returns the cluster's current cluster layout:
- - Currently configured cluster layout
- - Staged changes to the cluster layout
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ClusterLayout'
-
- /UpdateClusterLayout:
- post:
- tags:
- - Layout
- operationId: "UpdateClusterLayout"
- summary: "Send modifications to the cluster layout"
- description: |
- Send modifications to the cluster layout. These modifications will be included in the staged role changes, visible in subsequent calls of `GET /GetClusterHealth`. Once the set of staged changes is satisfactory, the user may call `POST /ApplyClusterLayout` to apply the changed changes, or `POST /RevertClusterLayout` to clear all of the staged changes in the layout.
-
- Setting the capacity to `null` will configure the node as a gateway.
- Otherwise, capacity must be now set in bytes (before Garage 0.9 it was arbitrary weights).
- For example to declare 100GB, you must set `capacity: 100000000000`.
-
- Garage uses internally the International System of Units (SI), it assumes that 1kB = 1000 bytes, and displays storage as kB, MB, GB (and not KiB, MiB, GiB that assume 1KiB = 1024 bytes).
- requestBody:
- description: |
- To add a new node to the layout or to change the configuration of an existing node, simply set the values you want (`zone`, `capacity`, and `tags`).
- To remove a node, simply pass the `remove: true` field.
- This logic is represented in OpenAPI with a "One Of" object.
-
- Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
- required: true
- content:
- application/json:
- schema:
- type: array
- example:
- - id: "e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b"
- zone: "geneva"
- capacity: 100000000000
- tags:
- - gateway
- - id: "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff"
- remove: true
- items:
- $ref: '#/components/schemas/NodeRoleChange'
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Invalid syntax or requested change"
- '200':
- description: "The layout modification has been correctly staged"
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ClusterLayout'
-
- /ApplyClusterLayout:
- post:
- tags:
- - Layout
- operationId: "ApplyClusterLayout"
- summary: "Apply staged layout"
- description: |
- Applies to the cluster the layout changes currently registered as staged layout changes.
-
- *Note: do not try to parse the `message` field of the response, it is given as an array of string specifically because its format is not stable.*
- requestBody:
- description: |
- Similarly to the CLI, the body must include the version of the new layout that will be created, which MUST be 1 + the value of the currently existing layout in the cluster.
- required: true
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/LayoutVersion'
-
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Invalid syntax or requested change"
- '200':
- description: "The staged layout has been applied as the new layout of the cluster, a rebalance has been triggered."
- content:
- application/json:
- schema:
- type: object
- required: [ message, layout ]
- properties:
- message:
- type: array
- items:
- type: string
- example:
- - "==== COMPUTATION OF A NEW PARTITION ASSIGNATION ===="
- - ""
- - "Partitions are replicated 1 times on at least 1 distinct zones."
- - ""
- - "Optimal partition size: 419.4 MB (3 B in previous layout)"
- - "Usable capacity / total cluster capacity: 107.4 GB / 107.4 GB (100.0 %)"
- - "Effective capacity (replication factor 1): 107.4 GB"
- - ""
- - "A total of 0 new copies of partitions need to be transferred."
- - ""
- - "dc1 Tags Partitions Capacity Usable capacity\n 6a8e08af2aab1083 a,v 256 (0 new) 107.4 GB 107.4 GB (100.0%)\n TOTAL 256 (256 unique) 107.4 GB 107.4 GB (100.0%)\n\n"
- layout:
- $ref: '#/components/schemas/ClusterLayout'
-
-
- /RevertClusterLayout:
- post:
- tags:
- - Layout
- operationId: "RevertClusterLayout"
- summary: "Clear staged layout"
- description: |
- Clears all of the staged layout changes.
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Invalid syntax or requested change"
- '200':
- description: "The staged layout has been cleared, you can start again sending modification from a fresh copy with `POST /UpdateClusterLayout`."
-
- /ListKeys:
- get:
- tags:
- - Key
- operationId: "ListKeys"
- summary: "List all keys"
- description: |
- Returns all API access keys in the cluster.
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '200':
- description: |
- Returns the key identifier (aka `AWS_ACCESS_KEY_ID`) and its associated, human friendly, name if any (otherwise return an empty string)
- content:
- application/json:
- schema:
- type: array
- example:
- - id: "GK31c2f218a2e44f485b94239e"
- name: "test-key"
- - id: "GKe10061ac9c2921f09e4c5540"
- name: ""
- items:
- type: object
- required: [ id ]
- properties:
- id:
- type: string
- name:
- type: string
-
- /CreateKey:
- post:
- tags:
- - Key
- operationId: "CreateKey"
- summary: "Create a new API key"
- description: |
- Creates a new API access key.
- requestBody:
- description: |
- You can set a friendly name for this key.
- If you don't want to, you can set the name to `null`.
-
- *Note: the secret key is returned in the response.*
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- name:
- type: string
- nullable: true
- example: "test-key"
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Invalid syntax or requested change"
- '200':
- description: "The key has been added"
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/KeyInfo'
-
- /GetKeyInfo:
- get:
- tags:
- - Key
- operationId: "GetKeyInfo"
- summary: "Get key information"
- description: |
- Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions.
- You can search by specifying the exact key identifier (`id`) or by specifying a pattern (`search`).
-
- For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it.
- parameters:
- - name: id
- in: query
- description: |
- The exact API access key generated by Garage.
-
- Incompatible with `search`.
- example: "GK31c2f218a2e44f485b94239e"
- schema:
- type: string
- - name: search
- in: query
- description: |
- A pattern (beginning or full string) corresponding to a key identifier or friendly name.
-
- Incompatible with `id`.
- example: "test-k"
- schema:
- type: string
- - name: showSecretKey
- in: query
- schema:
- type: string
- default: "false"
- enum:
- - "false"
- - "true"
- example: "false"
- required: false
- description: "Wether or not the secret key should be returned in the response"
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '200':
- description: |
- Returns information about the key
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/KeyInfo'
-
- /DeleteKey:
- post:
- tags:
- - Key
- operationId: "DeleteKey"
- summary: "Delete a key"
- description: |
- Delete a key from the cluster. Its access will be removed from all the buckets. Buckets are not automatically deleted and can be dangling. You should manually delete them before.
- parameters:
- - name: id
- in: query
- required: true
- description: "The exact API access key generated by Garage"
- example: "GK31c2f218a2e44f485b94239e"
- schema:
- type: string
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '200':
- description: "The key has been deleted"
-
-
- /UpdateKey:
- post:
- tags:
- - Key
- operationId: "UpdateKey"
- summary: "Update a key"
- description: |
- Updates information about the specified API access key.
-
- *Note: the secret key is not returned in the response, `null` is sent instead.*
- parameters:
- - name: id
- in: query
- required: true
- description: "The exact API access key generated by Garage"
- example: "GK31c2f218a2e44f485b94239e"
- schema:
- type: string
- requestBody:
- description: |
- For a given key, provide a first set with the permissions to grant, and a second set with the permissions to remove
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- name:
- type: string
- example: "test-key"
- allow:
- type: object
- example:
- properties:
- createBucket:
- type: boolean
- example: true
- deny:
- type: object
- properties:
- createBucket:
- type: boolean
- example: true
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Invalid syntax or requested change"
- '200':
- description: |
- Returns information about the key
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/KeyInfo'
-
-
- /ImportKey:
- post:
- tags:
- - Key
- operationId: "ImportKey"
- summary: "Import an existing key"
- description: |
- Imports an existing API key. This feature must only be used for migrations and backup restore.
-
- **Do not use it to generate custom key identifiers or you will break your Garage cluster.**
- requestBody:
- description: |
- Information on the key to import
- required: true
- content:
- application/json:
- schema:
- type: object
- required: [ name, accessKeyId, secretAccessKey ]
- properties:
- name:
- type: string
- example: "test-key"
- nullable: true
- accessKeyId:
- type: string
- example: "GK31c2f218a2e44f485b94239e"
- secretAccessKey:
- type: string
- example: "b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835"
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Invalid syntax or requested change"
- '200':
- description: "The key has been imported into the system"
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/KeyInfo'
-
- /ListBuckets:
- get:
- tags:
- - Bucket
- operationId: "ListBuckets"
- summary: "List all buckets"
- description: |
- List all the buckets on the cluster with their UUID and their global and local aliases.
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '200':
- description: |
- Returns the UUID of the bucket and all its aliases
- content:
- application/json:
- schema:
- type: array
- example:
- - id: "70dc3bed7fe83a75e46b66e7ddef7d56e65f3c02f9f80b6749fb97eccb5e1033"
- globalAliases:
- - "container_registry"
- - id: "96470e0df00ec28807138daf01915cfda2bee8eccc91dea9558c0b4855b5bf95"
- localAliases:
- - alias: "my_documents"
- accessKeyid: "GK31c2f218a2e44f485b94239e"
- - id: "d7452a935e663fc1914f3a5515163a6d3724010ce8dfd9e4743ca8be5974f995"
- globalAliases:
- - "example.com"
- - "www.example.com"
- localAliases:
- - alias: "corp_website"
- accessKeyId: "GKe10061ac9c2921f09e4c5540"
- - alias: "web"
- accessKeyid: "GK31c2f218a2e44f485b94239e"
- - id: ""
- items:
- type: object
- required: [ id ]
- properties:
- id:
- type: string
- globalAliases:
- type: array
- items:
- type: string
- localAliases:
- type: array
- items:
- type: object
- required: [ alias, accessKeyId ]
- properties:
- alias:
- type: string
- accessKeyId:
- type: string
-
- /CreateBucket:
- post:
- tags:
- - Bucket
- operationId: "CreateBucket"
- summary: "Create a bucket"
- description: |
- Creates a new bucket, either with a global alias, a local one, or no alias at all.
- Technically, you can also specify both `globalAlias` and `localAlias` and that would create two aliases.
- requestBody:
- description: |
- Aliases to put on the new bucket
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- globalAlias:
- type: string
- example: "my_documents"
- localAlias:
- type: object
- properties:
- accessKeyId:
- type: string
- alias:
- type: string
- allow:
- type: object
- properties:
- read:
- type: boolean
- example: true
- write:
- type: boolean
- example: true
- owner:
- type: boolean
- example: true
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "The payload is not formatted correctly"
- '200':
- description: Returns exhaustive information about the bucket
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/BucketInfo'
-
- /GetBucketInfo:
- get:
- tags:
- - Bucket
- operationId: "GetBucketInfo"
- summary: "Get a bucket"
- description: |
- Given a bucket identifier (`id`) or a global alias (`alias`), get its information.
- It includes its aliases, its web configuration, keys that have some permissions
- on it, some statistics (number of objects, size), number of dangling multipart uploads,
- and its quotas (if any).
- parameters:
- - name: id
- in: query
- description: |
- The exact bucket identifier, a 32 bytes hexadecimal string.
-
- Incompatible with `alias`.
- example: "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87"
- schema:
- type: string
- - name: alias
- in: query
- description: |
- The exact global alias of one of the existing buckets.
-
- Incompatible with `id`.
- example: "my_documents"
- schema:
- type: string
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '404':
- description: "Bucket not found"
- '200':
- description: Returns exhaustive information about the bucket
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/BucketInfo'
-
-
- /DeleteBucket:
- post:
- tags:
- - Bucket
- operationId: "DeleteBucket"
- summary: "Delete a bucket"
- description: |
- Delete a bucket.Deletes a storage bucket. A bucket cannot be deleted if it is not empty.
-
- **Warning:** this will delete all aliases associated with the bucket!
- parameters:
- - name: id
- in: query
- required: true
- description: "The exact bucket identifier, a 32 bytes hexadecimal string"
- example: "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87"
- schema:
- type: string
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Bucket is not empty"
- '404':
- description: "Bucket not found"
- '200':
- description: Bucket has been deleted
-
-
-
- /UpdateBucket:
- post:
- tags:
- - Bucket
- operationId: "UpdateBucket"
- summary: "Update a bucket"
- description: |
- All fields (`websiteAccess` and `quotas`) are optional.
- If they are present, the corresponding modifications are applied to the bucket, otherwise nothing is changed.
-
- In `websiteAccess`: if `enabled` is `true`, `indexDocument` must be specified.
- The field `errorDocument` is optional, if no error document is set a generic
- error message is displayed when errors happen. Conversely, if `enabled` is
- `false`, neither `indexDocument` nor `errorDocument` must be specified.
-
- In `quotas`: new values of `maxSize` and `maxObjects` must both be specified, or set to `null`
- to remove the quotas. An absent value will be considered the same as a `null`. It is not possible
- to change only one of the two quotas.
- parameters:
- - name: id
- in: query
- required: true
- description: "The exact bucket identifier, a 32 bytes hexadecimal string"
- example: "b4018dc61b27ccb5c64ec1b24f53454bbbd180697c758c4d47a22a8921864a87"
- schema:
- type: string
- requestBody:
- description: |
- Requested changes on the bucket. Both root fields are optionals.
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- websiteAccess:
- type: object
- properties:
- enabled:
- type: boolean
- example: true
- indexDocument:
- type: string
- example: "index.html"
- errorDocument:
- type: string
- example: "error/400.html"
- quotas:
- type: object
- properties:
- maxSize:
- type: integer
- format: int64
- nullable: true
- example: 19029801
- maxObjects:
- type: integer
- format: int64
- nullable: true
- example: null
-
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Bad request, check your body."
- '404':
- description: "Bucket not found"
- '200':
- description: Returns exhaustive information about the bucket
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/BucketInfo'
-
- /CleanupIncompleteUploads:
- post:
- tags:
- - Bucket
- operationId: "CleanupIncompleteUploads"
- summary: "Cleanup incomplete uploads in a bucket"
- description: |
- Cleanup all incomplete uploads in a bucket that are older than a specified number of seconds
- requestBody:
- description: |
- Bucket id and minimum age of uploads to delete (in seconds)
- required: true
- content:
- application/json:
- schema:
- type: object
- required: [bucketId, olderThanSecs]
- properties:
- bucketId:
- type: string
- example: "e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b"
- olderThanSecs:
- type: integer
- example: "3600"
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "The payload is not formatted correctly"
- '200':
- description: "The bucket was cleaned up successfully"
- content:
- application/json:
- schema:
- type: object
- properties:
- uploadsDeleted:
- type: integer
- example: 12
-
- /AllowBucketKey:
- post:
- tags:
- - Permissions
- operationId: "AllowBucketKey"
- summary: "Allow key"
- description: |
- ⚠️ **DISCLAIMER**: Garage's developers are aware that this endpoint has an unconventional semantic. Be extra careful when implementing it, its behavior is not obvious.
-
- Allows a key to do read/write/owner operations on a bucket.
-
- Flags in permissions which have the value true will be activated. Other flags will remain unchanged (ie. they will keep their internal value).
-
- For example, if you set read to true, the key will be allowed to read the bucket.
- If you set it to false, the key will keeps its previous read permission.
- If you want to disallow read for the key, check the DenyBucketKey operation.
-
- requestBody:
- description: |
- Aliases to put on the new bucket
- required: true
- content:
- application/json:
- schema:
- type: object
- required: [ bucketId, accessKeyId, permissions ]
- properties:
- bucketId:
- type: string
- example: "e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b"
- accessKeyId:
- type: string
- example: "GK31c2f218a2e44f485b94239e"
- permissions:
- type: object
- required: [ read, write, owner ]
- properties:
- read:
- type: boolean
- example: true
- write:
- type: boolean
- example: true
- owner:
- type: boolean
- example: true
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Bad request, check your request body"
- '404':
- description: "Bucket not found"
- '200':
- description: Returns exhaustive information about the bucket
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/BucketInfo'
-
- /DenyBucketKey:
- post:
- tags:
- - Permissions
- operationId: "DenyBucketKey"
- summary: "Deny key"
- description: |
- ⚠️ **DISCLAIMER**: Garage's developers are aware that this endpoint has an unconventional semantic. Be extra careful when implementing it, its behavior is not obvious.
-
- Denies a key from doing read/write/owner operations on a bucket.
-
- Flags in permissions which have the value true will be deactivated. Other flags will remain unchanged.
-
- For example, if you set read to true, the key will be denied from reading.
- If you set read to false, the key will keep its previous permissions.
- If you want the key to have the reading permission, check the AllowBucketKey operation.
-
- requestBody:
- description: |
- Aliases to put on the new bucket
- required: true
- content:
- application/json:
- schema:
- type: object
- required: [ bucketId, accessKeyId, permissions ]
- properties:
- bucketId:
- type: string
- example: "e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b"
- accessKeyId:
- type: string
- example: "GK31c2f218a2e44f485b94239e"
- permissions:
- type: object
- required: [ read, write, owner ]
- properties:
- read:
- type: boolean
- example: true
- write:
- type: boolean
- example: true
- owner:
- type: boolean
- example: true
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Bad request, check your request body"
- '404':
- description: "Bucket not found"
- '200':
- description: Returns exhaustive information about the bucket
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/BucketInfo'
-
- /AddBucketAlias:
- post:
- tags:
- - Bucket aliases
- operationId: "AddBucketAlias"
- summary: "Add an alias to a bucket"
- description: |
- Add an alias for the target bucket.
- This can be a local alias if `accessKeyId` is specified,
- or a global alias otherwise.
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- required: [bucketId]
- properties:
- bucketId:
- type: string
- example: e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b
- globalAlias:
- type: string
- localAlias:
- type: string
- example: my_documents
- accessKeyId:
- type: string
- example: GK31c2f218a2e44f485b94239e
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Bad request, check your request body"
- '404':
- description: "Bucket not found"
- '200':
- description: Returns exhaustive information about the bucket
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/BucketInfo'
-
- /RemoveBucketAlias:
- post:
- tags:
- - Bucket aliases
- operationId: "RemoveBucketAlias"
- summary: "Remove an alias from a bucket"
- description: |
- Remove an alias for the target bucket.
- This can be a local alias if `accessKeyId` is specified,
- or a global alias otherwise.
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- required: [bucketId]
- properties:
- bucketId:
- type: string
- example: e6a14cd6a27f48684579ec6b381c078ab11697e6bc8513b72b2f5307e25fff9b
- globalAlias:
- type: string
- example: the_bucket
- localAlias:
- type: string
- accessKeyId:
- type: string
- responses:
- '500':
- description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
- '400':
- description: "Bad request, check your request body"
- '404':
- description: "Bucket not found"
- '200':
- description: Returns exhaustive information about the bucket
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/BucketInfo'
-
-components:
- securitySchemes:
- bearerAuth:
- type: http
- scheme: bearer
- schemas:
- NodeNetworkInfo:
- type: object
- required: [ addr, isUp, lastSeenSecsAgo, hostname ]
- properties:
- id:
- type: string
- example: "6a8e08af2aab1083ebab9b22165ea8b5b9d333b60a39ecd504e85cc1f432c36f"
- addr:
- type: string
- example: "10.0.0.11:3901"
- isUp:
- type: boolean
- example: true
- lastSeenSecsAgo:
- type: integer
- nullable: true
- example: 9
- hostname:
- type: string
- example: "node1"
- NodeClusterInfo:
- type: object
- required: [ id, zone, tags ]
- properties:
- zone:
- type: string
- example: dc1
- capacity:
- type: integer
- format: int64
- nullable: true
- example: 4
- tags:
- type: array
- description: |
- User defined tags, put whatever makes sense for you, these tags are not interpreted by Garage
- example:
- - gateway
- - fast
- items:
- type: string
- NodeRoleChange:
- oneOf:
- - $ref: '#/components/schemas/NodeRoleRemove'
- - $ref: '#/components/schemas/NodeRoleUpdate'
- NodeRoleRemove:
- type: object
- required: [ id, remove ]
- properties:
- id:
- type: string
- example: "6a8e08af2aab1083ebab9b22165ea8b5b9d333b60a39ecd504e85cc1f432c36f"
- remove:
- type: boolean
- example: true
- NodeRoleUpdate:
- type: object
- required: [ id, zone, capacity, tags ]
- properties:
- id:
- type: string
- example: "6a8e08af2aab1083ebab9b22165ea8b5b9d333b60a39ecd504e85cc1f432c36f"
- zone:
- type: string
- example: "dc1"
- capacity:
- type: integer
- format: int64
- nullable: true
- example: 150000000000
- tags:
- type: array
- items:
- type: string
- example:
- - gateway
- - fast
-
- ClusterLayout:
- type: object
- required: [ version, roles, stagedRoleChanges ]
- properties:
- version:
- type: integer
- example: 12
- roles:
- type: array
- example:
- - id: "ec79480e0ce52ae26fd00c9da684e4fa56658d9c64cdcecb094e936de0bfe71f"
- zone: "madrid"
- capacity: 300000000000
- tags:
- - fast
- - amd64
- - id: "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff"
- zone: "geneva"
- capacity: 700000000000
- tags:
- - arm64
- items:
- $ref: '#/components/schemas/NodeClusterInfo'
- stagedRoleChanges:
- type: array
- example:
- - id: "e2ee7984ee65b260682086ec70026165903c86e601a4a5a501c1900afe28d84b"
- zone: "geneva"
- capacity: 800000000000
- tags:
- - gateway
- - id: "4a6ae5a1d0d33bf895f5bb4f0a418b7dc94c47c0dd2eb108d1158f3c8f60b0ff"
- remove: true
- items:
- $ref: '#/components/schemas/NodeRoleChange'
- LayoutVersion:
- type: object
- required: [ version ]
- properties:
- version:
- type: integer
- #format: int64
- example: 13
-
- KeyInfo:
- type: object
- properties:
- name:
- type: string
- example: "test-key"
- accessKeyId:
- type: string
- example: "GK31c2f218a2e44f485b94239e"
- secretAccessKey:
- type: string
- nullable: true
- example: "b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835"
- permissions:
- type: object
- properties:
- createBucket:
- type: boolean
- example: false
- buckets:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- example: "70dc3bed7fe83a75e46b66e7ddef7d56e65f3c02f9f80b6749fb97eccb5e1033"
- globalAliases:
- type: array
- items:
- type: string
- example: "my-bucket"
- localAliases:
- type: array
- items:
- type: string
- example: "GK31c2f218a2e44f485b94239e:localname"
- permissions:
- type: object
- properties:
- read:
- type: boolean
- example: true
- write:
- type: boolean
- example: true
- owner:
- type: boolean
- example: false
- BucketInfo:
- type: object
- properties:
- id:
- type: string
- example: afa8f0a22b40b1247ccd0affb869b0af5cff980924a20e4b5e0720a44deb8d39
- globalAliases:
- type: array
- items:
- type: string
- example: "my_documents"
- websiteAccess:
- type: boolean
- example: true
- websiteConfig:
- type: object
- nullable: true
- properties:
- indexDocument:
- type: string
- example: "index.html"
- errorDocument:
- type: string
- example: "error/400.html"
- keys:
- type: array
- items:
- $ref: '#/components/schemas/BucketKeyInfo'
- objects:
- type: integer
- format: int64
- example: 14827
- bytes:
- type: integer
- format: int64
- example: 13189855625
- unfinishedUploads:
- type: integer
- example: 0
- quotas:
- type: object
- properties:
- maxSize:
- nullable: true
- type: integer
- format: int64
- example: null
- maxObjects:
- nullable: true
- type: integer
- format: int64
- example: null
-
-
- BucketKeyInfo:
- type: object
- properties:
- accessKeyId:
- type: string
- name:
- type: string
- permissions:
- type: object
- properties:
- read:
- type: boolean
- example: true
- write:
- type: boolean
- example: true
- owner:
- type: boolean
- example: true
- bucketLocalAliases:
- type: array
- items:
- type: string
- example: "my_documents"
-
-
-security:
- - bearerAuth: []
-
-servers:
- - description: A local server
- url: http://localhost:3903/v2/
diff --git a/src/api/admin/Cargo.toml b/src/api/admin/Cargo.toml
index 883bded9..b4e2350a 100644
--- a/src/api/admin/Cargo.toml
+++ b/src/api/admin/Cargo.toml
@@ -38,6 +38,7 @@ url.workspace = true
serde.workspace = true
serde_json.workspace = true
+utoipa.workspace = true
opentelemetry.workspace = true
opentelemetry-prometheus = { workspace = true, optional = true }
diff --git a/src/api/admin/api.rs b/src/api/admin/api.rs
index 4ab28e2d..4ec62aa9 100644
--- a/src/api/admin/api.rs
+++ b/src/api/admin/api.rs
@@ -5,6 +5,7 @@ use std::sync::Arc;
use paste::paste;
use serde::{Deserialize, Serialize};
+use utoipa::ToSchema;
use garage_rpc::*;
@@ -45,7 +46,10 @@ admin_endpoints![
// Cluster operations
GetClusterStatus,
GetClusterHealth,
+ GetClusterStatistics,
ConnectClusterNodes,
+
+ // Layout operations
GetClusterLayout,
UpdateClusterLayout,
ApplyClusterLayout,
@@ -77,9 +81,8 @@ admin_endpoints![
// Node operations
GetNodeInfo,
- CreateMetadataSnapshot,
GetNodeStatistics,
- GetClusterStatistics,
+ CreateMetadataSnapshot,
LaunchRepairOperation,
// Worker operations
@@ -98,8 +101,8 @@ admin_endpoints![
local_admin_endpoints![
// Node operations
GetNodeInfo,
- CreateMetadataSnapshot,
GetNodeStatistics,
+ CreateMetadataSnapshot,
LaunchRepairOperation,
// Background workers
ListWorkers,
@@ -119,9 +122,13 @@ pub struct MultiRequest {
pub body: RB,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct MultiResponse {
+ /// Map of node id to response returned by this node, for nodes that were able to
+ /// successfully complete the API call
pub success: HashMap,
+ /// Map of node id to error message, for nodes that were unable to complete the API
+ /// call
pub error: HashMap,
}
@@ -155,18 +162,19 @@ pub struct MetricsRequest;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetClusterStatusRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct GetClusterStatusResponse {
pub layout_version: u64,
pub nodes: Vec,
}
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+#[derive(Debug, Clone, Serialize, Deserialize, Default, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct NodeResp {
pub id: String,
pub role: Option,
+ #[schema(value_type = Option )]
pub addr: Option,
pub hostname: Option,
pub is_up: bool,
@@ -178,7 +186,7 @@ pub struct NodeResp {
pub metadata_partition: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct NodeRoleResp {
pub id: String,
@@ -187,7 +195,7 @@ pub struct NodeRoleResp {
pub tags: Vec,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct FreeSpaceResp {
pub available: u64,
@@ -199,40 +207,67 @@ pub struct FreeSpaceResp {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetClusterHealthRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct GetClusterHealthResponse {
+ /// One of `healthy`, `degraded` or `unavailable`:
+ /// - `healthy`: Garage node is connected to all storage nodes
+ /// - `degraded`: Garage node is not connected to all storage nodes, but a quorum of write nodes is available for all partitions
+ /// - `unavailable`: a quorum of write nodes is not available for some partitions
pub status: String,
+ /// the number of nodes this Garage node has had a TCP connection to since the daemon started
pub known_nodes: usize,
+ /// the nubmer of nodes this Garage node currently has an open connection to
pub connected_nodes: usize,
+ /// the number of storage nodes currently registered in the cluster layout
pub storage_nodes: usize,
+ /// the number of storage nodes to which a connection is currently open
pub storage_nodes_ok: usize,
+ /// the total number of partitions of the data (currently always 256)
pub partitions: usize,
+ /// the number of partitions for which a quorum of write nodes is available
pub partitions_quorum: usize,
+ /// the number of partitions for which we are connected to all storage nodes responsible of storing it
pub partitions_all_ok: usize,
}
+// ---- GetClusterStatistics ----
+
+#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+pub struct GetClusterStatisticsRequest;
+
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+pub struct GetClusterStatisticsResponse {
+ pub freeform: String,
+}
+
// ---- ConnectClusterNodes ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ConnectClusterNodesRequest(pub Vec);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ConnectClusterNodesResponse(pub Vec);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ConnectNodeResponse {
+ /// `true` if Garage managed to connect to this node
pub success: bool,
+ /// An error message if Garage did not manage to connect to this node
pub error: Option,
}
+// **********************************************
+// Layout operations
+// **********************************************
+
// ---- GetClusterLayout ----
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GetClusterLayoutRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct GetClusterLayoutResponse {
pub version: u64,
@@ -240,44 +275,51 @@ pub struct GetClusterLayoutResponse {
pub staged_role_changes: Vec,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct NodeRoleChange {
+ /// ID of the node for which this change applies
pub id: String,
#[serde(flatten)]
pub action: NodeRoleChangeEnum,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(untagged)]
pub enum NodeRoleChangeEnum {
#[serde(rename_all = "camelCase")]
- Remove { remove: bool },
+ Remove {
+ /// Set `remove` to `true` to remove the node from the layout
+ remove: bool,
+ },
#[serde(rename_all = "camelCase")]
Update {
+ /// New zone of the node
zone: String,
+ /// New capacity (in bytes) of the node
capacity: Option,
+ /// New tags of the node
tags: Vec,
},
}
// ---- UpdateClusterLayout ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct UpdateClusterLayoutRequest(pub Vec);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct UpdateClusterLayoutResponse(pub GetClusterLayoutResponse);
// ---- ApplyClusterLayout ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ApplyClusterLayoutRequest {
pub version: u64,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ApplyClusterLayoutResponse {
pub message: Vec,
@@ -289,7 +331,7 @@ pub struct ApplyClusterLayoutResponse {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RevertClusterLayoutRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RevertClusterLayoutResponse(pub GetClusterLayoutResponse);
// **********************************************
@@ -301,10 +343,10 @@ pub struct RevertClusterLayoutResponse(pub GetClusterLayoutResponse);
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ListKeysRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ListKeysResponse(pub Vec);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ListKeysResponseItem {
pub id: String,
@@ -320,7 +362,7 @@ pub struct GetKeyInfoRequest {
pub show_secret_key: bool,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct GetKeyInfoResponse {
pub name: String,
@@ -331,14 +373,14 @@ pub struct GetKeyInfoResponse {
pub buckets: Vec,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct KeyPerm {
#[serde(default)]
pub create_bucket: bool,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct KeyInfoBucketResponse {
pub id: String,
@@ -347,7 +389,7 @@ pub struct KeyInfoBucketResponse {
pub permissions: ApiBucketKeyPerm,
}
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+#[derive(Debug, Clone, Serialize, Deserialize, Default, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ApiBucketKeyPerm {
#[serde(default)]
@@ -360,18 +402,18 @@ pub struct ApiBucketKeyPerm {
// ---- CreateKey ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct CreateKeyRequest {
pub name: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct CreateKeyResponse(pub GetKeyInfoResponse);
// ---- ImportKey ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ImportKeyRequest {
pub access_key_id: String,
@@ -379,7 +421,7 @@ pub struct ImportKeyRequest {
pub name: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ImportKeyResponse(pub GetKeyInfoResponse);
// ---- UpdateKey ----
@@ -390,10 +432,10 @@ pub struct UpdateKeyRequest {
pub body: UpdateKeyRequestBody,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct UpdateKeyResponse(pub GetKeyInfoResponse);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct UpdateKeyRequestBody {
pub name: Option,
@@ -420,10 +462,10 @@ pub struct DeleteKeyResponse;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ListBucketsRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ListBucketsResponse(pub Vec);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ListBucketsResponseItem {
pub id: String,
@@ -431,7 +473,7 @@ pub struct ListBucketsResponseItem {
pub local_aliases: Vec,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct BucketLocalAlias {
pub access_key_id: String,
@@ -447,32 +489,44 @@ pub struct GetBucketInfoRequest {
pub search: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct GetBucketInfoResponse {
+ /// Identifier of the bucket
pub id: String,
+ /// List of global aliases for this bucket
pub global_aliases: Vec,
+ /// Whether website acces is enabled for this bucket
pub website_access: bool,
#[serde(default)]
+ /// Website configuration for this bucket
pub website_config: Option,
+ /// List of access keys that have permissions granted on this bucket
pub keys: Vec,
+ /// Number of objects in this bucket
pub objects: i64,
+ /// Total number of bytes used by objects in this bucket
pub bytes: i64,
+ /// Number of unfinished uploads in this bucket
pub unfinished_uploads: i64,
+ /// Number of unfinished multipart uploads in this bucket
pub unfinished_multipart_uploads: i64,
+ /// Number of parts in unfinished multipart uploads in this bucket
pub unfinished_multipart_upload_parts: i64,
+ /// Total number of bytes used by unfinished multipart uploads in this bucket
pub unfinished_multipart_upload_bytes: i64,
+ /// Quotas that apply to this bucket
pub quotas: ApiBucketQuotas,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct GetBucketInfoWebsiteResponse {
pub index_document: String,
pub error_document: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct GetBucketInfoKey {
pub access_key_id: String,
@@ -481,7 +535,7 @@ pub struct GetBucketInfoKey {
pub bucket_local_aliases: Vec,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ApiBucketQuotas {
pub max_size: Option,
@@ -490,17 +544,17 @@ pub struct ApiBucketQuotas {
// ---- CreateBucket ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct CreateBucketRequest {
pub global_alias: Option,
pub local_alias: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct CreateBucketResponse(pub GetBucketInfoResponse);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct CreateBucketLocalAlias {
pub access_key_id: String,
@@ -517,17 +571,17 @@ pub struct UpdateBucketRequest {
pub body: UpdateBucketRequestBody,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct UpdateBucketResponse(pub GetBucketInfoResponse);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct UpdateBucketRequestBody {
pub website_access: Option,
pub quotas: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct UpdateBucketWebsiteAccess {
pub enabled: bool,
@@ -547,13 +601,15 @@ pub struct DeleteBucketResponse;
// ---- CleanupIncompleteUploads ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(rename_all = "camelCase")]
pub struct CleanupIncompleteUploadsRequest {
pub bucket_id: String,
pub older_than_secs: u64,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(rename_all = "camelCase")]
pub struct CleanupIncompleteUploadsResponse {
pub uploads_deleted: u64,
}
@@ -564,13 +620,13 @@ pub struct CleanupIncompleteUploadsResponse {
// ---- AllowBucketKey ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct AllowBucketKeyRequest(pub BucketKeyPermChangeRequest);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct AllowBucketKeyResponse(pub GetBucketInfoResponse);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct BucketKeyPermChangeRequest {
pub bucket_id: String,
@@ -580,10 +636,10 @@ pub struct BucketKeyPermChangeRequest {
// ---- DenyBucketKey ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct DenyBucketKeyRequest(pub BucketKeyPermChangeRequest);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct DenyBucketKeyResponse(pub GetBucketInfoResponse);
// **********************************************
@@ -592,7 +648,7 @@ pub struct DenyBucketKeyResponse(pub GetBucketInfoResponse);
// ---- AddBucketAlias ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct AddBucketAliasRequest {
pub bucket_id: String,
@@ -600,10 +656,10 @@ pub struct AddBucketAliasRequest {
pub alias: BucketAliasEnum,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct AddBucketAliasResponse(pub GetBucketInfoResponse);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(untagged)]
pub enum BucketAliasEnum {
#[serde(rename_all = "camelCase")]
@@ -617,7 +673,7 @@ pub enum BucketAliasEnum {
// ---- RemoveBucketAlias ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct RemoveBucketAliasRequest {
pub bucket_id: String,
@@ -625,7 +681,7 @@ pub struct RemoveBucketAliasRequest {
pub alias: BucketAliasEnum,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct RemoveBucketAliasResponse(pub GetBucketInfoResponse);
// **********************************************
@@ -637,7 +693,7 @@ pub struct RemoveBucketAliasResponse(pub GetBucketInfoResponse);
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct LocalGetNodeInfoRequest;
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+#[derive(Debug, Clone, Serialize, Deserialize, Default, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LocalGetNodeInfoResponse {
pub node_id: String,
@@ -647,42 +703,33 @@ pub struct LocalGetNodeInfoResponse {
pub db_engine: String,
}
-// ---- CreateMetadataSnapshot ----
-
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
-pub struct LocalCreateMetadataSnapshotRequest;
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct LocalCreateMetadataSnapshotResponse;
-
// ---- GetNodeStatistics ----
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct LocalGetNodeStatisticsRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalGetNodeStatisticsResponse {
pub freeform: String,
}
-// ---- GetClusterStatistics ----
+// ---- CreateMetadataSnapshot ----
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
-pub struct GetClusterStatisticsRequest;
+pub struct LocalCreateMetadataSnapshotRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct GetClusterStatisticsResponse {
- pub freeform: String,
-}
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+pub struct LocalCreateMetadataSnapshotResponse;
// ---- LaunchRepairOperation ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
+#[serde(rename_all = "camelCase")]
pub struct LocalLaunchRepairOperationRequest {
pub repair_type: RepairType,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub enum RepairType {
Tables,
@@ -695,7 +742,7 @@ pub enum RepairType {
Scrub(ScrubCommand),
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub enum ScrubCommand {
Start,
@@ -704,16 +751,16 @@ pub enum ScrubCommand {
Cancel,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalLaunchRepairOperationResponse;
// **********************************************
// Worker operations
// **********************************************
-// ---- GetWorkerList ----
+// ---- ListWorkers ----
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+#[derive(Debug, Clone, Serialize, Deserialize, Default, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LocalListWorkersRequest {
#[serde(default)]
@@ -722,10 +769,10 @@ pub struct LocalListWorkersRequest {
pub error_only: bool,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalListWorkersResponse(pub Vec);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct WorkerInfoResp {
pub id: u64,
@@ -741,51 +788,54 @@ pub struct WorkerInfoResp {
pub freeform: Vec,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub enum WorkerStateResp {
Busy,
- Throttled { duration_secs: f32 },
+ #[serde(rename_all = "camelCase")]
+ Throttled {
+ duration_secs: f32,
+ },
Idle,
Done,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct WorkerLastError {
pub message: String,
pub secs_ago: u64,
}
-// ---- GetWorkerList ----
+// ---- GetWorkerInfo ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalGetWorkerInfoRequest {
pub id: u64,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalGetWorkerInfoResponse(pub WorkerInfoResp);
// ---- GetWorkerVariable ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalGetWorkerVariableRequest {
pub variable: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalGetWorkerVariableResponse(pub HashMap);
// ---- SetWorkerVariable ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalSetWorkerVariableRequest {
pub variable: String,
pub value: String,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalSetWorkerVariableResponse {
pub variable: String,
pub value: String,
@@ -800,10 +850,10 @@ pub struct LocalSetWorkerVariableResponse {
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct LocalListBlockErrorsRequest;
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct LocalListBlockErrorsResponse(pub Vec);
-#[derive(Serialize, Deserialize, Clone, Debug)]
+#[derive(Serialize, Deserialize, Clone, Debug, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct BlockError {
pub block_hash: String,
@@ -815,13 +865,13 @@ pub struct BlockError {
// ---- GetBlockInfo ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LocalGetBlockInfoRequest {
pub block_hash: String,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LocalGetBlockInfoResponse {
pub block_hash: String,
@@ -829,7 +879,7 @@ pub struct LocalGetBlockInfoResponse {
pub versions: Vec,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct BlockVersion {
pub version_id: String,
@@ -838,13 +888,12 @@ pub struct BlockVersion {
pub backlink: Option,
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub enum BlockVersionBacklink {
- Object {
- bucket_id: String,
- key: String,
- },
+ #[serde(rename_all = "camelCase")]
+ Object { bucket_id: String, key: String },
+ #[serde(rename_all = "camelCase")]
Upload {
upload_id: String,
upload_deleted: bool,
@@ -856,7 +905,7 @@ pub enum BlockVersionBacklink {
// ---- RetryBlockResync ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(untagged)]
pub enum LocalRetryBlockResyncRequest {
#[serde(rename_all = "camelCase")]
@@ -865,7 +914,7 @@ pub enum LocalRetryBlockResyncRequest {
Blocks { block_hashes: Vec },
}
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LocalRetryBlockResyncResponse {
pub count: u64,
@@ -873,11 +922,11 @@ pub struct LocalRetryBlockResyncResponse {
// ---- PurgeBlocks ----
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LocalPurgeBlocksRequest(pub Vec);
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LocalPurgeBlocksResponse {
pub blocks_purged: u64,
diff --git a/src/api/admin/lib.rs b/src/api/admin/lib.rs
index dd9b7ffd..3993b906 100644
--- a/src/api/admin/lib.rs
+++ b/src/api/admin/lib.rs
@@ -6,6 +6,7 @@ mod error;
mod macros;
pub mod api;
+pub mod openapi;
mod router_v0;
mod router_v1;
mod router_v2;
diff --git a/src/api/admin/openapi.rs b/src/api/admin/openapi.rs
new file mode 100644
index 00000000..0e48bf54
--- /dev/null
+++ b/src/api/admin/openapi.rs
@@ -0,0 +1,731 @@
+#![allow(dead_code)]
+#![allow(non_snake_case)]
+
+use utoipa::{Modify, OpenApi};
+
+use crate::api::*;
+
+// **********************************************
+// Cluster operations
+// **********************************************
+
+#[utoipa::path(get,
+ path = "/v2/GetClusterStatus",
+ tag = "Cluster",
+ description = "
+Returns the cluster's current status, including:
+
+- ID of the node being queried and its version of the Garage daemon
+- Live nodes
+- Currently configured cluster layout
+- Staged changes to the cluster layout
+
+*Capacity is given in bytes*
+ ",
+ responses(
+ (status = 200, description = "Cluster status report", body = GetClusterStatusResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetClusterStatus() -> () {}
+
+#[utoipa::path(get,
+ path = "/v2/GetClusterHealth",
+ tag = "Cluster",
+ description = "Returns the global status of the cluster, the number of connected nodes (over the number of known ones), the number of healthy storage nodes (over the declared ones), and the number of healthy partitions (over the total).",
+ responses(
+ (status = 200, description = "Cluster health report", body = GetClusterHealthResponse),
+ ),
+)]
+fn GetClusterHealth() -> () {}
+
+#[utoipa::path(get,
+ path = "/v2/GetClusterStatistics",
+ tag = "Cluster",
+ description = "
+Fetch global cluster statistics.
+
+*Note: do not try to parse the `freeform` field of the response, it is given as a string specifically because its format is not stable.*
+ ",
+ responses(
+ (status = 200, description = "Global cluster statistics", body = GetClusterStatisticsResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetClusterStatistics() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/ConnectClusterNodes",
+ tag = "Cluster",
+ description = "Instructs this Garage node to connect to other Garage nodes at specified `@`. `node_id` is generated automatically on node start.",
+ request_body=ConnectClusterNodesRequest,
+ responses(
+ (status = 200, description = "The request has been handled correctly but it does not mean that all connection requests succeeded; some might have fail, you need to check the body!", body = ConnectClusterNodesResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn ConnectClusterNodes() -> () {}
+
+// **********************************************
+// Layout operations
+// **********************************************
+
+#[utoipa::path(get,
+ path = "/v2/GetClusterLayout",
+ tag = "Cluster layout",
+ description = "
+Returns the cluster's current layout, including:
+
+- Currently configured cluster layout
+- Staged changes to the cluster layout
+
+*Capacity is given in bytes*
+ ",
+ responses(
+ (status = 200, description = "Current cluster layout", body = GetClusterLayoutResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetClusterLayout() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/UpdateClusterLayout",
+ tag = "Cluster layout",
+ description = "
+Send modifications to the cluster layout. These modifications will be included in the staged role changes, visible in subsequent calls of `GET /GetClusterHealth`. Once the set of staged changes is satisfactory, the user may call `POST /ApplyClusterLayout` to apply the changed changes, or `POST /RevertClusterLayout` to clear all of the staged changes in the layout.
+
+Setting the capacity to `null` will configure the node as a gateway.
+Otherwise, capacity must be now set in bytes (before Garage 0.9 it was arbitrary weights).
+For example to declare 100GB, you must set `capacity: 100000000000`.
+
+Garage uses internally the International System of Units (SI), it assumes that 1kB = 1000 bytes, and displays storage as kB, MB, GB (and not KiB, MiB, GiB that assume 1KiB = 1024 bytes).
+ ",
+ request_body(
+ content=UpdateClusterLayoutRequest,
+ description="
+To add a new node to the layout or to change the configuration of an existing node, simply set the values you want (`zone`, `capacity`, and `tags`).
+To remove a node, simply pass the `remove: true` field.
+This logic is represented in OpenAPI with a 'One Of' object.
+
+Contrary to the CLI that may update only a subset of the fields capacity, zone and tags, when calling this API all of these values must be specified.
+ "
+ ),
+ responses(
+ (status = 200, description = "Proposed changes have been added to the list of pending changes", body = UpdateClusterLayoutResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn UpdateClusterLayout() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/ApplyClusterLayout",
+ tag = "Cluster layout",
+ description = "
+Applies to the cluster the layout changes currently registered as staged layout changes.
+
+*Note: do not try to parse the `message` field of the response, it is given as an array of string specifically because its format is not stable.*
+ ",
+ request_body=ApplyClusterLayoutRequest,
+ responses(
+ (status = 200, description = "The updated cluster layout has been applied in the cluster", body = ApplyClusterLayoutResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn ApplyClusterLayout() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/RevertClusterLayout",
+ tag = "Cluster layout",
+ description = "Clear staged layout changes",
+ responses(
+ (status = 200, description = "All pending changes to the cluster layout have been erased", body = RevertClusterLayoutResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn RevertClusterLayout() -> () {}
+
+// **********************************************
+// Access key operations
+// **********************************************
+
+#[utoipa::path(get,
+ path = "/v2/ListKeys",
+ tag = "Access key",
+ description = "Returns all API access keys in the cluster.",
+ responses(
+ (status = 200, description = "Returns the key identifier (aka `AWS_ACCESS_KEY_ID`) and its associated, human friendly, name if any (otherwise return an empty string)", body = ListKeysResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn ListKeys() -> () {}
+
+#[utoipa::path(get,
+ path = "/v2/GetKeyInfo",
+ tag = "Access key",
+ description = "
+Return information about a specific key like its identifiers, its permissions and buckets on which it has permissions.
+You can search by specifying the exact key identifier (`id`) or by specifying a pattern (`search`).
+
+For confidentiality reasons, the secret key is not returned by default: you must pass the `showSecretKey` query parameter to get it.
+ ",
+ params(
+ ("id", description = "Access key ID"),
+ ("search", description = "Partial key ID or name to search for"),
+ ("showSecretKey", description = "Whether to return the secret access key"),
+ ),
+ responses(
+ (status = 200, description = "Information about the access key", body = GetKeyInfoResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetKeyInfo() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/CreateKey",
+ tag = "Access key",
+ description = "Creates a new API access key.",
+ request_body = CreateKeyRequest,
+ responses(
+ (status = 200, description = "Access key has been created", body = CreateKeyResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn CreateKey() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/ImportKey",
+ tag = "Access key",
+ description = "
+Imports an existing API key. This feature must only be used for migrations and backup restore.
+
+**Do not use it to generate custom key identifiers or you will break your Garage cluster.**
+ ",
+ request_body = ImportKeyRequest,
+ responses(
+ (status = 200, description = "Access key has been imported", body = ImportKeyResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn ImportKey() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/UpdateKey",
+ tag = "Access key",
+ description = "
+Updates information about the specified API access key.
+
+*Note: the secret key is not returned in the response, `null` is sent instead.*
+ ",
+ request_body = UpdateKeyRequestBody,
+ params(
+ ("id", description = "Access key ID"),
+ ),
+ responses(
+ (status = 200, description = "Access key has been updated", body = UpdateKeyResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn UpdateKey() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/DeleteKey",
+ tag = "Access key",
+ description = "Delete a key from the cluster. Its access will be removed from all the buckets. Buckets are not automatically deleted and can be dangling. You should manually delete them before. ",
+ params(
+ ("id", description = "Access key ID"),
+ ),
+ responses(
+ (status = 200, description = "Access key has been deleted"),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn DeleteKey() -> () {}
+
+// **********************************************
+// Bucket operations
+// **********************************************
+
+#[utoipa::path(get,
+ path = "/v2/ListBuckets",
+ tag = "Bucket",
+ description = "List all the buckets on the cluster with their UUID and their global and local aliases.",
+ responses(
+ (status = 200, description = "Returns the UUID of all the buckets and all their aliases", body = ListBucketsResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn ListBuckets() -> () {}
+
+#[utoipa::path(get,
+ path = "/v2/GetBucketInfo",
+ tag = "Bucket",
+ description = "
+Given a bucket identifier (`id`) or a global alias (`alias`), get its information.
+It includes its aliases, its web configuration, keys that have some permissions
+on it, some statistics (number of objects, size), number of dangling multipart uploads,
+and its quotas (if any).
+ ",
+ params(
+ ("id", description = "Exact bucket ID to look up"),
+ ("globalAlias", description = "Global alias of bucket to look up"),
+ ("search", description = "Partial ID or alias to search for"),
+ ),
+ responses(
+ (status = 200, description = "Returns exhaustive information about the bucket", body = GetBucketInfoResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetBucketInfo() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/CreateBucket",
+ tag = "Bucket",
+ description = "
+Creates a new bucket, either with a global alias, a local one, or no alias at all.
+Technically, you can also specify both `globalAlias` and `localAlias` and that would create two aliases.
+ ",
+ request_body = CreateBucketRequest,
+ responses(
+ (status = 200, description = "Returns exhaustive information about the bucket", body = CreateBucketResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn CreateBucket() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/UpdateBucket",
+ tag = "Bucket",
+ description = "
+All fields (`websiteAccess` and `quotas`) are optional.
+If they are present, the corresponding modifications are applied to the bucket, otherwise nothing is changed.
+
+In `websiteAccess`: if `enabled` is `true`, `indexDocument` must be specified.
+The field `errorDocument` is optional, if no error document is set a generic
+error message is displayed when errors happen. Conversely, if `enabled` is
+`false`, neither `indexDocument` nor `errorDocument` must be specified.
+
+In `quotas`: new values of `maxSize` and `maxObjects` must both be specified, or set to `null`
+to remove the quotas. An absent value will be considered the same as a `null`. It is not possible
+to change only one of the two quotas.
+ ",
+ params(
+ ("id", description = "ID of the bucket to update"),
+ ),
+ request_body = UpdateBucketRequestBody,
+ responses(
+ (status = 200, description = "Bucket has been updated", body = UpdateBucketResponse),
+ (status = 404, description = "Bucket not found"),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn UpdateBucket() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/DeleteBucket",
+ tag = "Bucket",
+ description = "
+Deletes a storage bucket. A bucket cannot be deleted if it is not empty.
+
+**Warning:** this will delete all aliases associated with the bucket!
+ ",
+ params(
+ ("id", description = "ID of the bucket to delete"),
+ ),
+ responses(
+ (status = 200, description = "Bucket has been deleted"),
+ (status = 400, description = "Bucket is not empty"),
+ (status = 404, description = "Bucket not found"),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn DeleteBucket() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/CleanupIncompleteUploads",
+ tag = "Bucket",
+ description = "Removes all incomplete multipart uploads that are older than the specified number of seconds.",
+ request_body = CleanupIncompleteUploadsRequest,
+ responses(
+ (status = 200, description = "The bucket was cleaned up successfully", body = CleanupIncompleteUploadsResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn CleanupIncompleteUploads() -> () {}
+
+// **********************************************
+// Operations on permissions for keys on buckets
+// **********************************************
+
+#[utoipa::path(post,
+ path = "/v2/AllowBucketKey",
+ tag = "Permission",
+ description = "
+⚠️ **DISCLAIMER**: Garage's developers are aware that this endpoint has an unconventional semantic. Be extra careful when implementing it, its behavior is not obvious.
+
+Allows a key to do read/write/owner operations on a bucket.
+
+Flags in permissions which have the value true will be activated. Other flags will remain unchanged (ie. they will keep their internal value).
+
+For example, if you set read to true, the key will be allowed to read the bucket.
+If you set it to false, the key will keeps its previous read permission.
+If you want to disallow read for the key, check the DenyBucketKey operation.
+ ",
+ request_body = AllowBucketKeyRequest,
+ responses(
+ (status = 200, description = "Returns exhaustive information about the bucket", body = AllowBucketKeyResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn AllowBucketKey() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/DenyBucketKey",
+ tag = "Permission",
+ description = "
+⚠️ **DISCLAIMER**: Garage's developers are aware that this endpoint has an unconventional semantic. Be extra careful when implementing it, its behavior is not obvious.
+
+Denies a key from doing read/write/owner operations on a bucket.
+
+Flags in permissions which have the value true will be deactivated. Other flags will remain unchanged.
+
+For example, if you set read to true, the key will be denied from reading.
+If you set read to false, the key will keep its previous permissions.
+If you want the key to have the reading permission, check the AllowBucketKey operation.
+ ",
+ request_body = DenyBucketKeyRequest,
+ responses(
+ (status = 200, description = "Returns exhaustive information about the bucket", body = DenyBucketKeyResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn DenyBucketKey() -> () {}
+
+// **********************************************
+// Operations on bucket aliases
+// **********************************************
+
+#[utoipa::path(post,
+ path = "/v2/AddBucketAlias",
+ tag = "Bucket alias",
+ description = "Add an alias for the target bucket. This can be either a global or a local alias, depending on which fields are specified.",
+ request_body = AddBucketAliasRequest,
+ responses(
+ (status = 200, description = "Returns exhaustive information about the bucket", body = AddBucketAliasResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn AddBucketAlias() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/RemoveBucketAlias",
+ tag = "Bucket alias",
+ description = "Remove an alias for the target bucket. This can be either a global or a local alias, depending on which fields are specified.",
+ request_body = RemoveBucketAliasRequest,
+ responses(
+ (status = 200, description = "Returns exhaustive information about the bucket", body = RemoveBucketAliasResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn RemoveBucketAlias() -> () {}
+
+// **********************************************
+// Node operations
+// **********************************************
+
+#[utoipa::path(get,
+ path = "/v2/GetNodeInfo",
+ tag = "Node",
+ description = "
+Return information about the Garage daemon running on one or several nodes.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetNodeInfo() -> () {}
+
+#[utoipa::path(get,
+ path = "/v2/GetNodeStatistics",
+ tag = "Node",
+ description = "
+Fetch statistics for one or several Garage nodes.
+
+*Note: do not try to parse the `freeform` field of the response, it is given as a string specifically because its format is not stable.*
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetNodeStatistics() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/CreateMetadataSnapshot",
+ tag = "Node",
+ description = "
+Instruct one or several nodes to take a snapshot of their metadata databases.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn CreateMetadataSnapshot() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/LaunchRepairOperation",
+ tag = "Node",
+ description = "
+Launch a repair operation on one or several cluster nodes.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ request_body = LocalLaunchRepairOperationRequest,
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn LaunchRepairOperation() -> () {}
+
+// **********************************************
+// Worker operations
+// **********************************************
+
+#[utoipa::path(post,
+ path = "/v2/ListWorkers",
+ tag = "Worker",
+ description = "
+List background workers currently running on one or several cluster nodes.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ request_body = LocalListWorkersRequest,
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn ListWorkers() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/GetWorkerInfo",
+ tag = "Worker",
+ description = "
+Get information about the specified background worker on one or several cluster nodes.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ request_body = LocalGetWorkerInfoRequest,
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetWorkerInfo() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/GetWorkerVariable",
+ tag = "Worker",
+ description = "
+Fetch values of one or several worker variables, from one or several cluster nodes.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ request_body = LocalGetWorkerVariableRequest,
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetWorkerVariable() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/SetWorkerVariable",
+ tag = "Worker",
+ description = "
+Set the value for a worker variable, on one or several cluster nodes.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ request_body = LocalSetWorkerVariableRequest,
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn SetWorkerVariable() -> () {}
+
+// **********************************************
+// Block operations
+// **********************************************
+
+#[utoipa::path(get,
+ path = "/v2/ListBlockErrors",
+ tag = "Block",
+ description = "
+List data blocks that are currently in an errored state on one or several Garage nodes.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn ListBlockErrors() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/GetBlockInfo",
+ tag = "Block",
+ description = "
+Get detailed information about a data block stored on a Garage node, including all object versions and in-progress multipart uploads that contain a reference to this block.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ request_body = LocalGetBlockInfoRequest,
+ responses(
+ (status = 200, description = "Detailed block information", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn GetBlockInfo() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/RetryBlockResync",
+ tag = "Block",
+ description = "
+Instruct Garage node(s) to retry the resynchronization of one or several missing data block(s).
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ request_body = LocalRetryBlockResyncRequest,
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn RetryBlockResync() -> () {}
+
+#[utoipa::path(post,
+ path = "/v2/PurgeBlocks",
+ tag = "Block",
+ description = "
+Purge references to one or several missing data blocks.
+
+This will remove all objects and in-progress multipart uploads that contain the specified data block(s). The objects will be permanently deleted from the buckets in which they appear. Use with caution.
+ ",
+ params(
+ ("node", description = "Node ID to query, or `*` for all nodes, or `self` for the node responding to the request"),
+ ),
+ request_body = LocalPurgeBlocksRequest,
+ responses(
+ (status = 200, description = "Responses from individual cluster nodes", body = MultiResponse),
+ (status = 500, description = "Internal server error")
+ ),
+)]
+fn PurgeBlocks() -> () {}
+
+// **********************************************
+// **********************************************
+// **********************************************
+
+struct SecurityAddon;
+
+impl Modify for SecurityAddon {
+ fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) {
+ use utoipa::openapi::security::*;
+ let components = openapi.components.as_mut().unwrap(); // we can unwrap safely since there already is components registered.
+ components.add_security_scheme(
+ "bearerAuth",
+ SecurityScheme::Http(Http::builder().scheme(HttpAuthScheme::Bearer).build()),
+ )
+ }
+}
+
+#[derive(OpenApi)]
+#[openapi(
+ info(
+ version = "v2.0.0",
+ title = "Garage administration API",
+ description = "Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.
+
+*Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is early stage and can contain bugs, so be careful and please report any issues on our issue tracker.*",
+ contact(
+ name = "The Garage team",
+ email = "garagehq@deuxfleurs.fr",
+ url = "https://garagehq.deuxfleurs.fr/",
+ ),
+ ),
+ modifiers(&SecurityAddon),
+ security(("bearerAuth" = [])),
+ paths(
+ // Cluster operations
+ GetClusterHealth,
+ GetClusterStatus,
+ GetClusterStatistics,
+ ConnectClusterNodes,
+ // Layout operations
+ GetClusterLayout,
+ UpdateClusterLayout,
+ ApplyClusterLayout,
+ RevertClusterLayout,
+ // Key operations
+ ListKeys,
+ GetKeyInfo,
+ CreateKey,
+ ImportKey,
+ UpdateKey,
+ DeleteKey,
+ // Bucket operations
+ ListBuckets,
+ GetBucketInfo,
+ CreateBucket,
+ UpdateBucket,
+ DeleteBucket,
+ CleanupIncompleteUploads,
+ // Operations on permissions
+ AllowBucketKey,
+ DenyBucketKey,
+ // Operations on aliases
+ AddBucketAlias,
+ RemoveBucketAlias,
+ // Node operations
+ GetNodeInfo,
+ GetNodeStatistics,
+ CreateMetadataSnapshot,
+ LaunchRepairOperation,
+ // Worker operations
+ ListWorkers,
+ GetWorkerInfo,
+ GetWorkerVariable,
+ SetWorkerVariable,
+ // Block operations
+ ListBlockErrors,
+ GetBlockInfo,
+ RetryBlockResync,
+ PurgeBlocks,
+ ),
+ servers(
+ (url = "http://localhost:3903/", description = "A local server")
+ ),
+)]
+pub struct ApiDoc;
diff --git a/src/garage/Cargo.toml b/src/garage/Cargo.toml
index 6bbf83ac..ba747fdf 100644
--- a/src/garage/Cargo.toml
+++ b/src/garage/Cargo.toml
@@ -48,6 +48,7 @@ sha1.workspace = true
sodiumoxide.workspace = true
structopt.workspace = true
git-version.workspace = true
+utoipa.workspace = true
futures.workspace = true
tokio.workspace = true
diff --git a/src/garage/cli/structs.rs b/src/garage/cli/structs.rs
index c6471515..58d066b3 100644
--- a/src/garage/cli/structs.rs
+++ b/src/garage/cli/structs.rs
@@ -58,6 +58,10 @@ pub enum Command {
/// Convert metadata db between database engine formats
#[structopt(name = "convert-db", version = garage_version())]
ConvertDb(convert_db::ConvertDbOpt),
+
+ /// Output openapi JSON schema for admin api
+ #[structopt(name = "admin-api-schema", version = garage_version(), setting(structopt::clap::AppSettings::Hidden))]
+ AdminApiSchema,
}
#[derive(StructOpt, Debug)]
diff --git a/src/garage/main.rs b/src/garage/main.rs
index 2a88d760..683042d9 100644
--- a/src/garage/main.rs
+++ b/src/garage/main.rs
@@ -24,6 +24,7 @@ use std::net::SocketAddr;
use std::path::PathBuf;
use structopt::StructOpt;
+use utoipa::OpenApi;
use garage_net::util::parse_and_resolve_peer_addr;
use garage_net::NetworkKey;
@@ -151,6 +152,15 @@ async fn main() {
Command::Node(NodeOperation::NodeId(node_id_opt)) => {
cli::init::node_id_command(opt.config_file, node_id_opt.quiet)
}
+ Command::AdminApiSchema => {
+ println!(
+ "{}",
+ garage_api_admin::openapi::ApiDoc::openapi()
+ .to_pretty_json()
+ .unwrap()
+ );
+ Ok(())
+ }
_ => cli_command(opt).await,
};