LogBucket.fromJson constructor

LogBucket.fromJson(
  1. Object? j
)

Implementation

factory LogBucket.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return LogBucket(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => Timestamp.fromJson($1),
    },
    retentionDays: switch (json['retentionDays']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    locked: switch (json['locked']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    lifecycleState: switch (json['lifecycleState']) {
      null => LifecycleState.$default,
      Object $1 => LifecycleState.fromJson($1),
    },
    analyticsEnabled: switch (json['analyticsEnabled']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    restrictedFields: switch (json['restrictedFields']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"restrictedFields" is not a list'),
    },
    indexConfigs: switch (json['indexConfigs']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) IndexConfig.fromJson(i)],
      _ => throw const FormatException('"indexConfigs" is not a list'),
    },
    cmekSettings: switch (json['cmekSettings']) {
      null => null,
      Object $1 => CmekSettings.fromJson($1),
    },
  );
}