public async Task <HttpResponseData> SearchStates([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "testhooks/nodeOperations/searchStates")] HttpRequestData req) { _log.Info("search states"); var query = UriExtension.GetQueryComponents(req.Url); Guid?poolId = UriExtension.GetGuid("poolId", query); Guid?scaleSetId = UriExtension.GetGuid("scaleSetId", query); List <NodeState>?states = default; if (query.ContainsKey("states")) { states = query["states"].Split('-').Select(s => Enum.Parse <NodeState>(s)).ToList(); } string?poolNameString = UriExtension.GetString("poolName", query); PoolName?poolName = poolNameString is null ? null : PoolName.Parse(poolNameString); var excludeUpdateScheduled = UriExtension.GetBool("excludeUpdateScheduled", query, false); int?numResults = UriExtension.GetInt("numResults", query); var r = _nodeOps.SearchStates(poolId, scaleSetId, states, poolName, excludeUpdateScheduled, numResults); var json = JsonSerializer.Serialize(await r.ToListAsync(), EntityConverter.GetJsonSerializerOptions()); var resp = req.CreateResponse(HttpStatusCode.OK); await resp.WriteStringAsync(json); return(resp); }