/// <summary> /// Description - Gets a Rds HostPool associated with the Tenant specified in the Rds context. /// </summary> /// <param name="tenantName">Name of Tenant</param> /// <param name="hostPoolName">Name of Hostpool</param> /// <param name="refresh_token">Refresh token to get access token</param> /// <returns></returns> public HttpResponseMessage GetHostPoolDetails(string tenantGroupName, string tenantName, string hostPoolName, string refresh_token) { //get deployment url deploymentUrl = configurations.rdBrokerUrl; RdMgmtHostPool rdMgmtHostPool = new RdMgmtHostPool(); try { if (!string.IsNullOrEmpty(refresh_token)) { string accessToken = ""; //get token value accessToken = common.GetTokenValue(refresh_token); if (!string.IsNullOrEmpty(accessToken) && accessToken.ToString().ToLower() != invalidToken && accessToken.ToString().ToLower() != invalidCode) { return(hostPoolBL.GetHostPoolDetails(tenantGroupName, deploymentUrl, accessToken, tenantName, hostPoolName)); } else { return(Request.CreateResponse(HttpStatusCode.OK, new JObject() { { "code", Constants.invalidToken } })); } } else { return(null); } } catch { return(null); } }
/// <summary> /// Description: Gets all Rds SessionHosts associated with the Tenant and Host Pool specified in the Rds context. /// </summary> /// <param name="tenantName">Name of Tenant</param> /// <param name="hostPoolName">Name of Hostpool</param> /// <param name="refresh_token">Refresh token to get access token</param> /// //old parameters -- , int pageSize, string sortField, bool isDescending = false, int initialSkip = 0, string lastEntry = null /// <returns></returns> public async Task <HttpResponseMessage> GetSessionhostList(string tenantGroupName, string tenantName, string hostPoolName, string refresh_token, string subscriptionId = null) { //get deployment url deploymentUrl = configurations.rdBrokerUrl; string azureDeployUrl = configurations.managementResourceUrl; try { if (!string.IsNullOrEmpty(refresh_token)) { string wvdAccessToken = "", AzureAccessToken = ""; //get token value wvdAccessToken = common.GetTokenValue(refresh_token); AzureAccessToken = common.GetManagementTokenValue(refresh_token); if (!string.IsNullOrEmpty(wvdAccessToken) && wvdAccessToken.ToString().ToLower() != invalidToken && wvdAccessToken.ToString().ToLower() != invalidCode) { return(await sessionHostBL.GetSessionhostList(deploymentUrl, wvdAccessToken, tenantGroupName, tenantName, hostPoolName, azureDeployUrl, AzureAccessToken, subscriptionId)); } else { return(Request.CreateResponse(HttpStatusCode.OK, new JArray() { new JObject() { { "code", Constants.invalidToken } } })); } } else { return(null); } } catch { return(null); } }