@ApiOperation(value = "Initiate a canary pipeline with CanaryConfig provided") @RequestMapping(consumes = "application/json", method = RequestMethod.POST) public CanaryExecutionResponse initiateCanaryWithConfig(@RequestParam(required = false) final String application, @RequestParam(required = false) final String parentPipelineExecutionId, @RequestParam(required = false) final String metricsAccountName, @RequestParam(required = false) final String storageAccountName, @ApiParam @RequestBody final CanaryAdhocExecutionRequest canaryAdhocExecutionRequest) throws JsonProcessingException { String resolvedMetricsAccountName = CredentialsHelper.resolveAccountByNameOrType(metricsAccountName, AccountCredentials.Type.METRICS_STORE, accountCredentialsRepository); String resolvedStorageAccountName = CredentialsHelper.resolveAccountByNameOrType(storageAccountName, AccountCredentials.Type.OBJECT_STORE, accountCredentialsRepository); if (canaryAdhocExecutionRequest.getCanaryConfig() == null) { throw new IllegalArgumentException("canaryConfig must be provided for ad-hoc requests"); } if (canaryAdhocExecutionRequest.getExecutionRequest() == null) { throw new IllegalArgumentException("executionRequest must be provided for ad-hoc requests"); } return executionMapper.buildExecution(Optional.ofNullable(application).orElse(AD_HOC), parentPipelineExecutionId, AD_HOC, canaryAdhocExecutionRequest.getCanaryConfig(), null, resolvedMetricsAccountName, resolvedStorageAccountName, canaryAdhocExecutionRequest.getExecutionRequest()); }
String storageAccount = context.getStorageAccountName(); CanaryAdhocExecutionRequest request = new CanaryAdhocExecutionRequest(); request.setCanaryConfig(context.getCanaryConfig()); .setSiteLocal(context.getSiteLocal()); request.setExecutionRequest(executionRequest); accountCredentialsRepository); if (request.getCanaryConfig() == null) { throw new IllegalArgumentException("canaryConfig must be provided for ad-hoc requests"); if (request.getExecutionRequest() == null) { throw new IllegalArgumentException("executionRequest must be provided for ad-hoc requests"); stage.getExecution().getId(), Optional.ofNullable(context.getCanaryConfigId()).orElse(AD_HOC), request.getCanaryConfig(), null, resolvedMetricsAccountName, resolvedStorageAccountName, request.getExecutionRequest()); } catch (Exception e) { throw new RuntimeException("Failed to initiate canary analysis", e);
String storageAccount = context.getStorageAccountName(); CanaryAdhocExecutionRequest request = new CanaryAdhocExecutionRequest(); request.setCanaryConfig(context.getCanaryConfig()); .setSiteLocal(context.getSiteLocal()); request.setExecutionRequest(executionRequest); accountCredentialsRepository); if (request.getCanaryConfig() == null) { throw new IllegalArgumentException("canaryConfig must be provided for ad-hoc requests"); if (request.getExecutionRequest() == null) { throw new IllegalArgumentException("executionRequest must be provided for ad-hoc requests"); stage.getExecution().getId(), Optional.ofNullable(context.getCanaryConfigId()).orElse(AD_HOC), request.getCanaryConfig(), null, resolvedMetricsAccountName, resolvedStorageAccountName, request.getExecutionRequest()); } catch (Exception e) { throw new RuntimeException("Failed to initiate canary analysis", e);