private Amazon.Comprehend.Model.StartEntitiesDetectionJobResponse CallAWSServiceOperation(IAmazonComprehend client, Amazon.Comprehend.Model.StartEntitiesDetectionJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Comprehend", "StartEntitiesDetectionJob"); try { #if DESKTOP return(client.StartEntitiesDetectionJob(request)); #elif CORECLR return(client.StartEntitiesDetectionJobAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Comprehend.Model.StartEntitiesDetectionJobRequest(); if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } if (cmdletContext.DataAccessRoleArn != null) { request.DataAccessRoleArn = cmdletContext.DataAccessRoleArn; } if (cmdletContext.EntityRecognizerArn != null) { request.EntityRecognizerArn = cmdletContext.EntityRecognizerArn; } 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.VolumeKmsKeyId != null) { request.VolumeKmsKeyId = cmdletContext.VolumeKmsKeyId; } // populate VpcConfig var requestVpcConfigIsNull = true; request.VpcConfig = new Amazon.Comprehend.Model.VpcConfig(); List <System.String> requestVpcConfig_vpcConfig_SecurityGroupId = null; if (cmdletContext.VpcConfig_SecurityGroupId != null) { requestVpcConfig_vpcConfig_SecurityGroupId = cmdletContext.VpcConfig_SecurityGroupId; } if (requestVpcConfig_vpcConfig_SecurityGroupId != null) { request.VpcConfig.SecurityGroupIds = requestVpcConfig_vpcConfig_SecurityGroupId; requestVpcConfigIsNull = false; } List <System.String> requestVpcConfig_vpcConfig_Subnet = null; if (cmdletContext.VpcConfig_Subnet != null) { requestVpcConfig_vpcConfig_Subnet = cmdletContext.VpcConfig_Subnet; } if (requestVpcConfig_vpcConfig_Subnet != null) { request.VpcConfig.Subnets = requestVpcConfig_vpcConfig_Subnet; requestVpcConfigIsNull = false; } // determine if request.VpcConfig should be set to null if (requestVpcConfigIsNull) { request.VpcConfig = null; } 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); }