2023-02-09 23:31:22 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) Cloud Software Group, Inc.
|
2017-09-13 18:14:07 +02:00
|
|
|
*
|
2017-03-21 10:06:04 +01:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
2017-09-13 18:14:07 +02:00
|
|
|
*
|
2017-03-21 10:06:04 +01:00
|
|
|
* 1) Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
2017-09-13 18:14:07 +02:00
|
|
|
*
|
2017-03-21 10:06:04 +01:00
|
|
|
* 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.
|
2017-09-13 18:14:07 +02:00
|
|
|
*
|
2017-03-21 10:06:04 +01:00
|
|
|
* 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;
|
2017-09-13 18:14:07 +02:00
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Globalization;
|
2021-04-13 11:05:38 +02:00
|
|
|
using System.Linq;
|
2017-09-13 18:14:07 +02:00
|
|
|
using Newtonsoft.Json;
|
2017-03-21 10:06:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
namespace XenAPI
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// VM Snapshot Schedule
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
public partial class VMSS : XenObject<VMSS>
|
|
|
|
{
|
2019-06-19 10:11:30 +02:00
|
|
|
#region Constructors
|
|
|
|
|
2017-03-21 10:06:04 +01:00
|
|
|
public VMSS()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public VMSS(string uuid,
|
|
|
|
string name_label,
|
|
|
|
string name_description,
|
|
|
|
bool enabled,
|
|
|
|
vmss_type type,
|
|
|
|
long retained_snapshots,
|
|
|
|
vmss_frequency frequency,
|
|
|
|
Dictionary<string, string> schedule,
|
|
|
|
DateTime last_run_time,
|
|
|
|
List<XenRef<VM>> VMs)
|
|
|
|
{
|
|
|
|
this.uuid = uuid;
|
|
|
|
this.name_label = name_label;
|
|
|
|
this.name_description = name_description;
|
|
|
|
this.enabled = enabled;
|
|
|
|
this.type = type;
|
|
|
|
this.retained_snapshots = retained_snapshots;
|
|
|
|
this.frequency = frequency;
|
|
|
|
this.schedule = schedule;
|
|
|
|
this.last_run_time = last_run_time;
|
|
|
|
this.VMs = VMs;
|
|
|
|
}
|
|
|
|
|
2019-06-19 10:11:30 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new VMSS from a Hashtable.
|
|
|
|
/// Note that the fields not contained in the Hashtable
|
|
|
|
/// will be created with their default values.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="table"></param>
|
|
|
|
public VMSS(Hashtable table)
|
|
|
|
: this()
|
|
|
|
{
|
|
|
|
UpdateFrom(table);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2018-02-16 17:27:30 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Updates each field of this instance with the value of
|
|
|
|
/// the corresponding field of a given VMSS.
|
|
|
|
/// </summary>
|
2021-04-13 11:05:38 +02:00
|
|
|
public override void UpdateFrom(VMSS record)
|
2017-03-21 10:06:04 +01:00
|
|
|
{
|
2021-04-13 11:05:38 +02:00
|
|
|
uuid = record.uuid;
|
|
|
|
name_label = record.name_label;
|
|
|
|
name_description = record.name_description;
|
|
|
|
enabled = record.enabled;
|
|
|
|
type = record.type;
|
|
|
|
retained_snapshots = record.retained_snapshots;
|
|
|
|
frequency = record.frequency;
|
|
|
|
schedule = record.schedule;
|
|
|
|
last_run_time = record.last_run_time;
|
|
|
|
VMs = record.VMs;
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
2018-02-16 17:27:30 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Given a Hashtable with field-value pairs, it updates the fields of this VMSS
|
|
|
|
/// with the values listed in the Hashtable. Note that only the fields contained
|
|
|
|
/// in the Hashtable will be updated and the rest will remain the same.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="table"></param>
|
2018-02-16 17:27:30 +01:00
|
|
|
public void UpdateFrom(Hashtable table)
|
2017-03-21 10:06:04 +01:00
|
|
|
{
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("uuid"))
|
2018-02-23 17:06:32 +01:00
|
|
|
uuid = Marshalling.ParseString(table, "uuid");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("name_label"))
|
2018-02-23 17:06:32 +01:00
|
|
|
name_label = Marshalling.ParseString(table, "name_label");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("name_description"))
|
2018-02-23 17:06:32 +01:00
|
|
|
name_description = Marshalling.ParseString(table, "name_description");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("enabled"))
|
2018-02-23 17:06:32 +01:00
|
|
|
enabled = Marshalling.ParseBool(table, "enabled");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("type"))
|
2018-02-23 17:06:32 +01:00
|
|
|
type = (vmss_type)Helper.EnumParseDefault(typeof(vmss_type), Marshalling.ParseString(table, "type"));
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("retained_snapshots"))
|
2018-02-23 17:06:32 +01:00
|
|
|
retained_snapshots = Marshalling.ParseLong(table, "retained_snapshots");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("frequency"))
|
2018-02-23 17:06:32 +01:00
|
|
|
frequency = (vmss_frequency)Helper.EnumParseDefault(typeof(vmss_frequency), Marshalling.ParseString(table, "frequency"));
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("schedule"))
|
2023-08-20 13:28:53 +02:00
|
|
|
schedule = Maps.ToDictionary_string_string(Marshalling.ParseHashTable(table, "schedule"));
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("last_run_time"))
|
2018-02-23 17:06:32 +01:00
|
|
|
last_run_time = Marshalling.ParseDateTime(table, "last_run_time");
|
2018-02-16 17:27:30 +01:00
|
|
|
if (table.ContainsKey("VMs"))
|
2018-02-23 17:06:32 +01:00
|
|
|
VMs = Marshalling.ParseSetRef<VM>(table, "VMs");
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool DeepEquals(VMSS other)
|
|
|
|
{
|
|
|
|
if (ReferenceEquals(null, other))
|
|
|
|
return false;
|
|
|
|
if (ReferenceEquals(this, other))
|
|
|
|
return true;
|
|
|
|
|
2023-08-20 13:28:53 +02:00
|
|
|
return Helper.AreEqual2(_uuid, other._uuid) &&
|
|
|
|
Helper.AreEqual2(_name_label, other._name_label) &&
|
|
|
|
Helper.AreEqual2(_name_description, other._name_description) &&
|
|
|
|
Helper.AreEqual2(_enabled, other._enabled) &&
|
|
|
|
Helper.AreEqual2(_type, other._type) &&
|
|
|
|
Helper.AreEqual2(_retained_snapshots, other._retained_snapshots) &&
|
|
|
|
Helper.AreEqual2(_frequency, other._frequency) &&
|
|
|
|
Helper.AreEqual2(_schedule, other._schedule) &&
|
|
|
|
Helper.AreEqual2(_last_run_time, other._last_run_time) &&
|
|
|
|
Helper.AreEqual2(_VMs, other._VMs);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public override string SaveChanges(Session session, string opaqueRef, VMSS server)
|
|
|
|
{
|
|
|
|
if (opaqueRef == null)
|
|
|
|
{
|
2017-09-13 18:14:07 +02:00
|
|
|
var reference = create(session, this);
|
|
|
|
return reference == null ? null : reference.opaque_ref;
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual2(_name_label, server._name_label))
|
|
|
|
{
|
|
|
|
VMSS.set_name_label(session, opaqueRef, _name_label);
|
|
|
|
}
|
|
|
|
if (!Helper.AreEqual2(_name_description, server._name_description))
|
|
|
|
{
|
|
|
|
VMSS.set_name_description(session, opaqueRef, _name_description);
|
|
|
|
}
|
|
|
|
if (!Helper.AreEqual2(_enabled, server._enabled))
|
|
|
|
{
|
|
|
|
VMSS.set_enabled(session, opaqueRef, _enabled);
|
|
|
|
}
|
|
|
|
if (!Helper.AreEqual2(_type, server._type))
|
|
|
|
{
|
|
|
|
VMSS.set_type(session, opaqueRef, _type);
|
|
|
|
}
|
|
|
|
if (!Helper.AreEqual2(_retained_snapshots, server._retained_snapshots))
|
|
|
|
{
|
|
|
|
VMSS.set_retained_snapshots(session, opaqueRef, _retained_snapshots);
|
|
|
|
}
|
|
|
|
if (!Helper.AreEqual2(_frequency, server._frequency))
|
|
|
|
{
|
|
|
|
VMSS.set_frequency(session, opaqueRef, _frequency);
|
|
|
|
}
|
|
|
|
if (!Helper.AreEqual2(_schedule, server._schedule))
|
|
|
|
{
|
|
|
|
VMSS.set_schedule(session, opaqueRef, _schedule);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2021-04-13 11:05:38 +02:00
|
|
|
|
2017-03-21 10:06:04 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Get a record containing the current state of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static VMSS get_record(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_record(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get a reference to the VMSS instance with the specified UUID.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_uuid">UUID of object to return</param>
|
|
|
|
public static XenRef<VMSS> get_by_uuid(Session session, string _uuid)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_by_uuid(session.opaque_ref, _uuid);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new VMSS instance, and return its handle.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_record">All constructor arguments</param>
|
|
|
|
public static XenRef<VMSS> create(Session session, VMSS _record)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_create(session.opaque_ref, _record);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new VMSS instance, and return its handle.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_record">All constructor arguments</param>
|
|
|
|
public static XenRef<Task> async_create(Session session, VMSS _record)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.async_vmss_create(session.opaque_ref, _record);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Destroy the specified VMSS instance.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static void destroy(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_destroy(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Destroy the specified VMSS instance.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static XenRef<Task> async_destroy(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.async_vmss_destroy(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get all the VMSS instances with the given label.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_label">label of object to return</param>
|
|
|
|
public static List<XenRef<VMSS>> get_by_name_label(Session session, string _label)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_by_name_label(session.opaque_ref, _label);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the uuid field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static string get_uuid(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_uuid(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the name/label field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static string get_name_label(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_name_label(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the name/description field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static string get_name_description(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_name_description(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the enabled field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static bool get_enabled(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_enabled(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the type field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static vmss_type get_type(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_type(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the retained_snapshots field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static long get_retained_snapshots(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_retained_snapshots(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the frequency field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static vmss_frequency get_frequency(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_frequency(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the schedule field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static Dictionary<string, string> get_schedule(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_schedule(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the last_run_time field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static DateTime get_last_run_time(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_last_run_time(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get the VMs field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static List<XenRef<VM>> get_VMs(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_vms(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the name/label field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_label">New value to set</param>
|
|
|
|
public static void set_name_label(Session session, string _vmss, string _label)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_set_name_label(session.opaque_ref, _vmss, _label);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the name/description field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_description">New value to set</param>
|
|
|
|
public static void set_name_description(Session session, string _vmss, string _description)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_set_name_description(session.opaque_ref, _vmss, _description);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the enabled field of the given VMSS.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_enabled">New value to set</param>
|
|
|
|
public static void set_enabled(Session session, string _vmss, bool _enabled)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_set_enabled(session.opaque_ref, _vmss, _enabled);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// This call executes the snapshot schedule immediately
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
public static string snapshot_now(Session session, string _vmss)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_snapshot_now(session.opaque_ref, _vmss);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_value">the value to set</param>
|
|
|
|
public static void set_retained_snapshots(Session session, string _vmss, long _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_set_retained_snapshots(session.opaque_ref, _vmss, _value);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the value of the frequency field
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_value">the snapshot schedule frequency</param>
|
|
|
|
public static void set_frequency(Session session, string _vmss, vmss_frequency _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_set_frequency(session.opaque_ref, _vmss, _value);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_value">the value to set</param>
|
|
|
|
public static void set_schedule(Session session, string _vmss, Dictionary<string, string> _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_set_schedule(session.opaque_ref, _vmss, _value);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_key">the key to add</param>
|
|
|
|
/// <param name="_value">the value to add</param>
|
|
|
|
public static void add_to_schedule(Session session, string _vmss, string _key, string _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_add_to_schedule(session.opaque_ref, _vmss, _key, _value);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_key">the key to remove</param>
|
|
|
|
public static void remove_from_schedule(Session session, string _vmss, string _key)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_remove_from_schedule(session.opaque_ref, _vmss, _key);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_value">the value to set</param>
|
|
|
|
public static void set_last_run_time(Session session, string _vmss, DateTime _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_set_last_run_time(session.opaque_ref, _vmss, _value);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
///
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
/// <param name="_vmss">The opaque_ref of the given vmss</param>
|
|
|
|
/// <param name="_value">the snapshot schedule type</param>
|
|
|
|
public static void set_type(Session session, string _vmss, vmss_type _value)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
session.JsonRpcClient.vmss_set_type(session.opaque_ref, _vmss, _value);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return a list of all the VMSSs known to the system.
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
public static List<XenRef<VMSS>> get_all(Session session)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_all(session.opaque_ref);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get all the VMSS Records at once, in a single XML RPC call
|
2017-06-28 18:00:22 +02:00
|
|
|
/// First published in XenServer 7.2.
|
2017-03-21 10:06:04 +01:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="session">The session</param>
|
|
|
|
public static Dictionary<XenRef<VMSS>, VMSS> get_all_records(Session session)
|
|
|
|
{
|
2023-02-09 23:31:22 +01:00
|
|
|
return session.JsonRpcClient.vmss_get_all_records(session.opaque_ref);
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Unique identifier/object reference
|
|
|
|
/// </summary>
|
|
|
|
public virtual string uuid
|
|
|
|
{
|
|
|
|
get { return _uuid; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _uuid))
|
|
|
|
{
|
|
|
|
_uuid = value;
|
|
|
|
NotifyPropertyChanged("uuid");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:14:07 +02:00
|
|
|
private string _uuid = "";
|
2017-03-21 10:06:04 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// a human-readable name
|
|
|
|
/// </summary>
|
|
|
|
public virtual string name_label
|
|
|
|
{
|
|
|
|
get { return _name_label; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _name_label))
|
|
|
|
{
|
|
|
|
_name_label = value;
|
|
|
|
NotifyPropertyChanged("name_label");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:14:07 +02:00
|
|
|
private string _name_label = "";
|
2017-03-21 10:06:04 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// a notes field containing human-readable description
|
|
|
|
/// </summary>
|
|
|
|
public virtual string name_description
|
|
|
|
{
|
|
|
|
get { return _name_description; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _name_description))
|
|
|
|
{
|
|
|
|
_name_description = value;
|
|
|
|
NotifyPropertyChanged("name_description");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:14:07 +02:00
|
|
|
private string _name_description = "";
|
2017-03-21 10:06:04 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// enable or disable this snapshot schedule
|
|
|
|
/// </summary>
|
|
|
|
public virtual bool enabled
|
|
|
|
{
|
|
|
|
get { return _enabled; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _enabled))
|
|
|
|
{
|
|
|
|
_enabled = value;
|
|
|
|
NotifyPropertyChanged("enabled");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:14:07 +02:00
|
|
|
private bool _enabled = true;
|
2017-03-21 10:06:04 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// type of the snapshot schedule
|
|
|
|
/// </summary>
|
2017-09-13 18:14:07 +02:00
|
|
|
[JsonConverter(typeof(vmss_typeConverter))]
|
2017-03-21 10:06:04 +01:00
|
|
|
public virtual vmss_type type
|
|
|
|
{
|
|
|
|
get { return _type; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _type))
|
|
|
|
{
|
|
|
|
_type = value;
|
|
|
|
NotifyPropertyChanged("type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private vmss_type _type;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// maximum number of snapshots that should be stored at any time
|
|
|
|
/// </summary>
|
|
|
|
public virtual long retained_snapshots
|
|
|
|
{
|
|
|
|
get { return _retained_snapshots; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _retained_snapshots))
|
|
|
|
{
|
|
|
|
_retained_snapshots = value;
|
|
|
|
NotifyPropertyChanged("retained_snapshots");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:14:07 +02:00
|
|
|
private long _retained_snapshots = 7;
|
2017-03-21 10:06:04 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// frequency of taking snapshot from snapshot schedule
|
|
|
|
/// </summary>
|
2017-09-13 18:14:07 +02:00
|
|
|
[JsonConverter(typeof(vmss_frequencyConverter))]
|
2017-03-21 10:06:04 +01:00
|
|
|
public virtual vmss_frequency frequency
|
|
|
|
{
|
|
|
|
get { return _frequency; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _frequency))
|
|
|
|
{
|
|
|
|
_frequency = value;
|
|
|
|
NotifyPropertyChanged("frequency");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private vmss_frequency _frequency;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// schedule of the snapshot containing 'hour', 'min', 'days'. Date/time-related information is in Local Timezone
|
|
|
|
/// </summary>
|
2018-02-27 15:52:46 +01:00
|
|
|
[JsonConverter(typeof(StringStringMapConverter))]
|
2017-03-21 10:06:04 +01:00
|
|
|
public virtual Dictionary<string, string> schedule
|
|
|
|
{
|
|
|
|
get { return _schedule; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _schedule))
|
|
|
|
{
|
|
|
|
_schedule = value;
|
|
|
|
NotifyPropertyChanged("schedule");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:14:07 +02:00
|
|
|
private Dictionary<string, string> _schedule = new Dictionary<string, string>() {};
|
2017-03-21 10:06:04 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// time of the last snapshot
|
|
|
|
/// </summary>
|
2017-09-13 18:14:07 +02:00
|
|
|
[JsonConverter(typeof(XenDateTimeConverter))]
|
2017-03-21 10:06:04 +01:00
|
|
|
public virtual DateTime last_run_time
|
|
|
|
{
|
|
|
|
get { return _last_run_time; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _last_run_time))
|
|
|
|
{
|
|
|
|
_last_run_time = value;
|
|
|
|
NotifyPropertyChanged("last_run_time");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:14:07 +02:00
|
|
|
private DateTime _last_run_time = DateTime.ParseExact("19700101T00:00:00Z", "yyyyMMddTHH:mm:ssZ", CultureInfo.InvariantCulture);
|
2017-03-21 10:06:04 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// all VMs attached to this snapshot schedule
|
|
|
|
/// </summary>
|
2017-09-13 18:14:07 +02:00
|
|
|
[JsonConverter(typeof(XenRefListConverter<VM>))]
|
2017-03-21 10:06:04 +01:00
|
|
|
public virtual List<XenRef<VM>> VMs
|
|
|
|
{
|
|
|
|
get { return _VMs; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (!Helper.AreEqual(value, _VMs))
|
|
|
|
{
|
|
|
|
_VMs = value;
|
|
|
|
NotifyPropertyChanged("VMs");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-13 18:14:07 +02:00
|
|
|
private List<XenRef<VM>> _VMs = new List<XenRef<VM>>() {};
|
2017-03-21 10:06:04 +01:00
|
|
|
}
|
|
|
|
}
|