Prefix all APIs with v0/
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Alex 2022-05-17 17:51:38 +02:00
parent 5072dbd228
commit 440a577563
Signed by: lx
GPG key ID: 0E496D15096376BE
2 changed files with 48 additions and 48 deletions

View file

@ -15,7 +15,7 @@ Returns internal Garage metrics in Prometheus format.
## Cluster operations
### GetClusterStatus `GET /status`
### GetClusterStatus `GET /v0/status`
Returns the cluster's current status in JSON, including:
@ -94,7 +94,7 @@ Example response body:
}
```
### GetClusterLayout `GET /layout`
### GetClusterLayout `GET /v0/layout`
Returns the cluster's current layout in JSON, including:
@ -143,7 +143,7 @@ Example response body:
}
```
### UpdateClusterLayout `POST /layout`
### UpdateClusterLayout `POST /v0/layout`
Send modifications to the cluster layout. These modifications will
be included in the staged role changes, visible in subsequent calls
@ -174,7 +174,7 @@ Contrary to the CLI that may update only a subset of the fields
values must be specified.
### ApplyClusterLayout `POST /layout/apply`
### ApplyClusterLayout `POST /v0/layout/apply`
Applies to the cluster the layout changes currently registered as
staged layout changes.
@ -191,7 +191,7 @@ 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.
### RevertClusterLayout `POST /layout/revert`
### RevertClusterLayout `POST /v0/layout/revert`
Clears all of the staged layout changes.
@ -212,7 +212,7 @@ existing layout in the cluster.
## Access key operations
### ListKeys `GET /key`
### ListKeys `GET /v0/key`
Returns all API access keys in the cluster.
@ -231,7 +231,7 @@ Example response:
]
```
### CreateKey `POST /key`
### CreateKey `POST /v0/key`
Creates a new API access key.
@ -243,8 +243,8 @@ Request body format:
}
```
### GetKeyInfo `GET /key?id=<acces key id>`
### GetKeyInfo `GET /key?search=<pattern>`
### GetKeyInfo `GET /v0/key?id=<acces key id>`
### GetKeyInfo `GET /v0/key?search=<pattern>`
Returns information about the requested API access key.
@ -315,11 +315,11 @@ Example response:
}
```
### DeleteKey `DELETE /key?id=<acces key id>`
### DeleteKey `DELETE /v0/key?id=<acces key id>`
Deletes an API access key.
### UpdateKey `POST /key?id=<acces key id>`
### UpdateKey `POST /v0/key?id=<acces key id>`
Updates information about the specified API access key.
@ -342,7 +342,7 @@ The possible flags in `allow` and `deny` are: `createBucket`.
## Bucket operations
### ListBuckets `GET /bucket`
### ListBuckets `GET /v0/bucket`
Returns all storage buckets in the cluster.
@ -384,8 +384,8 @@ Example response:
]
```
### GetBucketInfo `GET /bucket?id=<bucket id>`
### GetBucketInfo `GET /bucket?globalAlias=<alias>`
### GetBucketInfo `GET /v0/bucket?id=<bucket id>`
### GetBucketInfo `GET /v0/bucket?globalAlias=<alias>`
Returns information about the requested storage bucket.
@ -418,7 +418,7 @@ Example response:
}
```
### CreateBucket `POST /bucket`
### CreateBucket `POST /v0/bucket`
Creates a new storage bucket.
@ -451,13 +451,13 @@ OR
Creates a new bucket, either with a global alias, a local one,
or no alias at all.
### DeleteBucket `DELETE /bucket?id=<bucket id>`
### DeleteBucket `DELETE /v0/bucket?id=<bucket id>`
Deletes a storage bucket. A bucket cannot be deleted if it is not empty.
Warning: this will delete all aliases associated with the bucket!
### PutBucketWebsite `PUT /bucket/website?id=<bucket id>`
### PutBucketWebsite `PUT /v0/bucket/website?id=<bucket id>`
Sets the website configuration for a bucket (this also enables website access for this bucket).
@ -473,14 +473,14 @@ Request body format:
The field `errorDocument` is optional, if no error document is set a generic error message is displayed when errors happen.
### DeleteBucketWebsite `DELETE /bucket/website?id=<bucket id>`
### DeleteBucketWebsite `DELETE /v0/bucket/website?id=<bucket id>`
Deletes the website configuration for a bucket (disables website access for this bucket).
## Operations on permissions for keys on buckets
### BucketAllowKey `POST /bucket/allow`
### BucketAllowKey `POST /v0/bucket/allow`
Allows a key to do read/write/owner operations on a bucket.
@ -501,7 +501,7 @@ Request body format:
Flags in `permissions` which have the value `true` will be activated.
Other flags will remain unchanged.
### BucketDenyKey `POST /bucket/deny`
### BucketDenyKey `POST /v0/bucket/deny`
Denies a key from doing read/write/owner operations on a bucket.
@ -525,19 +525,19 @@ Other flags will remain unchanged.
## Operations on bucket aliases
### GlobalAliasBucket `PUT /bucket/alias/global?id=<bucket id>&alias=<global alias>`
### GlobalAliasBucket `PUT /v0/bucket/alias/global?id=<bucket id>&alias=<global alias>`
Empty body. Creates a global alias for a bucket.
### GlobalUnaliasBucket `DELETE /bucket/alias/global?id=<bucket id>&alias=<global alias>`
### GlobalUnaliasBucket `DELETE /v0/bucket/alias/global?id=<bucket id>&alias=<global alias>`
Removes a global alias for a bucket.
### LocalAliasBucket `PUT /bucket/alias/local?id=<bucket id>&accessKeyId=<access key ID>&alias=<local alias>`
### LocalAliasBucket `PUT /v0/bucket/alias/local?id=<bucket id>&accessKeyId=<access key ID>&alias=<local alias>`
Empty body. Creates a local alias for a bucket in the namespace of a specific access key.
### LocalUnaliasBucket `DELETE /bucket/alias/local?id=<bucket id>&accessKeyId<access key ID>&alias=<local alias>`
### LocalUnaliasBucket `DELETE /v0/bucket/alias/local?id=<bucket id>&accessKeyId<access key ID>&alias=<local alias>`
Removes a local alias for a bucket in the namespace of a specific access key.

View file

@ -90,35 +90,35 @@ impl Endpoint {
let res = router_match!(@gen_path_parser (req.method(), path, query) [
OPTIONS _ => Options,
GET "/metrics" => Metrics,
GET "/status" => GetClusterStatus,
GET "/v0/status" => GetClusterStatus,
// Layout endpoints
GET "/layout" => GetClusterLayout,
POST "/layout" => UpdateClusterLayout,
POST "/layout/apply" => ApplyClusterLayout,
POST "/layout/revert" => RevertClusterLayout,
GET "/v0/layout" => GetClusterLayout,
POST "/v0/layout" => UpdateClusterLayout,
POST "/v0/layout/apply" => ApplyClusterLayout,
POST "/v0/layout/revert" => RevertClusterLayout,
// API key endpoints
GET "/key" if id => GetKeyInfo (query_opt::id, query_opt::search),
GET "/key" if search => GetKeyInfo (query_opt::id, query_opt::search),
POST "/key" if id => UpdateKey (query::id),
POST "/key" => CreateKey,
DELETE "/key" if id => DeleteKey (query::id),
GET "/key" => ListKeys,
GET "/v0/key" if id => GetKeyInfo (query_opt::id, query_opt::search),
GET "/v0/key" if search => GetKeyInfo (query_opt::id, query_opt::search),
POST "/v0/key" if id => UpdateKey (query::id),
POST "/v0/key" => CreateKey,
DELETE "/v0/key" if id => DeleteKey (query::id),
GET "/v0/key" => ListKeys,
// Bucket endpoints
GET "/bucket" if id => GetBucketInfo (query_opt::id, query_opt::global_alias),
GET "/bucket" if global_alias => GetBucketInfo (query_opt::id, query_opt::global_alias),
GET "/bucket" => ListBuckets,
POST "/bucket" => CreateBucket,
DELETE "/bucket" if id => DeleteBucket (query::id),
PUT "/bucket/website" if id => PutBucketWebsite (query::id),
DELETE "/bucket/website" if id => DeleteBucketWebsite (query::id),
GET "/v0/bucket" if id => GetBucketInfo (query_opt::id, query_opt::global_alias),
GET "/v0/bucket" if global_alias => GetBucketInfo (query_opt::id, query_opt::global_alias),
GET "/v0/bucket" => ListBuckets,
POST "/v0/bucket" => CreateBucket,
DELETE "/v0/bucket" if id => DeleteBucket (query::id),
PUT "/v0/bucket/website" if id => PutBucketWebsite (query::id),
DELETE "/v0/bucket/website" if id => DeleteBucketWebsite (query::id),
// Bucket-key permissions
POST "/bucket/allow" => BucketAllowKey,
POST "/bucket/deny" => BucketDenyKey,
POST "/v0/bucket/allow" => BucketAllowKey,
POST "/v0/bucket/deny" => BucketDenyKey,
// Bucket aliases
PUT "/bucket/alias/global" => GlobalAliasBucket (query::id, query::alias),
DELETE "/bucket/alias/global" => GlobalUnaliasBucket (query::id, query::alias),
PUT "/bucket/alias/local" => LocalAliasBucket (query::id, query::access_key_id, query::alias),
DELETE "/bucket/alias/local" => LocalUnaliasBucket (query::id, query::access_key_id, query::alias),
PUT "/v0/bucket/alias/global" => GlobalAliasBucket (query::id, query::alias),
DELETE "/v0/bucket/alias/global" => GlobalUnaliasBucket (query::id, query::alias),
PUT "/v0/bucket/alias/local" => LocalAliasBucket (query::id, query::access_key_id, query::alias),
DELETE "/v0/bucket/alias/local" => LocalUnaliasBucket (query::id, query::access_key_id, query::alias),
]);
if let Some(message) = query.nonempty_message() {