/// <summary> Add host name to the known endpoints. </summary> /// <remarks> Anthony, 4/24/2015. </remarks> /// <param name="vendor"> The Vendor. </param> /// <param name="region"> The Region. </param> /// <param name="apiUrl"> The API URL. </param> private void AddHostName(KnownApiVendor vendor, KnownApiRegion region, string apiUrl) { string key = string.Concat(vendor.ToString(), '-', region.ToString()); KnownApiHostNames.Add(key, apiUrl); KnownVendorEndPointPairs.Add(new KeyValuePair <KnownApiVendor, KnownApiRegion>(vendor, region)); }
/// <summary> /// Return the geokey for a known region /// </summary> /// <param name="region">Known Api Region</param> /// <returns>Geo Key</returns> public string GetKnownRegionGeoKey(KnownApiRegion region) { var regionName = region.ToString().ToLowerInvariant(); int index = regionName.IndexOf("_", StringComparison.Ordinal); return(regionName.Substring(0, index)); }
/// <summary> /// The get ftp host. /// </summary> /// <param name="vendor"> /// The vendor. /// </param> /// <param name="region"> /// The region. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> /// <exception cref="ComputeApiException"> /// </exception> public string GetFtpHost(KnownApiVendor vendor, KnownApiRegion region) { string key = string.Concat(vendor.ToString(), '-', region.ToString()); if (!KnownApiHostNames.ContainsKey(key)) { throw new ApiHostNotFoundException(vendor, region); } return(KnownFtpHostNames[key]); }
/// <summary> /// The get Monitoring url. /// </summary> /// <param name="vendor"> /// The vendor. /// </param> /// <param name="region"> /// The region. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> /// <exception cref="ComputeApiException"> /// </exception> public Uri GetMonitoringUrl(KnownApiVendor vendor, KnownApiRegion region) { const string urltemplate = "https://{0}/"; string key = region.ToString(); if (!KnownMonitoringHostNames.ContainsKey(key)) { throw new ApiHostNotFoundException(vendor, region); } string apiurl = string.Format(urltemplate, KnownMonitoringHostNames[key]); return(new Uri(apiurl)); }
/// <summary> The add ftp host name. </summary> /// <remarks> Anthony, 4/24/2015. </remarks> /// <param name="vendor"> The vendor. </param> /// <param name="region"> The region. </param> /// <param name="apiUrl"> The API url. </param> private void AddFtpHostName(KnownApiVendor vendor, KnownApiRegion region, string apiUrl) { string key = string.Concat(vendor.ToString(), '-', region.ToString()); KnownFtpHostNames.Add(key, apiUrl); }
/// <summary> Add host name to the known endpoints. </summary> /// <remarks> Anthony, 4/24/2015. </remarks> /// <param name="vendor"> The Vendor. </param> /// <param name="region"> The Region. </param> /// <param name="apiUrl"> The API URL. </param> private void AddHostName(KnownApiVendor vendor, KnownApiRegion region, string apiUrl) { string key = string.Concat(vendor.ToString(), '-', region.ToString()); KnownApiHostNames.Add(key, apiUrl); KnownVendorEndPointPairs.Add(new KeyValuePair<KnownApiVendor, KnownApiRegion>(vendor, region)); }
/// <summary> /// The get ftp host. /// </summary> /// <param name="vendor"> /// The vendor. /// </param> /// <param name="region"> /// The region. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> /// <exception cref="ComputeApiException"> /// </exception> public string GetFtpHost(KnownApiVendor vendor, KnownApiRegion region) { string key = string.Concat(vendor.ToString(), '-', region.ToString()); if (!KnownApiHostNames.ContainsKey(key)) throw new ApiHostNotFoundException(vendor, region); return KnownFtpHostNames[key]; }
/// <summary> /// Return an known CaaS URI based on vendor and region /// </summary> /// <param name="vendor"> /// The vendor /// </param> /// <param name="region"> /// The region /// </param> /// <returns> /// The <see cref="Uri"/>. /// </returns> public Uri GetBaseUri(KnownApiVendor vendor, KnownApiRegion region) { const string urltemplate = "https://{0}/"; string key = string.Concat(vendor.ToString(), '-', region.ToString()); if (!KnownApiHostNames.ContainsKey(key)) throw new ApiHostNotFoundException(vendor, region); string apiurl = string.Format(urltemplate, KnownApiHostNames[key]); return new Uri(apiurl); }
/// <summary> The add ftp host name. </summary> /// <remarks> Anthony, 4/24/2015. </remarks> /// <param name="vendor"> The vendor. </param> /// <param name="region"> The region. </param> /// <param name="apiUrl"> The API url. </param> private void AddFtpHostName(KnownApiVendor vendor, KnownApiRegion region, string apiUrl) { string key = string.Concat(vendor.ToString(), '-', region.ToString()); KnownFtpHostNames.Add(key, apiUrl); }
/// <summary> /// The get ftp host. /// </summary> /// <param name="vendor"> /// The vendor. /// </param> /// <param name="region"> /// The region. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> /// <exception cref="ComputeApiException"> /// </exception> public string GetFtpHost(KnownApiVendor vendor, KnownApiRegion region) { string key = string.Concat(vendor.ToString(), '-', region.ToString()); if (!KnownApiHostNames.ContainsKey(key)) throw new ComputeApiException( ComputeApiError.BadRequest, "Known Cloud API hostname not found with this vendor and region combination.", string.Empty, null, string.Empty); return KnownFtpHostNames[key]; }
/// <summary> /// Return an known CaaS URI based on vendor and region /// </summary> /// <param name="vendor"> /// The vendor /// </param> /// <param name="region"> /// The region /// </param> /// <returns> /// The <see cref="Uri"/>. /// </returns> public Uri GetBaseUri(KnownApiVendor vendor, KnownApiRegion region) { const string urltemplate = "https://{0}/"; string key = string.Concat(vendor.ToString(), '-', region.ToString()); if (!KnownApiHostNames.ContainsKey(key)) throw new ComputeApiException ( ComputeApiError.BadRequest, "Known Cloud API hostname not found with this vendor and region combination.", string.Empty, null, string.Empty); string apiurl = string.Format(urltemplate, KnownApiHostNames[key]); return new Uri(apiurl); }
/// <summary> The add monitoring host name. </summary> /// <param name="region"> The region. </param> /// <param name="apiUrl"> The API url. </param> private void AddMonitoringHostName(KnownApiRegion region, string apiUrl) { KnownMonitoringHostNames.Add(region.ToString(), apiUrl); }
/// <summary> The add vpn host name. </summary> /// <param name="region"> The region. </param> /// <param name="apiUrl"> The API url. </param> private void AddVpnHostName(KnownApiRegion region, string apiUrl) { KnownVpnHostNames.Add(region.ToString(), apiUrl); }