Esempio n. 1
0
 private Amazon.CodeCommit.Model.MergePullRequestByThreeWayResponse CallAWSServiceOperation(IAmazonCodeCommit client, Amazon.CodeCommit.Model.MergePullRequestByThreeWayRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CodeCommit", "MergePullRequestByThreeWay");
     try
     {
         #if DESKTOP
         return(client.MergePullRequestByThreeWay(request));
         #elif CORECLR
         return(client.MergePullRequestByThreeWayAsync(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;
     }
 }
Esempio n. 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CodeCommit.Model.MergePullRequestByThreeWayRequest();

            if (cmdletContext.AuthorName != null)
            {
                request.AuthorName = cmdletContext.AuthorName;
            }
            if (cmdletContext.CommitMessage != null)
            {
                request.CommitMessage = cmdletContext.CommitMessage;
            }
            if (cmdletContext.ConflictDetailLevel != null)
            {
                request.ConflictDetailLevel = cmdletContext.ConflictDetailLevel;
            }

            // populate ConflictResolution
            var requestConflictResolutionIsNull = true;

            request.ConflictResolution = new Amazon.CodeCommit.Model.ConflictResolution();
            List <Amazon.CodeCommit.Model.DeleteFileEntry> requestConflictResolution_conflictResolution_DeleteFile = null;

            if (cmdletContext.ConflictResolution_DeleteFile != null)
            {
                requestConflictResolution_conflictResolution_DeleteFile = cmdletContext.ConflictResolution_DeleteFile;
            }
            if (requestConflictResolution_conflictResolution_DeleteFile != null)
            {
                request.ConflictResolution.DeleteFiles = requestConflictResolution_conflictResolution_DeleteFile;
                requestConflictResolutionIsNull        = false;
            }
            List <Amazon.CodeCommit.Model.ReplaceContentEntry> requestConflictResolution_conflictResolution_ReplaceContent = null;

            if (cmdletContext.ConflictResolution_ReplaceContent != null)
            {
                requestConflictResolution_conflictResolution_ReplaceContent = cmdletContext.ConflictResolution_ReplaceContent;
            }
            if (requestConflictResolution_conflictResolution_ReplaceContent != null)
            {
                request.ConflictResolution.ReplaceContents = requestConflictResolution_conflictResolution_ReplaceContent;
                requestConflictResolutionIsNull            = false;
            }
            List <Amazon.CodeCommit.Model.SetFileModeEntry> requestConflictResolution_conflictResolution_SetFileMode = null;

            if (cmdletContext.ConflictResolution_SetFileMode != null)
            {
                requestConflictResolution_conflictResolution_SetFileMode = cmdletContext.ConflictResolution_SetFileMode;
            }
            if (requestConflictResolution_conflictResolution_SetFileMode != null)
            {
                request.ConflictResolution.SetFileModes = requestConflictResolution_conflictResolution_SetFileMode;
                requestConflictResolutionIsNull         = false;
            }
            // determine if request.ConflictResolution should be set to null
            if (requestConflictResolutionIsNull)
            {
                request.ConflictResolution = null;
            }
            if (cmdletContext.ConflictResolutionStrategy != null)
            {
                request.ConflictResolutionStrategy = cmdletContext.ConflictResolutionStrategy;
            }
            if (cmdletContext.Email != null)
            {
                request.Email = cmdletContext.Email;
            }
            if (cmdletContext.KeepEmptyFolder != null)
            {
                request.KeepEmptyFolders = cmdletContext.KeepEmptyFolder.Value;
            }
            if (cmdletContext.PullRequestId != null)
            {
                request.PullRequestId = cmdletContext.PullRequestId;
            }
            if (cmdletContext.RepositoryName != null)
            {
                request.RepositoryName = cmdletContext.RepositoryName;
            }
            if (cmdletContext.SourceCommitId != null)
            {
                request.SourceCommitId = cmdletContext.SourceCommitId;
            }

            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);
        }