forked from influxdata/influxdb-client-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTelegrafsApi.cs
643 lines (558 loc) · 25.5 KB
/
TelegrafsApi.cs
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using InfluxDB.Client.Api.Domain;
using InfluxDB.Client.Api.Service;
using InfluxDB.Client.Core;
namespace InfluxDB.Client
{
/// <summary>
/// The client of the InfluxDB 2.0 that implement Telegrafs HTTP API endpoint.
/// </summary>
public class TelegrafsApi
{
private readonly TelegrafsService _service;
protected internal TelegrafsApi(TelegrafsService service)
{
Arguments.CheckNotNull(service, nameof(service));
_service = service;
}
/// <summary>
/// Create a telegraf config.
/// </summary>
/// <param name="name">Telegraf Configuration Name</param>
/// <param name="description">Telegraf Configuration Description</param>
/// <param name="org">The organization that owns this config</param>
/// <param name="plugins">The telegraf plugins config</param>
/// <returns>Telegraf config created</returns>
public async Task<Telegraf> CreateTelegrafAsync(string name, string description, Organization org,
List<TelegrafPlugin> plugins)
{
return await CreateTelegrafAsync(name, description, org, CreateAgentConfiguration(), plugins);
}
/// <summary>
/// Create a telegraf config.
/// </summary>
/// <param name="name">Telegraf Configuration Name</param>
/// <param name="description">Telegraf Configuration Description</param>
/// <param name="org">The organization that owns this config</param>
/// <param name="agentConfiguration">The telegraf agent config</param>
/// <param name="plugins">The telegraf plugins config</param>
/// <returns>Telegraf config created</returns>
public async Task<Telegraf> CreateTelegrafAsync(string name, string description, Organization org,
Dictionary<string, object> agentConfiguration, List<TelegrafPlugin> plugins)
{
return await CreateTelegrafAsync(name, description, org.Id, agentConfiguration, plugins);
}
/// <summary>
/// Create a telegraf config.
/// </summary>
/// <param name="name">Telegraf Configuration Name</param>
/// <param name="description">Telegraf Configuration Description</param>
/// <param name="orgId">The organization that owns this config</param>
/// <param name="plugins">The telegraf plugins config</param>
/// <returns>Telegraf config created</returns>
public async Task<Telegraf> CreateTelegrafAsync(string name, string description, string orgId,
List<TelegrafPlugin> plugins)
{
return await CreateTelegrafAsync(name, description, orgId, CreateAgentConfiguration(), plugins);
}
/// <summary>
/// Create a telegraf config.
/// </summary>
/// <param name="name">Telegraf Configuration Name</param>
/// <param name="description">Telegraf Configuration Description</param>
/// <param name="orgId">The organization that owns this config</param>
/// <param name="agentConfiguration">The telegraf agent config</param>
/// <param name="plugins">The telegraf plugins config</param>
/// <returns>Telegraf config created</returns>
public async Task<Telegraf> CreateTelegrafAsync(string name, string description, string orgId,
Dictionary<string, object> agentConfiguration, List<TelegrafPlugin> plugins)
{
var config = new StringBuilder();
// append agent configuration
config.Append("[agent]").Append("\n");
foreach (var pair in agentConfiguration)
{
AppendConfiguration(config, pair.Key, pair.Value);
}
config.Append("\n");
// append plugins configuration
foreach (var plugin in plugins)
{
if (!string.IsNullOrEmpty(plugin.Description))
{
config.Append("#").Append(plugin.Description).Append("\n");
}
config
.Append("[[")
.Append(plugin.Type.ToString().ToLower())
.Append(".")
.Append(plugin.Name)
.Append("]]")
.Append("\n");
foreach (var pair in plugin.Config)
{
AppendConfiguration(config, pair.Key, pair.Value);
}
config.Append("\n");
}
var request = new TelegrafRequest(name: name, description: description, orgID: orgId,
config: config.ToString());
return await CreateTelegrafAsync(request);
}
/// <summary>
/// Create a telegraf config.
/// </summary>
/// <param name="name">Telegraf Configuration Name</param>
/// <param name="description">Telegraf Configuration Description</param>
/// <param name="org">The organization that owns this config</param>
/// <param name="config">ConfigTOML contains the raw toml config</param>
/// <param name="metadata">Metadata for the config</param>
/// <returns>Telegraf config created</returns>
public async Task<Telegraf> CreateTelegrafAsync(string name, string description, Organization org,
string config, TelegrafRequestMetadata metadata)
{
return await CreateTelegrafAsync(name, description, org.Id, config, metadata);
}
/// <summary>
/// Create a telegraf config.
/// </summary>
/// <param name="name">Telegraf Configuration Name</param>
/// <param name="description">Telegraf Configuration Description</param>
/// <param name="orgId">The organization that owns this config</param>
/// <param name="config">ConfigTOML contains the raw toml config</param>
/// <param name="metadata">Metadata for the config</param>
/// <returns>Telegraf config created</returns>
public async Task<Telegraf> CreateTelegrafAsync(string name, string description, string orgId,
string config, TelegrafRequestMetadata metadata)
{
var request = new TelegrafRequest(name, description, metadata, config, orgId);
return await CreateTelegrafAsync(request);
}
/// <summary>
/// Create a telegraf config.
/// </summary>
/// <param name="telegrafRequest">Telegraf Configuration to create</param>
/// <returns>Telegraf config created</returns>
public async Task<Telegraf> CreateTelegrafAsync(TelegrafRequest telegrafRequest)
{
Arguments.CheckNotNull(telegrafRequest, nameof(telegrafRequest));
return await _service.PostTelegrafsAsync(telegrafRequest);
}
/// <summary>
/// Created default Telegraf Agent configuration.
/// <example>
/// [agent]
/// interval = "10s"
/// round_interval = true
/// metric_batch_size = 1000
/// metric_buffer_limit = 10000
/// collection_jitter = "0s"
/// flush_jitter = "0s"
/// precision = ""
/// omit_hostname = false
/// </example>
/// </summary>
/// <returns>default configuration</returns>
public Dictionary<string, object> CreateAgentConfiguration()
{
return new Dictionary<string, object>
{
{"interval", "10s"},
{"round_interval", true},
{"metric_batch_size", 1000},
{"metric_buffer_limit", 10000},
{"collection_jitter", "0s"},
{"flush_jitter", "0s"},
{"precision", ""},
{"omit_hostname", false}
};
}
/// <summary>
/// Update a telegraf config.
/// </summary>
/// <param name="telegraf">telegraf config update to apply</param>
/// <returns>An updated telegraf</returns>
public async Task<Telegraf> UpdateTelegrafAsync(Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
var request = new TelegrafRequest(telegraf.Name, telegraf.Description, telegraf.Metadata, telegraf.Config,
telegraf.OrgID);
return await UpdateTelegrafAsync(telegraf.Id, request);
}
/// <summary>
/// Update a telegraf config.
/// </summary>
/// <param name="telegrafId">ID of telegraf config</param>
/// <param name="telegrafRequest">telegraf config update to apply</param>
/// <returns>An updated telegraf</returns>
public async Task<Telegraf> UpdateTelegrafAsync(string telegrafId, TelegrafRequest telegrafRequest)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
Arguments.CheckNotNull(telegrafRequest, nameof(telegrafRequest));
return await _service.PutTelegrafsIDAsync(telegrafId, telegrafRequest);
}
/// <summary>
/// Delete a telegraf config.
/// </summary>
/// <param name="telegraf">telegraf config to delete</param>
/// <returns>delete has been accepted</returns>
public async Task DeleteTelegrafAsync(Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
await DeleteTelegrafAsync(telegraf.Id);
}
/// <summary>
/// Delete a telegraf config.
/// </summary>
/// <param name="telegrafId">ID of telegraf config to delete</param>
/// <returns>delete has been accepted</returns>
public async Task DeleteTelegrafAsync(string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
await _service.DeleteTelegrafsIDAsync(telegrafId);
}
/// <summary>
/// Clone a telegraf config.
/// </summary>
/// <param name="clonedName">name of cloned telegraf config</param>
/// <param name="telegrafId">ID of telegraf config to clone</param>
/// <returns>cloned telegraf config</returns>
public async Task<Telegraf> CloneTelegrafAsync(string clonedName, string telegrafId)
{
Arguments.CheckNonEmptyString(clonedName, nameof(clonedName));
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
return await FindTelegrafByIdAsync(telegrafId).ContinueWith(t => CloneTelegrafAsync(clonedName, t.Result))
.Unwrap();
}
/// <summary>
/// Clone a telegraf config.
/// </summary>
/// <param name="clonedName">name of cloned telegraf config</param>
/// <param name="telegraf">telegraf config to clone></param>
/// <returns>cloned telegraf config</returns>
public async Task<Telegraf> CloneTelegrafAsync(string clonedName, Telegraf telegraf)
{
Arguments.CheckNonEmptyString(clonedName, nameof(clonedName));
Arguments.CheckNotNull(telegraf, nameof(telegraf));
var cloned = new TelegrafRequest(clonedName, telegraf.Description, telegraf.Metadata, telegraf.Config,
telegraf.OrgID);
return await CreateTelegrafAsync(cloned).ContinueWith(created =>
{
//
// Add labels
//
return GetLabelsAsync(telegraf)
.ContinueWith(labels =>
{
return labels.Result.Select(label => AddLabelAsync(label, created.Result));
})
.ContinueWith(async tasks =>
{
await Task.WhenAll(tasks.Result);
return created.Result;
})
.Unwrap();
}).Unwrap();
}
/// <summary>
/// Retrieve a telegraf config.
/// </summary>
/// <param name="telegrafId">ID of telegraf config to get</param>
/// <returns>telegraf config details</returns>
public async Task<Telegraf> FindTelegrafByIdAsync(string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
return await _service.GetTelegrafsIDWithIRestResponseAsync(telegrafId, null, "application/json")
.ContinueWith(t => (Telegraf) _service.Configuration.ApiClient.Deserialize(t.Result, typeof(Telegraf)));
}
/// <summary>
/// Returns a list of telegraf configs.
/// </summary>
/// <returns>A list of telegraf configs</returns>
public async Task<List<Telegraf>> FindTelegrafsAsync()
{
return await FindTelegrafsByOrgIdAsync(null);
}
/// <summary>
/// Returns a list of telegraf configs for specified organization.
/// </summary>
/// <param name="organization">specifies the organization of the telegraf configs</param>
/// <returns>A list of telegraf configs</returns>
public async Task<List<Telegraf>> FindTelegrafsByOrgAsync(Organization organization)
{
Arguments.CheckNotNull(organization, nameof(organization));
return await FindTelegrafsByOrgIdAsync(organization.Id);
}
/// <summary>
/// Returns a list of telegraf configs for specified organization.
/// </summary>
/// <param name="orgId">specifies the organization of the telegraf configs</param>
/// <returns>A list of telegraf configs</returns>
public async Task<List<Telegraf>> FindTelegrafsByOrgIdAsync(string orgId)
{
return await _service.GetTelegrafsAsync(orgId).ContinueWith(t => t.Result.Configurations);
}
/// <summary>
/// Retrieve a telegraf config in TOML.
/// </summary>
/// <param name="telegraf">telegraf config to get</param>
/// <returns>telegraf config details in TOML format</returns>
public async Task<string> GetTOMLAsync(Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
return await GetTOMLAsync(telegraf.Id);
}
/// <summary>
/// Retrieve a telegraf config in TOML.
/// </summary>
/// <param name="telegrafId">ID of telegraf config to get</param>
/// <returns>telegraf config details in TOML format</returns>
public async Task<string> GetTOMLAsync(string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
return await _service.GetTelegrafsIDstringAsync(telegrafId, null, "application/toml");
}
/// <summary>
/// List all users with member privileges for a telegraf config.
/// </summary>
/// <param name="telegraf">the telegraf config</param>
/// <returns>a list of telegraf config members</returns>
public async Task<List<ResourceMember>> GetMembersAsync(Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
return await GetMembersAsync(telegraf.Id);
}
/// <summary>
/// List all users with member privileges for a telegraf config.
/// </summary>
/// <param name="telegrafId">ID of the telegraf config</param>
/// <returns>a list of telegraf config members</returns>
public async Task<List<ResourceMember>> GetMembersAsync(string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
return await _service.GetTelegrafsIDMembersAsync(telegrafId).ContinueWith(t => t.Result.Users);
}
/// <summary>
/// Add telegraf config member.
/// </summary>
/// <param name="member">user to add as member</param>
/// <param name="telegraf">the telegraf config</param>
/// <returns>member added to telegraf</returns>
public async Task<ResourceMember> AddMemberAsync(User member, Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
Arguments.CheckNotNull(member, nameof(member));
return await AddMemberAsync(member.Id, telegraf.Id);
}
/// <summary>
/// Add telegraf config member.
/// </summary>
/// <param name="memberId">user ID to add as member</param>
/// <param name="telegrafId">ID of the telegraf config</param>
/// <returns>member added to telegraf</returns>
public async Task<ResourceMember> AddMemberAsync(string memberId, string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
Arguments.CheckNonEmptyString(memberId, nameof(memberId));
return await _service.PostTelegrafsIDMembersAsync(telegrafId, new AddResourceMemberRequestBody(memberId));
}
/// <summary>
/// Removes a member from a telegraf config.
/// </summary>
/// <param name="member">member to remove</param>
/// <param name="telegraf">the telegraf</param>
/// <returns>member removed</returns>
public async Task DeleteMemberAsync(User member, Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
Arguments.CheckNotNull(member, nameof(member));
await DeleteMemberAsync(member.Id, telegraf.Id);
}
/// <summary>
/// Removes a member from a telegraf config.
/// </summary>
/// <param name="memberId">ID of member to remove</param>
/// <param name="telegrafId">ID of the telegraf</param>
/// <returns>member removed</returns>
public async Task DeleteMemberAsync(string memberId, string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
Arguments.CheckNonEmptyString(memberId, nameof(memberId));
await _service.DeleteTelegrafsIDMembersIDAsync(memberId, telegrafId);
}
/// <summary>
/// List all owners of a telegraf config.
/// </summary>
/// <param name="telegraf">the telegraf config</param>
/// <returns>a list of telegraf config owners</returns>
public async Task<List<ResourceOwner>> GetOwnersAsync(Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
return await GetOwnersAsync(telegraf.Id);
}
/// <summary>
/// List all owners of a telegraf config.
/// </summary>
/// <param name="telegrafId">ID of the telegraf config</param>
/// <returns>a list of telegraf config owners</returns>
public async Task<List<ResourceOwner>> GetOwnersAsync(string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
return await _service.GetTelegrafsIDOwnersAsync(telegrafId).ContinueWith(t => t.Result.Users);
}
/// <summary>
/// Add telegraf config owner.
/// </summary>
/// <param name="owner">user to add as owner</param>
/// <param name="telegraf">the telegraf config</param>
/// <returns>telegraf config owner added</returns>
public async Task<ResourceOwner> AddOwnerAsync(User owner, Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
Arguments.CheckNotNull(owner, nameof(owner));
return await AddOwnerAsync(owner.Id, telegraf.Id);
}
/// <summary>
/// Add telegraf config owner.
/// </summary>
/// <param name="ownerId">ID of user to add as owner</param>
/// <param name="telegrafId"> ID of the telegraf config</param>
/// <returns>telegraf config owner added</returns>
public async Task<ResourceOwner> AddOwnerAsync(string ownerId, string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
Arguments.CheckNonEmptyString(ownerId, nameof(ownerId));
return await _service.PostTelegrafsIDOwnersAsync(telegrafId, new AddResourceMemberRequestBody(ownerId));
}
/// <summary>
/// Removes an owner from a telegraf config.
/// </summary>
/// <param name="owner">owner to remove</param>
/// <param name="telegraf">the telegraf config</param>
/// <returns>owner removed</returns>
public async Task DeleteOwnerAsync(User owner, Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
Arguments.CheckNotNull(owner, nameof(owner));
await DeleteOwnerAsync(owner.Id, telegraf.Id);
}
/// <summary>
/// Removes an owner from a telegraf config.
/// </summary>
/// <param name="ownerId">ID of owner to remove</param>
/// <param name="telegrafId">ID of the telegraf config</param>
/// <returns>owner removed</returns>
public async Task DeleteOwnerAsync(string ownerId, string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
Arguments.CheckNonEmptyString(ownerId, nameof(ownerId));
await _service.DeleteTelegrafsIDOwnersIDAsync(ownerId, telegrafId);
}
/// <summary>
/// List all labels for a telegraf config.
/// </summary>
/// <param name="telegraf">the telegraf config</param>
/// <returns>a list of all labels for a telegraf config</returns>
public async Task<List<Label>> GetLabelsAsync(Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
return await GetLabelsAsync(telegraf.Id);
}
/// <summary>
/// List all labels for a telegraf config.
/// </summary>
/// <param name="telegrafId">ID of the telegraf config</param>
/// <returns>a list of all labels for a telegraf config</returns>
public async Task<List<Label>> GetLabelsAsync(string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
return await _service.GetTelegrafsIDLabelsAsync(telegrafId).ContinueWith(t => t.Result.Labels);
}
/// <summary>
/// Add a label to a telegraf config.
/// </summary>
/// <param name="label">label to add</param>
/// <param name="telegraf">the telegraf config</param>
/// <returns>added label</returns>
public async Task<Label> AddLabelAsync(Label label, Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
Arguments.CheckNotNull(label, nameof(label));
return await AddLabelAsync(label.Id, telegraf.Id);
}
/// <summary>
/// Add a label to a telegraf config.
/// </summary>
/// <param name="labelId">ID of label to add</param>
/// <param name="telegrafId">ID of the telegraf config</param>
/// <returns>added label</returns>
public async Task<Label> AddLabelAsync(string labelId, string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
Arguments.CheckNonEmptyString(labelId, nameof(labelId));
return await _service.PostTelegrafsIDLabelsAsync(telegrafId, new LabelMapping(labelId))
.ContinueWith(t => t.Result.Label);
}
/// <summary>
/// Delete a label from a telegraf config.
/// </summary>
/// <param name="label">label to delete</param>
/// <param name="telegraf">the telegraf config</param>
/// <returns>delete has been accepted</returns>
public async Task DeleteLabelAsync(Label label, Telegraf telegraf)
{
Arguments.CheckNotNull(telegraf, nameof(telegraf));
Arguments.CheckNotNull(label, nameof(label));
await DeleteLabelAsync(label.Id, telegraf.Id);
}
/// <summary>
/// Delete a label from a telegraf config.
/// </summary>
/// <param name="labelId">ID of label to delete</param>
/// <param name="telegrafId">ID of the telegraf config</param>
/// <returns>delete has been accepted</returns>
public async Task DeleteLabelAsync(string labelId, string telegrafId)
{
Arguments.CheckNonEmptyString(telegrafId, nameof(telegrafId));
Arguments.CheckNonEmptyString(labelId, nameof(labelId));
await _service.DeleteTelegrafsIDLabelsIDAsync(telegrafId, labelId);
}
private void AppendConfiguration(StringBuilder config, string key, object value)
{
if (value == null) return;
config.Append(" ").Append(key).Append(" = ");
if (value is IEnumerable<object> enumerable)
{
var values = enumerable.Select(it =>
{
if (it is string str)
{
return $"\"{str}\"";
}
return it.ToString();
});
config.Append("[");
config.Append(string.Join(", ", values));
config.Append("]");
}
else if (value is string)
{
config.Append('"');
config.Append(value);
config.Append('"');
}
else if (value is bool b)
{
config.Append(b.ToString().ToLower());
}
else
{
config.Append(value);
}
config.Append("\n");
}
}
}