use of com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryAccount in project halyard by spinnaker.
the class GoogleAddCanaryAccountCommand method buildAccount.
@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());
if (account.getBucket() == null) {
String bucketName = "spin-kayenta-" + UUID.randomUUID().toString();
AnsiUi.raw("Generated canary bucket name: " + bucketName);
account.setBucket(bucketName);
}
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;
}
use of com.netflix.spinnaker.halyard.config.model.v1.canary.google.GoogleCanaryAccount in project halyard by spinnaker.
the class GoogleCanaryAccountValidator method validate.
@Override
public void validate(ConfigProblemSetBuilder p, AbstractCanaryAccount n) {
super.validate(p, n);
GoogleCanaryAccount canaryAccount = (GoogleCanaryAccount) n;
DaemonTaskHandler.message("Validating " + n.getNodeName() + " with " + GoogleCanaryAccountValidator.class.getSimpleName());
GoogleNamedAccountCredentials credentials = canaryAccount.getNamedAccountCredentials(halyardVersion, p);
if (credentials == null) {
return;
}
try {
Compute compute = credentials.getCompute();
compute.projects().get(canaryAccount.getProject()).execute();
} catch (IOException e) {
p.addProblem(Severity.ERROR, "Failed to load project \"" + canaryAccount.getProject() + "\": " + e.getMessage() + ".");
}
}
Aggregations