admin api: rename bucket aliasing operations
This commit is contained in:
parent
17cbfb7fa6
commit
70bf358b60
5 changed files with 58 additions and 58 deletions
|
@ -946,11 +946,11 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/BucketInfo'
|
||||
|
||||
/GlobalAliasBucket:
|
||||
/AddGlobalBucketAlias:
|
||||
post:
|
||||
tags:
|
||||
- Bucket aliases
|
||||
operationId: "GlobalAliasBucket"
|
||||
operationId: "AddGlobalBucketAlias"
|
||||
summary: "Add a global alias"
|
||||
description: |
|
||||
Add a global alias to the target bucket
|
||||
|
@ -982,11 +982,11 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/BucketInfo'
|
||||
|
||||
/GlobalUnaliasBucket:
|
||||
/RemoveGlobalBucketAlias:
|
||||
post:
|
||||
tags:
|
||||
- Bucket aliases
|
||||
operationId: "GlobalUnaliasBucket"
|
||||
operationId: "RemoveGlobalBucketAlias"
|
||||
summary: "Delete a global alias"
|
||||
description: |
|
||||
Delete a global alias from the target bucket
|
||||
|
@ -1018,11 +1018,11 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/BucketInfo'
|
||||
|
||||
/LocalAliasBucket:
|
||||
/AddLocalBucketAlias:
|
||||
post:
|
||||
tags:
|
||||
- Bucket aliases
|
||||
operationId: "LocalAliasBucket"
|
||||
operationId: "AddLocalBucketAlias"
|
||||
summary: "Add a local alias"
|
||||
description: |
|
||||
Add a local alias, bound to specified account, to the target bucket
|
||||
|
@ -1057,11 +1057,11 @@ paths:
|
|||
schema:
|
||||
$ref: '#/components/schemas/BucketInfo'
|
||||
|
||||
/LocalUnaliasBucket:
|
||||
/RemoveGlobalBucketAlias:
|
||||
post:
|
||||
tags:
|
||||
- Bucket aliases
|
||||
operationId: "LocalUnaliasBucket"
|
||||
operationId: "RemoveGlobalBucketAlias"
|
||||
summary: "Delete a local alias"
|
||||
description: |
|
||||
Delete a local alias, bound to specified account, from the target bucket
|
||||
|
|
|
@ -750,7 +750,7 @@ Other flags will remain unchanged.
|
|||
|
||||
### Operations on bucket aliases
|
||||
|
||||
#### GlobalAliasBucket `POST /v2/GlobalAliasBucket`
|
||||
#### AddGlobalBucketAlias `POST /v2/AddGlobalBucketAlias`
|
||||
|
||||
Creates a global alias for a bucket.
|
||||
|
||||
|
@ -763,7 +763,7 @@ Request body format:
|
|||
}
|
||||
```
|
||||
|
||||
#### GlobalUnaliasBucket `POST /v2/GlobalUnaliasBucket`
|
||||
#### RemoveGlobalBucketAlias `POST /v2/RemoveGlobalBucketAlias`
|
||||
|
||||
Removes a global alias for a bucket.
|
||||
|
||||
|
@ -776,7 +776,7 @@ Request body format:
|
|||
}
|
||||
```
|
||||
|
||||
#### LocalAliasBucket `POST /v2/LocalAliasBucket`
|
||||
#### AddLocalBucketAlias `POST /v2/AddLocalBucketAlias`
|
||||
|
||||
Creates a local alias for a bucket in the namespace of a specific access key.
|
||||
|
||||
|
@ -790,7 +790,7 @@ Request body format:
|
|||
}
|
||||
```
|
||||
|
||||
#### LocalUnaliasBucket `POST /v2/LocalUnaliasBucket`
|
||||
#### RemoveLocalBucketAlias `POST /v2/RemoveLocalBucketAlias`
|
||||
|
||||
Removes a local alias for a bucket in the namespace of a specific access key.
|
||||
|
||||
|
|
|
@ -54,10 +54,10 @@ admin_endpoints![
|
|||
BucketDenyKey,
|
||||
|
||||
// Operations on bucket aliases
|
||||
GlobalAliasBucket,
|
||||
GlobalUnaliasBucket,
|
||||
LocalAliasBucket,
|
||||
LocalUnaliasBucket,
|
||||
AddGlobalBucketAlias,
|
||||
RemoveGlobalBucketAlias,
|
||||
AddLocalBucketAlias,
|
||||
RemoveLocalBucketAlias,
|
||||
];
|
||||
|
||||
// **********************************************
|
||||
|
@ -514,48 +514,48 @@ pub struct BucketDenyKeyResponse(pub GetBucketInfoResponse);
|
|||
// Operations on bucket aliases
|
||||
// **********************************************
|
||||
|
||||
// ---- GlobalAliasBucket ----
|
||||
// ---- AddGlobalBucketAlias ----
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct GlobalAliasBucketRequest {
|
||||
pub struct AddGlobalBucketAliasRequest {
|
||||
pub bucket_id: String,
|
||||
pub alias: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct GlobalAliasBucketResponse(pub GetBucketInfoResponse);
|
||||
pub struct AddGlobalBucketAliasResponse(pub GetBucketInfoResponse);
|
||||
|
||||
// ---- GlobalUnaliasBucket ----
|
||||
// ---- RemoveGlobalBucketAlias ----
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct GlobalUnaliasBucketRequest {
|
||||
pub struct RemoveGlobalBucketAliasRequest {
|
||||
pub bucket_id: String,
|
||||
pub alias: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct GlobalUnaliasBucketResponse(pub GetBucketInfoResponse);
|
||||
pub struct RemoveGlobalBucketAliasResponse(pub GetBucketInfoResponse);
|
||||
|
||||
// ---- LocalAliasBucket ----
|
||||
// ---- AddLocalBucketAlias ----
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct LocalAliasBucketRequest {
|
||||
pub struct AddLocalBucketAliasRequest {
|
||||
pub bucket_id: String,
|
||||
pub access_key_id: String,
|
||||
pub alias: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct LocalAliasBucketResponse(pub GetBucketInfoResponse);
|
||||
pub struct AddLocalBucketAliasResponse(pub GetBucketInfoResponse);
|
||||
|
||||
// ---- LocalUnaliasBucket ----
|
||||
// ---- RemoveLocalBucketAlias ----
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct LocalUnaliasBucketRequest {
|
||||
pub struct RemoveLocalBucketAliasRequest {
|
||||
pub bucket_id: String,
|
||||
pub access_key_id: String,
|
||||
pub alias: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct LocalUnaliasBucketResponse(pub GetBucketInfoResponse);
|
||||
pub struct RemoveLocalBucketAliasResponse(pub GetBucketInfoResponse);
|
||||
|
|
|
@ -22,10 +22,10 @@ use crate::admin::api::{
|
|||
BucketDenyKeyResponse, BucketKeyPermChangeRequest, BucketLocalAlias, CreateBucketRequest,
|
||||
CreateBucketResponse, DeleteBucketRequest, DeleteBucketResponse, GetBucketInfoKey,
|
||||
GetBucketInfoRequest, GetBucketInfoResponse, GetBucketInfoWebsiteResponse,
|
||||
GlobalAliasBucketRequest, GlobalAliasBucketResponse, GlobalUnaliasBucketRequest,
|
||||
GlobalUnaliasBucketResponse, ListBucketsRequest, ListBucketsResponse, ListBucketsResponseItem,
|
||||
LocalAliasBucketRequest, LocalAliasBucketResponse, LocalUnaliasBucketRequest,
|
||||
LocalUnaliasBucketResponse, UpdateBucketRequest, UpdateBucketResponse,
|
||||
AddGlobalBucketAliasRequest, AddGlobalBucketAliasResponse, RemoveGlobalBucketAliasRequest,
|
||||
RemoveGlobalBucketAliasResponse, ListBucketsRequest, ListBucketsResponse, ListBucketsResponseItem,
|
||||
AddLocalBucketAliasRequest, AddLocalBucketAliasResponse, RemoveLocalBucketAliasRequest,
|
||||
RemoveLocalBucketAliasResponse, UpdateBucketRequest, UpdateBucketResponse,
|
||||
};
|
||||
use crate::admin::error::*;
|
||||
use crate::admin::EndpointHandler;
|
||||
|
@ -453,10 +453,10 @@ pub async fn handle_bucket_change_key_perm(
|
|||
// ---- BUCKET ALIASES ----
|
||||
|
||||
#[async_trait]
|
||||
impl EndpointHandler for GlobalAliasBucketRequest {
|
||||
type Response = GlobalAliasBucketResponse;
|
||||
impl EndpointHandler for AddGlobalBucketAliasRequest {
|
||||
type Response = AddGlobalBucketAliasResponse;
|
||||
|
||||
async fn handle(self, garage: &Arc<Garage>) -> Result<GlobalAliasBucketResponse, Error> {
|
||||
async fn handle(self, garage: &Arc<Garage>) -> Result<AddGlobalBucketAliasResponse, Error> {
|
||||
let bucket_id = parse_bucket_id(&self.bucket_id)?;
|
||||
|
||||
let helper = garage.locked_helper().await;
|
||||
|
@ -465,17 +465,17 @@ impl EndpointHandler for GlobalAliasBucketRequest {
|
|||
.set_global_bucket_alias(bucket_id, &self.alias)
|
||||
.await?;
|
||||
|
||||
Ok(GlobalAliasBucketResponse(
|
||||
Ok(AddGlobalBucketAliasResponse(
|
||||
bucket_info_results(garage, bucket_id).await?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl EndpointHandler for GlobalUnaliasBucketRequest {
|
||||
type Response = GlobalUnaliasBucketResponse;
|
||||
impl EndpointHandler for RemoveGlobalBucketAliasRequest {
|
||||
type Response = RemoveGlobalBucketAliasResponse;
|
||||
|
||||
async fn handle(self, garage: &Arc<Garage>) -> Result<GlobalUnaliasBucketResponse, Error> {
|
||||
async fn handle(self, garage: &Arc<Garage>) -> Result<RemoveGlobalBucketAliasResponse, Error> {
|
||||
let bucket_id = parse_bucket_id(&self.bucket_id)?;
|
||||
|
||||
let helper = garage.locked_helper().await;
|
||||
|
@ -484,17 +484,17 @@ impl EndpointHandler for GlobalUnaliasBucketRequest {
|
|||
.unset_global_bucket_alias(bucket_id, &self.alias)
|
||||
.await?;
|
||||
|
||||
Ok(GlobalUnaliasBucketResponse(
|
||||
Ok(RemoveGlobalBucketAliasResponse(
|
||||
bucket_info_results(garage, bucket_id).await?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl EndpointHandler for LocalAliasBucketRequest {
|
||||
type Response = LocalAliasBucketResponse;
|
||||
impl EndpointHandler for AddLocalBucketAliasRequest {
|
||||
type Response = AddLocalBucketAliasResponse;
|
||||
|
||||
async fn handle(self, garage: &Arc<Garage>) -> Result<LocalAliasBucketResponse, Error> {
|
||||
async fn handle(self, garage: &Arc<Garage>) -> Result<AddLocalBucketAliasResponse, Error> {
|
||||
let bucket_id = parse_bucket_id(&self.bucket_id)?;
|
||||
|
||||
let helper = garage.locked_helper().await;
|
||||
|
@ -503,17 +503,17 @@ impl EndpointHandler for LocalAliasBucketRequest {
|
|||
.set_local_bucket_alias(bucket_id, &self.access_key_id, &self.alias)
|
||||
.await?;
|
||||
|
||||
Ok(LocalAliasBucketResponse(
|
||||
Ok(AddLocalBucketAliasResponse(
|
||||
bucket_info_results(garage, bucket_id).await?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl EndpointHandler for LocalUnaliasBucketRequest {
|
||||
type Response = LocalUnaliasBucketResponse;
|
||||
impl EndpointHandler for RemoveLocalBucketAliasRequest {
|
||||
type Response = RemoveLocalBucketAliasResponse;
|
||||
|
||||
async fn handle(self, garage: &Arc<Garage>) -> Result<LocalUnaliasBucketResponse, Error> {
|
||||
async fn handle(self, garage: &Arc<Garage>) -> Result<RemoveLocalBucketAliasResponse, Error> {
|
||||
let bucket_id = parse_bucket_id(&self.bucket_id)?;
|
||||
|
||||
let helper = garage.locked_helper().await;
|
||||
|
@ -522,7 +522,7 @@ impl EndpointHandler for LocalUnaliasBucketRequest {
|
|||
.unset_local_bucket_alias(bucket_id, &self.access_key_id, &self.alias)
|
||||
.await?;
|
||||
|
||||
Ok(LocalUnaliasBucketResponse(
|
||||
Ok(RemoveLocalBucketAliasResponse(
|
||||
bucket_info_results(garage, bucket_id).await?,
|
||||
))
|
||||
}
|
||||
|
|
|
@ -55,10 +55,10 @@ impl AdminApiRequest {
|
|||
POST BucketAllowKey (body),
|
||||
POST BucketDenyKey (body),
|
||||
// Bucket aliases
|
||||
POST GlobalAliasBucket (body),
|
||||
POST GlobalUnaliasBucket (body),
|
||||
POST LocalAliasBucket (body),
|
||||
POST LocalUnaliasBucket (body),
|
||||
POST AddGlobalBucketAlias (body),
|
||||
POST RemoveGlobalBucketAlias (body),
|
||||
POST AddLocalBucketAlias (body),
|
||||
POST RemoveLocalBucketAlias (body),
|
||||
]);
|
||||
|
||||
if let Some(message) = query.nonempty_message() {
|
||||
|
@ -174,14 +174,14 @@ impl AdminApiRequest {
|
|||
Ok(AdminApiRequest::BucketDenyKey(BucketDenyKeyRequest(req)))
|
||||
}
|
||||
// Bucket aliasing
|
||||
Endpoint::GlobalAliasBucket { id, alias } => Ok(AdminApiRequest::GlobalAliasBucket(
|
||||
GlobalAliasBucketRequest {
|
||||
Endpoint::GlobalAliasBucket { id, alias } => Ok(AdminApiRequest::AddGlobalBucketAlias(
|
||||
AddGlobalBucketAliasRequest {
|
||||
bucket_id: id,
|
||||
alias,
|
||||
},
|
||||
)),
|
||||
Endpoint::GlobalUnaliasBucket { id, alias } => Ok(
|
||||
AdminApiRequest::GlobalUnaliasBucket(GlobalUnaliasBucketRequest {
|
||||
AdminApiRequest::RemoveGlobalBucketAlias(RemoveGlobalBucketAliasRequest {
|
||||
bucket_id: id,
|
||||
alias,
|
||||
}),
|
||||
|
@ -190,7 +190,7 @@ impl AdminApiRequest {
|
|||
id,
|
||||
access_key_id,
|
||||
alias,
|
||||
} => Ok(AdminApiRequest::LocalAliasBucket(LocalAliasBucketRequest {
|
||||
} => Ok(AdminApiRequest::AddLocalBucketAlias(AddLocalBucketAliasRequest {
|
||||
access_key_id,
|
||||
bucket_id: id,
|
||||
alias,
|
||||
|
@ -199,8 +199,8 @@ impl AdminApiRequest {
|
|||
id,
|
||||
access_key_id,
|
||||
alias,
|
||||
} => Ok(AdminApiRequest::LocalUnaliasBucket(
|
||||
LocalUnaliasBucketRequest {
|
||||
} => Ok(AdminApiRequest::RemoveLocalBucketAlias(
|
||||
RemoveLocalBucketAliasRequest {
|
||||
access_key_id,
|
||||
bucket_id: id,
|
||||
alias,
|
||||
|
|
Loading…
Add table
Reference in a new issue