mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
49 lines
1.4 KiB
Dart
49 lines
1.4 KiB
Dart
import 'package:toolbox/data/model/server/private_key_info.dart';
|
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
|
import 'package:toolbox/data/model/server/snippet.dart';
|
|
|
|
class Backup {
|
|
// backup format version
|
|
final int version;
|
|
final String date;
|
|
final List<ServerPrivateInfo> spis;
|
|
final List<Snippet> snippets;
|
|
final List<PrivateKeyInfo> keys;
|
|
final Map<String, dynamic> dockerHosts;
|
|
final Map<String, dynamic> settings;
|
|
|
|
Backup({
|
|
required this.version,
|
|
required this.date,
|
|
required this.spis,
|
|
required this.snippets,
|
|
required this.keys,
|
|
required this.dockerHosts,
|
|
required this.settings,
|
|
});
|
|
|
|
Backup.fromJson(Map<String, dynamic> json)
|
|
: version = json['version'] as int,
|
|
date = json['date'],
|
|
spis = (json['spis'] as List)
|
|
.map((e) => ServerPrivateInfo.fromJson(e))
|
|
.toList(),
|
|
snippets =
|
|
(json['snippets'] as List).map((e) => Snippet.fromJson(e)).toList(),
|
|
keys = (json['keys'] as List)
|
|
.map((e) => PrivateKeyInfo.fromJson(e))
|
|
.toList(),
|
|
dockerHosts = json['dockerHosts'] ?? {},
|
|
settings = json['settings'] ?? {};
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'version': version,
|
|
'date': date,
|
|
'spis': spis,
|
|
'snippets': snippets,
|
|
'keys': keys,
|
|
'dockerHosts': dockerHosts,
|
|
'settings': settings,
|
|
};
|
|
}
|