use of com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount in project halyard by spinnaker.
the class AbstractAddCanaryAccountCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
// Disable validation here, since we don't want an illegal config to prevent us from fixing it.
Canary canary = new OperationHandler<Canary>().setFailureMesssage("Failed to get canary.").setOperation(Daemon.getCanary(currentDeployment, false)).get();
String accountName = getAccountName();
AbstractCanaryAccount account = buildAccount(canary, accountName);
String serviceIntegration = getServiceIntegration();
new OperationHandler<Void>().setFailureMesssage("Failed to add canary account " + accountName + " for service integration " + serviceIntegration + ".").setSuccessMessage("Successfully added canary account " + accountName + " for service integration " + serviceIntegration + ".").setOperation(Daemon.addCanaryAccount(currentDeployment, serviceIntegration.toLowerCase(), !noValidate, account)).get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount in project halyard by spinnaker.
the class ListCanaryAccountsCommand method executeThis.
@Override
protected void executeThis() {
AbstractCanaryServiceIntegration serviceIntegration = CanaryUtils.getServiceIntegrationByName(null, getCurrentDeployment(), getServiceIntegration(), noValidate);
List<AbstractCanaryAccount> accounts = serviceIntegration.getAccounts();
if (accounts.isEmpty()) {
AnsiUi.success("No configured accounts for " + getServiceIntegration() + ".");
} else {
AnsiUi.success("Accounts for " + getServiceIntegration() + ":");
accounts.forEach(account -> AnsiUi.listItem(account.getName()));
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount in project halyard by spinnaker.
the class AwsAddCanaryAccountCommand method buildAccount.
@Override
protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) {
AwsCanaryAccount account = (AwsCanaryAccount) new AwsCanaryAccount().setName(accountName);
account.setBucket(bucket);
account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder());
AwsCanaryServiceIntegration awsCanaryServiceIntegration = (AwsCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, AwsCanaryServiceIntegration.class);
if (awsCanaryServiceIntegration.isS3Enabled()) {
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.AbstractCanaryAccount in project halyard by spinnaker.
the class DatadogAddCanaryAccountCommand method buildAccount.
@Override
protected AbstractCanaryAccount buildAccount(Canary canary, String accountName) {
DatadogCanaryAccount account = (DatadogCanaryAccount) new DatadogCanaryAccount().setName(accountName);
account.setEndpoint(new DatadogCanaryAccount.Endpoint().setBaseUrl(baseUrl)).setApiKey(apiKey).setApplicationKey(applicationKey);
return account;
}
use of com.netflix.spinnaker.halyard.config.model.v1.canary.AbstractCanaryAccount 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;
}
Aggregations