generated/api/Models/TestFailoverMonitorMachines.json.cs

// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/powershell@4.0.708)
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

namespace Commvault.Powershell.Models
{
    using static Commvault.Powershell.Runtime.Extensions;

    /// <summary>Test failover Machine details from Replication monitor</summary>
    public partial class TestFailoverMonitorMachines
    {

        /// <summary>
        /// <c>AfterFromJson</c> will be called after the json deserialization has finished, allowing customization of the object
        /// before it is returned. Implement this method in a partial class to enable this behavior
        /// </summary>
        /// <param name="json">The JsonNode that should be deserialized into this object.</param>

        partial void AfterFromJson(Commvault.Powershell.Runtime.Json.JsonObject json);

        /// <summary>
        /// <c>AfterToJson</c> will be called after the json serialization has finished, allowing customization of the <see cref="Commvault.Powershell.Runtime.Json.JsonObject"
        /// /> before it is returned. Implement this method in a partial class to enable this behavior
        /// </summary>
        /// <param name="container">The JSON container that the serialization result will be placed in.</param>

        partial void AfterToJson(ref Commvault.Powershell.Runtime.Json.JsonObject container);

        /// <summary>
        /// <c>BeforeFromJson</c> will be called before the json deserialization has commenced, allowing complete customization of
        /// the object before it is deserialized.
        /// If you wish to disable the default deserialization entirely, return <c>true</c> in the <paramref name= "returnNow" />
        /// output parameter.
        /// Implement this method in a partial class to enable this behavior.
        /// </summary>
        /// <param name="json">The JsonNode that should be deserialized into this object.</param>
        /// <param name="returnNow">Determines if the rest of the deserialization should be processed, or if the method should return
        /// instantly.</param>

        partial void BeforeFromJson(Commvault.Powershell.Runtime.Json.JsonObject json, ref bool returnNow);

        /// <summary>
        /// <c>BeforeToJson</c> will be called before the json serialization has commenced, allowing complete customization of the
        /// object before it is serialized.
        /// If you wish to disable the default serialization entirely, return <c>true</c> in the <paramref name="returnNow" /> output
        /// parameter.
        /// Implement this method in a partial class to enable this behavior.
        /// </summary>
        /// <param name="container">The JSON container that the serialization result will be placed in.</param>
        /// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
        /// instantly.</param>

        partial void BeforeToJson(ref Commvault.Powershell.Runtime.Json.JsonObject container, ref bool returnNow);

        /// <summary>
        /// Deserializes a <see cref="Commvault.Powershell.Runtime.Json.JsonNode"/> into an instance of Commvault.Powershell.Models.ITestFailoverMonitorMachines.
        /// </summary>
        /// <param name="node">a <see cref="Commvault.Powershell.Runtime.Json.JsonNode" /> to deserialize from.</param>
        /// <returns>an instance of Commvault.Powershell.Models.ITestFailoverMonitorMachines.</returns>
        public static Commvault.Powershell.Models.ITestFailoverMonitorMachines FromJson(Commvault.Powershell.Runtime.Json.JsonNode node)
        {
            return node is Commvault.Powershell.Runtime.Json.JsonObject json ? new TestFailoverMonitorMachines(json) : null;
        }

