Esempio n. 1
0
        /// <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));
        }
Esempio n. 2
0
        /// <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]);
        }
Esempio n. 3
0
        /// <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>	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);
        }
Esempio n. 8
0
        /// <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);
        }