WriteLogEntriesRequest.fromJson constructor

WriteLogEntriesRequest.fromJson(
  1. Object? j
)

Implementation

factory WriteLogEntriesRequest.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return WriteLogEntriesRequest(
    logName: switch (json['logName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    resource: switch (json['resource']) {
      null => null,
      Object $1 => MonitoredResource.fromJson($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'),
    },
    entries: switch (json['entries']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) LogEntry.fromJson(i)],
      _ => throw const FormatException('"entries" is not a list'),
    },
    partialSuccess: switch (json['partialSuccess']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    dryRun: switch (json['dryRun']) {
      null => false,
      Object $1 => decodeBool($1),
    },
  );
}