@Override public String getNodeName() { return getName(); }
@Override public String getNodeName() { return getName(); }
@Override public boolean isEnabled(DeploymentConfiguration deploymentConfiguration) { return deploymentConfiguration.getCanary().isEnabled(); }
public void deleteAccount(String deploymentName, String serviceIntegrationName, String accountName) { AbstractCanaryServiceIntegration serviceIntegration = getServiceIntegration(deploymentName, serviceIntegrationName); boolean removed = serviceIntegration.getAccounts().removeIf(account -> ((AbstractCanaryAccount)account).getName().equals(accountName)); if (!removed) { throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Canary account \"" + accountName + "\" wasn't found").build()); } }
private AbstractCanaryServiceIntegration getServiceIntegration(String deploymentName, String serviceIntegrationName) { Canary canary = canaryService.getCanary(deploymentName); return canary.getServiceIntegrations() .stream() .filter(s -> s.getName().equals(serviceIntegrationName)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Canary service integration " + serviceIntegrationName + " not found.")); }
public void setAccount(String deploymentName, String serviceIntegrationName, String accountName, AbstractCanaryAccount newAccount) { AbstractCanaryServiceIntegration serviceIntegration = getServiceIntegration(deploymentName, serviceIntegrationName); for (int i = 0; i < serviceIntegration.getAccounts().size(); i++) { AbstractCanaryAccount account = (AbstractCanaryAccount)serviceIntegration.getAccounts().get(i); if (account.getNodeName().equals(accountName)) { serviceIntegration.getAccounts().set(i, newAccount); return; } } throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Canary account \"" + accountName + "\" wasn't found").build()); }
public void addAccount(String deploymentName, String serviceIntegrationName, AbstractCanaryAccount newCanaryAccount) { AbstractCanaryServiceIntegration serviceIntegration = getServiceIntegration(deploymentName, serviceIntegrationName); serviceIntegration.getAccounts().add(newCanaryAccount); }
public void setCanaryEnabled(String deploymentName, boolean enabled) { Canary canary = getCanary(deploymentName); canary.setEnabled(enabled); }
public void deleteAccount(String deploymentName, String serviceIntegrationName, String accountName) { AbstractCanaryServiceIntegration serviceIntegration = getServiceIntegration(deploymentName, serviceIntegrationName); boolean removed = serviceIntegration.getAccounts().removeIf(account -> ((AbstractCanaryAccount)account).getName().equals(accountName)); if (!removed) { throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Canary account \"" + accountName + "\" wasn't found").build()); } }
private AbstractCanaryServiceIntegration getServiceIntegration(String deploymentName, String serviceIntegrationName) { Canary canary = canaryService.getCanary(deploymentName); return canary.getServiceIntegrations() .stream() .filter(s -> s.getName().equals(serviceIntegrationName)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Canary service integration " + serviceIntegrationName + " not found.")); }
@Override public String getNodeName() { return getName(); }
public void setAccount(String deploymentName, String serviceIntegrationName, String accountName, AbstractCanaryAccount newAccount) { AbstractCanaryServiceIntegration serviceIntegration = getServiceIntegration(deploymentName, serviceIntegrationName); for (int i = 0; i < serviceIntegration.getAccounts().size(); i++) { AbstractCanaryAccount account = (AbstractCanaryAccount)serviceIntegration.getAccounts().get(i); if (account.getNodeName().equals(accountName)) { serviceIntegration.getAccounts().set(i, newAccount); return; } } throw new HalException(new ConfigProblemBuilder(Severity.FATAL, "Canary account \"" + accountName + "\" wasn't found").build()); }
@Override public String getNodeName() { return getName(); }
@Override public boolean isEnabled(DeploymentConfiguration deploymentConfiguration) { return deploymentConfiguration.getCanary().isEnabled(); }
public void addAccount(String deploymentName, String serviceIntegrationName, AbstractCanaryAccount newCanaryAccount) { AbstractCanaryServiceIntegration serviceIntegration = getServiceIntegration(deploymentName, serviceIntegrationName); serviceIntegration.getAccounts().add(newCanaryAccount); }
public void setCanaryEnabled(String deploymentName, boolean enabled) { Canary canary = getCanary(deploymentName); canary.setEnabled(enabled); }
@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())); } } }
@Override public void validate(ConfigProblemSetBuilder p, AbstractCanaryAccount n) { if (n.getName() == null) { p.addProblem(Severity.FATAL, "Canary account name must be specified"); } else if (!Pattern.matches(namePattern, n.getName())) { p.addProblem(Severity.ERROR, "Canary account name must match pattern " + namePattern) .setRemediation("It must start and end with a lower-case character or number, and only contain lower-case characters, numbers, dashes, or underscores"); } } }
@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())); } } }
@Override public void validate(ConfigProblemSetBuilder p, AbstractCanaryAccount n) { if (n.getName() == null) { p.addProblem(Severity.FATAL, "Canary account name must be specified"); } else if (!Pattern.matches(namePattern, n.getName())) { p.addProblem(Severity.ERROR, "Canary account name must match pattern " + namePattern) .setRemediation("It must start and end with a lower-case character or number, and only contain lower-case characters, numbers, dashes, or underscores"); } } }