SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig.fromJson constructor

SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig.fromJson(
  1. Object? j
)

Implementation

factory SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig.fromJson(
  Object? j,
) {
  final json = j as Map<String, Object?>;
  return SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig(
    enable: switch (json['enable']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    ruleVisibility: switch (json['ruleVisibility']) {
      null => null,
      Object $1 => decodeString($1),
    },
    thresholdConfigs: switch (json['thresholdConfigs']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfig.fromJson(
            i,
          ),
      ],
      _ => throw const FormatException('"thresholdConfigs" is not a list'),
    },
  );
}