mirror of
https://github.com/versity/versitygw.git
synced 2026-07-29 03:22:57 +00:00
Merge pull request #1476 from versity/sis/bucket-request-payment-actions-not-implemented
feat: adds not implemented routes for bucket request payment actions
This commit is contained in:
@@ -72,6 +72,8 @@ const (
|
||||
GetLifecycleConfigurationAction Action = "s3:GetLifecycleConfiguration"
|
||||
PutBucketLoggingAction Action = "s3:PutBucketLogging"
|
||||
GetBucketLoggingAction Action = "s3:GetBucketLogging"
|
||||
PutBucketRequestPaymentAction Action = "s3:PutBucketRequestPayment"
|
||||
GetBucketRequestPaymentAction Action = "s3:GetBucketRequestPayment"
|
||||
|
||||
AllActions Action = "s3:*"
|
||||
)
|
||||
|
||||
@@ -96,6 +96,8 @@ var (
|
||||
ActionDeleteBucketLifecycle = "s3_DeleteBucketLifecycle"
|
||||
ActionPutBucketLogging = "s3_PutBucketLogging"
|
||||
ActionGetBucketLogging = "s3_GetBucketLogging"
|
||||
ActionPutBucketRequestPayment = "s3_PutBucketRequestPayment"
|
||||
ActionGetBucketRequestPayment = "s3_GetBucketRequestPayment"
|
||||
|
||||
// Admin actions
|
||||
ActionAdminCreateUser = "admin_CreateUser"
|
||||
|
||||
@@ -286,6 +286,20 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend, iam auth.IAMServ
|
||||
middlewares.ParseAcl(be),
|
||||
),
|
||||
)
|
||||
bucketRouter.Put("",
|
||||
middlewares.MatchQueryArgs("requestPayment"),
|
||||
controllers.ProcessHandlers(
|
||||
ctrl.HandleErrorRoute(s3err.GetAPIError(s3err.ErrNotImplemented)),
|
||||
metrics.ActionPutBucketRequestPayment,
|
||||
services,
|
||||
middlewares.BucketObjectNameValidator(),
|
||||
middlewares.AuthorizePublicBucketAccess(be, metrics.ActionPutBucketRequestPayment, auth.PutBucketRequestPaymentAction, auth.PermissionWrite),
|
||||
middlewares.VerifyPresignedV4Signature(root, iam, region, debug),
|
||||
middlewares.VerifyV4Signature(root, iam, region, debug),
|
||||
middlewares.VerifyMD5Body(),
|
||||
middlewares.ParseAcl(be),
|
||||
),
|
||||
)
|
||||
bucketRouter.Put("",
|
||||
controllers.ProcessHandlers(
|
||||
ctrl.CreateBucket,
|
||||
@@ -709,6 +723,20 @@ func (sa *S3ApiRouter) Init(app *fiber.App, be backend.Backend, iam auth.IAMServ
|
||||
middlewares.ParseAcl(be),
|
||||
),
|
||||
)
|
||||
bucketRouter.Get("",
|
||||
middlewares.MatchQueryArgs("requestPayment"),
|
||||
controllers.ProcessHandlers(
|
||||
ctrl.HandleErrorRoute(s3err.GetAPIError(s3err.ErrNotImplemented)),
|
||||
metrics.ActionGetBucketRequestPayment,
|
||||
services,
|
||||
middlewares.BucketObjectNameValidator(),
|
||||
middlewares.AuthorizePublicBucketAccess(be, metrics.ActionGetBucketRequestPayment, auth.GetBucketRequestPaymentAction, auth.PermissionRead),
|
||||
middlewares.VerifyPresignedV4Signature(root, iam, region, debug),
|
||||
middlewares.VerifyV4Signature(root, iam, region, debug),
|
||||
middlewares.VerifyMD5Body(),
|
||||
middlewares.ParseAcl(be),
|
||||
),
|
||||
)
|
||||
bucketRouter.Get("",
|
||||
middlewares.MatchQueryArgWithValue("list-type", "2"),
|
||||
controllers.ProcessHandlers(
|
||||
|
||||
@@ -648,6 +648,9 @@ func TestNotImplementedActions(s *S3Conf) {
|
||||
// bucket logging actions
|
||||
PutBucketLogging_not_implemented(s)
|
||||
GetBucketLogging_not_implemented(s)
|
||||
// request payment actions
|
||||
PutBucketRequestPayment_not_implemented(s)
|
||||
GetBucketRequestPayment_not_implemented(s)
|
||||
}
|
||||
|
||||
func TestWORMProtection(s *S3Conf) {
|
||||
@@ -1402,6 +1405,8 @@ func GetIntTests() IntTests {
|
||||
"DeleteBucketLifecycle_not_implemented": DeleteBucketLifecycle_not_implemented,
|
||||
"PutBucketLogging_not_implemented": PutBucketLogging_not_implemented,
|
||||
"GetBucketLogging_not_implemented": GetBucketLogging_not_implemented,
|
||||
"PutBucketRequestPayment_not_implemented": PutBucketRequestPayment_not_implemented,
|
||||
"GetBucketRequestPayment_not_implemented": GetBucketRequestPayment_not_implemented,
|
||||
"WORMProtection_bucket_object_lock_configuration_compliance_mode": WORMProtection_bucket_object_lock_configuration_compliance_mode,
|
||||
"WORMProtection_bucket_object_lock_configuration_governance_mode": WORMProtection_bucket_object_lock_configuration_governance_mode,
|
||||
"WORMProtection_bucket_object_lock_governance_bypass_delete": WORMProtection_bucket_object_lock_governance_bypass_delete,
|
||||
|
||||
@@ -15758,6 +15758,37 @@ func GetBucketLogging_not_implemented(s *S3Conf) error {
|
||||
})
|
||||
}
|
||||
|
||||
func PutBucketRequestPayment_not_implemented(s *S3Conf) error {
|
||||
testName := "PutBucketRequestPayment_not_implemented"
|
||||
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), shortTimeout)
|
||||
_, err := s3client.PutBucketRequestPayment(ctx,
|
||||
&s3.PutBucketRequestPaymentInput{
|
||||
Bucket: &bucket,
|
||||
RequestPaymentConfiguration: &types.RequestPaymentConfiguration{
|
||||
Payer: types.PayerBucketOwner,
|
||||
},
|
||||
})
|
||||
cancel()
|
||||
|
||||
return checkApiErr(err, s3err.GetAPIError(s3err.ErrNotImplemented))
|
||||
})
|
||||
}
|
||||
|
||||
func GetBucketRequestPayment_not_implemented(s *S3Conf) error {
|
||||
testName := "GetBucketRequestPayment_not_implemented"
|
||||
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), shortTimeout)
|
||||
_, err := s3client.GetBucketRequestPayment(ctx,
|
||||
&s3.GetBucketRequestPaymentInput{
|
||||
Bucket: &bucket,
|
||||
})
|
||||
cancel()
|
||||
|
||||
return checkApiErr(err, s3err.GetAPIError(s3err.ErrNotImplemented))
|
||||
})
|
||||
}
|
||||
|
||||
func WORMProtection_bucket_object_lock_configuration_compliance_mode(s *S3Conf) error {
|
||||
testName := "WORMProtection_bucket_object_lock_configuration_compliance_mode"
|
||||
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
|
||||
|
||||
Reference in New Issue
Block a user