private Amazon.CodeCommit.Model.PutFileResponse CallAWSServiceOperation(IAmazonCodeCommit client, Amazon.CodeCommit.Model.PutFileRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CodeCommit", "PutFile");
     try
     {
         #if DESKTOP
         return(client.PutFile(request));
         #elif CORECLR
         return(client.PutFileAsync(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 _FileContentStream = null;

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

                if (cmdletContext.BranchName != null)
                {
                    request.BranchName = cmdletContext.BranchName;
                }
                if (cmdletContext.CommitMessage != null)
                {
                    request.CommitMessage = cmdletContext.CommitMessage;
                }
                if (cmdletContext.Email != null)
                {
                    request.Email = cmdletContext.Email;
                }
                if (cmdletContext.FileContent != null)
                {
                    _FileContentStream  = new System.IO.MemoryStream(cmdletContext.FileContent);
                    request.FileContent = _FileContentStream;
                }
                if (cmdletContext.FileMode != null)
                {
                    request.FileMode = cmdletContext.FileMode;
                }
                if (cmdletContext.FilePath != null)
                {
                    request.FilePath = cmdletContext.FilePath;
                }
                if (cmdletContext.Name != null)
                {
                    request.Name = cmdletContext.Name;
                }
                if (cmdletContext.ParentCommitId != null)
                {
                    request.ParentCommitId = cmdletContext.ParentCommitId;
                }
                if (cmdletContext.RepositoryName != null)
                {
                    request.RepositoryName = cmdletContext.RepositoryName;
                }

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