public static Uri GetResourceUriByTypes(IList <string> httpGatewayAddresses, string[] resourceTypes, Dictionary <string, string> queryParameters, string apiVersion) { ThrowIf.Null(resourceTypes, "resourceTypes"); ThrowIf.Null(httpGatewayAddresses, "httpGatewayAddresses"); int index = RandomUtility.NextFromTimestamp(httpGatewayAddresses.Count); string endpoint = httpGatewayAddresses[index]; endpoint = RestPathBuilder.RemoveExtraCharacter(endpoint); StringBuilder sb = new StringBuilder(); sb.Append(endpoint); foreach (var partUri in resourceTypes) { sb.Append("/"); sb.Append(partUri); } sb.Append(string.Format(CultureInfo.InvariantCulture, RestPathBuilder.FirstQueryStringFormat, RestPathBuilder.ApiVersionUri, apiVersion)); if (queryParameters != null) { foreach (var key in queryParameters.Keys) { sb.Append(string.Format(CultureInfo.InvariantCulture, RestPathBuilder.QueryStringFormat, key, queryParameters[key])); } } return(new Uri(sb.ToString())); }
public static Uri BuildRequestEndpoint(IList <string> httpGatewayAddresses, string suffix, string queryParameters) { ThrowIf.Null(httpGatewayAddresses, "resourceTypes"); ThrowIf.Null(suffix, "resourceIds"); ThrowIf.Null(queryParameters, "httpGatewayAddresses"); int index = RandomUtility.NextFromTimestamp(httpGatewayAddresses.Count); string endpoint = httpGatewayAddresses[index]; endpoint = RestPathBuilder.RemoveExtraCharacter(endpoint); StringBuilder sb = new StringBuilder(); sb.Append(endpoint); sb.Append(suffix); sb.Append(queryParameters); return(new Uri(sb.ToString())); }
public static Uri GetResourceUriByTypes(IList <string> httpGatewayAddresses, string[] resourceTypes) { return(RestPathBuilder.GetResourceUriByTypes(httpGatewayAddresses, resourceTypes, null)); }
public static Uri GetResourceUriById(IList <string> httpGatewayAddresses, string[] resourceTypes, string[] resourceIds, Dictionary <string, string> queryParameters) { return(RestPathBuilder.GetResourceUriById(httpGatewayAddresses, resourceTypes, resourceIds, queryParameters, RestPathBuilder.ApiVersionDefault)); }
public static Uri GetResourceUriById(IList <string> httpGatewayAddresses, string[] resourceTypes, string[] resourceIds, string apiVersion = RestPathBuilder.ApiVersionDefault) { return(RestPathBuilder.GetResourceUriById(httpGatewayAddresses, resourceTypes, resourceIds, null, apiVersion)); }
public static Uri GetResourceUriById(IList <string> httpGatewayAddresses, string resourceType, string resourceId, string apiVersion = RestPathBuilder.ApiVersionDefault) { string[] resourceTypes = new string[] { resourceType }; string[] resourceIds = string.IsNullOrEmpty(resourceId) ? new string[0] : new string[] { resourceId }; return(RestPathBuilder.GetResourceUriById(httpGatewayAddresses, resourceTypes, resourceIds, null, apiVersion)); }
public static Uri GetBaseResourceUri(IList <string> httpGatewayAddresses, string resource) { return(RestPathBuilder.GetBaseResourceUri(httpGatewayAddresses, resource, null)); }