Source:
public Credential create(Credential credential, @Nonnull String accountId, @Nonnull String creatorUserCrn) { repository.findByNameAndAccountId(credential.getName(), accountId, getEnabledPlatforms()) .map(Credential::getName) .ifPresent(name -> { throw new BadRequestException("Credential already exists with name: " + name); }); LOGGER.debug("Validating credential for cloudPlatform and creator {}.", credential.getCloudPlatform(), creatorUserCrn); credentialValidator.validateCredentialCloudPlatform(credential.getCloudPlatform(), creatorUserCrn); LOGGER.debug("Validating credential parameters for cloudPlatform and creator {}.", credential.getCloudPlatform(), creatorUserCrn); credentialValidator.validateParameters(Platform.platform(credential.getCloudPlatform()), new Json(credential.getAttributes())); String credentialCrn = createCRN(accountId); credential.setResourceCrn(credentialCrn); credential.setCreator(creatorUserCrn); credential.setAccountId(accountId); grpcUmsClient.assignResourceOwnerRoleIfEntitled(creatorUserCrn, credentialCrn, accountId); try { return transactionService.required(() -> { Credential verifiedCredential = credentialAdapter.verify(credential, accountId).getCredential(); if (verifiedCredential.getVerificationStatusText() != null) { throw new BadRequestException(verifiedCredential.getVerificationStatusText()); } Credential created = repository.save(verifiedCredential); sendCredentialNotification(credential, ResourceEvent.CREDENTIAL_CREATED); return created; }); } catch (TransactionService.TransactionExecutionException e) { LOGGER.error("Error happened during credential creation: ", e); throw new InternalServerErrorException(e); } }

Target:
public Credential create(Credential credential, @Nonnull String accountId, @Nonnull String creatorUserCrn) { repository.findByNameAndAccountId(credential.getName(), accountId, getEnabledPlatforms()) .map(Credential::getName) .ifPresent(name -> { throw new BadRequestException("Credential already exists with name: " + name); }); LOGGER.debug("Validating credential for cloudPlatform and creator {}.", credential.getCloudPlatform(), creatorUserCrn); credentialValidator.validateCredentialCloudPlatform(credential.getCloudPlatform(), creatorUserCrn); LOGGER.debug("Validating credential parameters for cloudPlatform and creator {}.", credential.getCloudPlatform(), creatorUserCrn); credentialValidator.validateParameters(Platform.platform(credential.getCloudPlatform()), new Json(credential.getAttributes())); String credentialCrn = createCRN(accountId); credential.setResourceCrn(credentialCrn); credential.setCreator(creatorUserCrn); credential.setAccountId(accountId); try { return transactionService.required(() -> { Credential verifiedCredential = credentialAdapter.verify(credential, accountId).getCredential(); if (verifiedCredential.getVerificationStatusText() != null) { throw new BadRequestException(verifiedCredential.getVerificationStatusText()); } Credential created = repository.save(verifiedCredential); grpcUmsClient.assignResourceOwnerRoleIfEntitled(creatorUserCrn, credentialCrn, accountId); sendCredentialNotification(credential, ResourceEvent.CREDENTIAL_CREATED); return created; }); } catch (TransactionService.TransactionExecutionException e) { LOGGER.error("Error happened during credential creation: ", e); throw new InternalServerErrorException(e); } }