public async Task <string> CreateTemplate(long id, AuthorInfo authorInfo, ITemplateDescriptor templateDescriptor) { if (id == 0) { throw new ArgumentException("Template Id must be set", nameof(id)); } using (await _distributedLockManager.AcquireLockAsync(id)) { if (await _templatesStorageReader.IsTemplateExists(id)) { throw new ObjectAlreadyExistsException(id); } await PutTemplate(id, authorInfo, templateDescriptor); // ceph does not return version-id response header, so we need to do another request to get version return(await _templatesStorageReader.GetTemplateLatestVersion(id)); } }
public async Task <string> CreateTemplate(long id, AuthorInfo authorInfo, ITemplateDescriptor templateDescriptor) { if (id == default) { throw new InputDataValidationException("Template Id must be set"); } using (await _distributedLockManager.AcquireLockAsync(id)) { if (await _templatesStorageReader.IsTemplateExists(id)) { throw new ObjectAlreadyExistsException(id); } return(await PutTemplate(id, authorInfo, templateDescriptor)); } }