GcsConfig(GoogleCanaryServiceIntegration googleSvc) { enabled = googleSvc.isGcsEnabled(); } }
GcsConfig(GoogleCanaryServiceIntegration googleSvc) { enabled = googleSvc.isGcsEnabled(); } }
@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 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 buildAccount(Canary canary, String accountName) { GoogleCanaryAccount account = (GoogleCanaryAccount)new GoogleCanaryAccount().setName(accountName); account.setProject(project).setJsonPath(jsonPath); account.setBucket(bucket).setBucketLocation(bucketLocation); account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder()); GoogleCanaryServiceIntegration googleCanaryServiceIntegration = (GoogleCanaryServiceIntegration)CanaryUtils.getServiceIntegrationByClass(canary, GoogleCanaryServiceIntegration.class); if (googleCanaryServiceIntegration.isStackdriverEnabled()) { account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.METRICS_STORE); } if (googleCanaryServiceIntegration.isGcsEnabled()) { account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE); account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE); } return account; }
@Override protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) { GoogleCanaryAccount account = (GoogleCanaryAccount)new GoogleCanaryAccount().setName(accountName); account.setProject(project).setJsonPath(jsonPath); account.setBucket(bucket).setBucketLocation(bucketLocation); account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder()); GoogleCanaryServiceIntegration googleCanaryServiceIntegration = (GoogleCanaryServiceIntegration)CanaryUtils.getServiceIntegrationByClass(canary, GoogleCanaryServiceIntegration.class); if (googleCanaryServiceIntegration.isStackdriverEnabled()) { account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.METRICS_STORE); } if (googleCanaryServiceIntegration.isGcsEnabled()) { account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE); account.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE); } return account; }
(GoogleCanaryServiceIntegration)CanaryUtils.getServiceIntegrationByClass(canary, GoogleCanaryServiceIntegration.class); googleCanaryServiceIntegration.setGcsEnabled(isSet(gcsEnabled) ? gcsEnabled : googleCanaryServiceIntegration.isGcsEnabled()); googleCanaryServiceIntegration.setStackdriverEnabled(isSet(stackdriverEnabled) ? stackdriverEnabled : googleCanaryServiceIntegration.isStackdriverEnabled()); googleCanaryServiceIntegration.setMetadataCachingIntervalMS(isSet(metadataCachingIntervalMS) ? metadataCachingIntervalMS : googleCanaryServiceIntegration.getMetadataCachingIntervalMS()); if (googleCanaryServiceIntegration.isGcsEnabled()) { googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE)); googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE));
(GoogleCanaryServiceIntegration)CanaryUtils.getServiceIntegrationByClass(canary, GoogleCanaryServiceIntegration.class); googleCanaryServiceIntegration.setGcsEnabled(isSet(gcsEnabled) ? gcsEnabled : googleCanaryServiceIntegration.isGcsEnabled()); googleCanaryServiceIntegration.setStackdriverEnabled(isSet(stackdriverEnabled) ? stackdriverEnabled : googleCanaryServiceIntegration.isStackdriverEnabled()); googleCanaryServiceIntegration.setMetadataCachingIntervalMS(isSet(metadataCachingIntervalMS) ? metadataCachingIntervalMS : googleCanaryServiceIntegration.getMetadataCachingIntervalMS()); if (googleCanaryServiceIntegration.isGcsEnabled()) { googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE)); googleCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE));
configurationAndObjectStoresAreConfigured = googleCanaryServiceIntegration.isEnabled() && googleCanaryServiceIntegration.isGcsEnabled();
configurationAndObjectStoresAreConfigured = googleCanaryServiceIntegration.isEnabled() && googleCanaryServiceIntegration.isGcsEnabled();