Standalone TCA with EELF Logger
[dcaegen2/analytics/tca-gen2.git] / dcae-analytics / dcae-analytics-tca-web / src / main / java / org / onap / dcae / analytics / tca / web / config / SwaggerConfig.java
diff --git a/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/SwaggerConfig.java b/dcae-analytics/dcae-analytics-tca-web/src/main/java/org/onap/dcae/analytics/tca/web/config/SwaggerConfig.java
new file mode 100644 (file)
index 0000000..11fa97c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ *
+ */
+
+package org.onap.dcae.analytics.tca.web.config;
+
+import static org.onap.dcae.analytics.model.TcaModelConstants.TCA_REST_API_PREFIX;
+
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author Rajiv Singla
+ */
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig {
+
+    @Bean
+    public Docket apiDocker() {
+        return new Docket(DocumentationType.SWAGGER_2)
+                .apiInfo(getApiInfo())
+                .useDefaultResponseMessages(false)
+                .select()
+                .apis(RequestHandlerSelectors.basePackage("org.onap.dcae.analytics.tca.web.controller"))
+                .paths(PathSelectors.ant(TCA_REST_API_PREFIX + "**"))
+                .build();
+    }
+
+
+    private static ApiInfo getApiInfo() {
+        return new ApiInfoBuilder()
+                .title("TCA (Threshold Crossing Alert) Analytics RESTful API")
+                .description("RESTful API for Threshold Crossing Alerts Analytics")
+                .license("Apache License Version 2.0")
+                .version("3.0")
+                .build();
+    }
+
+}