BackendServiceCdnPolicy.fromJson constructor

BackendServiceCdnPolicy.fromJson(
  1. Object? j
)

Implementation

factory BackendServiceCdnPolicy.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return BackendServiceCdnPolicy(
    bypassCacheOnRequestHeaders:
        switch (json['bypassCacheOnRequestHeaders']) {
          null => [],
          List<Object?> $1 => [
            for (final i in $1)
              BackendServiceCdnPolicyBypassCacheOnRequestHeader.fromJson(i),
          ],
          _ => throw const FormatException(
            '"bypassCacheOnRequestHeaders" is not a list',
          ),
        },
    cacheKeyPolicy: switch (json['cacheKeyPolicy']) {
      null => null,
      Object $1 => CacheKeyPolicy.fromJson($1),
    },
    cacheMode: switch (json['cacheMode']) {
      null => null,
      Object $1 => decodeString($1),
    },
    clientTtl: switch (json['clientTtl']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    defaultTtl: switch (json['defaultTtl']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    maxTtl: switch (json['maxTtl']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    negativeCaching: switch (json['negativeCaching']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    negativeCachingPolicy: switch (json['negativeCachingPolicy']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          BackendServiceCdnPolicyNegativeCachingPolicy.fromJson(i),
      ],
      _ => throw const FormatException(
        '"negativeCachingPolicy" is not a list',
      ),
    },
    requestCoalescing: switch (json['requestCoalescing']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    serveWhileStale: switch (json['serveWhileStale']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    signedUrlCacheMaxAgeSec: switch (json['signedUrlCacheMaxAgeSec']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    signedUrlKeyNames: switch (json['signedUrlKeyNames']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"signedUrlKeyNames" is not a list'),
    },
  );
}