public override async Task ProcessMessageAsync(QueueEvent queueEvent) { LogInfo($"queueEvent {JsonConvert.SerializeObject(queueEvent)}"); if (queueEvent.Event != null) { LogInfo($"testEvent {JsonConvert.SerializeObject(queueEvent)}"); return; } var bucket = queueEvent.Records.FirstOrDefault()?.S3.Bucket.Name; var objectKey = queueEvent.Records.FirstOrDefault()?.S3.Object.Key; var startRequest = new StartDocumentAnalysisRequest { DocumentLocation = new DocumentLocation { S3Object = new S3Object { Bucket = bucket, Name = objectKey } }, NotificationChannel = new NotificationChannel { RoleArn = _roleArn, SNSTopicArn = _topicArn }, FeatureTypes = new List <string> { "TABLES" } }; LogInfo(JsonConvert.SerializeObject(startRequest)); var response = await _textractClient.StartDocumentAnalysisAsync(startRequest); LogInfo(JsonConvert.SerializeObject(response)); }
public async Task <string> StartDocumentAnalysis(string bucketName, string key, string featureType) { var request = new StartDocumentAnalysisRequest(); var s3Object = new S3Object { Bucket = bucketName, Name = key }; request.DocumentLocation = new DocumentLocation { S3Object = s3Object }; request.FeatureTypes = new List <string> { featureType }; var response = await _textract.StartDocumentAnalysisAsync(request); return(response.JobId); }
private Amazon.Textract.Model.StartDocumentAnalysisResponse CallAWSServiceOperation(IAmazonTextract client, Amazon.Textract.Model.StartDocumentAnalysisRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Textract", "StartDocumentAnalysis"); try { #if DESKTOP return(client.StartDocumentAnalysis(request)); #elif CORECLR return(client.StartDocumentAnalysisAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }