private Amazon.CodeCommit.Model.PostCommentForPullRequestResponse CallAWSServiceOperation(IAmazonCodeCommit client, Amazon.CodeCommit.Model.PostCommentForPullRequestRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CodeCommit", "PostCommentForPullRequest"); try { #if DESKTOP return(client.PostCommentForPullRequest(request)); #elif CORECLR return(client.PostCommentForPullRequestAsync(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) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CodeCommit.Model.PostCommentForPullRequestRequest(); if (cmdletContext.AfterCommitId != null) { request.AfterCommitId = cmdletContext.AfterCommitId; } if (cmdletContext.BeforeCommitId != null) { request.BeforeCommitId = cmdletContext.BeforeCommitId; } if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } if (cmdletContext.Content != null) { request.Content = cmdletContext.Content; } // populate Location var requestLocationIsNull = true; request.Location = new Amazon.CodeCommit.Model.Location(); System.String requestLocation_location_FilePath = null; if (cmdletContext.Location_FilePath != null) { requestLocation_location_FilePath = cmdletContext.Location_FilePath; } if (requestLocation_location_FilePath != null) { request.Location.FilePath = requestLocation_location_FilePath; requestLocationIsNull = false; } System.Int64?requestLocation_location_FilePosition = null; if (cmdletContext.Location_FilePosition != null) { requestLocation_location_FilePosition = cmdletContext.Location_FilePosition.Value; } if (requestLocation_location_FilePosition != null) { request.Location.FilePosition = requestLocation_location_FilePosition.Value; requestLocationIsNull = false; } Amazon.CodeCommit.RelativeFileVersionEnum requestLocation_location_RelativeFileVersion = null; if (cmdletContext.Location_RelativeFileVersion != null) { requestLocation_location_RelativeFileVersion = cmdletContext.Location_RelativeFileVersion; } if (requestLocation_location_RelativeFileVersion != null) { request.Location.RelativeFileVersion = requestLocation_location_RelativeFileVersion; requestLocationIsNull = false; } // determine if request.Location should be set to null if (requestLocationIsNull) { request.Location = null; } if (cmdletContext.PullRequestId != null) { request.PullRequestId = cmdletContext.PullRequestId; } 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); }