Пример #1
0
        /// <summary>
        /// Serializes this instance of <see cref="VmDisk" /> into a <see cref="Carbon.Json.JsonNode" />.
        /// </summary>
        /// <param name="container">The <see cref="Carbon.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.Rest.ClientRuntime.SerializationMode"/>.</param>
        /// <returns>
        /// a serialized instance of <see cref="VmDisk" /> as a <see cref="Carbon.Json.JsonNode" />.
        /// </returns>
        public Carbon.Json.JsonNode ToJson(Carbon.Json.JsonObject container, Microsoft.Rest.ClientRuntime.SerializationMode serializationMode)
        {
            container = container ?? new Carbon.Json.JsonObject();

            bool returnNow = false;

            BeforeToJson(ref container, ref returnNow);
            if (returnNow)
            {
                return(container);
            }
            AddIf(null != DataSourceReference ? (Carbon.Json.JsonNode)DataSourceReference.ToJson(null) : null, "data_source_reference", container.Add);
            AddIf(null != DeviceProperties ? (Carbon.Json.JsonNode)DeviceProperties.ToJson(null) : null, "device_properties", container.Add);
            AddIf(null != DiskSizeBytes ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((long)DiskSizeBytes) : null, "disk_size_bytes", container.Add);
            AddIf(null != DiskSizeMib ? (Carbon.Json.JsonNode) new Carbon.Json.JsonNumber((int)DiskSizeMib) : null, "disk_size_mib", container.Add);
            AddIf(null != Uuid ? (Carbon.Json.JsonNode) new Carbon.Json.JsonString(Uuid) : null, "uuid", container.Add);
            AddIf(null != VolumeGroupReference ? (Carbon.Json.JsonNode)VolumeGroupReference.ToJson(null) : null, "volume_group_reference", container.Add);
            AfterToJson(ref container);
            return(container);
        }