Exemple #1
0
        internal static VirtualWanSecurityProvider DeserializeVirtualWanSecurityProvider(JsonElement element)
        {
            Optional <string> name = default;
            Optional <string> url  = default;
            Optional <VirtualWanSecurityProviderType> type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    url = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new VirtualWanSecurityProviderType(property.Value.GetString());
                    continue;
                }
            }
            return(new VirtualWanSecurityProvider(name.Value, url.Value, Optional.ToNullable(type)));
        }
Exemple #2
0
        internal static VirtualWanSecurityProvider DeserializeVirtualWanSecurityProvider(JsonElement element)
        {
            string name = default;
            string url  = default;
            VirtualWanSecurityProviderType?type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    url = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = new VirtualWanSecurityProviderType(property.Value.GetString());
                    continue;
                }
            }
            return(new VirtualWanSecurityProvider(name, url, type));
        }