devmadhuu commented on code in PR #4822: URL: https://github.com/apache/ozone/pull/4822#discussion_r1217506713
########## hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/FeaturesEndpoint.java: ########## @@ -0,0 +1,77 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.recon.api; + +import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.apache.hadoop.ozone.recon.api.types.Feature; +import org.apache.hadoop.ozone.recon.heatmap.HeatMapServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.List; + + +/** + * Endpoint for APIs related to features in Recon. + * API: "api/v1/features/disabledFeatures" + * Disabled features may represent or fall under below categories: + * 1. Implementation Not Available + * 2. Beta Phase + */ +@Path("/features") +@Produces(MediaType.APPLICATION_JSON) +@AdminOnly +public class FeaturesEndpoint { + + private static final Logger LOG = + LoggerFactory.getLogger(HeatMapServiceImpl.class); + private final OzoneConfiguration ozoneConfiguration; + + @Inject + public FeaturesEndpoint(OzoneConfiguration ozoneConfiguration) { + this.ozoneConfiguration = ozoneConfiguration; + } + + /** + * This API returns the list of all disabled features in Recon. + * + * @return {@link Response} + */ + @GET + @Path("/disabledFeatures") + public Response getDisabledFeatures() { + List<Feature> allDisabledFeatures; + try { + allDisabledFeatures = Feature.getAllDisabledFeatures(); Review Comment: @sumitagrawl Thanks for review. Initialization of false for default as this is kind of framework, so by default disabled as false, and in future also if more features will get added in this enum, then they will be initialized as false only, because normally before any API gets called, features information are loaded at startup and in our case of heatmap also , if you check then initializeHeatMap provider method tries to load and set disable as true -- 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]
