private Amazon.Comprehend.Model.CreateEntityRecognizerResponse CallAWSServiceOperation(IAmazonComprehend client, Amazon.Comprehend.Model.CreateEntityRecognizerRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Comprehend", "CreateEntityRecognizer");
     try
     {
         #if DESKTOP
         return(client.CreateEntityRecognizer(request));
         #elif CORECLR
         return(client.CreateEntityRecognizerAsync(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.CreateEntityRecognizerRequest();

            if (cmdletContext.ClientRequestToken != null)
            {
                request.ClientRequestToken = cmdletContext.ClientRequestToken;
            }
            if (cmdletContext.DataAccessRoleArn != null)
            {
                request.DataAccessRoleArn = cmdletContext.DataAccessRoleArn;
            }

            // populate InputDataConfig
            var requestInputDataConfigIsNull = true;

            request.InputDataConfig = new Amazon.Comprehend.Model.EntityRecognizerInputDataConfig();
            List <Amazon.Comprehend.Model.EntityTypesListItem> requestInputDataConfig_inputDataConfig_EntityType = null;

            if (cmdletContext.InputDataConfig_EntityType != null)
            {
                requestInputDataConfig_inputDataConfig_EntityType = cmdletContext.InputDataConfig_EntityType;
            }
            if (requestInputDataConfig_inputDataConfig_EntityType != null)
            {
                request.InputDataConfig.EntityTypes = requestInputDataConfig_inputDataConfig_EntityType;
                requestInputDataConfigIsNull        = false;
            }
            Amazon.Comprehend.Model.EntityRecognizerAnnotations requestInputDataConfig_inputDataConfig_Annotations = null;

            // populate Annotations
            var requestInputDataConfig_inputDataConfig_AnnotationsIsNull = true;

            requestInputDataConfig_inputDataConfig_Annotations = new Amazon.Comprehend.Model.EntityRecognizerAnnotations();
            System.String requestInputDataConfig_inputDataConfig_Annotations_annotations_S3Uri = null;
            if (cmdletContext.Annotations_S3Uri != null)
            {
                requestInputDataConfig_inputDataConfig_Annotations_annotations_S3Uri = cmdletContext.Annotations_S3Uri;
            }
            if (requestInputDataConfig_inputDataConfig_Annotations_annotations_S3Uri != null)
            {
                requestInputDataConfig_inputDataConfig_Annotations.S3Uri = requestInputDataConfig_inputDataConfig_Annotations_annotations_S3Uri;
                requestInputDataConfig_inputDataConfig_AnnotationsIsNull = false;
            }
            // determine if requestInputDataConfig_inputDataConfig_Annotations should be set to null
            if (requestInputDataConfig_inputDataConfig_AnnotationsIsNull)
            {
                requestInputDataConfig_inputDataConfig_Annotations = null;
            }
            if (requestInputDataConfig_inputDataConfig_Annotations != null)
            {
                request.InputDataConfig.Annotations = requestInputDataConfig_inputDataConfig_Annotations;
                requestInputDataConfigIsNull        = false;
            }
            Amazon.Comprehend.Model.EntityRecognizerDocuments requestInputDataConfig_inputDataConfig_Documents = null;

            // populate Documents
            var requestInputDataConfig_inputDataConfig_DocumentsIsNull = true;

            requestInputDataConfig_inputDataConfig_Documents = new Amazon.Comprehend.Model.EntityRecognizerDocuments();
            System.String requestInputDataConfig_inputDataConfig_Documents_documents_S3Uri = null;
            if (cmdletContext.Documents_S3Uri != null)
            {
                requestInputDataConfig_inputDataConfig_Documents_documents_S3Uri = cmdletContext.Documents_S3Uri;
            }
            if (requestInputDataConfig_inputDataConfig_Documents_documents_S3Uri != null)
            {
                requestInputDataConfig_inputDataConfig_Documents.S3Uri = requestInputDataConfig_inputDataConfig_Documents_documents_S3Uri;
                requestInputDataConfig_inputDataConfig_DocumentsIsNull = false;
            }
            // determine if requestInputDataConfig_inputDataConfig_Documents should be set to null
            if (requestInputDataConfig_inputDataConfig_DocumentsIsNull)
            {
                requestInputDataConfig_inputDataConfig_Documents = null;
            }
            if (requestInputDataConfig_inputDataConfig_Documents != null)
            {
                request.InputDataConfig.Documents = requestInputDataConfig_inputDataConfig_Documents;
                requestInputDataConfigIsNull      = false;
            }
            Amazon.Comprehend.Model.EntityRecognizerEntityList requestInputDataConfig_inputDataConfig_EntityList = null;

            // populate EntityList
            var requestInputDataConfig_inputDataConfig_EntityListIsNull = true;

            requestInputDataConfig_inputDataConfig_EntityList = new Amazon.Comprehend.Model.EntityRecognizerEntityList();
            System.String requestInputDataConfig_inputDataConfig_EntityList_entityList_S3Uri = null;
            if (cmdletContext.EntityList_S3Uri != null)
            {
                requestInputDataConfig_inputDataConfig_EntityList_entityList_S3Uri = cmdletContext.EntityList_S3Uri;
            }
            if (requestInputDataConfig_inputDataConfig_EntityList_entityList_S3Uri != null)
            {
                requestInputDataConfig_inputDataConfig_EntityList.S3Uri = requestInputDataConfig_inputDataConfig_EntityList_entityList_S3Uri;
                requestInputDataConfig_inputDataConfig_EntityListIsNull = false;
            }
            // determine if requestInputDataConfig_inputDataConfig_EntityList should be set to null
            if (requestInputDataConfig_inputDataConfig_EntityListIsNull)
            {
                requestInputDataConfig_inputDataConfig_EntityList = null;
            }
            if (requestInputDataConfig_inputDataConfig_EntityList != null)
            {
                request.InputDataConfig.EntityList = requestInputDataConfig_inputDataConfig_EntityList;
                requestInputDataConfigIsNull       = false;
            }
            // determine if request.InputDataConfig should be set to null
            if (requestInputDataConfigIsNull)
            {
                request.InputDataConfig = null;
            }
            if (cmdletContext.LanguageCode != null)
            {
                request.LanguageCode = cmdletContext.LanguageCode;
            }
            if (cmdletContext.RecognizerName != null)
            {
                request.RecognizerName = cmdletContext.RecognizerName;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            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);
        }