ForwardingRule.fromJson constructor

ForwardingRule.fromJson(
  1. Object? j
)

Implementation

factory ForwardingRule.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ForwardingRule(
    iPAddress: switch (json['IPAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    iPProtocol: switch (json['IPProtocol']) {
      null => null,
      Object $1 => decodeString($1),
    },
    allPorts: switch (json['allPorts']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    allowGlobalAccess: switch (json['allowGlobalAccess']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    allowPscGlobalAccess: switch (json['allowPscGlobalAccess']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    attachedExtensions: switch (json['attachedExtensions']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) ForwardingRuleAttachedExtension.fromJson(i),
      ],
      _ => throw const FormatException('"attachedExtensions" is not a list'),
    },
    backendService: switch (json['backendService']) {
      null => null,
      Object $1 => decodeString($1),
    },
    baseForwardingRule: switch (json['baseForwardingRule']) {
      null => null,
      Object $1 => decodeString($1),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    externalManagedBackendBucketMigrationState:
        switch (json['externalManagedBackendBucketMigrationState']) {
          null => null,
          Object $1 => decodeString($1),
        },
    externalManagedBackendBucketMigrationTestingPercentage:
        switch (json['externalManagedBackendBucketMigrationTestingPercentage']) {
          null => null,
          Object $1 => decodeDouble($1),
        },
    fingerprint: switch (json['fingerprint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    ipCollection: switch (json['ipCollection']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipVersion: switch (json['ipVersion']) {
      null => null,
      Object $1 => decodeString($1),
    },
    isMirroringCollector: switch (json['isMirroringCollector']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    labelFingerprint: switch (json['labelFingerprint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    loadBalancingScheme: switch (json['loadBalancingScheme']) {
      null => null,
      Object $1 => decodeString($1),
    },
    metadataFilters: switch (json['metadataFilters']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) MetadataFilter.fromJson(i)],
      _ => throw const FormatException('"metadataFilters" is not a list'),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    network: switch (json['network']) {
      null => null,
      Object $1 => decodeString($1),
    },
    networkTier: switch (json['networkTier']) {
      null => null,
      Object $1 => decodeString($1),
    },
    noAutomateDnsZone: switch (json['noAutomateDnsZone']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    portRange: switch (json['portRange']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ports: switch (json['ports']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"ports" is not a list'),
    },
    pscConnectionId: switch (json['pscConnectionId']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    pscConnectionStatus: switch (json['pscConnectionStatus']) {
      null => null,
      Object $1 => decodeString($1),
    },
    region: switch (json['region']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLinkWithId: switch (json['selfLinkWithId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    serviceDirectoryRegistrations:
        switch (json['serviceDirectoryRegistrations']) {
          null => [],
          List<Object?> $1 => [
            for (final i in $1)
              ForwardingRuleServiceDirectoryRegistration.fromJson(i),
          ],
          _ => throw const FormatException(
            '"serviceDirectoryRegistrations" is not a list',
          ),
        },
    serviceLabel: switch (json['serviceLabel']) {
      null => null,
      Object $1 => decodeString($1),
    },
    serviceName: switch (json['serviceName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceIpRanges: switch (json['sourceIpRanges']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"sourceIpRanges" is not a list'),
    },
    subnetwork: switch (json['subnetwork']) {
      null => null,
      Object $1 => decodeString($1),
    },
    target: switch (json['target']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}