This repository was archived by the owner on Oct 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathDecodeConfiguration.swift
152 lines (147 loc) · 6.06 KB
/
DecodeConfiguration.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//
// DecodeConfiguration.swift
// RsyncOSX
//
// Created by Thomas Evensen on 17/10/2020.
// Copyright © 2020 Thomas Evensen. All rights reserved.
//
// Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
import Foundation
struct DecodeConfiguration: Codable {
let backupID: String?
let dateRun: String?
let haltshelltasksonerror: Int?
let hiddenID: Int?
let localCatalog: String?
let offsiteCatalog: String?
let offsiteServer: String?
let offsiteUsername: String?
let parameter1: String?
let parameter10: String?
let parameter11: String?
let parameter12: String?
let parameter13: String?
let parameter14: String?
let parameter2: String?
let parameter3: String?
let parameter4: String?
let parameter5: String?
let parameter6: String?
let parameter8: String?
let parameter9: String?
let rsyncdaemon: Int?
let sshkeypathandidentityfile: String?
let sshport: Int?
let task: String?
let snapdayoffweek: String?
let snaplast: Int?
let executepretask: Int?
let pretask: String?
let executeposttask: Int?
let posttask: String?
let snapshotnum: Int?
enum CodingKeys: String, CodingKey {
case backupID
case dateRun
case haltshelltasksonerror
case hiddenID
case localCatalog
case offsiteCatalog
case offsiteServer
case offsiteUsername
case parameter1
case parameter10
case parameter11
case parameter12
case parameter13
case parameter14
case parameter2
case parameter3
case parameter4
case parameter5
case parameter6
case parameter8
case parameter9
case rsyncdaemon
case sshkeypathandidentityfile
case sshport
case task
case snapdayoffweek
case snaplast
case executepretask
case pretask
case executeposttask
case posttask
case snapshotnum
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
backupID = try values.decodeIfPresent(String.self, forKey: .backupID)
dateRun = try values.decodeIfPresent(String.self, forKey: .dateRun)
haltshelltasksonerror = try values.decodeIfPresent(Int.self, forKey: .haltshelltasksonerror)
hiddenID = try values.decodeIfPresent(Int.self, forKey: .hiddenID)
localCatalog = try values.decodeIfPresent(String.self, forKey: .localCatalog)
offsiteCatalog = try values.decodeIfPresent(String.self, forKey: .offsiteCatalog)
offsiteServer = try values.decodeIfPresent(String.self, forKey: .offsiteServer)
offsiteUsername = try values.decodeIfPresent(String.self, forKey: .offsiteUsername)
parameter1 = try values.decodeIfPresent(String.self, forKey: .parameter1)
parameter10 = try values.decodeIfPresent(String.self, forKey: .parameter10)
parameter11 = try values.decodeIfPresent(String.self, forKey: .parameter11)
parameter12 = try values.decodeIfPresent(String.self, forKey: .parameter12)
parameter13 = try values.decodeIfPresent(String.self, forKey: .parameter13)
parameter14 = try values.decodeIfPresent(String.self, forKey: .parameter14)
parameter2 = try values.decodeIfPresent(String.self, forKey: .parameter2)
parameter3 = try values.decodeIfPresent(String.self, forKey: .parameter3)
parameter4 = try values.decodeIfPresent(String.self, forKey: .parameter4)
parameter5 = try values.decodeIfPresent(String.self, forKey: .parameter5)
parameter6 = try values.decodeIfPresent(String.self, forKey: .parameter6)
parameter8 = try values.decodeIfPresent(String.self, forKey: .parameter8)
parameter9 = try values.decodeIfPresent(String.self, forKey: .parameter9)
rsyncdaemon = try values.decodeIfPresent(Int.self, forKey: .rsyncdaemon)
sshkeypathandidentityfile = try values.decodeIfPresent(String.self, forKey: .sshkeypathandidentityfile)
sshport = try values.decodeIfPresent(Int.self, forKey: .sshport)
task = try values.decodeIfPresent(String.self, forKey: .task)
snapdayoffweek = try values.decodeIfPresent(String.self, forKey: .snapdayoffweek)
snaplast = try values.decodeIfPresent(Int.self, forKey: .snaplast)
executepretask = try values.decodeIfPresent(Int.self, forKey: .executepretask)
pretask = try values.decodeIfPresent(String.self, forKey: .pretask)
executeposttask = try values.decodeIfPresent(Int.self, forKey: .executeposttask)
posttask = try values.decodeIfPresent(String.self, forKey: .posttask)
snapshotnum = try values.decodeIfPresent(Int.self, forKey: .snapshotnum)
}
// This init is used in WriteConfigurationJSON
init(_ data: Configuration) {
backupID = data.backupID
dateRun = data.dateRun
haltshelltasksonerror = data.haltshelltasksonerror
hiddenID = data.hiddenID
localCatalog = data.localCatalog
offsiteCatalog = data.offsiteCatalog
offsiteServer = data.offsiteServer
offsiteUsername = data.offsiteUsername
parameter1 = data.parameter1
parameter10 = data.parameter10
parameter11 = data.parameter11
parameter12 = data.parameter12
parameter13 = data.parameter13
parameter14 = data.parameter14
parameter2 = data.parameter2
parameter3 = data.parameter3
parameter4 = data.parameter4
parameter5 = data.parameter5
parameter6 = data.parameter6
parameter8 = data.parameter8
parameter9 = data.parameter9
rsyncdaemon = data.rsyncdaemon
sshkeypathandidentityfile = data.sshkeypathandidentityfile
sshport = data.sshport
task = data.task
snapdayoffweek = data.snapdayoffweek
snaplast = data.snaplast
executepretask = data.executepretask
pretask = data.pretask
executeposttask = data.executeposttask
posttask = data.posttask
snapshotnum = data.snapshotnum
}
}