/* * Copyright (c) Citrix Systems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Collections; using System.Collections.Generic; using CookComputing.XmlRpc; namespace XenAPI { /// /// machines serving blocks of data for provisioning VMs /// public partial class PVS_site : XenObject { public PVS_site() { } public PVS_site(string uuid, string name_label, string name_description, string PVS_uuid, List> cache_storage, List> servers, List> proxies) { this.uuid = uuid; this.name_label = name_label; this.name_description = name_description; this.PVS_uuid = PVS_uuid; this.cache_storage = cache_storage; this.servers = servers; this.proxies = proxies; } /// /// Creates a new PVS_site from a Proxy_PVS_site. /// /// public PVS_site(Proxy_PVS_site proxy) { this.UpdateFromProxy(proxy); } public override void UpdateFrom(PVS_site update) { uuid = update.uuid; name_label = update.name_label; name_description = update.name_description; PVS_uuid = update.PVS_uuid; cache_storage = update.cache_storage; servers = update.servers; proxies = update.proxies; } internal void UpdateFromProxy(Proxy_PVS_site proxy) { uuid = proxy.uuid == null ? null : (string)proxy.uuid; name_label = proxy.name_label == null ? null : (string)proxy.name_label; name_description = proxy.name_description == null ? null : (string)proxy.name_description; PVS_uuid = proxy.PVS_uuid == null ? null : (string)proxy.PVS_uuid; cache_storage = proxy.cache_storage == null ? null : XenRef.Create(proxy.cache_storage); servers = proxy.servers == null ? null : XenRef.Create(proxy.servers); proxies = proxy.proxies == null ? null : XenRef.Create(proxy.proxies); } public Proxy_PVS_site ToProxy() { Proxy_PVS_site result_ = new Proxy_PVS_site(); result_.uuid = (uuid != null) ? uuid : ""; result_.name_label = (name_label != null) ? name_label : ""; result_.name_description = (name_description != null) ? name_description : ""; result_.PVS_uuid = (PVS_uuid != null) ? PVS_uuid : ""; result_.cache_storage = (cache_storage != null) ? Helper.RefListToStringArray(cache_storage) : new string[] {}; result_.servers = (servers != null) ? Helper.RefListToStringArray(servers) : new string[] {}; result_.proxies = (proxies != null) ? Helper.RefListToStringArray(proxies) : new string[] {}; return result_; } /// /// Creates a new PVS_site from a Hashtable. /// /// public PVS_site(Hashtable table) { uuid = Marshalling.ParseString(table, "uuid"); name_label = Marshalling.ParseString(table, "name_label"); name_description = Marshalling.ParseString(table, "name_description"); PVS_uuid = Marshalling.ParseString(table, "PVS_uuid"); cache_storage = Marshalling.ParseSetRef(table, "cache_storage"); servers = Marshalling.ParseSetRef(table, "servers"); proxies = Marshalling.ParseSetRef(table, "proxies"); } public bool DeepEquals(PVS_site other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Helper.AreEqual2(this._uuid, other._uuid) && Helper.AreEqual2(this._name_label, other._name_label) && Helper.AreEqual2(this._name_description, other._name_description) && Helper.AreEqual2(this._PVS_uuid, other._PVS_uuid) && Helper.AreEqual2(this._cache_storage, other._cache_storage) && Helper.AreEqual2(this._servers, other._servers) && Helper.AreEqual2(this._proxies, other._proxies); } public override string SaveChanges(Session session, string opaqueRef, PVS_site server) { if (opaqueRef == null) { System.Diagnostics.Debug.Assert(false, "Cannot create instances of this type on the server"); return ""; } else { if (!Helper.AreEqual2(_name_label, server._name_label)) { PVS_site.set_name_label(session, opaqueRef, _name_label); } if (!Helper.AreEqual2(_name_description, server._name_description)) { PVS_site.set_name_description(session, opaqueRef, _name_description); } if (!Helper.AreEqual2(_PVS_uuid, server._PVS_uuid)) { PVS_site.set_PVS_uuid(session, opaqueRef, _PVS_uuid); } return null; } } /// /// Get a record containing the current state of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static PVS_site get_record(Session session, string _pvs_site) { return new PVS_site((Proxy_PVS_site)session.proxy.pvs_site_get_record(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse()); } /// /// Get a reference to the PVS_site instance with the specified UUID. /// Experimental. First published in XenServer 7.1. /// /// The session /// UUID of object to return public static XenRef get_by_uuid(Session session, string _uuid) { return XenRef.Create(session.proxy.pvs_site_get_by_uuid(session.uuid, (_uuid != null) ? _uuid : "").parse()); } /// /// Get all the PVS_site instances with the given label. /// Experimental. First published in XenServer 7.1. /// /// The session /// label of object to return public static List> get_by_name_label(Session session, string _label) { return XenRef.Create(session.proxy.pvs_site_get_by_name_label(session.uuid, (_label != null) ? _label : "").parse()); } /// /// Get the uuid field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static string get_uuid(Session session, string _pvs_site) { return (string)session.proxy.pvs_site_get_uuid(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse(); } /// /// Get the name/label field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static string get_name_label(Session session, string _pvs_site) { return (string)session.proxy.pvs_site_get_name_label(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse(); } /// /// Get the name/description field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static string get_name_description(Session session, string _pvs_site) { return (string)session.proxy.pvs_site_get_name_description(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse(); } /// /// Get the PVS_uuid field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static string get_PVS_uuid(Session session, string _pvs_site) { return (string)session.proxy.pvs_site_get_pvs_uuid(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse(); } /// /// Get the cache_storage field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static List> get_cache_storage(Session session, string _pvs_site) { return XenRef.Create(session.proxy.pvs_site_get_cache_storage(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse()); } /// /// Get the servers field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static List> get_servers(Session session, string _pvs_site) { return XenRef.Create(session.proxy.pvs_site_get_servers(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse()); } /// /// Get the proxies field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static List> get_proxies(Session session, string _pvs_site) { return XenRef.Create(session.proxy.pvs_site_get_proxies(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse()); } /// /// Set the name/label field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site /// New value to set public static void set_name_label(Session session, string _pvs_site, string _label) { session.proxy.pvs_site_set_name_label(session.uuid, (_pvs_site != null) ? _pvs_site : "", (_label != null) ? _label : "").parse(); } /// /// Set the name/description field of the given PVS_site. /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site /// New value to set public static void set_name_description(Session session, string _pvs_site, string _description) { session.proxy.pvs_site_set_name_description(session.uuid, (_pvs_site != null) ? _pvs_site : "", (_description != null) ? _description : "").parse(); } /// /// Introduce new PVS site /// Experimental. First published in XenServer 7.1. /// /// The session /// name of the PVS site /// description of the PVS site /// unique identifier of the PVS site public static XenRef introduce(Session session, string _name_label, string _name_description, string _pvs_uuid) { return XenRef.Create(session.proxy.pvs_site_introduce(session.uuid, (_name_label != null) ? _name_label : "", (_name_description != null) ? _name_description : "", (_pvs_uuid != null) ? _pvs_uuid : "").parse()); } /// /// Introduce new PVS site /// Experimental. First published in XenServer 7.1. /// /// The session /// name of the PVS site /// description of the PVS site /// unique identifier of the PVS site public static XenRef async_introduce(Session session, string _name_label, string _name_description, string _pvs_uuid) { return XenRef.Create(session.proxy.async_pvs_site_introduce(session.uuid, (_name_label != null) ? _name_label : "", (_name_description != null) ? _name_description : "", (_pvs_uuid != null) ? _pvs_uuid : "").parse()); } /// /// Remove a site's meta data /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static void forget(Session session, string _pvs_site) { session.proxy.pvs_site_forget(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse(); } /// /// Remove a site's meta data /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site public static XenRef async_forget(Session session, string _pvs_site) { return XenRef.Create(session.proxy.async_pvs_site_forget(session.uuid, (_pvs_site != null) ? _pvs_site : "").parse()); } /// /// Update the PVS UUID of the PVS site /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site /// PVS UUID to be used public static void set_PVS_uuid(Session session, string _pvs_site, string _value) { session.proxy.pvs_site_set_pvs_uuid(session.uuid, (_pvs_site != null) ? _pvs_site : "", (_value != null) ? _value : "").parse(); } /// /// Update the PVS UUID of the PVS site /// Experimental. First published in XenServer 7.1. /// /// The session /// The opaque_ref of the given pvs_site /// PVS UUID to be used public static XenRef async_set_PVS_uuid(Session session, string _pvs_site, string _value) { return XenRef.Create(session.proxy.async_pvs_site_set_pvs_uuid(session.uuid, (_pvs_site != null) ? _pvs_site : "", (_value != null) ? _value : "").parse()); } /// /// Return a list of all the PVS_sites known to the system. /// Experimental. First published in XenServer 7.1. /// /// The session public static List> get_all(Session session) { return XenRef.Create(session.proxy.pvs_site_get_all(session.uuid).parse()); } /// /// Get all the PVS_site Records at once, in a single XML RPC call /// /// The session public static Dictionary, PVS_site> get_all_records(Session session) { return XenRef.Create(session.proxy.pvs_site_get_all_records(session.uuid).parse()); } /// /// Unique identifier/object reference /// Experimental. First published in XenServer 7.1. /// public virtual string uuid { get { return _uuid; } set { if (!Helper.AreEqual(value, _uuid)) { _uuid = value; Changed = true; NotifyPropertyChanged("uuid"); } } } private string _uuid; /// /// a human-readable name /// Experimental. First published in XenServer 7.1. /// public virtual string name_label { get { return _name_label; } set { if (!Helper.AreEqual(value, _name_label)) { _name_label = value; Changed = true; NotifyPropertyChanged("name_label"); } } } private string _name_label; /// /// a notes field containing human-readable description /// Experimental. First published in XenServer 7.1. /// public virtual string name_description { get { return _name_description; } set { if (!Helper.AreEqual(value, _name_description)) { _name_description = value; Changed = true; NotifyPropertyChanged("name_description"); } } } private string _name_description; /// /// Unique identifier of the PVS site, as configured in PVS /// Experimental. First published in XenServer 7.1. /// public virtual string PVS_uuid { get { return _PVS_uuid; } set { if (!Helper.AreEqual(value, _PVS_uuid)) { _PVS_uuid = value; Changed = true; NotifyPropertyChanged("PVS_uuid"); } } } private string _PVS_uuid; /// /// The SR used by PVS proxy for the cache /// Experimental. First published in XenServer 7.1. /// public virtual List> cache_storage { get { return _cache_storage; } set { if (!Helper.AreEqual(value, _cache_storage)) { _cache_storage = value; Changed = true; NotifyPropertyChanged("cache_storage"); } } } private List> _cache_storage; /// /// The set of PVS servers in the site /// Experimental. First published in XenServer 7.1. /// public virtual List> servers { get { return _servers; } set { if (!Helper.AreEqual(value, _servers)) { _servers = value; Changed = true; NotifyPropertyChanged("servers"); } } } private List> _servers; /// /// The set of proxies associated with the site /// Experimental. First published in XenServer 7.1. /// public virtual List> proxies { get { return _proxies; } set { if (!Helper.AreEqual(value, _proxies)) { _proxies = value; Changed = true; NotifyPropertyChanged("proxies"); } } } private List> _proxies; } }