From 87184e23ddfbd218f9816c28fc4057ef05ba99cb Mon Sep 17 00:00:00 2001 From: Roman Kredentser Date: Thu, 15 Dec 2022 15:53:57 +0200 Subject: [PATCH 1/2] add AssignedLabels to node response --- node.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/node.go b/node.go index 1bea5cc9..510ac7d2 100644 --- a/node.go +++ b/node.go @@ -35,10 +35,11 @@ type Node struct { } type NodeResponse struct { - Class string `json:"_class"` - Actions []interface{} `json:"actions"` - DisplayName string `json:"displayName"` - Executors []struct { + Class string `json:"_class"` + Actions []interface{} `json:"actions"` + DisplayName string `json:"displayName"` + AssignedLabels []map[string]string `json:"assignedLabels"` + Executors []struct { CurrentExecutable struct { Number int `json:"number"` URL string `json:"url"` From e358f2d2548ddb8985d66117da34ed75f231058d Mon Sep 17 00:00:00 2001 From: Roman Kredentser Date: Tue, 10 Jan 2023 23:35:08 +0200 Subject: [PATCH 2/2] split NodeResponse and Executors struct --- node.go | 66 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/node.go b/node.go index 510ac7d2..48648e43 100644 --- a/node.go +++ b/node.go @@ -34,38 +34,42 @@ type Node struct { Base string } +type NodeExecutor struct { + Idle bool `json:"idle"` + Number int `json:"number"` + CurrentExecutable struct { + Number int `json:"number"` + URL string `json:"url"` + SubBuilds []struct { + Abort bool `json:"abort"` + Build interface{} `json:"build"` + BuildNumber int `json:"buildNumber"` + Duration string `json:"duration"` + Icon string `json:"icon"` + JobName string `json:"jobName"` + ParentBuildNumber int `json:"parentBuildNumber"` + ParentJobName string `json:"parentJobName"` + PhaseName string `json:"phaseName"` + Result string `json:"result"` + Retry bool `json:"retry"` + URL string `json:"url"` + } `json:"subBuilds"` + } `json:"currentExecutable"` +} + type NodeResponse struct { - Class string `json:"_class"` - Actions []interface{} `json:"actions"` - DisplayName string `json:"displayName"` - AssignedLabels []map[string]string `json:"assignedLabels"` - Executors []struct { - CurrentExecutable struct { - Number int `json:"number"` - URL string `json:"url"` - SubBuilds []struct { - Abort bool `json:"abort"` - Build interface{} `json:"build"` - BuildNumber int `json:"buildNumber"` - Duration string `json:"duration"` - Icon string `json:"icon"` - JobName string `json:"jobName"` - ParentBuildNumber int `json:"parentBuildNumber"` - ParentJobName string `json:"parentJobName"` - PhaseName string `json:"phaseName"` - Result string `json:"result"` - Retry bool `json:"retry"` - URL string `json:"url"` - } `json:"subBuilds"` - } `json:"currentExecutable"` - } `json:"executors"` - Icon string `json:"icon"` - IconClassName string `json:"iconClassName"` - Idle bool `json:"idle"` - JnlpAgent bool `json:"jnlpAgent"` - LaunchSupported bool `json:"launchSupported"` - LoadStatistics struct{} `json:"loadStatistics"` - ManualLaunchAllowed bool `json:"manualLaunchAllowed"` + Class string `json:"_class"` + Actions []interface{} `json:"actions"` + DisplayName string `json:"displayName"` + AssignedLabels []map[string]string `json:"assignedLabels"` + Executors []*NodeExecutor `json:"executors"` + Icon string `json:"icon"` + IconClassName string `json:"iconClassName"` + Idle bool `json:"idle"` + JnlpAgent bool `json:"jnlpAgent"` + LaunchSupported bool `json:"launchSupported"` + LoadStatistics struct{} `json:"loadStatistics"` + ManualLaunchAllowed bool `json:"manualLaunchAllowed"` MonitorData struct { Hudson_NodeMonitors_ArchitectureMonitor interface{} `json:"hudson.node_monitors.ArchitectureMonitor"` Hudson_NodeMonitors_ClockMonitor interface{} `json:"hudson.node_monitors.ClockMonitor"`