public static Supplier<AbstractCanaryAccount> getCanaryAccount(String deploymentName, String serviceIntegrationName, String accountName, boolean validate) { return () -> { Object rawAccount = ResponseUnwrapper.get(getService().getCanaryAccount(deploymentName, serviceIntegrationName, accountName, validate)); return getObjectMapper().convertValue(rawAccount, Canary.translateCanaryAccountType(serviceIntegrationName)); }; }
public static Supplier<AbstractCanaryAccount> getCanaryAccount(String deploymentName, String serviceIntegrationName, String accountName, boolean validate) { return () -> { Object rawAccount = ResponseUnwrapper.get(getService().getCanaryAccount(deploymentName, serviceIntegrationName, accountName, validate)); return getObjectMapper().convertValue(rawAccount, Canary.translateCanaryAccountType(serviceIntegrationName)); }; }
@RequestMapping(value = "/{serviceIntegrationName:.+}/accounts/account/{accountName:.+}", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setCanaryAccount(@PathVariable String deploymentName, @PathVariable String serviceIntegrationName, @PathVariable String accountName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawCanaryAccount) { AbstractCanaryAccount canaryAccount = objectMapper.convertValue( rawCanaryAccount, Canary.translateCanaryAccountType(serviceIntegrationName) ); return GenericUpdateRequest.<AbstractCanaryAccount>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(c -> canaryAccountService.setAccount(deploymentName, serviceIntegrationName, accountName, c)) .validator(() -> canaryService.validateCanary(deploymentName)) .description("Edit the " + accountName + " canary account") .build() .execute(validationSettings, canaryAccount); }
@RequestMapping(value = "/{serviceIntegrationName:.+}/accounts/", method = RequestMethod.POST) DaemonTask<Halconfig, Void> addCanaryAccount(@PathVariable String deploymentName, @PathVariable String serviceIntegrationName, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawCanaryAccount) { AbstractCanaryAccount canaryAccount = objectMapper.convertValue( rawCanaryAccount, Canary.translateCanaryAccountType(serviceIntegrationName) ); return GenericUpdateRequest.<AbstractCanaryAccount>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(c -> canaryAccountService.addAccount(deploymentName, serviceIntegrationName, c)) .validator(() -> canaryService.validateCanary(deploymentName)) .description("Add the " + canaryAccount.getName() + " canary account to " + serviceIntegrationName + " service integration") .build() .execute(validationSettings, canaryAccount); }