adoroszlai commented on code in PR #9679: URL: https://github.com/apache/ozone/pull/9679#discussion_r2732391968
########## hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketCrudHandler.java: ########## @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.ozone.s3.endpoint; + +import static org.apache.hadoop.ozone.s3.exception.S3ErrorTable.newError; + +import java.io.IOException; +import java.io.InputStream; +import javax.ws.rs.core.Response; +import org.apache.hadoop.ozone.audit.S3GAction; +import org.apache.hadoop.ozone.client.OzoneBucket; +import org.apache.hadoop.ozone.om.exceptions.OMException; +import org.apache.hadoop.ozone.s3.exception.OS3Exception; +import org.apache.hadoop.ozone.s3.exception.S3ErrorTable; +import org.apache.hadoop.ozone.s3.util.S3Consts.QueryParams; +import org.apache.hadoop.util.Time; +import org.apache.http.HttpStatus; + +/** + * Handler for default bucket CRUD operations. + * Implements PUT (create bucket) and DELETE operations when no + * subresource query parameters are present. + * + * This handler processes bucket-level requests that do not target + * specific subresources (such as {@code ?acl}, {@code ?uploads}, + * or {@code ?delete}), which are handled by dedicated handlers. + * + * This handler extends EndpointBase to inherit all required functionality + * (configuration, headers, request context, audit logging, metrics, etc.). + */ +public class BucketCrudHandler extends EndpointBase implements BucketOperationHandler { + + /** + * Handle only plain PUT bucket (create bucket), not subresources. + */ + private boolean shouldHandlePutCreateBucket() { + return queryParams().get(QueryParams.ACL) == null + && queryParams().get(QueryParams.UPLOADS) == null + && queryParams().get(QueryParams.DELETE) == null; Review Comment: Handlers are tried in order, so `BucketCrudHandler` does not need to check conditions, just handle all requests that reach it, like `BucketEndpoint` did. We can keep this method if you prefer, but then please rename to `shouldHandle` and reuse in `handleDeleteRequest`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
