-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathNodesGetCommand.cs
More file actions
34 lines (26 loc) · 950 Bytes
/
NodesGetCommand.cs
File metadata and controls
34 lines (26 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Collections.Generic;
using System.Diagnostics;
using JenkinsNET.Models;
namespace JenkinsNET.Internal.Commands
{
internal class NodesGetCommand : JenkinsHttpCommand
{
public IEnumerable<Models.JenkinsNode> Result { get; private set; }
public NodesGetCommand(IJenkinsContext context)
{
if (context == null)
throw new ArgumentNullException(nameof(context));
Url = NetPath.Combine(context.BaseUrl, "computer/", "api/xml");
UserName = context.UserName;
Password = context.Password;
OnWrite = request => {
request.Method = "GET";
};
OnRead = response => {
var document = ReadXml(response);
Result = document.Root.WrapGroup("computer", n => new JenkinsNode(n));
};
}
}
}