Skip to content

Commit

Permalink
Merge pull request #161 from tmobile/dev/pacbot1.2
Browse files Browse the repository at this point in the history
Dev/pacbot1.2
  • Loading branch information
kaykumar authored Mar 13, 2019
2 parents 797321e + 1781685 commit f5e2f89
Show file tree
Hide file tree
Showing 257 changed files with 25,490 additions and 23,502 deletions.
11 changes: 1 addition & 10 deletions api/pacman-api-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,7 @@
<version>2.7.0</version>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* AdminApplication Main Class
*/
@SpringBootApplication
/*@EnableHystrix
@EnableHystrixDashboard*/
@EnableFeignClients
@EnableConfigurationProperties
@Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tmobile.pacman.api.admin.domain.CreateUpdateAssetGroupDetails;
import com.tmobile.pacman.api.admin.domain.DeleteAssetGroupRequest;
import com.tmobile.pacman.api.admin.domain.Response;
Expand Down Expand Up @@ -65,7 +64,7 @@ public class AssetGroupController {
* @return The asset group names
*/
@ApiOperation(httpMethod = "GET", value = "API to get all asset group names", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@HystrixCommand

@RequestMapping(path = "/list-names", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAllAssetGroupNames() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tmobile.pacman.api.admin.domain.Response;
import com.tmobile.pacman.api.admin.repository.service.DatasourceService;
import com.tmobile.pacman.api.commons.utils.ResponseUtils;
Expand Down Expand Up @@ -57,7 +56,7 @@ public class DatasourceController {
*/
@ApiOperation(httpMethod = "GET", value = "API to get all datasource details", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
//@PreAuthorize("@securityService.hasPermission(authentication)")
@HystrixCommand

@RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAllDatasourceDetails() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tmobile.pacman.api.admin.domain.JobDetails;
import com.tmobile.pacman.api.admin.domain.Response;
import com.tmobile.pacman.api.admin.repository.service.JobExecutionManagerService;
Expand Down Expand Up @@ -68,7 +67,6 @@ public class JobExecutionManagerController {
* @return All JobExecutionManagers details
*/
@ApiOperation(httpMethod = "GET", value = "API to get all Job Execution Managers", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE)
@HystrixCommand
@RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAllJobExecutionManagers(
@ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page,
Expand All @@ -92,7 +90,6 @@ public ResponseEntity<Object> getAllJobExecutionManagers(
*/
@ApiOperation(httpMethod = "POST", value = "API to create new job", response = Response.class, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@RequestMapping(path = "/create", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@HystrixCommand
public ResponseEntity<Object> createJob(@AuthenticationPrincipal Principal user,
@ApiParam(value = "provide valid job details", required = false) @RequestParam(defaultValue = StringUtils.EMPTY, value = "file", required = false) MultipartFile fileToUpload, JobDetails createJobDetails) {
try {
Expand All @@ -113,7 +110,6 @@ public ResponseEntity<Object> createJob(@AuthenticationPrincipal Principal user,
*/
@ApiOperation(httpMethod = "POST", value = "API to update existing job", response = Response.class, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@RequestMapping(path = "/update", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@HystrixCommand
public ResponseEntity<Object> updateJob(@AuthenticationPrincipal Principal user,
@ApiParam(value = "provide valid job details", required = false) @RequestParam(value = "file", required = false) MultipartFile fileToUpload, JobDetails updateJobDetails) {
try {
Expand All @@ -131,7 +127,6 @@ public ResponseEntity<Object> updateJob(@AuthenticationPrincipal Principal user,
* @return All Job Id list
*/
@ApiOperation(httpMethod = "GET", value = "API to get all Job Id's", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE)
@HystrixCommand
@RequestMapping(path = "/job-ids", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAllJobIds() {
try {
Expand All @@ -150,7 +145,6 @@ public ResponseEntity<Object> getAllJobIds() {
* @return Job details
*/
@ApiOperation(httpMethod = "GET", value = "API to get job by id", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@HystrixCommand
@RequestMapping(path = "/details-by-id", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getRulesById(
@ApiParam(value = "provide valid job id", required = true) @RequestParam(defaultValue = StringUtils.EMPTY, name = "jobId", required = true) String jobId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,29 @@
******************************************************************************/
package com.tmobile.pacman.api.admin.controller;

import io.swagger.annotations.Api;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tmobile.pacman.api.admin.domain.PluginDetails;
import com.tmobile.pacman.api.admin.repository.service.PluginService;
import com.tmobile.pacman.api.commons.exception.ServiceException;
import com.tmobile.pacman.api.commons.utils.ResponseUtils;

import io.swagger.annotations.Api;

@Api(value = "/plugin", consumes = "application/json", produces = "application/json")
@RestController
@PreAuthorize("@securityService.hasPermission(authentication, 'ROLE_ADMIN')")
@RequestMapping("/plugin")
public class PluginController {
PluginService pluginService;

@HystrixCommand
@RequestMapping(path = "/v1/plugins", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Object> getplugins( @RequestParam(name = "pluginId", required = false) String pluginId){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tmobile.pacman.api.admin.domain.CreatePolicyDetails;
import com.tmobile.pacman.api.admin.domain.Response;
import com.tmobile.pacman.api.admin.domain.UpdatePolicyDetails;
Expand Down Expand Up @@ -67,7 +66,6 @@ public class PolicyController {
@ApiOperation(httpMethod = "GET", value = "API to get all policies", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE)
//@PreAuthorize("@securityService.hasPermission(authentication)")
@RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@HystrixCommand
public ResponseEntity<Object> getPolicies(
@ApiParam(value = "provide valid page number", required = true) @RequestParam("page") Integer page,
@ApiParam(value = "provide valid page size", required = true) @RequestParam("size") Integer size,
Expand Down Expand Up @@ -109,7 +107,6 @@ public ResponseEntity<Object> getRulesById(
@ApiOperation(httpMethod = "GET", value = "API to get all policy ids", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
//@PreAuthorize("@securityService.hasPermission(authentication)")
@RequestMapping(path = "/list-ids", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@HystrixCommand
public ResponseEntity<Object> getAllPolicyIds() {
try {
return ResponseUtils.buildSucessResponse(policyService.getAllPolicyIds());
Expand All @@ -129,7 +126,6 @@ public ResponseEntity<Object> getAllPolicyIds() {
@ApiOperation(httpMethod = "POST", value = "API to update existing policy", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
//@PreAuthorize("@securityService.hasPermission(authentication)")
@RequestMapping(path = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@HystrixCommand
public ResponseEntity<Object> updatePolicies(
@ApiParam(value = "provide valid policy details", required = true) @RequestBody(required = true) UpdatePolicyDetails policyDetails) {
try {
Expand All @@ -150,7 +146,6 @@ public ResponseEntity<Object> updatePolicies(
@ApiOperation(httpMethod = "POST", value = "API to create new policy", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
//@PreAuthorize("@securityService.hasPermission(authentication)")
@RequestMapping(path = "/create", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@HystrixCommand
public ResponseEntity<Object> createPolicies(
@ApiParam(value = "provide valid policy details", required = true) @RequestBody(required = true) CreatePolicyDetails policyDetails) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tmobile.pacman.api.admin.domain.CreateUpdateRuleDetails;
import com.tmobile.pacman.api.admin.domain.Response;
import com.tmobile.pacman.api.admin.repository.service.RuleService;
Expand Down Expand Up @@ -70,7 +69,6 @@ public class RuleController {
* @param searchTerm - searchTerm to be searched.
* @return All Rules details
*/
@HystrixCommand
@ApiOperation(httpMethod = "GET", value = "API to get all rules", response = Page.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getRules(
Expand Down Expand Up @@ -110,7 +108,6 @@ public ResponseEntity<Object> getRulesById(
* @author Nidhish
* @return All AlexaKeywords
*/
@HystrixCommand
@ApiOperation(httpMethod = "GET", value = "API to get alexa keywords", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/alexa-keywords", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAllAlexaKeywords() {
Expand All @@ -128,7 +125,6 @@ public ResponseEntity<Object> getAllAlexaKeywords() {
* @author Nidhish
* @return All Rule Id's
*/
@HystrixCommand
@ApiOperation(httpMethod = "GET", value = "API to get all Rule Id's", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/rule-ids", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAllRuleIds() {
Expand All @@ -148,7 +144,6 @@ public ResponseEntity<Object> getAllRuleIds() {
* @param createRuleDetails - details for creating new rule
* @return Success or Failure response
*/
@HystrixCommand
@ApiOperation(httpMethod = "POST", value = "API to create new rule", response = Response.class, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@RequestMapping(path = "/create", method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<Object> createRule(@AuthenticationPrincipal Principal user,
Expand Down Expand Up @@ -229,7 +224,6 @@ public ResponseEntity<Object> enableDisableRule(@AuthenticationPrincipal Princip
*
* @return the all rule category
*/
@HystrixCommand
@ApiOperation(httpMethod = "GET", value = "API to get all Rule Category's", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/categories", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAllRuleCategory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.tmobile.pacman.api.admin.domain.AttributeValuesRequest;
import com.tmobile.pacman.api.admin.domain.CreateUpdateTargetTypeDetailsRequest;
import com.tmobile.pacman.api.admin.domain.Response;
Expand Down Expand Up @@ -111,7 +110,6 @@ public ResponseEntity<Object> getAllTargetTypesCategories() {
* @param assetGroupName - valid assetGroup name
* @return TargetTypes details
*/
@HystrixCommand
@ApiOperation(httpMethod = "GET", value = "API to get all target types by asset group name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/list-by-asset-group-name", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getTargetTypesByAssetGroupName(
Expand All @@ -131,7 +129,6 @@ public ResponseEntity<Object> getTargetTypesByAssetGroupName(
* @param targetTypeName - valid targetType name
* @return TargetTypes details
*/
@HystrixCommand
@ApiOperation(httpMethod = "GET", value = "API to get target types details by name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/list-by-target-type-name", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getTargetTypesByName(
Expand Down Expand Up @@ -206,7 +203,6 @@ public ResponseEntity<Object> getAllTargetTypes(
* @param dataSourceName - valid dataSourceName
* @return TargetTypes names
*/
@HystrixCommand
@ApiOperation(httpMethod = "GET", value = "API to get all target type names by datasource name", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/list-names-by-datasource", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getTargetTypesNamesByDataSourceName(
Expand All @@ -226,7 +222,6 @@ public ResponseEntity<Object> getTargetTypesNamesByDataSourceName(
* @param targetTypes - list of target type details
* @return TargetType Attributes
*/
@HystrixCommand
@ApiOperation(httpMethod = "POST", value = "API to get all target type attributes", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/list-target-type-attributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getTargetTypeAttributes(
Expand All @@ -246,7 +241,6 @@ public ResponseEntity<Object> getTargetTypeAttributes(
* @param attributeValuesRequest - valid attribute value request details
* @return TargetType Attribute Values
*/
@HystrixCommand
@ApiOperation(httpMethod = "POST", value = "API to get attribute values", response = Response.class, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/list-target-type-attributes-values", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> getAttributeValues(
Expand Down
Loading

0 comments on commit f5e2f89

Please sign in to comment.