use of com.netflix.spinnaker.front50.config.GcsProperties in project front50 by spinnaker.
the class GcsConfig method applicationPermissionDAO.
@Bean
public ApplicationPermissionDAO applicationPermissionDAO(Storage storage, StorageServiceConfigurationProperties storageServiceConfigurationProperties, Registry registry, CircuitBreakerRegistry circuitBreakerRegistry, GcsProperties gcsProperties) {
GcsStorageService service = googleCloudStorageService(storage, APPLICATION_PERMISSION_DATA_FILENAME, gcsProperties);
ObjectKeyLoader keyLoader = new DefaultObjectKeyLoader(service);
return new DefaultApplicationPermissionDAO(service, Schedulers.from(Executors.newFixedThreadPool(storageServiceConfigurationProperties.getApplicationPermission().getThreadPool())), keyLoader, storageServiceConfigurationProperties.getApplicationPermission().getRefreshMs(), storageServiceConfigurationProperties.getApplicationPermission().getShouldWarmCache(), registry, circuitBreakerRegistry);
}
use of com.netflix.spinnaker.front50.config.GcsProperties in project front50 by spinnaker.
the class GcsConfig method googleCloudStorageService.
private GcsStorageService googleCloudStorageService(Storage storage, String dataFilename, GcsProperties gcsProperties) {
var executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat(GcsStorageService.class.getName() + "-%s").build());
GcsStorageService service = new GcsStorageService(storage, gcsProperties.getBucket(), gcsProperties.getBucketLocation(), gcsProperties.getRootFolder(), dataFilename, new ObjectMapper().addMixIn(Timestamped.class, TimestampedMixins.class).addMixIn(Pipeline.class, PipelineMixins.class), executor);
log.info("Using Google Cloud Storage bucket={} in project={}", value("bucket", gcsProperties.getBucket()), value("project", gcsProperties.getProject()));
return service;
}
use of com.netflix.spinnaker.front50.config.GcsProperties in project halyard by spinnaker.
the class GoogleCanaryAccountValidator method validate.
@Override
public void validate(ConfigProblemSetBuilder p, GoogleCanaryAccount n) {
super.validate(p, n);
DaemonTaskHandler.message("Validating " + n.getNodeName() + " with " + GoogleCanaryAccountValidator.class.getSimpleName());
GoogleNamedAccountCredentials credentials = getNamedAccountCredentials(p, n);
if (credentials == null) {
return;
}
GcsProperties gcsProperties = getGoogleCloudStorageProperties(n);
try {
Credentials gcsCredentials = GCSConfig.getGcsCredentials(gcsProperties);
Storage googleCloudStorage = GCSConfig.getGoogleCloudStorage(gcsCredentials, gcsProperties);
ExecutorService executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat(GcsStorageService.class.getName() + "-%s").build());
GcsStorageService storageService = new GcsStorageService(googleCloudStorage, n.getBucket(), n.getBucketLocation(), n.getRootFolder(), n.getProject(), new ObjectMapper(), executor);
storageService.ensureBucketExists();
} catch (Exception e) {
p.addProblem(Severity.ERROR, "Failed to ensure the required bucket \"" + n.getBucket() + "\" exists: " + e.getMessage());
}
}
use of com.netflix.spinnaker.front50.config.GcsProperties in project halyard by spinnaker.
the class GoogleCanaryAccountValidator method getGoogleCloudStorageProperties.
public GcsProperties getGoogleCloudStorageProperties(GoogleCanaryAccount n) {
GcsProperties gcsProperties = new GcsProperties();
Path jsonPath = validatingFileDecryptPath(n.getJsonPath());
gcsProperties.setJsonPath(jsonPath.toString());
gcsProperties.setProject(n.getProject());
gcsProperties.setBucket(n.getBucket());
gcsProperties.setBucketLocation(n.getBucketLocation());
return gcsProperties;
}
use of com.netflix.spinnaker.front50.config.GcsProperties in project halyard by spinnaker.
the class GCSValidator method validate.
@Override
public void validate(ConfigProblemSetBuilder ps, GcsPersistentStore n) {
GcsProperties gcsProperties = getGoogleCloudStorageProperties(n);
try {
Credentials credentials = GCSConfig.getGcsCredentials(gcsProperties);
Storage googleCloudStorage = GCSConfig.getGoogleCloudStorage(credentials, gcsProperties);
ExecutorService executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat(GcsStorageService.class.getName() + "-%s").build());
GcsStorageService storageService = new GcsStorageService(googleCloudStorage, n.getBucket(), n.getBucketLocation(), n.getRootFolder(), n.getProject(), new ObjectMapper(), executor);
storageService.ensureBucketExists();
} catch (Exception e) {
ps.addProblem(Severity.ERROR, "Failed to ensure the required bucket \"" + n.getBucket() + "\" exists: " + e.getMessage());
}
}
Aggregations