Secret.fromJson constructor

Secret.fromJson(
  1. Object? j
)

Implementation

factory Secret.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Secret(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    replication: switch (json['replication']) {
      null => null,
      Object $1 => Replication.fromJson($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => Timestamp.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'),
    },
    topics: switch (json['topics']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Topic.fromJson(i)],
      _ => throw const FormatException('"topics" is not a list'),
    },
    expireTime: switch (json['expireTime']) {
      null => null,
      Object $1 => Timestamp.fromJson($1),
    },
    ttl: switch (json['ttl']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    etag: switch (json['etag']) {
      null => '',
      Object $1 => decodeString($1),
    },
    rotation: switch (json['rotation']) {
      null => null,
      Object $1 => Rotation.fromJson($1),
    },
    versionAliases: switch (json['versionAliases']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries) decodeString(e.key): decodeInt64(e.value),
      },
      _ => throw const FormatException('"versionAliases" is not an object'),
    },
    annotations: switch (json['annotations']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"annotations" is not an object'),
    },
    versionDestroyTtl: switch (json['versionDestroyTtl']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    customerManagedEncryption: switch (json['customerManagedEncryption']) {
      null => null,
      Object $1 => CustomerManagedEncryption.fromJson($1),
    },
    tags: switch (json['tags']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"tags" is not an object'),
    },
  );
}