FirewallPolicy.fromJson constructor

FirewallPolicy.fromJson(
  1. Object? j
)

Implementation

factory FirewallPolicy.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return FirewallPolicy(
    associations: switch (json['associations']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) FirewallPolicyAssociation.fromJson(i),
      ],
      _ => throw const FormatException('"associations" is not a list'),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    fingerprint: switch (json['fingerprint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    packetMirroringRules: switch (json['packetMirroringRules']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) FirewallPolicyRule.fromJson(i),
      ],
      _ => throw const FormatException(
        '"packetMirroringRules" is not a list',
      ),
    },
    parent: switch (json['parent']) {
      null => null,
      Object $1 => decodeString($1),
    },
    policyType: switch (json['policyType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    region: switch (json['region']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ruleTupleCount: switch (json['ruleTupleCount']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    rules: switch (json['rules']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) FirewallPolicyRule.fromJson(i),
      ],
      _ => throw const FormatException('"rules" is not a list'),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLinkWithId: switch (json['selfLinkWithId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    shortName: switch (json['shortName']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}