use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method deleteByName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DELETE_CREDENTIAL)
public CredentialResponse deleteByName(@ResourceName String name) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential deleted = credentialDeleteService.deleteByName(name, accountId, ENVIRONMENT);
notify(ResourceEvent.CREDENTIAL_DELETED);
return credentialConverter.convert(deleted);
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1Controller method getByEnvironmentName.
@Override
@CheckPermissionByResourceName(action = AuthorizationResourceAction.DESCRIBE_CREDENTIAL_ON_ENVIRONMENT)
public CredentialResponse getByEnvironmentName(@ResourceName String environmentName) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
Credential credential = credentialService.getByEnvironmentNameAndAccountId(environmentName, accountId, ENVIRONMENT);
return credentialConverter.convert(credential);
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialToCredentialV1ResponseConverter method convert.
public Credential convert(EditCredentialRequest source) {
if (source == null) {
return null;
}
Credential credential = new Credential();
credential.setName(Strings.isNullOrEmpty(source.getName()) ? UUID.randomUUID().toString() : source.getName());
credential.setDescription(source.getDescription());
credential.setCloudPlatform(source.getCloudPlatform());
credential.setVerificationStatusText(source.getVerificationStatusText());
credential.setVerifyPermissions(source.isVerifyPermissions());
convertAttributes(source, credential);
if (source.getAws() != null) {
credential.setGovCloud(source.getAws().getGovCloud());
}
return credential;
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialV1RequestToCredentialConverter method convert.
public Credential convert(CredentialRequest source) {
Credential credential = new Credential();
credential.setName(Strings.isNullOrEmpty(source.getName()) ? UUID.randomUUID().toString() : source.getName());
credential.setDescription(source.getDescription());
credential.setCloudPlatform(source.getCloudPlatform());
credential.setVerificationStatusText(source.getVerificationStatusText());
convertAttributes(source, credential);
if (source.getAws() != null) {
credential.setGovCloud(source.getAws().getGovCloud());
}
return credential;
}
use of com.sequenceiq.environment.credential.domain.Credential in project cloudbreak by hortonworks.
the class CredentialService method updateByAccountId.
public Credential updateByAccountId(Credential credential, String accountId, CredentialType type) {
Credential original = getCredentialAndValidateUpdate(credential, accountId, type);
credential.setId(original.getId());
credential.setAccountId(accountId);
credential.setResourceCrn(original.getResourceCrn());
credential.setCreator(original.getCreator());
Credential updated = repository.save(credentialAdapter.verify(credential, accountId).getCredential());
secretService.delete(original.getAttributesSecret());
sendCredentialNotification(credential, ResourceEvent.CREDENTIAL_MODIFIED);
return updated;
}
Aggregations