internal static VirtualNetworkUsage DeserializeVirtualNetworkUsage(JsonElement element)
        {
            double?currentValue          = default;
            string id                    = default;
            double?limit                 = default;
            VirtualNetworkUsageName name = default;
            string unit                  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("currentValue"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    currentValue = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("limit"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    limit = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = VirtualNetworkUsageName.DeserializeVirtualNetworkUsageName(property.Value);
                    continue;
                }
                if (property.NameEquals("unit"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    unit = property.Value.GetString();
                    continue;
                }
            }
            return(new VirtualNetworkUsage(currentValue, id, limit, name, unit));
        }
Ejemplo n.º 2
0
        internal static VirtualNetworkUsage DeserializeVirtualNetworkUsage(JsonElement element)
        {
            Optional <double> currentValue          = default;
            Optional <string> id                    = default;
            Optional <double> limit                 = default;
            Optional <VirtualNetworkUsageName> name = default;
            Optional <string> unit                  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("currentValue"))
                {
                    currentValue = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("limit"))
                {
                    limit = property.Value.GetDouble();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = VirtualNetworkUsageName.DeserializeVirtualNetworkUsageName(property.Value);
                    continue;
                }
                if (property.NameEquals("unit"))
                {
                    unit = property.Value.GetString();
                    continue;
                }
            }
            return(new VirtualNetworkUsage(Optional.ToNullable(currentValue), id.Value, Optional.ToNullable(limit), name.Value, unit.Value));
        }