FirewallPolicyRule.fromJson constructor

FirewallPolicyRule.fromJson(
  1. Object? j
)

Implementation

factory FirewallPolicyRule.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return FirewallPolicyRule(
    action: switch (json['action']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    direction: switch (json['direction']) {
      null => null,
      Object $1 => decodeString($1),
    },
    disabled: switch (json['disabled']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    enableLogging: switch (json['enableLogging']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    match: switch (json['match']) {
      null => null,
      Object $1 => FirewallPolicyRuleMatcher.fromJson($1),
    },
    priority: switch (json['priority']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    ruleName: switch (json['ruleName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ruleTupleCount: switch (json['ruleTupleCount']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    securityProfileGroup: switch (json['securityProfileGroup']) {
      null => null,
      Object $1 => decodeString($1),
    },
    targetForwardingRules: switch (json['targetForwardingRules']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"targetForwardingRules" is not a list',
      ),
    },
    targetResources: switch (json['targetResources']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"targetResources" is not a list'),
    },
    targetSecureTags: switch (json['targetSecureTags']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) FirewallPolicyRuleSecureTag.fromJson(i),
      ],
      _ => throw const FormatException('"targetSecureTags" is not a list'),
    },
    targetServiceAccounts: switch (json['targetServiceAccounts']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"targetServiceAccounts" is not a list',
      ),
    },
    targetType: switch (json['targetType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    tlsInspect: switch (json['tlsInspect']) {
      null => null,
      Object $1 => decodeBool($1),
    },
  );
}