use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class AbstractFileSystemConfiguratorTest method testGetScripts.
@Test
public void testGetScripts() {
Credential credential = new Credential();
credential.setId(0L);
FileSystemConfiguration fsConfig = new FileSystemConfiguration();
List<RecipeScript> actual = underTest.getScripts(credential, fsConfig);
List<RecipeScript> expected = singletonList(new RecipeScript("echo 'newContent'", ExecutionType.ALL_NODES, RecipeType.POST_AMBARI_START));
Assert.assertEquals(expected, actual);
}
use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class CredentialController method getPublics.
@Override
public Set<CredentialResponse> getPublics() {
IdentityUser user = authenticatedUserService.getCbUser();
Set<Credential> credentials = credentialService.retrieveAccountCredentials(user);
return convertCredentials(credentials);
}
use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class CredentialController method convert.
private Credential convert(CredentialRequest json, boolean publicInAccount) {
Credential converted = conversionService.convert(json, Credential.class);
converted.setPublicInAccount(publicInAccount);
return converted;
}
use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class CredentialController method modifyCredential.
private CredentialResponse modifyCredential(IdentityUser user, CredentialRequest credentialRequest, boolean publicInAccount) {
Credential credential = convert(credentialRequest, publicInAccount);
credential = credentialService.modify(user, credential);
return convert(credential);
}
use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class CredentialRequestToCredentialConverter method convert.
@Override
public Credential convert(CredentialRequest source) {
Credential credential = new Credential();
credential.setName(source.getName());
credential.setDescription(source.getDescription());
String cloudPlatform = source.getCloudPlatform();
credential.setCloudPlatform(cloudPlatform);
Map<String, Object> parameters = credentialDefinitionService.processProperties(platform(cloudPlatform), source.getParameters());
if (parameters != null && !parameters.isEmpty()) {
try {
credential.setAttributes(new Json(parameters));
} catch (JsonProcessingException ignored) {
throw new BadRequestException("Invalid parameters");
}
}
if (source.getTopologyId() != null) {
credential.setTopology(topologyService.getById(source.getTopologyId()));
}
return credential;
}
Aggregations