9
9
Name : "CaConfig" ,
10
10
Fields : graphql.Fields {
11
11
"externalCas" : & graphql.Field {
12
- Type : externalCa ,
13
- // This must return a externalCa slice
14
- // Resolver
12
+ Type : graphql .NewList (externalCa ),
13
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
14
+ return swInfo .Cluster .Spec .CAConfig .ExternalCAs , nil
15
+ },
15
16
},
16
17
"nodeCertExpiry" : & graphql.Field {
17
- Type : graphql .Float ,
18
- // Resolver
18
+ Type : graphql .Int ,
19
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
20
+ return int32 (swInfo .Cluster .Spec .CAConfig .NodeCertExpiry ), nil
21
+ },
19
22
},
20
23
},
21
24
})
22
25
dispatcherConfig = graphql .NewObject (graphql.ObjectConfig {
23
26
Name : "DispatcherConfig" ,
24
27
Fields : graphql.Fields {
25
28
"heartbeatPeriod" : & graphql.Field {
26
- Type : graphql .Float ,
27
- // Resolver
29
+ Type : graphql .Int ,
30
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
31
+ return int32 (swInfo .Cluster .Spec .Dispatcher .HeartbeatPeriod ), nil
32
+ },
28
33
},
29
34
},
30
35
})
@@ -33,20 +38,25 @@ var (
33
38
Fields : graphql.Fields {
34
39
"name" : & graphql.Field {
35
40
Type : graphql .String ,
36
- // Resolver
37
- },
38
- "options" : & graphql.Field {
39
- Type : stringAnyMap ,
40
- // Resolver
41
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
42
+ return swInfo .Cluster .Spec .TaskDefaults .LogDriver .Name , nil
43
+ },
41
44
},
45
+ // TBI
46
+ // "options": &graphql.Field{
47
+ // Type: stringAnyMap,
48
+ // // Resolver
49
+ // },
42
50
},
43
51
})
44
52
encryptionConfig = graphql .NewObject (graphql.ObjectConfig {
45
53
Name : "EncryptionConfig" ,
46
54
Fields : graphql.Fields {
47
55
"autoLockManagers" : & graphql.Field {
48
56
Type : graphql .Boolean ,
49
- // Resolver
57
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
58
+ return swInfo .Cluster .Spec .EncryptionConfig .AutoLockManagers , nil
59
+ },
50
60
},
51
61
},
52
62
})
@@ -84,17 +94,37 @@ var (
84
94
externalCa = graphql .NewObject (graphql.ObjectConfig {
85
95
Name : "ExternalCa" ,
86
96
Fields : graphql.Fields {
87
- "options" : & graphql.Field {
88
- Type : stringAnyMap ,
89
- // Resolver
97
+ "caCert" : & graphql.Field {
98
+ Type : graphql .String ,
99
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
100
+ for _ , exCa := range swInfo .Cluster .Spec .CAConfig .ExternalCAs {
101
+ return exCa .CACert , nil
102
+ }
103
+ return nil , nil
104
+ },
90
105
},
106
+ // TBI
107
+ // "options": &graphql.Field{
108
+ // Type: stringAnyMap,
109
+ // // Resolver
110
+ // },
91
111
"protocols" : & graphql.Field {
92
112
Type : graphql .String ,
93
- // Resolver
113
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
114
+ for _ , exCa := range swInfo .Cluster .Spec .CAConfig .ExternalCAs {
115
+ return exCa .Protocol , nil
116
+ }
117
+ return nil , nil
118
+ },
94
119
},
95
120
"url" : & graphql.Field {
96
121
Type : graphql .String ,
97
- // Resolver
122
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
123
+ for _ , exCa := range swInfo .Cluster .Spec .CAConfig .ExternalCAs {
124
+ return exCa .URL , nil
125
+ }
126
+ return nil , nil
127
+ },
98
128
},
99
129
},
100
130
})
@@ -277,7 +307,9 @@ var (
277
307
Fields : graphql.Fields {
278
308
"taskHistoryRetentionLimit" : & graphql.Field {
279
309
Type : graphql .Int ,
280
- // Resolver
310
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
311
+ return int32 (* swInfo .Cluster .Spec .Orchestration .TaskHistoryRetentionLimit ), nil
312
+ },
281
313
},
282
314
},
283
315
})
@@ -299,40 +331,59 @@ var (
299
331
Fields : graphql.Fields {
300
332
"electionTick" : & graphql.Field {
301
333
Type : graphql .Int ,
302
- // Resolver
334
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
335
+ return int32 (swInfo .Cluster .Spec .Raft .ElectionTick ), nil
336
+ },
303
337
},
304
338
"heartbeatTick" : & graphql.Field {
305
339
Type : graphql .Int ,
306
- // Resolver
340
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
341
+ return int32 (swInfo .Cluster .Spec .Raft .HeartbeatTick ), nil
342
+ },
307
343
},
308
344
"keepOldSnapshots" : & graphql.Field {
309
345
Type : graphql .Int ,
310
- // Resolver
346
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
347
+ return int32 (* swInfo .Cluster .Spec .Raft .KeepOldSnapshots ), nil
348
+ },
311
349
},
312
350
"logEntriesForSlowFollowers" : & graphql.Field {
313
351
Type : graphql .Int ,
314
- // Resolver
352
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
353
+ return int32 (swInfo .Cluster .Spec .Raft .LogEntriesForSlowFollowers ), nil
354
+ },
315
355
},
316
356
"snapshotInterval" : & graphql.Field {
317
357
Type : graphql .Int ,
318
- // Resolver
358
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
359
+ return int32 (swInfo .Cluster .Spec .Raft .SnapshotInterval ), nil
360
+ },
361
+ },
362
+ },
363
+ })
364
+ remoteManager = graphql .NewObject (graphql.ObjectConfig {
365
+ Name : "RemoteManager" ,
366
+ Fields : graphql.Fields {
367
+ "addr" : & graphql.Field {
368
+ Type : graphql .String ,
369
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
370
+ for _ , peer := range swInfo .RemoteManagers {
371
+ return peer .Addr , nil
372
+ }
373
+ return nil , nil
374
+ },
375
+ },
376
+ "nodeId" : & graphql.Field {
377
+ Type : graphql .String ,
378
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
379
+ for _ , peer := range swInfo .RemoteManagers {
380
+ return peer .NodeID , nil
381
+ }
382
+ return nil , nil
383
+ },
319
384
},
320
385
},
321
386
})
322
- // TBI
323
- // remoteManager = graphql.NewObject(graphql.ObjectConfig{
324
- // Name: "RemoteManager",
325
- // Fields: graphql.Fields{
326
- // "addr": &graphql.Field{
327
- // Type: graphql.String,
328
- // // Resolver
329
- // },
330
- // "nodeId": &graphql.Field{
331
- // Type: graphql.String,
332
- // // Resolver
333
- // },
334
- // },
335
- // })
336
387
resources = graphql .NewObject (graphql.ObjectConfig {
337
388
Name : "Resources" ,
338
389
Fields : graphql.Fields {
@@ -402,11 +453,12 @@ var (
402
453
return swInfo .Cluster .RootRotationInProgress , nil
403
454
},
404
455
},
405
- // TBI
406
- // "swarmSpec": &graphql.Field{
407
- // Type: swarmSpec,
408
- // // Resolver
409
- // },
456
+ "swarmSpec" : & graphql.Field {
457
+ Type : swarmSpec ,
458
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
459
+ return swInfo .Cluster .Spec , nil
460
+ },
461
+ },
410
462
"tlsInfo" : & graphql.Field {
411
463
Type : tlsInfo ,
412
464
Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
@@ -427,7 +479,6 @@ var (
427
479
},
428
480
},
429
481
})
430
-
431
482
swarmInfo = graphql .NewObject (graphql.ObjectConfig {
432
483
Name : "SwarmInfo" ,
433
484
Fields : graphql.Fields {
@@ -479,13 +530,12 @@ var (
479
530
return swInfo .Nodes , nil
480
531
},
481
532
},
482
- // TBI
483
- // "remoteManagers": &graphql.Field{
484
- // Type: graphql.NewList(remoteManager),
485
- // Resolve: func(p graphql.ResolveParams) (interface{}, error) {
486
- // return swInfo.RemoteManagers, nil
487
- // },
488
- // },
533
+ "remoteManagers" : & graphql.Field {
534
+ Type : graphql .NewList (remoteManager ),
535
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
536
+ return swInfo .RemoteManagers , nil
537
+ },
538
+ },
489
539
},
490
540
})
491
541
swarmNode = graphql .NewObject (graphql.ObjectConfig {
@@ -534,35 +584,50 @@ var (
534
584
Fields : graphql.Fields {
535
585
"caConfig" : & graphql.Field {
536
586
Type : caConfig ,
537
- // Resolver
587
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
588
+ return swInfo .Cluster .Spec .CAConfig , nil
589
+ },
538
590
},
539
591
"dispatcher" : & graphql.Field {
540
592
Type : dispatcherConfig ,
541
- // Resolver
593
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
594
+ return swInfo .Cluster .Spec .Dispatcher , nil
595
+ },
542
596
},
543
597
"encryptionConfig" : & graphql.Field {
544
598
Type : encryptionConfig ,
545
- // Resolver
546
- },
547
- "labels" : & graphql.Field {
548
- Type : stringAnyMap ,
549
- // Resolver
599
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
600
+ return swInfo .Cluster .Spec .EncryptionConfig , nil
601
+ },
550
602
},
603
+ // TBI
604
+ // "labels": &graphql.Field{
605
+ // Type: stringAnyMap,
606
+ // // Resolver
607
+ // },
551
608
"name" : & graphql.Field {
552
- Type : graphql .DateTime ,
553
- // Resolver
609
+ Type : graphql .String ,
610
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
611
+ return swInfo .Cluster .Spec .Annotations .Name , nil
612
+ },
554
613
},
555
614
"orchestration" : & graphql.Field {
556
615
Type : orchestrationConfig ,
557
- // Resolver
616
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
617
+ return swInfo .Cluster .Spec .Orchestration , nil
618
+ },
558
619
},
559
620
"raft" : & graphql.Field {
560
621
Type : raftconfig ,
561
- // Resolver
622
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
623
+ return swInfo .Cluster .Spec .Raft , nil
624
+ },
562
625
},
563
626
"taskDefaults" : & graphql.Field {
564
627
Type : taskDefaults ,
565
- // Resolver
628
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
629
+ return swInfo .Cluster .Spec .TaskDefaults , nil
630
+ },
566
631
},
567
632
},
568
633
})
@@ -582,7 +647,9 @@ var (
582
647
Fields : graphql.Fields {
583
648
"logDriver" : & graphql.Field {
584
649
Type : driver ,
585
- // Resolver
650
+ Resolve : func (p graphql.ResolveParams ) (interface {}, error ) {
651
+ return swInfo .Cluster .Spec .TaskDefaults .LogDriver , nil
652
+ },
586
653
},
587
654
},
588
655
})
0 commit comments