@RequestMapping(value = "/", method = RequestMethod.GET) DaemonTask<Halconfig, PersistentStorage> getPersistentStorage(@PathVariable String deploymentName, @ModelAttribute ValidationSettings validationSettings) { return GenericGetRequest.<PersistentStorage>builder() .getter(() -> persistentStorageService.getPersistentStorage(deploymentName)) .validator(() -> persistentStorageService.validatePersistentStorage(deploymentName)) .description("Get persistent storage settings") .build() .execute(validationSettings); }
@RequestMapping(value = "/", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setPersistentStorage(@PathVariable String deploymentName, @ModelAttribute ValidationSettings validationSettings, @RequestBody PersistentStorage persistentStorage) { return GenericUpdateRequest.<PersistentStorage>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(p -> persistentStorageService.setPersistentStorage(deploymentName, p)) .validator(() -> persistentStorageService.validatePersistentStorage(deploymentName)) .description("Edit persistent storage settings") .build() .execute(validationSettings, persistentStorage); }
@RequestMapping(value = "/{persistentStoreType:.+}", method = RequestMethod.GET) DaemonTask<Halconfig, PersistentStore> getPersistentStore(@PathVariable String deploymentName, @PathVariable String persistentStoreType, @ModelAttribute ValidationSettings validationSettings) { return GenericGetRequest.<PersistentStore>builder() .getter(() -> persistentStorageService.getPersistentStore(deploymentName, persistentStoreType)) .validator(() -> persistentStorageService.validatePersistentStore(deploymentName, persistentStoreType)) .description("Get persistent store") .build() .execute(validationSettings); }
public void setPersistentStore(String deploymentName, PersistentStore newPersistentStore) { PersistentStorage persistentStorage = getPersistentStorage(deploymentName); switch (newPersistentStore.persistentStoreType()) { case S3: persistentStorage.setS3((S3PersistentStore) newPersistentStore); break; case GCS: persistentStorage.setGcs((GcsPersistentStore) newPersistentStore); break; case AZS: persistentStorage.setAzs((AzsPersistentStore) newPersistentStore); break; case ORACLE: persistentStorage.setOracle((OraclePersistentStore) newPersistentStore); break; case ORACLEBMCS: persistentStorage.setOraclebmcs((OracleBMCSPersistentStore) newPersistentStore); break; default: throw new RuntimeException("Unknown persistent store " + newPersistentStore.persistentStoreType()); } }
public PersistentStorage getPersistentStorage(String deploymentName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setPersistentStorage(); List<PersistentStorage> matching = lookupService.getMatchingNodesOfType(filter, PersistentStorage.class); switch (matching.size()) { case 0: PersistentStorage persistentStorage = new PersistentStorage(); setPersistentStorage(deploymentName, persistentStorage); return persistentStorage; case 1: return matching.get(0); default: throw new RuntimeException("It shouldn't be possible to have multiple persistentStorage nodes. This is a bug."); } }
@RequestMapping(value = "/{persistentStoreType:.+}", method = RequestMethod.PUT) DaemonTask<Halconfig, Void> setPersistentStore(@PathVariable String deploymentName, @PathVariable String persistentStoreType, @ModelAttribute ValidationSettings validationSettings, @RequestBody Object rawPersistentStore) { PersistentStore persistentStore = objectMapper.convertValue(rawPersistentStore, PersistentStorage.translatePersistentStoreType(persistentStoreType)); return GenericUpdateRequest.<PersistentStore>builder(halconfigParser) .stagePath(halconfigDirectoryStructure.getStagingPath(deploymentName)) .updater(p -> persistentStorageService.setPersistentStore(deploymentName, p)) .validator(() -> persistentStorageService.validatePersistentStore(deploymentName, persistentStoreType)) .description("Edit persistent store") .build() .execute(validationSettings, persistentStore); } }
public void setPersistentStore(String deploymentName, PersistentStore newPersistentStore) { PersistentStorage persistentStorage = getPersistentStorage(deploymentName); switch (newPersistentStore.persistentStoreType()) { case S3: persistentStorage.setS3((S3PersistentStore) newPersistentStore); break; case GCS: persistentStorage.setGcs((GcsPersistentStore) newPersistentStore); break; case AZS: persistentStorage.setAzs((AzsPersistentStore) newPersistentStore); break; case ORACLE: persistentStorage.setOracle((OraclePersistentStore) newPersistentStore); break; case ORACLEBMCS: persistentStorage.setOraclebmcs((OracleBMCSPersistentStore) newPersistentStore); break; default: throw new RuntimeException("Unknown persistent store " + newPersistentStore.persistentStoreType()); } }
public PersistentStorage getPersistentStorage(String deploymentName) { NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setPersistentStorage(); List<PersistentStorage> matching = lookupService.getMatchingNodesOfType(filter, PersistentStorage.class); switch (matching.size()) { case 0: PersistentStorage persistentStorage = new PersistentStorage(); setPersistentStorage(deploymentName, persistentStorage); return persistentStorage; case 1: return matching.get(0); default: throw new RuntimeException("It shouldn't be possible to have multiple persistentStorage nodes. This is a bug."); } }
public ProblemSet validatePersistentStorage(String deploymentName) { PersistentStorage storage = getPersistentStorage(deploymentName); NodeFilter filter = new NodeFilter() .setDeployment(deploymentName) .setPersistentStorage(); if (storage.getPersistentStoreType() != null) { filter.setPersistentStore(storage.getPersistentStoreType().getId()); } return validateService.validateMatchingFilter(filter); }
public ProblemSet validatePersistentStorage(String deploymentName) { PersistentStorage storage = getPersistentStorage(deploymentName); NodeFilter filter = new NodeFilter() .setDeployment(deploymentName) .setPersistentStorage(); if (storage.getPersistentStoreType() != null) { filter.setPersistentStore(storage.getPersistentStoreType().getId()); } return validateService.validateMatchingFilter(filter); }
public ProblemSet validateDeployment(String deploymentName) { PersistentStorage storage = storageService.getPersistentStorage(deploymentName); NodeFilter filter = new NodeFilter() .setDeployment(deploymentName) .withAnyProvider() .withAnyAccount() .setFeatures() .setSecurity(); if (storage.getPersistentStoreType() != null) { filter.setPersistentStore(storage.getPersistentStoreType().getId()); } return validateService.validateMatchingFilter(filter); }
public ProblemSet validateDeployment(String deploymentName) { PersistentStorage storage = storageService.getPersistentStorage(deploymentName); NodeFilter filter = new NodeFilter() .setDeployment(deploymentName) .withAnyProvider() .withAnyAccount() .setFeatures() .setSecurity(); if (storage.getPersistentStoreType() != null) { filter.setPersistentStore(storage.getPersistentStoreType().getId()); } return validateService.validateMatchingFilter(filter); }