private Amazon.ECRPublic.Model.UploadLayerPartResponse CallAWSServiceOperation(IAmazonECRPublic client, Amazon.ECRPublic.Model.UploadLayerPartRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Container Registry Public", "UploadLayerPart");
     try
     {
         #if DESKTOP
         return(client.UploadLayerPart(request));
         #elif CORECLR
         return(client.UploadLayerPartAsync(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 _LayerPartBlobStream = null;

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

                if (cmdletContext.LayerPartBlob != null)
                {
                    _LayerPartBlobStream  = new System.IO.MemoryStream(cmdletContext.LayerPartBlob);
                    request.LayerPartBlob = _LayerPartBlobStream;
                }
                if (cmdletContext.PartFirstByte != null)
                {
                    request.PartFirstByte = cmdletContext.PartFirstByte.Value;
                }
                if (cmdletContext.PartLastByte != null)
                {
                    request.PartLastByte = cmdletContext.PartLastByte.Value;
                }
                if (cmdletContext.RegistryId != null)
                {
                    request.RegistryId = cmdletContext.RegistryId;
                }
                if (cmdletContext.RepositoryName != null)
                {
                    request.RepositoryName = cmdletContext.RepositoryName;
                }
                if (cmdletContext.UploadId != null)
                {
                    request.UploadId = cmdletContext.UploadId;
                }

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