private Amazon.Rekognition.Model.DetectModerationLabelsResponse CallAWSServiceOperation(IAmazonRekognition client, Amazon.Rekognition.Model.DetectModerationLabelsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Rekognition", "DetectModerationLabels"); try { #if DESKTOP return(client.DetectModerationLabels(request)); #elif CORECLR return(client.DetectModerationLabelsAsync(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) { System.IO.MemoryStream _Image_ByteStream = null; try { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Rekognition.Model.DetectModerationLabelsRequest(); // populate HumanLoopConfig var requestHumanLoopConfigIsNull = true; request.HumanLoopConfig = new Amazon.Rekognition.Model.HumanLoopConfig(); System.String requestHumanLoopConfig_humanLoopConfig_FlowDefinitionArn = null; if (cmdletContext.HumanLoopConfig_FlowDefinitionArn != null) { requestHumanLoopConfig_humanLoopConfig_FlowDefinitionArn = cmdletContext.HumanLoopConfig_FlowDefinitionArn; } if (requestHumanLoopConfig_humanLoopConfig_FlowDefinitionArn != null) { request.HumanLoopConfig.FlowDefinitionArn = requestHumanLoopConfig_humanLoopConfig_FlowDefinitionArn; requestHumanLoopConfigIsNull = false; } System.String requestHumanLoopConfig_humanLoopConfig_HumanLoopName = null; if (cmdletContext.HumanLoopConfig_HumanLoopName != null) { requestHumanLoopConfig_humanLoopConfig_HumanLoopName = cmdletContext.HumanLoopConfig_HumanLoopName; } if (requestHumanLoopConfig_humanLoopConfig_HumanLoopName != null) { request.HumanLoopConfig.HumanLoopName = requestHumanLoopConfig_humanLoopConfig_HumanLoopName; requestHumanLoopConfigIsNull = false; } Amazon.Rekognition.Model.HumanLoopDataAttributes requestHumanLoopConfig_humanLoopConfig_DataAttributes = null; // populate DataAttributes var requestHumanLoopConfig_humanLoopConfig_DataAttributesIsNull = true; requestHumanLoopConfig_humanLoopConfig_DataAttributes = new Amazon.Rekognition.Model.HumanLoopDataAttributes(); List <System.String> requestHumanLoopConfig_humanLoopConfig_DataAttributes_dataAttributes_ContentClassifier = null; if (cmdletContext.DataAttributes_ContentClassifier != null) { requestHumanLoopConfig_humanLoopConfig_DataAttributes_dataAttributes_ContentClassifier = cmdletContext.DataAttributes_ContentClassifier; } if (requestHumanLoopConfig_humanLoopConfig_DataAttributes_dataAttributes_ContentClassifier != null) { requestHumanLoopConfig_humanLoopConfig_DataAttributes.ContentClassifiers = requestHumanLoopConfig_humanLoopConfig_DataAttributes_dataAttributes_ContentClassifier; requestHumanLoopConfig_humanLoopConfig_DataAttributesIsNull = false; } // determine if requestHumanLoopConfig_humanLoopConfig_DataAttributes should be set to null if (requestHumanLoopConfig_humanLoopConfig_DataAttributesIsNull) { requestHumanLoopConfig_humanLoopConfig_DataAttributes = null; } if (requestHumanLoopConfig_humanLoopConfig_DataAttributes != null) { request.HumanLoopConfig.DataAttributes = requestHumanLoopConfig_humanLoopConfig_DataAttributes; requestHumanLoopConfigIsNull = false; } // determine if request.HumanLoopConfig should be set to null if (requestHumanLoopConfigIsNull) { request.HumanLoopConfig = null; } // populate Image var requestImageIsNull = true; request.Image = new Amazon.Rekognition.Model.Image(); System.IO.MemoryStream requestImage_image_Byte = null; if (cmdletContext.Image_Byte != null) { _Image_ByteStream = new System.IO.MemoryStream(cmdletContext.Image_Byte); requestImage_image_Byte = _Image_ByteStream; } if (requestImage_image_Byte != null) { request.Image.Bytes = requestImage_image_Byte; requestImageIsNull = false; } Amazon.Rekognition.Model.S3Object requestImage_image_S3Object = null; // populate S3Object var requestImage_image_S3ObjectIsNull = true; requestImage_image_S3Object = new Amazon.Rekognition.Model.S3Object(); System.String requestImage_image_S3Object_s3Object_Bucket = null; if (cmdletContext.S3Object_Bucket != null) { requestImage_image_S3Object_s3Object_Bucket = cmdletContext.S3Object_Bucket; } if (requestImage_image_S3Object_s3Object_Bucket != null) { requestImage_image_S3Object.Bucket = requestImage_image_S3Object_s3Object_Bucket; requestImage_image_S3ObjectIsNull = false; } System.String requestImage_image_S3Object_s3Object_Name = null; if (cmdletContext.S3Object_Name != null) { requestImage_image_S3Object_s3Object_Name = cmdletContext.S3Object_Name; } if (requestImage_image_S3Object_s3Object_Name != null) { requestImage_image_S3Object.Name = requestImage_image_S3Object_s3Object_Name; requestImage_image_S3ObjectIsNull = false; } System.String requestImage_image_S3Object_s3Object_Version = null; if (cmdletContext.S3Object_Version != null) { requestImage_image_S3Object_s3Object_Version = cmdletContext.S3Object_Version; } if (requestImage_image_S3Object_s3Object_Version != null) { requestImage_image_S3Object.Version = requestImage_image_S3Object_s3Object_Version; requestImage_image_S3ObjectIsNull = false; } // determine if requestImage_image_S3Object should be set to null if (requestImage_image_S3ObjectIsNull) { requestImage_image_S3Object = null; } if (requestImage_image_S3Object != null) { request.Image.S3Object = requestImage_image_S3Object; requestImageIsNull = false; } // determine if request.Image should be set to null if (requestImageIsNull) { request.Image = null; } if (cmdletContext.MinConfidence != null) { request.MinConfidence = cmdletContext.MinConfidence.Value; } 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); } finally { if (_Image_ByteStream != null) { _Image_ByteStream.Dispose(); } } }