diff --git a/auth/bucket_policy_actions.go b/auth/bucket_policy_actions.go index a50d4a4a..96cfb4a5 100644 --- a/auth/bucket_policy_actions.go +++ b/auth/bucket_policy_actions.go @@ -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:*" ) diff --git a/metrics/actions.go b/metrics/actions.go index 5af70b00..615182fc 100644 --- a/metrics/actions.go +++ b/metrics/actions.go @@ -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" diff --git a/s3api/router.go b/s3api/router.go index 592fdfba..cbcdefea 100644 --- a/s3api/router.go +++ b/s3api/router.go @@ -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( diff --git a/tests/integration/group-tests.go b/tests/integration/group-tests.go index 6a0221ef..a588233d 100644 --- a/tests/integration/group-tests.go +++ b/tests/integration/group-tests.go @@ -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, diff --git a/tests/integration/tests.go b/tests/integration/tests.go index 683f5ae2..aa99af5c 100644 --- a/tests/integration/tests.go +++ b/tests/integration/tests.go @@ -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 {