コード例 #1
0
        public async Task <IActionResult> DesignAutomationCallback(string connectionId, string resultJson, [FromBody] JObject body)
        {
            var       awsCredentials = new Amazon.Runtime.BasicAWSCredentials(Utils.GetAppSetting("AWS_ACCESS_KEY"), Utils.GetAppSetting("AWS_SECRET_KEY"));
            IAmazonS3 client         = new AmazonS3Client(awsCredentials, Amazon.RegionEndpoint.USWest2);

            if (!await client.DoesS3BucketExistAsync(Utils.S3BucketName))
            {
                return(Ok());
            }
            Uri downloadFromS3 = new Uri(client.GeneratePreSignedURL(Utils.S3BucketName, resultJson, DateTime.Now.AddMinutes(10), null));

            string resultJsonPath = Path.Combine(_env.WebRootPath, resultJson);
            var    keys           = await client.GetAllObjectKeysAsync(Utils.S3BucketName, null, null);

            if (!keys.Contains(resultJson))
            {
                return(Ok());                            // file is not there
            }
            await client.DownloadToFilePathAsync(Utils.S3BucketName, resultJson, resultJsonPath, null);

            string contents = System.IO.File.ReadAllText(resultJsonPath);

            System.IO.File.Delete(resultJsonPath);
            //await client.DeleteObjectAsync(Utils.S3BucketName, resultJson);

            await ValidationHub.ValidationFinished(_hubContext, connectionId, resultJson, JObject.Parse(contents));

            return(Ok());
        }
コード例 #2
0
        public async Task <IActionResult> DerivativeCallback([FromBody] JObject body)
        {
            await ValidationHub.ExtractionFinished(_hubContext, body);

            return(Ok());
        }