/// <summary> /// Return the servers monitored by Contrast agents. /// </summary> /// <param name="organizationId">The uuid of the user's organization</param> /// <param name="filter">Query params that can be added to filter request.</param> /// <returns>A ServerResponse object which contains a list of Server objects being monitored</returns> /// <exception cref="System.AggregateException">Thrown when there is an error communicating with TeamServer</exception> public ServersResponse GetServers(string organizationId, ServerFilter filter) { string endpoint = String.Format(NgEndpoints.SERVERS, organizationId, string.Empty); if (filter != null) { endpoint += filter.ToString(); } return(GetResponseAndDeserialize <ServersResponse>(endpoint)); }
public void TestServerFilter() { ServerFilter filter = new ServerFilter(); filter.Limit = 10; filter.Expand = new List <ServerExpandValue>(); filter.Expand.Add(ServerExpandValue.applications); filter.IncludeArchived = false; filter.Status = "Denied"; filter.QueryParam = "any"; string query = filter.ToString(); Assert.IsTrue(query.Contains("includeArchived")); Assert.IsTrue(query.Contains("limit")); Assert.IsTrue(query.Contains("expand=applications")); Assert.IsTrue(query.Contains("status=Denied")); Assert.IsTrue(query.Contains("q=any")); Assert.IsFalse(query.Contains("applicationIds")); Assert.IsFalse(query.Contains("logLevels")); Assert.IsFalse(query.Contains("offset")); }