예제 #1
0
 private Amazon.CodeBuild.Model.BatchGetProjectsResponse CallAWSServiceOperation(IAmazonCodeBuild client, Amazon.CodeBuild.Model.BatchGetProjectsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CodeBuild", "BatchGetProjects");
     try
     {
         #if DESKTOP
         return(client.BatchGetProjects(request));
         #elif CORECLR
         return(client.BatchGetProjectsAsync(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 LogCodebuildEvent(LogToElasticsearch logToEs, IAmazonCodeBuild cb) : base(request =>
                                                                                  (from codebuildEvent in Observable.Return(request)
                                                                                   let projectName = codebuildEvent.SelectToken("detail.project-name")?.ToObject <string>()
                                                                                                     where !string.IsNullOrEmpty(projectName)
                                                                                                     let batchGetProjectsRequest = new BatchGetProjectsRequest
 {
     Names = new List <string> {
         projectName
     }
 }
                                                                                   from batchGetProjectsResponse in cb.BatchGetProjectsAsync(batchGetProjectsRequest)
                                                                                   let time = codebuildEvent["time"].Value <DateTime>()
                                                                                              from project in batchGetProjectsResponse.Projects
                                                                                              let tags = project.Tags
                                                                                                         let app = tags.GetValue("repo") ?? tags.GetValue("Application") ?? tags.GetValue("app")
                                                                                                                   let env = tags.GetValue("env") ?? tags.GetValue("Environment")
                                                                                                                             let sha = tags.GetValue("sha")
                                                                                                                                       let log = new AlteredLog
 {
     Time = time,
     Repo = app,
     Env = env,
     Sha = sha,
     Log = codebuildEvent
 }
                                                                                   from response in logToEs.Execute(log)
                                                                                   select response).ToTask())
 {
 }