@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() + "."); } } }
if (StringUtils.isEmpty(getProject())) { p.addProblem(Problem.Severity.ERROR, "No google project supplied."); return null; .name(getName()) .jsonKey(jsonKey) .project(getProject()) .applicationName("halyard " + version) .liveLookupsEnabled(false) } catch (Exception e) { p.addProblem(Problem.Severity.ERROR, "Error instantiating Google credentials: " + e.getMessage() + ".") .setRemediation("Do the provided credentials have access to project " + getProject() + "?"); return null;
if (StringUtils.isEmpty(getProject())) { p.addProblem(Problem.Severity.ERROR, "No google project supplied."); return null; .name(getName()) .jsonKey(jsonKey) .project(getProject()) .applicationName("halyard " + version) .liveLookupsEnabled(false) } catch (Exception e) { p.addProblem(Problem.Severity.ERROR, "Error instantiating Google credentials: " + e.getMessage() + ".") .setRemediation("Do the provided credentials have access to project " + getProject() + "?"); return null;
canaryAccount.getBucketLocation(), canaryAccount.getRootFolder(), canaryAccount.getProject(), jsonPath != null ? jsonPath : "", "halyard",
@Override protected AbstractCanaryAccount editAccount(GoogleCanaryAccount account) { account.setProject(isSet(project) ? project : account.getProject()); account.setJsonPath(isSet(jsonPath) ? jsonPath : account.getJsonPath()); account.setBucket(isSet(bucket) ? bucket : account.getBucket()); account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder()); account.setBucketLocation(isSet(bucketLocation) ? bucketLocation : account.getBucketLocation()); return account; } }
@Override protected AbstractCanaryAccount editAccount(GoogleCanaryAccount account) { account.setProject(isSet(project) ? project : account.getProject()); account.setJsonPath(isSet(jsonPath) ? jsonPath : account.getJsonPath()); account.setBucket(isSet(bucket) ? bucket : account.getBucket()); account.setRootFolder(isSet(rootFolder) ? rootFolder : account.getRootFolder()); account.setBucketLocation(isSet(bucketLocation) ? bucketLocation : account.getBucketLocation()); return account; } }