internal static ApplicationGatewayCustomError DeserializeApplicationGatewayCustomError(JsonElement element)
        {
            Optional <ApplicationGatewayCustomErrorStatusCode> statusCode = default;
            Optional <string> customErrorPageUrl = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("statusCode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    statusCode = new ApplicationGatewayCustomErrorStatusCode(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("customErrorPageUrl"))
                {
                    customErrorPageUrl = property.Value.GetString();
                    continue;
                }
            }
            return(new ApplicationGatewayCustomError(Optional.ToNullable(statusCode), customErrorPageUrl.Value));
        }
Exemple #2
0
        internal static ApplicationGatewayCustomError DeserializeApplicationGatewayCustomError(JsonElement element)
        {
            ApplicationGatewayCustomErrorStatusCode?statusCode = default;
            string customErrorPageUrl = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("statusCode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    statusCode = new ApplicationGatewayCustomErrorStatusCode(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("customErrorPageUrl"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    customErrorPageUrl = property.Value.GetString();
                    continue;
                }
            }
            return(new ApplicationGatewayCustomError(statusCode, customErrorPageUrl));
        }