@@ -48,6 +48,52 @@ func (c *AzureDevopsClient) ListAgentQueues(project string) (list AgentQueueList
4848 return
4949}
5050
51+ type AgentPoolList struct {
52+ Count int `json:"count"`
53+ Value []AgentPoolEntry `json:"value"`
54+ }
55+
56+ type AgentPoolEntry struct {
57+ CreatedOn time.Time `json:"createdOn"`
58+ AutoProvision bool `json:"autoProvision"`
59+ AutoUpdate bool `json:"autoUpdate"`
60+ AutoSize bool `json:"autoSize"`
61+ CreatedBy struct {
62+ DisplayName string `json:"displayName"`
63+ URL string `json:"url"`
64+ Links struct {
65+ Avatar struct {
66+ Href string `json:"href"`
67+ } `json:"avatar"`
68+ } `json:"_links"`
69+ ID string `json:"id"`
70+ UniqueName string `json:"uniqueName"`
71+ ImageURL string `json:"imageUrl"`
72+ Descriptor string `json:"descriptor"`
73+ } `json:"createdBy"`
74+ Owner struct {
75+ DisplayName string `json:"displayName"`
76+ URL string `json:"url"`
77+ Links struct {
78+ Avatar struct {
79+ Href string `json:"href"`
80+ } `json:"avatar"`
81+ } `json:"_links"`
82+ ID string `json:"id"`
83+ UniqueName string `json:"uniqueName"`
84+ ImageURL string `json:"imageUrl"`
85+ Descriptor string `json:"descriptor"`
86+ } `json:"owner"`
87+ ID int64 `json:"id"`
88+ Scope string `json:"scope"`
89+ Name string `json:"name"`
90+ IsHosted bool `json:"isHosted"`
91+ PoolType string `json:"poolType"`
92+ Size int `json:"size"`
93+ IsLegacy bool `json:"isLegacy"`
94+ Options string `json:"options"`
95+ }
96+
5197type AgentPoolAgentList struct {
5298 Count int `json:"count"`
5399 List []AgentPoolAgent `json:"value"`
@@ -86,6 +132,29 @@ type JobRequest struct {
86132 }
87133}
88134
135+ func (c * AzureDevopsClient ) ListAgentPools () (list AgentPoolList , error error ) {
136+ defer c .concurrencyUnlock ()
137+ c .concurrencyLock ()
138+
139+ url := fmt .Sprintf (
140+ "/_apis/distributedtask/pools?api-version=%s" ,
141+ url .QueryEscape (c .ApiVersion ),
142+ )
143+ response , err := c .rest ().R ().Get (url )
144+ if err := c .checkResponse (response , err ); err != nil {
145+ error = err
146+ return
147+ }
148+
149+ err = json .Unmarshal (response .Body (), & list )
150+ if err != nil {
151+ error = err
152+ return
153+ }
154+
155+ return
156+ }
157+
89158func (c * AzureDevopsClient ) ListAgentPoolAgents (agentPoolId int64 ) (list AgentPoolAgentList , error error ) {
90159 defer c .concurrencyUnlock ()
91160 c .concurrencyLock ()
0 commit comments