private Amazon.Comprehend.Model.StartPiiEntitiesDetectionJobResponse CallAWSServiceOperation(IAmazonComprehend client, Amazon.Comprehend.Model.StartPiiEntitiesDetectionJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Comprehend", "StartPiiEntitiesDetectionJob"); try { #if DESKTOP return(client.StartPiiEntitiesDetectionJob(request)); #elif CORECLR return(client.StartPiiEntitiesDetectionJobAsync(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.StartPiiEntitiesDetectionJobRequest(); 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.Mode != null) { request.Mode = cmdletContext.Mode; } if (cmdletContext.OutputDataConfig != null) { request.OutputDataConfig = cmdletContext.OutputDataConfig; } // populate RedactionConfig var requestRedactionConfigIsNull = true; request.RedactionConfig = new Amazon.Comprehend.Model.RedactionConfig(); System.String requestRedactionConfig_redactionConfig_MaskCharacter = null; if (cmdletContext.RedactionConfig_MaskCharacter != null) { requestRedactionConfig_redactionConfig_MaskCharacter = cmdletContext.RedactionConfig_MaskCharacter; } if (requestRedactionConfig_redactionConfig_MaskCharacter != null) { request.RedactionConfig.MaskCharacter = requestRedactionConfig_redactionConfig_MaskCharacter; requestRedactionConfigIsNull = false; } Amazon.Comprehend.PiiEntitiesDetectionMaskMode requestRedactionConfig_redactionConfig_MaskMode = null; if (cmdletContext.RedactionConfig_MaskMode != null) { requestRedactionConfig_redactionConfig_MaskMode = cmdletContext.RedactionConfig_MaskMode; } if (requestRedactionConfig_redactionConfig_MaskMode != null) { request.RedactionConfig.MaskMode = requestRedactionConfig_redactionConfig_MaskMode; requestRedactionConfigIsNull = false; } List <System.String> requestRedactionConfig_redactionConfig_PiiEntityType = null; if (cmdletContext.RedactionConfig_PiiEntityType != null) { requestRedactionConfig_redactionConfig_PiiEntityType = cmdletContext.RedactionConfig_PiiEntityType; } if (requestRedactionConfig_redactionConfig_PiiEntityType != null) { request.RedactionConfig.PiiEntityTypes = requestRedactionConfig_redactionConfig_PiiEntityType; requestRedactionConfigIsNull = false; } // determine if request.RedactionConfig should be set to null if (requestRedactionConfigIsNull) { request.RedactionConfig = 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); }