public override async Task <Tuple <bool, Exception> > CreateOrUpdateDetector(DetectorPackage pkg) { if (pkg == null) { return(new Tuple <bool, Exception>(false, new ArgumentNullException("pkg"))); } Tuple <bool, Exception> output = new Tuple <bool, Exception>(true, null); try { string detectorFilePath = $"{pkg.Id.ToLower()}/{pkg.Id.ToLower()}"; string csxFilePath = $"{detectorFilePath}.csx"; string dllFilePath = $"{detectorFilePath}.dll"; string pdbFilePath = $"{detectorFilePath}.pdb"; string commitMessage = $@"Detector : {pkg.Id.ToLower()}, CommittedBy : {pkg.CommittedByAlias}"; await _githubClient.CreateOrUpdateFile(csxFilePath, pkg.CodeString, commitMessage); await _githubClient.CreateOrUpdateFile(dllFilePath, pkg.DllBytes, commitMessage, false); await _githubClient.CreateOrUpdateFile(pdbFilePath, pkg.PdbBytes, commitMessage, false); } catch (Exception e) { output = new Tuple <bool, Exception>(false, e); } return(output); }
protected async Task <IActionResult> PublishDetector(DetectorPackage pkg) { if (pkg == null || string.IsNullOrWhiteSpace(pkg.Id) || string.IsNullOrWhiteSpace(pkg.DllBytes)) { return(BadRequest()); } var publishResult = await _sourceWatcherService.Watcher.CreateOrUpdateDetector(pkg); bool isPublishSuccessful = publishResult.Item1; Exception publishEx = publishResult.Item2; if (!isPublishSuccessful) { if (publishEx != null) { throw publishEx; } throw new Exception("Publish Operation failed"); } return(Ok()); }
public async Task <IActionResult> PublishDetector(string subscriptionId, string resourceGroupName, string hostingEnvironmentName, [FromBody] DetectorPackage pkg) { return(await base.PublishDetector(pkg)); }
public abstract Task <Tuple <bool, Exception> > CreateOrUpdateDetector(DetectorPackage pkg);
public override async Task <Tuple <bool, Exception> > CreateOrUpdateDetector(DetectorPackage pkg) { throw new NotImplementedException("Local Source Watcher Mode right now doesnt support live detector deployment."); }