Search in sources :

Example 1 with AwsCanaryServiceIntegration

use of com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration 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;
}
Also used : AwsCanaryAccount(com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryAccount) AwsCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration)

Example 2 with AwsCanaryServiceIntegration

use of com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration in project halyard by spinnaker.

the class EditCanaryAwsCommand 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();
    int originalHash = canary.hashCode();
    AwsCanaryServiceIntegration awsCanaryServiceIntegration = (AwsCanaryServiceIntegration) CanaryUtils.getServiceIntegrationByClass(canary, AwsCanaryServiceIntegration.class);
    awsCanaryServiceIntegration.setS3Enabled(isSet(s3Enabled) ? s3Enabled : awsCanaryServiceIntegration.isS3Enabled());
    if (awsCanaryServiceIntegration.isS3Enabled()) {
        awsCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE));
        awsCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().add(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE));
    } else {
        awsCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().remove(AbstractCanaryServiceIntegration.SupportedTypes.CONFIGURATION_STORE));
        awsCanaryServiceIntegration.getAccounts().forEach(a -> a.getSupportedTypes().remove(AbstractCanaryServiceIntegration.SupportedTypes.OBJECT_STORE));
    }
    if (originalHash == canary.hashCode()) {
        AnsiUi.failure("No changes supplied.");
        return;
    }
    new OperationHandler<Void>().setOperation(Daemon.setCanary(currentDeployment, !noValidate, canary)).setFailureMesssage("Failed to edit canary analysis AWS service integration settings.").setSuccessMessage("Successfully edited canary analysis AWS service integration settings.").get();
}
Also used : Canary(com.netflix.spinnaker.halyard.config.model.v1.canary.Canary) AwsCanaryServiceIntegration(com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Aggregations

AwsCanaryServiceIntegration (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryServiceIntegration)2 OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)1 Canary (com.netflix.spinnaker.halyard.config.model.v1.canary.Canary)1 AwsCanaryAccount (com.netflix.spinnaker.halyard.config.model.v1.canary.aws.AwsCanaryAccount)1