コード例 #1
0
 private Amazon.Rekognition.Model.UpdateDatasetEntriesResponse CallAWSServiceOperation(IAmazonRekognition client, Amazon.Rekognition.Model.UpdateDatasetEntriesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Rekognition", "UpdateDatasetEntries");
     try
     {
         #if DESKTOP
         return(client.UpdateDatasetEntries(request));
         #elif CORECLR
         return(client.UpdateDatasetEntriesAsync(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;
     }
 }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            System.IO.MemoryStream _Changes_GroundTruthStream = null;

            try
            {
                var cmdletContext = context as CmdletContext;
                // create request
                var request = new Amazon.Rekognition.Model.UpdateDatasetEntriesRequest();


                // populate Changes
                var requestChangesIsNull = true;
                request.Changes = new Amazon.Rekognition.Model.DatasetChanges();
                System.IO.MemoryStream requestChanges_changes_GroundTruth = null;
                if (cmdletContext.Changes_GroundTruth != null)
                {
                    _Changes_GroundTruthStream         = new System.IO.MemoryStream(cmdletContext.Changes_GroundTruth);
                    requestChanges_changes_GroundTruth = _Changes_GroundTruthStream;
                }
                if (requestChanges_changes_GroundTruth != null)
                {
                    request.Changes.GroundTruth = requestChanges_changes_GroundTruth;
                    requestChangesIsNull        = false;
                }
                // determine if request.Changes should be set to null
                if (requestChangesIsNull)
                {
                    request.Changes = null;
                }
                if (cmdletContext.DatasetArn != null)
                {
                    request.DatasetArn = cmdletContext.DatasetArn;
                }

                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 (_Changes_GroundTruthStream != null)
                {
                    _Changes_GroundTruthStream.Dispose();
                }
            }
        }