Exemple #1
0
        /// <summary>
        /// Serializes this instance of <see cref="Resource" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="Resource" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._id.ToString()) : null, "id", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._name.ToString()) : null, "name", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._type.ToString()) : null, "type", container.Add);
            }
            AddIf(null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._location.ToString()) : null, "location", container.Add);
            AddIf(null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._tag.ToJson(null, serializationMode) : null, "tags", container.Add);
            AfterToJson(ref container);
            return(container);
        }
        /// <summary>
        /// Serializes this instance of <see cref="RegionalReplicationStatus" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="RegionalReplicationStatus" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._region)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._region.ToString()) : null, "region", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._state.ToString()) : null, "state", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._detail)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._detail.ToString()) : null, "details", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != this._progress ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNumber((int)this._progress) : null, "progress", container.Add);
            }
            AfterToJson(ref container);
            return(container);
        }
Exemple #3
0
        /// <summary>
        /// Serializes this instance of <see cref="ReplicationStatus" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="ReplicationStatus" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._aggregatedState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._aggregatedState.ToString()) : null, "aggregatedState", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                if (null != this._summary)
                {
                    var __w = new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.XNodeArray();
                    foreach (var __x in this._summary)
                    {
                        AddIf(__x?.ToJson(null, serializationMode), __w.Add);
                    }
                    container.Add("summary", __w);
                }
            }
            AfterToJson(ref container);
            return(container);
        }
        /// <summary>
        /// Serializes this instance of <see cref="GalleryArtifactPublishingProfileBase" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode"
        /// />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="GalleryArtifactPublishingProfileBase" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            if (null != this._targetRegion)
            {
                var __w = new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.XNodeArray();
                foreach (var __x in this._targetRegion)
                {
                    AddIf(__x?.ToJson(null, serializationMode), __w.Add);
                }
                container.Add("targetRegions", __w);
            }
            AddIf(null != this._replicaCount ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNumber((int)this._replicaCount) : null, "replicaCount", container.Add);
            AddIf(null != this._excludeFromLatest ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonBoolean((bool)this._excludeFromLatest) : null, "excludeFromLatest", container.Add);
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != this._publishedDate ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._publishedDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", global::System.Globalization.CultureInfo.InvariantCulture)) : null, "publishedDate", container.Add);
            }
            AddIf(null != this._endOfLifeDate ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._endOfLifeDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endOfLifeDate", container.Add);
            AddIf(null != (((object)this._storageAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._storageAccountType.ToString()) : null, "storageAccountType", container.Add);
            AddIf(null != (((object)this._replicationMode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._replicationMode.ToString()) : null, "replicationMode", container.Add);
            AfterToJson(ref container);
            return(container);
        }
Exemple #5
0
        /// <summary>
        /// Serializes this instance of <see cref="VirtualMachineRunCommandProperties" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode"
        /// />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="VirtualMachineRunCommandProperties" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            AddIf(null != this._source ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._source.ToJson(null, serializationMode) : null, "source", container.Add);
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != this._instanceView ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._instanceView.ToJson(null, serializationMode) : null, "instanceView", container.Add);
            }
            if (null != this._parameter)
            {
                var __w = new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.XNodeArray();
                foreach (var __x in this._parameter)
                {
                    AddIf(__x?.ToJson(null, serializationMode), __w.Add);
                }
                container.Add("parameters", __w);
            }
            if (null != this._protectedParameter)
            {
                var __r = new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.XNodeArray();
                foreach (var __s in this._protectedParameter)
                {
                    AddIf(__s?.ToJson(null, serializationMode), __r.Add);
                }
                container.Add("protectedParameters", __r);
            }
            AddIf(null != this._asyncExecution ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonBoolean((bool)this._asyncExecution) : null, "asyncExecution", container.Add);
            AddIf(null != (((object)this._runAsUser)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._runAsUser.ToString()) : null, "runAsUser", container.Add);
            AddIf(null != (((object)this._runAsPassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._runAsPassword.ToString()) : null, "runAsPassword", container.Add);
            AddIf(null != this._timeoutInSecond ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNumber((int)this._timeoutInSecond) : null, "timeoutInSeconds", container.Add);
            AddIf(null != (((object)this._outputBlobUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._outputBlobUri.ToString()) : null, "outputBlobUri", container.Add);
            AddIf(null != (((object)this._errorBlobUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._errorBlobUri.ToString()) : null, "errorBlobUri", container.Add);
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState", container.Add);
            }
            AfterToJson(ref container);
            return(container);
        }
        /// <summary>
        /// Serializes this instance of <see cref="GalleryApplicationVersionProperties" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode"
        /// />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="GalleryApplicationVersionProperties" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            AddIf(null != this._publishingProfile ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._publishingProfile.ToJson(null, serializationMode) : null, "publishingProfile", container.Add);
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != this._replicationStatus ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._replicationStatus.ToJson(null, serializationMode) : null, "replicationStatus", container.Add);
            }
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState", container.Add);
            }
            AfterToJson(ref container);
            return(container);
        }
        /// <summary>
        /// Serializes this instance of <see cref="GalleryDiskImage" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="GalleryDiskImage" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            AddIf(null != this._source ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._source.ToJson(null, serializationMode) : null, "source", container.Add);
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != this._sizeInGb ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNumber((int)this._sizeInGb) : null, "sizeInGB", container.Add);
            }
            AddIf(null != (((object)this._hostCaching)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._hostCaching.ToString()) : null, "hostCaching", container.Add);
            AfterToJson(ref container);
            return(container);
        }
