@@ -65,6 +65,7 @@ public class Location
65
65
/// <summary>
66
66
/// Gets or sets the file system locations.
67
67
/// </summary>
68
+ [ JsonProperty ( PropertyName = "fileSystemLocations" ) ]
68
69
public FileSystemLocations fileSystemLocations { get ; set ; }
69
70
70
71
#endregion
@@ -80,12 +81,14 @@ public class FileSystemLocations
80
81
/// <summary>
81
82
/// Gets or sets the linux file type log paths.
82
83
/// </summary>
83
- public string [ ] linuxFileTypeLogPaths { get ; set ; }
84
+ [ JsonProperty ( PropertyName = "linuxFileTypeLogPaths" ) ]
85
+ public string [ ] LinuxFileTypeLogPaths { get ; set ; }
84
86
85
87
/// <summary>
86
88
/// Gets or sets the windows file type log paths.
87
89
/// </summary>
88
- public string [ ] windowsFileTypeLogPaths { get ; set ; }
90
+ [ JsonProperty ( PropertyName = "windowsFileTypeLogPaths" ) ]
91
+ public string [ ] WindowsFileTypeLogPaths { get ; set ; }
89
92
90
93
#endregion
91
94
}
@@ -100,7 +103,8 @@ public class RecordDelimiter
100
103
/// <summary>
101
104
/// Gets or sets the regex delimiter.
102
105
/// </summary>
103
- public RegexDelimiter regexDelimiter { get ; set ; }
106
+ [ JsonProperty ( PropertyName = "regexDelimiter" ) ]
107
+ public RegexDelimiter RegexDelimiter { get ; set ; }
104
108
105
109
#endregion
106
110
}
@@ -115,17 +119,20 @@ public class RegexDelimiter
115
119
/// <summary>
116
120
/// Gets or sets the match index.
117
121
/// </summary>
118
- public int matchIndex { get ; set ; }
122
+ [ JsonProperty ( PropertyName = "matchIndex" ) ]
123
+ public int MatchIndex { get ; set ; }
119
124
120
125
/// <summary>
121
126
/// Gets or sets the numberd group.
122
127
/// </summary>
123
- public string numberdGroup { get ; set ; }
128
+ [ JsonProperty ( PropertyName = "numberdGroup" ) ]
129
+ public string NumberdGroup { get ; set ; }
124
130
125
131
/// <summary>
126
132
/// Gets or sets the pattern.
127
133
/// </summary>
128
- public string pattern { get ; set ; }
134
+ [ JsonProperty ( PropertyName = "pattern" ) ]
135
+ public string Pattern { get ; set ; }
129
136
130
137
#endregion
131
138
}
@@ -140,12 +147,14 @@ public class CustomLogInput
140
147
/// <summary>
141
148
/// Gets or sets the location.
142
149
/// </summary>
143
- public Location location { get ; set ; }
150
+ [ JsonProperty ( PropertyName = "location" ) ]
151
+ public Location Location { get ; set ; }
144
152
145
153
/// <summary>
146
154
/// Gets or sets the record delimiter.
147
155
/// </summary>
148
- public RecordDelimiter recordDelimiter { get ; set ; }
156
+ [ JsonProperty ( PropertyName = "recordDelimiter" ) ]
157
+ public RecordDelimiter RecordDelimiter { get ; set ; }
149
158
150
159
#endregion
151
160
}
@@ -160,19 +169,28 @@ public class DateTimeExtraction
160
169
/// <summary>
161
170
/// Gets or sets the join string regex.
162
171
/// </summary>
163
- public string joinStringRegex { get ; set ; }
172
+ [ JsonProperty ( "joinStringRegex" ) ]
173
+ public string JoinStringRegex { get ; set ; }
174
+
175
+ /// <summary>
176
+ /// Gets or sets the regex string.
177
+ /// </summary>
178
+ [ JsonIgnore ]
179
+ public string Regex { get ; set ; }
164
180
165
181
/// <summary>
166
182
/// Gets or sets the regex.
167
183
/// </summary>
168
- [ CmdletParameterBreakingChange ( nameof ( regex ) , OldParamaterType = typeof ( string ) , NewParameterTypeName = nameof ( RegexDelimiter ) ) ]
184
+ [ CmdletParameterBreakingChange ( nameof ( Regex ) , OldParamaterType = typeof ( string ) , NewParameterTypeName = nameof ( RegexDelimiter ) ) ]
169
185
[ JsonConverter ( typeof ( RegexDelimiterJsonConverter ) ) ]
170
- public RegexDelimiter [ ] regex { get ; set ; }
186
+ [ JsonProperty ( "regex" ) ]
187
+ public RegexDelimiter [ ] RegexDelimiters { get ; set ; }
171
188
172
189
///<summary>
173
190
/// Gets or sets the FormatString
174
191
/// </summary>
175
- public string formatString { get ; set ; }
192
+ [ JsonProperty ( "formatString" ) ]
193
+ public string FormatString { get ; set ; }
176
194
177
195
#endregion
178
196
}
@@ -187,7 +205,8 @@ public class ExtractionProperties
187
205
/// <summary>
188
206
/// Gets or sets the date time extraction.
189
207
/// </summary>
190
- public DateTimeExtraction dateTimeExtraction { get ; set ; }
208
+ [ JsonProperty ( PropertyName = "dateTimeExtraction" ) ]
209
+ public DateTimeExtraction DateTimeExtraction { get ; set ; }
191
210
192
211
#endregion
193
212
}
@@ -202,21 +221,25 @@ public class CustomLogExtraction
202
221
/// <summary>
203
222
/// Gets or sets the extraction name.
204
223
/// </summary>
205
- public string extractionName { get ; set ; }
224
+ [ JsonProperty ( PropertyName = "extractionName" ) ]
225
+ public string ExtractionName { get ; set ; }
206
226
207
227
/// <summary>
208
228
/// Gets or sets the extraction properties.
209
229
/// </summary>
210
- public ExtractionProperties extractionProperties { get ; set ; }
230
+ [ JsonProperty ( PropertyName = "extractionProperties" ) ]
231
+ public ExtractionProperties ExtractionProperties { get ; set ; }
211
232
212
233
/// <summary>
213
234
/// Gets or sets the extraction type.
214
235
/// </summary>
215
- public string extractionType { get ; set ; }
236
+ [ JsonProperty ( PropertyName = "extractionType" ) ]
237
+ public string ExtractionType { get ; set ; }
216
238
217
239
#endregion
218
240
}
219
241
242
+ // This converter allows backward compatibility
220
243
public class RegexDelimiterJsonConverter : JsonConverter
221
244
{
222
245
public override object ReadJson ( JsonReader reader , Type objectType , object existingValue , JsonSerializer serializer )
@@ -227,11 +250,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
227
250
JToken token = JToken . Load ( reader ) ;
228
251
return token . ToObject < RegexDelimiter [ ] > ( ) ;
229
252
case JsonToken . String :
230
- // Allow input of just regex string for backward compatibility
231
- return new [ ] { new RegexDelimiter { matchIndex = 0 , pattern = ( string ) reader . Value } } ;
253
+ // Satisfy case in which user uses the old regex property in input
254
+ return new [ ] { new RegexDelimiter { MatchIndex = 0 , Pattern = ( string ) reader . Value } } ;
255
+ default :
256
+ throw new JsonSerializationException ( ) ;
232
257
}
233
-
234
- throw new JsonSerializationException ( ) ;
235
258
}
236
259
237
260
public override bool CanWrite => false ;
0 commit comments