use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class CredentialService method get.
public Credential get(Long id, String account) {
Credential credential = credentialRepository.findByIdInAccount(id, account);
if (credential == null) {
throw new AccessDeniedException(String.format("Access is denied: Credential '%d' in %s account.", id, account));
}
authorizationService.hasReadPermission(credential);
return credential;
}
use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class CredentialService method get.
public Credential get(Long id) {
Credential credential = credentialRepository.findOne(id);
if (credential == null) {
throw new AccessDeniedException(String.format("Access is denied: Credential '%d'.", id));
}
authorizationService.hasReadPermission(credential);
return credential;
}
use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class CredentialService method get.
public Credential get(String name, String account) {
Credential credential = credentialRepository.findOneByName(name, account);
if (credential == null) {
throw new AccessDeniedException(String.format("Access is denied: Credential '%s' in %s account.", name, account));
}
authorizationService.hasReadPermission(credential);
return credential;
}
use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class CredentialService method saveCredentialAndNotify.
private Credential saveCredentialAndNotify(Credential credential, ResourceEvent resourceEvent) {
credential = credentialAdapter.init(credential);
Credential savedCredential;
try {
savedCredential = credentialRepository.save(credential);
userProfileCredentialHandler.createProfilePreparation(credential);
sendCredentialNotification(credential, resourceEvent);
} catch (DataIntegrityViolationException ex) {
String msg = String.format("Error with resource [%s], error: [%s]", APIResourceType.CREDENTIAL, getProperSqlErrorMessage(ex));
throw new BadRequestException(msg);
}
return savedCredential;
}
use of com.sequenceiq.cloudbreak.domain.Credential in project cloudbreak by hortonworks.
the class TestUtil method awsCredential.
public static Credential awsCredential() {
Credential awsCredential = new Credential();
awsCredential.setPublicInAccount(false);
awsCredential.setArchived(false);
awsCredential.setCloudPlatform(AWS);
awsCredential.setDescription(DUMMY_DESCRIPTION);
awsCredential.setId(1L);
awsCredential.setName(DUMMY_NAME);
return awsCredential;
}
Aggregations