private Amazon.Rekognition.Model.DetectProtectiveEquipmentResponse CallAWSServiceOperation(IAmazonRekognition client, Amazon.Rekognition.Model.DetectProtectiveEquipmentRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Rekognition", "DetectProtectiveEquipment"); try { #if DESKTOP return(client.DetectProtectiveEquipment(request)); #elif CORECLR return(client.DetectProtectiveEquipmentAsync(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 _ImageContentStream = null; try { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Rekognition.Model.DetectProtectiveEquipmentRequest(); // populate Image var requestImageIsNull = true; request.Image = new Amazon.Rekognition.Model.Image(); System.IO.MemoryStream requestImage_imageContent = null; if (cmdletContext.ImageContent != null) { _ImageContentStream = new System.IO.MemoryStream(cmdletContext.ImageContent); requestImage_imageContent = _ImageContentStream; } if (requestImage_imageContent != null) { request.Image.Bytes = requestImage_imageContent; 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_imageBucket = null; if (cmdletContext.ImageBucket != null) { requestImage_image_S3Object_imageBucket = cmdletContext.ImageBucket; } if (requestImage_image_S3Object_imageBucket != null) { requestImage_image_S3Object.Bucket = requestImage_image_S3Object_imageBucket; requestImage_image_S3ObjectIsNull = false; } System.String requestImage_image_S3Object_imageName = null; if (cmdletContext.ImageName != null) { requestImage_image_S3Object_imageName = cmdletContext.ImageName; } if (requestImage_image_S3Object_imageName != null) { requestImage_image_S3Object.Name = requestImage_image_S3Object_imageName; requestImage_image_S3ObjectIsNull = false; } System.String requestImage_image_S3Object_imageVersion = null; if (cmdletContext.ImageVersion != null) { requestImage_image_S3Object_imageVersion = cmdletContext.ImageVersion; } if (requestImage_image_S3Object_imageVersion != null) { requestImage_image_S3Object.Version = requestImage_image_S3Object_imageVersion; 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; } // populate SummarizationAttributes var requestSummarizationAttributesIsNull = true; request.SummarizationAttributes = new Amazon.Rekognition.Model.ProtectiveEquipmentSummarizationAttributes(); System.Single?requestSummarizationAttributes_summarizationAttributes_MinConfidence = null; if (cmdletContext.SummarizationAttributes_MinConfidence != null) { requestSummarizationAttributes_summarizationAttributes_MinConfidence = cmdletContext.SummarizationAttributes_MinConfidence.Value; } if (requestSummarizationAttributes_summarizationAttributes_MinConfidence != null) { request.SummarizationAttributes.MinConfidence = requestSummarizationAttributes_summarizationAttributes_MinConfidence.Value; requestSummarizationAttributesIsNull = false; } List <System.String> requestSummarizationAttributes_summarizationAttributes_RequiredEquipmentType = null; if (cmdletContext.SummarizationAttributes_RequiredEquipmentType != null) { requestSummarizationAttributes_summarizationAttributes_RequiredEquipmentType = cmdletContext.SummarizationAttributes_RequiredEquipmentType; } if (requestSummarizationAttributes_summarizationAttributes_RequiredEquipmentType != null) { request.SummarizationAttributes.RequiredEquipmentTypes = requestSummarizationAttributes_summarizationAttributes_RequiredEquipmentType; requestSummarizationAttributesIsNull = false; } // determine if request.SummarizationAttributes should be set to null if (requestSummarizationAttributesIsNull) { request.SummarizationAttributes = 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); } finally { if (_ImageContentStream != null) { _ImageContentStream.Dispose(); } } }