示例#1
0
 private Amazon.CodeCommit.Model.CreateUnreferencedMergeCommitResponse CallAWSServiceOperation(IAmazonCodeCommit client, Amazon.CodeCommit.Model.CreateUnreferencedMergeCommitRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CodeCommit", "CreateUnreferencedMergeCommit");
     try
     {
         #if DESKTOP
         return(client.CreateUnreferencedMergeCommit(request));
         #elif CORECLR
         return(client.CreateUnreferencedMergeCommitAsync(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)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CodeCommit.Model.CreateUnreferencedMergeCommitRequest();

            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.DestinationCommitSpecifier != null)
            {
                request.DestinationCommitSpecifier = cmdletContext.DestinationCommitSpecifier;
            }
            if (cmdletContext.Email != null)
            {
                request.Email = cmdletContext.Email;
            }
            if (cmdletContext.KeepEmptyFolder != null)
            {
                request.KeepEmptyFolders = cmdletContext.KeepEmptyFolder.Value;
            }
            if (cmdletContext.MergeOption != null)
            {
                request.MergeOption = cmdletContext.MergeOption;
            }
            if (cmdletContext.RepositoryName != null)
            {
                request.RepositoryName = cmdletContext.RepositoryName;
            }
            if (cmdletContext.SourceCommitSpecifier != null)
            {
                request.SourceCommitSpecifier = cmdletContext.SourceCommitSpecifier;
            }

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