Exemple #8
0
        /// <summary>
        /// Serializes this instance of <see cref="GalleryProperties" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="GalleryProperties" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            AddIf(null != this._identifier ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._identifier.ToJson(null, serializationMode) : null, "identifier", container.Add);
            AddIf(null != this._sharingProfile ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._sharingProfile.ToJson(null, serializationMode) : null, "sharingProfile", container.Add);
            AddIf(null != this._softDeletePolicy ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._softDeletePolicy.ToJson(null, serializationMode) : null, "softDeletePolicy", container.Add);
            AddIf(null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._description.ToString()) : null, "description", container.Add);
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState", container.Add);
            }
            AfterToJson(ref container);
            return(container);
        }
Exemple #9
0
        /// <summary>
        /// Serializes this instance of <see cref="GalleryImageProperties" /> into a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.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="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="GalleryImageProperties" /> as a <see cref="Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode" />.
        /// </returns>
        public Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode serializationMode)
        {
            container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            AddIf(null != this._identifier ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._identifier.ToJson(null, serializationMode) : null, "identifier", container.Add);
            AddIf(null != this._recommended ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._recommended.ToJson(null, serializationMode) : null, "recommended", container.Add);
            AddIf(null != this._disallowed ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._disallowed.ToJson(null, serializationMode) : null, "disallowed", container.Add);
            AddIf(null != this._purchasePlan ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) this._purchasePlan.ToJson(null, serializationMode) : null, "purchasePlan", container.Add);
            AddIf(null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._description.ToString()) : null, "description", container.Add);
            AddIf(null != (((object)this._eula)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._eula.ToString()) : null, "eula", container.Add);
            AddIf(null != (((object)this._privacyStatementUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._privacyStatementUri.ToString()) : null, "privacyStatementUri", container.Add);
            AddIf(null != (((object)this._releaseNoteUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._releaseNoteUri.ToString()) : null, "releaseNoteUri", container.Add);
            AddIf(null != (((object)this._oSType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._oSType.ToString()) : null, "osType", container.Add);
            AddIf(null != (((object)this._oSState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._oSState.ToString()) : null, "osState", container.Add);
            AddIf(null != (((object)this._hyperVGeneration)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._hyperVGeneration.ToString()) : null, "hyperVGeneration", container.Add);
            AddIf(null != this._endOfLifeDate ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._endOfLifeDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK", global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endOfLifeDate", container.Add);
            if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.SerializationMode.IncludeReadOnly))
            {
                AddIf(null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState", container.Add);
            }
            if (null != this._feature)
            {
                var __w = new Microsoft.Azure.PowerShell.Cmdlets.Compute.Runtime.Json.XNodeArray();
                foreach (var __x in this._feature)
                {
                    AddIf(__x?.ToJson(null, serializationMode), __w.Add);
                }
                container.Add("features", __w);
            }
            AfterToJson(ref container);
            return(container);
        }