@Override public void validate(ConfigProblemSetBuilder p, GoogleCanaryServiceIntegration n) { GoogleCanaryAccountValidator googleCanaryAccountValidator = new GoogleCanaryAccountValidator(halyardVersion); n.getAccounts().forEach(a -> googleCanaryAccountValidator.validate(p, a)); if (n.isGcsEnabled()) { List<GoogleCanaryAccount> accountsWithBucket = n.getAccounts() .stream() .filter(a -> a.getBucket() != null) .collect(Collectors.toList()); if (CollectionUtils.isEmpty(accountsWithBucket)) { p.addProblem(Problem.Severity.ERROR, "At least one Google account must specify a bucket if GCS is enabled."); } } } }
@Override protected AbstractCanaryAccount editAccount(GoogleCanaryAccount account) { account.setProject(isSet(project) ? project : account.getProject()); account.setJsonPath(isSet(jsonPath) ? jsonPath : account.getJsonPath()); account.setBucket(isSet(bucket) ? bucket : account.getBucket()); account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder()); account.setBucketLocation(isSet(bucketLocation) ? bucketLocation : account.getBucketLocation()); return account; } }
@Override public void validate(ConfigProblemSetBuilder p, GoogleCanaryServiceIntegration n) { GoogleCanaryAccountValidator googleCanaryAccountValidator = new GoogleCanaryAccountValidator() .setHalyardVersion(halyardVersion) .setRegistry(registry) .setTaskScheduler(taskScheduler); if (n.isGcsEnabled()) { List<GoogleCanaryAccount> accountsWithBucket = n.getAccounts() .stream() .filter(a -> a.getBucket() != null) .collect(Collectors.toList()); if (CollectionUtils.isEmpty(accountsWithBucket)) { p.addProblem(Problem.Severity.ERROR, "At least one Google account must specify a bucket if GCS is enabled."); } else { accountsWithBucket.forEach(a -> googleCanaryAccountValidator.validate(p, a)); } } } }
@Override protected AbstractCanaryAccount editAccount(GoogleCanaryAccount account) { account.setProject(isSet(project) ? project : account.getProject()); account.setJsonPath(isSet(jsonPath) ? jsonPath : account.getJsonPath()); account.setBucket(isSet(bucket) ? bucket : account.getBucket()); account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder()); account.setBucketLocation(isSet(bucketLocation) ? bucketLocation : account.getBucketLocation()); return account; } }