JobConfiguration mutableJob,
@Nullable Lock mutableLock,
SessionKey session) {
IJobConfiguration job = IJobConfiguration.build(mutableJob);
IJobKey jobKey = JobKeys.assertValid(job.getKey());
requireNonNull(session);
Response response = Util.emptyResponse();
try {
sessionValidator.checkAuthenticated(session, ImmutableSet.of(job.getOwner().getRole()));
} catch (AuthFailedException e) {
return addMessage(response, AUTH_FAILED, e);
}
try {
SanitizedConfiguration sanitized = SanitizedConfiguration.fromUnsanitized(job);
lockManager.validateIfLocked(
ILockKey.build(LockKey.job(jobKey.newBuilder())),
Optional.fromNullable(mutableLock).transform(ILock.FROM_BUILDER));
if (!sanitized.isCron()) {
LOG.info("Invalid attempt to schedule non-cron job "
+ sanitized.getJobConfig().getKey()