internal static ProtocolCustomSettingsFormat DeserializeProtocolCustomSettingsFormat(JsonElement element)
        {
            Optional <DdosCustomPolicyProtocol> protocol = default;
            Optional <string> triggerRateOverride        = default;
            Optional <string> sourceRateOverride         = default;
            Optional <DdosCustomPolicyTriggerSensitivityOverride> triggerSensitivityOverride = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("protocol"))
                {
                    protocol = new DdosCustomPolicyProtocol(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("triggerRateOverride"))
                {
                    triggerRateOverride = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceRateOverride"))
                {
                    sourceRateOverride = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("triggerSensitivityOverride"))
                {
                    triggerSensitivityOverride = new DdosCustomPolicyTriggerSensitivityOverride(property.Value.GetString());
                    continue;
                }
            }
            return(new ProtocolCustomSettingsFormat(Optional.ToNullable(protocol), triggerRateOverride.Value, sourceRateOverride.Value, Optional.ToNullable(triggerSensitivityOverride)));
        }
示例#2
0
        internal static ProtocolCustomSettingsFormat DeserializeProtocolCustomSettingsFormat(JsonElement element)
        {
            DdosCustomPolicyProtocol?protocol = default;
            string triggerRateOverride        = default;
            string sourceRateOverride         = default;
            DdosCustomPolicyTriggerSensitivityOverride?triggerSensitivityOverride = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("protocol"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    protocol = new DdosCustomPolicyProtocol(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("triggerRateOverride"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    triggerRateOverride = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sourceRateOverride"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    sourceRateOverride = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("triggerSensitivityOverride"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    triggerSensitivityOverride = new DdosCustomPolicyTriggerSensitivityOverride(property.Value.GetString());
                    continue;
                }
            }
            return(new ProtocolCustomSettingsFormat(protocol, triggerRateOverride, sourceRateOverride, triggerSensitivityOverride));
        }