use of com.netflix.spinnaker.front50.model.StorageService 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.model.StorageService in project halyard by spinnaker.
the class CanaryGCSValidator method validate.
@Override
public void validate(ConfigProblemSetBuilder ps, GoogleCanaryAccount n) {
String jsonPath = n.getJsonPath();
try {
StorageService storageService = new GcsStorageService(n.getBucket(), n.getBucketLocation(), n.getRootFolder(), n.getProject(), jsonPath != null ? jsonPath : "", "halyard", registry);
storageService.ensureBucketExists();
} catch (Exception e) {
e.printStackTrace();
ps.addProblem(Severity.ERROR, "Failed to ensure the required canary bucket \"" + n.getBucket() + "\" exists: " + e.getMessage());
}
}
use of com.netflix.spinnaker.front50.model.StorageService 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