Skip to content

Commit

Permalink
Merge pull request #88 from Pranav-b-7/OP-3097
Browse files Browse the repository at this point in the history
Op 3097
  • Loading branch information
Pranav-b-7 authored Jan 6, 2021
2 parents 45530fc + 20daca1 commit 5ff85d2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
import okhttp3.Request
import org.apache.commons.io.IOUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
import retrofit.client.Response

@RequestMapping("/autopilot")
@RestController
Expand Down Expand Up @@ -61,6 +63,22 @@ class OpsmxAutopilotController {
return opsmxAutopilotService.getAutoResponse1(type)
}

@ApiOperation(value = "Endpoint for autopilot rest services")
@GetMapping(value = "/canaries/debugLogsData", produces = "application/zip")
@ResponseBody Object downloadDebugData(@RequestParam(value = "id", required = false) Integer canaryId){
Response response = opsmxAutopilotService.downloadDebugData(canaryId)
InputStream inputStream = response.getBody().in()
try {
byte [] zipFile = IOUtils.toByteArray(inputStream)
return zipFile
} finally{
if (inputStream!=null){
inputStream.close()
}
}

}

@ApiOperation(value = "Endpoint for autopilot rest services")
@RequestMapping(value = "/{type}/{source}", method = RequestMethod.GET)
Object getAutoResponse(@PathVariable("type") String type, @PathVariable("source") String source,
Expand Down Expand Up @@ -113,6 +131,7 @@ class OpsmxAutopilotController {
@RequestParam(value = "serviceList", required = false) List<String> serviceList,
@RequestParam(value = "pipelineId", required = false) String pipelineId,
@RequestParam(value = "referer", required = false) String referer){

return opsmxAutopilotService.getAutoResponse(type, source, id, applicationId, serviceId, startTime, endTime, intervalMins, limit, sourceType, datasourceType,
accountName, templateType, name, appId, pipelineid, applicationName, username, userName, templateName, credentialType, canaryId, service, canary, canaryid, clusterId, version, canaryAnalysisId,
metric,account,metricType,isBoxplotData,metricname,numofver,serviceName,platform,ruleId,zone,appType,metricTemplate,logTemplate,riskanalysis_id,service_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

package com.netflix.spinnaker.gate.services.internal

import org.springframework.web.bind.annotation.PathVariable
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 retrofit.client.Response
import retrofit.http.*

interface OpsmxAutopilotService {

@GET("/autopilot/canaries/debugLogsData")
Response downloadDebugData(@Query("id") Integer canaryId)

@GET("/autopilot/{type}/{source}")
Object getAutoResponse(@Path('type') String type,
@Path('source') String source,
Expand Down

0 comments on commit 5ff85d2

Please sign in to comment.