        /// <summary>
        /// Deserializes a Commvault.Powershell.Runtime.Json.JsonObject into a new instance of <see cref="TestFailoverMonitorMachines" />.
        /// </summary>
        /// <param name="json">A Commvault.Powershell.Runtime.Json.JsonObject instance to deserialize from.</param>
        internal TestFailoverMonitorMachines(Commvault.Powershell.Runtime.Json.JsonObject json)
        {
            bool returnNow = false;
            BeforeFromJson(json, ref returnNow);
            if (returnNow)
            {
                return;
            }
            {_proxyClient = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonObject>("proxyClient"), out var __jsonProxyClient) ? Commvault.Powershell.Models.IdName.FromJson(__jsonProxyClient) : _proxyClient;}
            {_iPAddress = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonObject>("ipAddress"), out var __jsonIPAddress) ? Commvault.Powershell.Models.TestFailoverIPAddress.FromJson(__jsonIPAddress) : _iPAddress;}
            {_vMLocation = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonObject>("vmLocation"), out var __jsonVMLocation) ? Commvault.Powershell.Models.TestFailoverVMLocation.FromJson(__jsonVMLocation) : _vMLocation;}
            {_vM = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonObject>("vm"), out var __jsonVM) ? Commvault.Powershell.Models.TestFailoverVMInfo.FromJson(__jsonVM) : _vM;}
            {_creator = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonObject>("creator"), out var __jsonCreator) ? Commvault.Powershell.Models.IdNameGuid.FromJson(__jsonCreator) : _creator;}
            {_advancedProperties = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonObject>("advancedProperties"), out var __jsonAdvancedProperties) ? Commvault.Powershell.Models.TestFailoverAdvancedProp.FromJson(__jsonAdvancedProperties) : _advancedProperties;}
            {_entity = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonObject>("entity"), out var __jsonEntity) ? Commvault.Powershell.Models.IdName.FromJson(__jsonEntity) : _entity;}
            {_operatingSystem = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonString>("operatingSystem"), out var __jsonOperatingSystem) ? (string)__jsonOperatingSystem : (string)_operatingSystem;}
            {_userCapabilities = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("userCapabilities"), out var __jsonUserCapabilities) ? (long?)__jsonUserCapabilities : _userCapabilities;}
            {_numberOfDisks = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("numberOfDisks"), out var __jsonNumberOfDisks) ? (long?)__jsonNumberOfDisks : _numberOfDisks;}
            {_memory = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("memory"), out var __jsonMemory) ? (long?)__jsonMemory : _memory;}
            {_flags = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("flags"), out var __jsonFlags) ? (long?)__jsonFlags : _flags;}
            {_isVirtualLabGateway = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonBoolean>("isVirtualLabGateway"), out var __jsonIsVirtualLabGateway) ? (bool?)__jsonIsVirtualLabGateway : _isVirtualLabGateway;}
            {_vMAllocPolicyId = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("vmAllocPolicyId"), out var __jsonVMAllocPolicyId) ? (long?)__jsonVMAllocPolicyId : _vMAllocPolicyId;}
            {_numberOfCpUs = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("numberOfCPUs"), out var __jsonNumberOfCpUs) ? (long?)__jsonNumberOfCpUs : _numberOfCpUs;}
            {_vMState = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("vmState"), out var __jsonVMState) ? (long?)__jsonVMState : _vMState;}
            {_modifiedTime = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("modifiedTime"), out var __jsonModifiedTime) ? (long?)__jsonModifiedTime : _modifiedTime;}
            {_expirationTime = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("expirationTime"), out var __jsonExpirationTime) ? (long?)__jsonExpirationTime : _expirationTime;}
            {_creationTime = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("creationTime"), out var __jsonCreationTime) ? (long?)__jsonCreationTime : _creationTime;}
            {_lastPowerOnTime = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonNumber>("lastPowerOnTime"), out var __jsonLastPowerOnTime) ? (long?)__jsonLastPowerOnTime : _lastPowerOnTime;}
            {_instanceTypeEntity = If( json?.PropertyT<Commvault.Powershell.Runtime.Json.JsonString>("instanceTypeEntity"), out var __jsonInstanceTypeEntity) ? (string)__jsonInstanceTypeEntity : (string)_instanceTypeEntity;}
            AfterFromJson(json);
        }

        /// <summary>
        /// Serializes this instance of <see cref="TestFailoverMonitorMachines" /> into a <see cref="Commvault.Powershell.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Commvault.Powershell.Runtime.Json.JsonObject"/> container to serialize this object into. If the caller
        /// passes in <c>null</c>, a new instance will be created and returned to the caller.</param>
        /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="TestFailoverMonitorMachines" /> as a <see cref="Commvault.Powershell.Runtime.Json.JsonNode" />.
        /// </returns>
        public Commvault.Powershell.Runtime.Json.JsonNode ToJson(Commvault.Powershell.Runtime.Json.JsonObject container, Commvault.Powershell.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Commvault.Powershell.Runtime.Json.JsonObject();

            bool returnNow = false;
            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return container;
            }
            AddIf( null != this._proxyClient ? (Commvault.Powershell.Runtime.Json.JsonNode) this._proxyClient.ToJson(null,serializationMode) : null, "proxyClient" ,container.Add );
            AddIf( null != this._iPAddress ? (Commvault.Powershell.Runtime.Json.JsonNode) this._iPAddress.ToJson(null,serializationMode) : null, "ipAddress" ,container.Add );
            AddIf( null != this._vMLocation ? (Commvault.Powershell.Runtime.Json.JsonNode) this._vMLocation.ToJson(null,serializationMode) : null, "vmLocation" ,container.Add );
            AddIf( null != this._vM ? (Commvault.Powershell.Runtime.Json.JsonNode) this._vM.ToJson(null,serializationMode) : null, "vm" ,container.Add );
            AddIf( null != this._creator ? (Commvault.Powershell.Runtime.Json.JsonNode) this._creator.ToJson(null,serializationMode) : null, "creator" ,container.Add );
            AddIf( null != this._advancedProperties ? (Commvault.Powershell.Runtime.Json.JsonNode) this._advancedProperties.ToJson(null,serializationMode) : null, "advancedProperties" ,container.Add );
            AddIf( null != this._entity ? (Commvault.Powershell.Runtime.Json.JsonNode) this._entity.ToJson(null,serializationMode) : null, "entity" ,container.Add );
            AddIf( null != (((object)this._operatingSystem)?.ToString()) ? (Commvault.Powershell.Runtime.Json.JsonNode) new Commvault.Powershell.Runtime.Json.JsonString(this._operatingSystem.ToString()) : null, "operatingSystem" ,container.Add );
            AddIf( null != this._userCapabilities ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._userCapabilities) : null, "userCapabilities" ,container.Add );
            AddIf( null != this._numberOfDisks ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._numberOfDisks) : null, "numberOfDisks" ,container.Add );
            AddIf( null != this._memory ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._memory) : null, "memory" ,container.Add );
            AddIf( null != this._flags ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._flags) : null, "flags" ,container.Add );
            AddIf( null != this._isVirtualLabGateway ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonBoolean((bool)this._isVirtualLabGateway) : null, "isVirtualLabGateway" ,container.Add );
            AddIf( null != this._vMAllocPolicyId ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._vMAllocPolicyId) : null, "vmAllocPolicyId" ,container.Add );
            AddIf( null != this._numberOfCpUs ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._numberOfCpUs) : null, "numberOfCPUs" ,container.Add );
            AddIf( null != this._vMState ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._vMState) : null, "vmState" ,container.Add );
            AddIf( null != this._modifiedTime ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._modifiedTime) : null, "modifiedTime" ,container.Add );
            AddIf( null != this._expirationTime ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._expirationTime) : null, "expirationTime" ,container.Add );
            AddIf( null != this._creationTime ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._creationTime) : null, "creationTime" ,container.Add );
            AddIf( null != this._lastPowerOnTime ? (Commvault.Powershell.Runtime.Json.JsonNode)new Commvault.Powershell.Runtime.Json.JsonNumber((long)this._lastPowerOnTime) : null, "lastPowerOnTime" ,container.Add );
            AddIf( null != (((object)this._instanceTypeEntity)?.ToString()) ? (Commvault.Powershell.Runtime.Json.JsonNode) new Commvault.Powershell.Runtime.Json.JsonString(this._instanceTypeEntity.ToString()) : null, "instanceTypeEntity" ,container.Add );
            AfterToJson(ref container);
            return container;
        }
    }
}