//--------------------------------------------------------------------------------------------------------------------- public static OcciCloudAppliance FromItemXml(IfyContext context, CloudProvider provider, XmlElement elem) { OcciCloudAppliance result = new OcciCloudAppliance(context); result.Provider = provider; result.Load(elem); return(result); }
//--------------------------------------------------------------------------------------------------------------------- /// <summary> /// Froms the OCCI interface. /// </summary> /// <returns> /// The OCCI interface. /// </returns> /// <param name='context'> /// Context. /// </param> /// <param name='provider'> /// Provider. /// </param> public static OcciCloudAppliance FromOCCIInterface(IfyContext context, CloudProvider provider, string remoteId) { OcciCloudAppliance result = new OcciCloudAppliance(context); result.Provider = provider; result.RemoteId = remoteId; HttpWebRequest httpRequest = context.GetSslRequest(String.Format("{0}/compute/{1}", provider.AccessPoint, remoteId), "GET", null); HttpWebResponse response = null; try { // Get response stream. response = (HttpWebResponse)httpRequest.GetResponse(); XmlDocument doc = new XmlDocument(); doc.Load(response.GetResponseStream()); result.Load(doc.DocumentElement); response.Close(); } catch (WebException we) { throw new WebException("Error during request to " + httpRequest.RequestUri, we, we.Status, response); } return(result); }