public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Comprehend.Model.StartEventsDetectionJobRequest(); if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } if (cmdletContext.DataAccessRoleArn != null) { request.DataAccessRoleArn = cmdletContext.DataAccessRoleArn; } if (cmdletContext.InputDataConfig != null) { request.InputDataConfig = cmdletContext.InputDataConfig; } if (cmdletContext.JobName != null) { request.JobName = cmdletContext.JobName; } if (cmdletContext.LanguageCode != null) { request.LanguageCode = cmdletContext.LanguageCode; } if (cmdletContext.OutputDataConfig != null) { request.OutputDataConfig = cmdletContext.OutputDataConfig; } if (cmdletContext.TargetEventType != null) { request.TargetEventTypes = cmdletContext.TargetEventType; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
private Amazon.Comprehend.Model.StartEventsDetectionJobResponse CallAWSServiceOperation(IAmazonComprehend client, Amazon.Comprehend.Model.StartEventsDetectionJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Comprehend", "StartEventsDetectionJob"); try { #if DESKTOP return(client.StartEventsDetectionJob(request)); #elif CORECLR return(client.StartEventsDetectionJobAsync(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; } }