Skip to content
Permalink
Browse files
AMBARI-24802 - Logsearch: upgrade swagger-ui to 3.19.0 (#10)
  • Loading branch information
kasakrisz committed Oct 18, 2018
1 parent 4471753 commit 49408e43c7487b00497861dfa20d5de6a20dfb63
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 162 deletions.
@@ -572,7 +572,7 @@
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>2.2.2</version>
<version>3.19.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
@@ -18,17 +18,20 @@
*/
package org.apache.ambari.logsearch.common;

import io.swagger.jaxrs.config.BeanConfig;
import io.swagger.models.Swagger;
import io.swagger.util.Yaml;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import io.swagger.jaxrs.config.BeanConfig;
import io.swagger.models.Swagger;
import io.swagger.models.auth.BasicAuthDefinition;
import io.swagger.util.Yaml;

@Named
public class ApiDocStorage {
@@ -47,20 +50,19 @@ private void postConstruct() {
public void run() {
logger.info("Start thread to scan REST API doc from endpoints.");
Swagger swagger = beanConfig.getSwagger();
swagger.addSecurityDefinition("basicAuth", new BasicAuthDefinition());
beanConfig.configure(swagger);
beanConfig.scanAndRead();
setSwagger(swagger);
try {
if (swagger != null) {
String yaml = Yaml.mapper().writeValueAsString(swagger);
StringBuilder b = new StringBuilder();
String[] parts = yaml.split("\n");
for (String part : parts) {
b.append(part);
b.append("\n");
}
setSwaggerYaml(b.toString());
String yaml = Yaml.mapper().writeValueAsString(swagger);
StringBuilder b = new StringBuilder();
String[] parts = yaml.split("\n");
for (String part : parts) {
b.append(part);
b.append("\n");
}
setSwaggerYaml(b.toString());
} catch (Exception e) {
e.printStackTrace();
}
@@ -19,6 +19,19 @@

package org.apache.ambari.logsearch.rest;

import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.EXPORT_USER_TALBE_TO_TEXT_FILE_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.GET_AUDIT_CLUSTERS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.GET_AUDIT_COMPONENTS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.GET_AUDIT_LINE_GRAPH_DATA_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.GET_AUDIT_LOGS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.GET_AUDIT_SCHEMA_FIELD_LIST_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.GET_SERVICE_LOAD_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.GET_TOP_AUDIT_RESOURCES_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.PURGE_AUDIT_LOGS_OD;

import java.util.List;
import java.util.Map;

import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Named;
@@ -34,11 +47,9 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import freemarker.template.TemplateException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ambari.logsearch.common.LogSearchConstants;
import org.apache.ambari.logsearch.common.StatusMessage;
import org.apache.ambari.logsearch.manager.AuditLogsManager;
import org.apache.ambari.logsearch.model.metadata.AuditFieldMetadataResponse;
import org.apache.ambari.logsearch.model.request.impl.body.AuditBarGraphBodyRequest;
import org.apache.ambari.logsearch.model.request.impl.body.AuditLogBodyRequest;
@@ -53,15 +64,14 @@
import org.apache.ambari.logsearch.model.request.impl.query.UserExportQueryRequest;
import org.apache.ambari.logsearch.model.response.AuditLogResponse;
import org.apache.ambari.logsearch.model.response.BarGraphDataListResponse;
import org.apache.ambari.logsearch.manager.AuditLogsManager;
import org.springframework.context.annotation.Scope;

import java.util.List;
import java.util.Map;

import static org.apache.ambari.logsearch.doc.DocConstants.AuditOperationDescriptions.*;
import freemarker.template.TemplateException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Authorization;

@Api(value = "audit/logs", description = "Audit log operations")
@Api(value = "audit/logs", description = "Audit log operations", authorizations = {@Authorization(value = "basicAuth")})
@Path("audit/logs")
@Named
@Scope("request")
@@ -19,6 +19,13 @@

package org.apache.ambari.logsearch.rest;

import static org.apache.ambari.logsearch.doc.DocConstants.EventHistoryOperationDescriptions.DELETE_EVENT_HISTORY_DATA_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.EventHistoryOperationDescriptions.GET_ALL_USER_NAMES_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.EventHistoryOperationDescriptions.GET_EVENT_HISTORY_DATA_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.EventHistoryOperationDescriptions.SAVE_EVENT_HISTORY_DATA_OD;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.BeanParam;
@@ -29,19 +36,17 @@
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ambari.logsearch.manager.EventHistoryManager;
import org.apache.ambari.logsearch.model.request.impl.query.EventHistoryQueryRequest;
import org.apache.ambari.logsearch.model.response.EventHistoryData;
import org.apache.ambari.logsearch.model.response.EventHistoryDataListResponse;
import org.springframework.context.annotation.Scope;

import java.util.List;

import static org.apache.ambari.logsearch.doc.DocConstants.EventHistoryOperationDescriptions.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Authorization;

@Api(value = "history", description = "Event history operations")
@Api(value = "history", description = "Event history operations", authorizations = {@Authorization(value = "basicAuth")})
@Path("history")
@Named
@Scope("request")
@@ -18,6 +18,28 @@
*/
package org.apache.ambari.logsearch.rest;

import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.EXPORT_TO_TEXT_FILE_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_AFTER_BEFORE_LOGS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_AGGREGATED_INFO_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_ANY_GRAPH_COUNT_DATA_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_COMPONENTS_COUNT_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_COMPONENTS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_COMPONENT_LIST_WITH_LEVEL_COUNT_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_HISTOGRAM_DATA_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_HOSTS_COUNT_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_HOSTS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_HOST_LIST_BY_COMPONENT_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_HOST_LOGFILES_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_LOG_LEVELS_COUNT_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_SERVICE_CLUSTERS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_SERVICE_LOGS_SCHEMA_FIELD_NAME_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.GET_TREE_EXTENSION_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.PURGE_LOGS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.REQUEST_CANCEL;
import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.SEARCH_LOGS_OD;

import java.util.List;

import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Named;
@@ -34,11 +56,9 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.apache.ambari.logsearch.common.LogSearchConstants;
import org.apache.ambari.logsearch.common.StatusMessage;
import org.apache.ambari.logsearch.manager.ServiceLogsManager;
import org.apache.ambari.logsearch.model.metadata.FieldMetadata;
import org.apache.ambari.logsearch.model.metadata.ServiceComponentMetadataWrapper;
import org.apache.ambari.logsearch.model.request.impl.body.ClusterBodyRequest;
@@ -72,14 +92,13 @@
import org.apache.ambari.logsearch.model.response.NameValueDataListResponse;
import org.apache.ambari.logsearch.model.response.NodeListResponse;
import org.apache.ambari.logsearch.model.response.ServiceLogResponse;
import org.apache.ambari.logsearch.manager.ServiceLogsManager;
import org.springframework.context.annotation.Scope;

import java.util.List;

import static org.apache.ambari.logsearch.doc.DocConstants.ServiceOperationDescriptions.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Authorization;

@Api(value = "service/logs", description = "Service log operations")
@Api(value = "service/logs", description = "Service log operations", authorizations = {@Authorization(value = "basicAuth")})
@Path("service/logs")
@Named
@Scope("request")
@@ -49,8 +49,9 @@

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Authorization;

@Api(value = "shipper", description = "Shipper config operations")
@Api(value = "shipper", description = "Shipper config operations", authorizations = {@Authorization(value = "basicAuth")})
@Path("shipper")
@Named
@Scope("request")
@@ -18,25 +18,28 @@
*/
package org.apache.ambari.logsearch.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ambari.logsearch.conf.global.SolrCollectionState;
import org.springframework.context.annotation.Scope;
import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.AUDIT_LOGS_STATUS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.EVENT_HISTORY_STATUS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.SERVICE_LOGS_STATUS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.STATUS_OD;

import java.util.HashMap;
import java.util.Map;

import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.HashMap;
import java.util.Map;

import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.AUDIT_LOGS_STATUS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.SERVICE_LOGS_STATUS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.STATUS_OD;
import static org.apache.ambari.logsearch.doc.DocConstants.StatusOperationDescriptions.EVENT_HISTORY_STATUS_OD;
import org.apache.ambari.logsearch.conf.global.SolrCollectionState;
import org.springframework.context.annotation.Scope;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Authorization;

@Api(value = "status", description = "Status Operations")
@Api(value = "status", description = "Status Operations", authorizations = {@Authorization(value = "basicAuth")})
@Path("status")
@Named
@Scope("request")

0 comments on commit 49408e4

Please sign in to comment.