forked from microsoft/PSRule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PSRule-language.schema.json
3910 lines (3910 loc) · 159 KB
/
PSRule-language.schema.json
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
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "PSRule language",
"description": "A schema for PSRule resources.",
"$ref": "#/definitions/resource-v1",
"definitions": {
"resource-v1": {
"oneOf": [
{
"$ref": "#/definitions/rule-v1"
},
{
"$ref": "#/definitions/baseline-v1"
},
{
"$ref": "#/definitions/moduleConfig-v1"
},
{
"$ref": "#/definitions/selector-v1"
},
{
"$ref": "#/definitions/suppressionGroup-v1"
}
]
},
"resource-metadata": {
"type": "object",
"title": "Metadata",
"description": "Additional information to identify the resource.",
"properties": {
"name": {
"type": "string",
"title": "Name",
"description": "The name of the resource. This must be unique.",
"markdownDescription": "The name of the resource. This must be unique.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/storing-rules/#naming-rules)",
"$ref": "#/definitions/resourceName"
},
"description": {
"type": "string",
"title": "Description",
"description": "A non-localized description of the resource. The description is intended to be a verbose description of the resource. If your resource documentation needs to include background information include it here. For localized documentation define markdown help.",
"markdownDescription": "A non-localized description of the resource.\n\nThe description is intended to be a verbose description of the resource. If your resource documentation needs to include background information include it here.\n\nFor localized documentation define markdown help.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rule-help/)",
"minLength": 1
},
"displayName": {
"type": "string",
"title": "Display name",
"description": "A non-localized display name for the resource. For localized documentation define markdown help.",
"markdownDescription": "A non-localized display name for the resource. For localized documentation define markdown help.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rule-help/)",
"minLength": 1
},
"link": {
"type": "string",
"title": "Online help",
"description": "A non-localized URL to documentation for the resource. URLs should be prefixed with https://. Relative URLs are not supported.",
"markdownDescription": "A non-localized URL to documentation for the resource. URLs should be prefixed with `https://`. Relative URLs are not supported.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rule-help/)",
"pattern": "^https://"
},
"annotations": {
"type": "object",
"title": "Annotations",
"description": "Additional annotations for the resource.",
"properties": {
"obsolete": {
"type": "boolean",
"title": "Obsolete",
"description": "A common annotation that flags the resource as obsolete.",
"default": false
}
},
"additionalProperties": true,
"defaultSnippets": [
{
"label": "Annotation key/ value",
"body": {
"${1:Key}": "${2:Value}"
}
}
]
},
"tags": {
"$ref": "#/definitions/resourceTags"
}
},
"required": [
"name"
],
"additionalProperties": false
},
"baseline-v1": {
"type": "object",
"title": "Baseline",
"description": "A PSRule Baseline.",
"markdownDescription": "A PSRule Baseline. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Baseline/)",
"properties": {
"apiVersion": {
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A PSRule Baseline resource.",
"markdownDescription": "A PSRule Baseline resource. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Baseline/)",
"enum": [
"Baseline"
]
},
"metadata": {
"type": "object",
"$ref": "#/definitions/resource-metadata"
},
"spec": {
"type": "object",
"$ref": "#/definitions/baselineSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
],
"additionalProperties": false
},
"baselineSpec": {
"type": "object",
"title": "Spec",
"description": "A specification for a baseline.",
"markdownDescription": "A specification for a baseline. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Baseline/)",
"properties": {
"configuration": {
"$ref": "#/definitions/configuration"
},
"rule": {
"type": "object",
"title": "Rule",
"description": "A filter for included or excluded rules.",
"properties": {
"include": {
"type": "array",
"title": "Include rules",
"description": "Rules to include by name in the baseline.",
"markdownDescription": "Rules to include by name in the baseline. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#ruleinclude)",
"items": {
"type": "string",
"$ref": "#/definitions/resourceNameReference"
},
"uniqueItems": true
},
"exclude": {
"type": "array",
"title": "Exclude rules",
"description": "Rules to exclude by name from the baseline.",
"markdownDescription": "Rules to exclude by name from the baseline. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#ruleexclude)",
"items": {
"type": "string",
"$ref": "#/definitions/resourceNameReference"
},
"uniqueItems": true
},
"tag": {
"type": "object",
"title": "Tags",
"description": "Require rules to have the following tags.",
"markdownDescription": "Require rules to have the following tags. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#ruletag)",
"additionalProperties": {
"oneOf": [
{
"type": "string",
"description": "A required tag."
},
{
"type": "array",
"description": "A required tag.",
"items": {
"type": "string"
},
"uniqueItems": true
}
]
}
},
"labels": {
"type": "object",
"title": "Labels",
"description": "Require rules to have the following associated labels.",
"markdownDescription": "Require rules to have the following associated labels.",
"additionalProperties": {
"oneOf": [
{
"type": "string",
"description": "A required reference."
},
{
"type": "array",
"description": "A required reference.",
"items": {
"type": "string"
},
"uniqueItems": true
}
]
}
}
},
"additionalProperties": false
},
"override": {
"type": "object",
"title": "Overrides",
"description": "Specifies additional rule overrides.",
"properties": {
"level": {
"type": "object",
"title": "Override severity level",
"description": "Overrides the severity level defined by the rule to the level specified. A rule can be configured with one of the following: Error, Warning, Information.",
"markdownDescription": "Overrides the severity level defined by the rule to the level specified.\n\nA rule can be configured with one of the following: `Error`, `Warning`, `Information`.\n\n[See help](https://microsoft.github.io/PSRule/v3/concepts/PSRule/en-US/about_PSRule_Options/#overridelevel)",
"additionalProperties": {
"type": "string",
"title": "Override level by rule",
"description": "Specify the new severity level of the rule. Choose one of the following supported values: Error, Warning, Information.",
"markdownDescription": "Specify the new severity level of the rule.\n\nChoose one of the following supported values: `Error`, `Warning`, `Information`.\n\n[See help](https://microsoft.github.io/PSRule/v3/concepts/PSRule/en-US/about_PSRule_Options/#overridelevel)",
"enum": [
"Error",
"Warning",
"Information"
]
},
"defaultSnippets": [
{
"label": "Override level",
"body": {
"${1:Rule}": "Error"
}
}
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"moduleConfig-v1": {
"type": "object",
"title": "ModuleConfig",
"description": "A PSRule ModuleConfig.",
"properties": {
"apiVersion": {
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A PSRule ModuleConfig resource.",
"enum": [
"ModuleConfig"
]
},
"metadata": {
"type": "object",
"$ref": "#/definitions/resource-metadata"
},
"spec": {
"type": "object",
"$ref": "#/definitions/moduleConfigSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
],
"additionalProperties": false
},
"moduleConfigSpec": {
"type": "object",
"title": "Spec",
"description": "A specification for a ModuleConfig.",
"properties": {
"binding": {
"$ref": "#/definitions/binding-option"
},
"configuration": {
"$ref": "#/definitions/configuration"
},
"convention": {
"$ref": "#/definitions/convention-option"
},
"output": {
"type": "object",
"title": "Output options",
"description": "Options that affect how output is generated.",
"properties": {
"culture": {
"type": "array",
"title": "Culture",
"description": "One or more cultures to use for generating output. When multiple cultures are specified, the first matching culture will be used. By default, the current PowerShell culture is used.",
"markdownDescription": "One or more cultures to use for generating output. When multiple cultures are specified, the first matching culture will be used. By default, the current PowerShell culture is used. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#outputculture)",
"items": {
"type": "string",
"description": "A culture for generating output.",
"minLength": 2
},
"uniqueItems": true,
"defaultSnippets": [
{
"label": "en-AU",
"bodyText": [
"en-AU"
]
},
{
"label": "en-US",
"bodyText": [
"en-US"
]
},
{
"label": "en-GB",
"bodyText": [
"en-GB"
]
}
]
}
},
"additionalProperties": false
},
"rule": {
"type": "object",
"title": "Rule",
"description": "A filter for included or excluded rules.",
"properties": {
"baseline": {
"type": "string",
"title": "Baseline",
"description": "The name of a baseline to use.",
"markdownDescription": "The name of a baseline to use. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#rulebaseline)",
"$ref": "#/definitions/resourceNameReference"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"resourceName": {
"type": "string",
"minLength": 3,
"maxLength": 128,
"pattern": "^[^<>:/\\\\|?*\"'`+@._\\-\\x00-\\x1F][^<>:/\\\\|?*\"'`+@\\x00-\\x1F]{1,126}[^<>:/\\\\|?*\"'`+@._\\-\\x00-\\x1F]$"
},
"resourceNameReference": {
"type": "string",
"minLength": 3,
"pattern": "^.*\\[^<>:/\\\\|?*\"'`+@._\\-\\x00-\\x1F][^<>:/\\\\|?*\"'`+@\\x00-\\x1F]{1,126}[^<>:/\\\\|?*\"'`+@._\\-\\x00-\\x1F]$"
},
"resourceTags": {
"type": "object",
"title": "Tags",
"description": "Additional indexed key/ value pairs for the resource.",
"additionalProperties": {
"type": "string"
},
"defaultSnippets": [
{
"label": "Tag key/ value",
"body": {
"${1:Key}": "${2:Value}"
}
}
]
},
"binding-option": {
"type": "object",
"title": "Object binding",
"description": "Configure property/ object binding options.",
"properties": {
"field": {
"type": "object",
"title": "Field",
"description": "Custom fields to bind.",
"markdownDescription": "Custom fields to bind. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#bindingfield)",
"additionalProperties": {
"type": "array",
"description": "A custom field to bind.",
"markdownDescription": "Custom field to bind. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#bindingfield)",
"items": {
"type": "string"
},
"uniqueItems": true
}
},
"ignoreCase": {
"type": "boolean",
"title": "Ignore case",
"description": "Determines if custom binding uses ignores case when matching properties. The default is true.",
"markdownDescription": "Determines if custom binding uses ignores case when matching properties. The default is `true`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#bindingignorecase)",
"default": true
},
"nameSeparator": {
"type": "string",
"title": "Name separator",
"description": "Configures the separator to use for building a qualified name. The default is '/'.",
"markdownDescription": "Configures the separator to use for building a qualified name. The default is `/`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#bindingnameseparator)",
"default": "/"
},
"preferTargetInfo": {
"type": "boolean",
"title": "Prefer target info",
"description": "Determines if binding prefers target info provided by the object over custom configuration. The default is false.",
"markdownDescription": "Determines if binding prefers target info provided by the object over custom configuration. The default is `false`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#bindingprefertargetinfo)",
"default": false
},
"targetName": {
"type": "array",
"title": "Bind TargetName",
"description": "Specifies one or more property names to bind TargetName to.",
"markdownDescription": "Specifies one or more property names to bind TargetName to. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#bindingtargetname)",
"items": {
"type": "string"
},
"uniqueItems": true
},
"targetType": {
"type": "array",
"title": "Bind TargetType",
"description": "Specifies one or more property names to bind TargetType to.",
"markdownDescription": "Specifies one or more property names to bind TargetType to. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#bindingtargettype)",
"items": {
"type": "string"
},
"uniqueItems": true
},
"useQualifiedName": {
"type": "boolean",
"title": "Use qualified name",
"description": "Determines if a qualified TargetName is used. The default is false.",
"markdownDescription": "Determines if a qualified TargetName is used. The default is `false`. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#bindingusequalifiedname)",
"default": false
}
},
"additionalProperties": false
},
"configuration": {
"type": "object",
"title": "Configuration values",
"description": "A set of key/ value configuration options for rules.",
"markdownDescription": "A set of key/ value configuration options for rules. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#configuration)",
"defaultSnippets": [
{
"label": "Configuration value",
"body": {
"${1:Key}": "${2:Value}"
}
}
]
},
"convention-option": {
"type": "object",
"title": "Convention options",
"description": "Options that configure conventions.",
"properties": {
"include": {
"type": "array",
"title": "Include conventions",
"description": "An ordered list of conventions to include.",
"markdownDescription": "An ordered list of conventions to include. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#conventioninclude)",
"items": {
"type": "string"
},
"uniqueItems": true
}
},
"additionalProperties": false
},
"selector-v1": {
"type": "object",
"title": "Selector",
"description": "A selector resource.",
"markdownDescription": "A selector resource. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Selectors/)",
"properties": {
"apiVersion": {
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A PSRule Selector resource.",
"enum": [
"Selector"
]
},
"metadata": {
"type": "object",
"$ref": "#/definitions/resource-metadata"
},
"spec": {
"type": "object",
"$ref": "#/definitions/selectorSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
]
},
"selectorSpec": {
"type": "object",
"title": "Spec",
"description": "The specification for a selector.",
"markdownDescription": "The specification for a selector. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Selectors/)",
"properties": {
"if": {
"type": "object",
"title": "If",
"description": "A condition made up of one or more expressions that will determine if an object is selected by the selector.",
"markdownDescription": "A condition made up of one or more [expressions](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/) that will determine if an object is selected by the selector. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Selectors/)",
"$ref": "#/definitions/expressions"
}
},
"required": [
"if"
],
"additionalProperties": false
},
"suppressionGroup-v1": {
"type": "object",
"title": "SuppressionGroup",
"description": "A PSRule Suppression Group",
"markdownDescription": "A PSRule Suppression Group. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_SuppressionGroups/)",
"properties": {
"apiVersion": {
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A PSRule SuppressionGroup resource.",
"enum": [
"SuppressionGroup"
]
},
"metadata": {
"type": "object",
"$ref": "#/definitions/resource-metadata"
},
"spec": {
"type": "object",
"$ref": "#/definitions/suppressionGroupSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
]
},
"suppressionGroupSpec": {
"type": "object",
"title": "Spec",
"description": "PSRule Suppression Group specification.",
"markdownDescription": "PSRule Suppression Group specification.",
"properties": {
"expiresOn": {
"type": "string",
"title": "Expires On",
"description": "The date time that the suppression is valid until. After this date time, the suppression is ignored. When not set, the suppression does not expire. This RFC3339 (ISO 8601) formatted date time using the format yyyy-MM-ddTHH:mm:ssZ.",
"markdownDescription": "The date time that the suppression is valid until. After this date time, the suppression is ignored. When not set, the suppression does not expire. This RFC3339 (ISO 8601) formatted date time using the format `yyyy-MM-ddTHH:mm:ssZ`.",
"format": "date-time"
},
"rule": {
"type": "array",
"title": "Rule pre-condition",
"description": "This only applies to rules that match the specified rule names.",
"markdownDescription": "This only applies to rules that match the specified rule names.",
"items": {
"type": "string"
},
"uniqueItems": true
},
"if": {
"type": "object",
"title": "If",
"description": "A condition made up of one or more expressions that will determine if the rule is suppressed.",
"markdownDescription": "A condition made up of one or more [expressions](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/) that will determine if the rule is suppressed. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_SuppressionGroups/)",
"$ref": "#/definitions/expressions"
}
},
"required": [
"if"
],
"additionalProperties": false
},
"rule-v1": {
"type": "object",
"title": "Rule",
"description": "A rule resource.",
"markdownDescription": "A rule resource. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Rules/)",
"properties": {
"apiVersion": {
"type": "string",
"title": "API Version",
"description": "The API Version for the PSRule resources.",
"enum": [
"github.com/microsoft/PSRule/v1"
]
},
"kind": {
"type": "string",
"title": "Kind",
"description": "A rule resource.",
"markdownDescription": "A rule resource. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Rules/)",
"enum": [
"Rule"
]
},
"metadata": {
"type": "object",
"$ref": "#/definitions/ruleMetadata"
},
"spec": {
"type": "object",
"$ref": "#/definitions/ruleSpec"
}
},
"required": [
"apiVersion",
"kind",
"metadata",
"spec"
]
},
"ruleSpec": {
"type": "object",
"title": "Spec",
"description": "The specification for the rule.",
"markdownDescription": "The specification for the rule. [See help](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Rules/)",
"properties": {
"condition": {
"type": "object",
"title": "Condition",
"description": "A condition is made up of one or more expressions that will determine if the rule passes or fails.",
"markdownDescription": "A condition is made up of one or more [expressions](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Expressions/) that will determine if the rule passes or fails.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rules/)",
"oneOf": [
{
"$ref": "#/definitions/expressions"
}
]
},
"level": {
"type": "string",
"title": "Level",
"description": "If the rule fails, how serious is the result. By default this is set to Error.",
"markdownDescription": "If the rule fails, how serious is the result. By default this is set to `Error`. [See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rules/)",
"enum": [
"Error",
"Warning",
"Information"
],
"default": "Error"
},
"recommend": {
"type": "string",
"title": "Recommendation",
"description": "A non-localized recommendation for the rule. The recommendation is intended to identify corrective actions that can be taken to address any failures. Avoid using URLs within the recommendation. For localized documentation define markdown help.",
"markdownDescription": "A non-localized recommendation for the rule.\n\nThe recommendation is intended to identify corrective actions that can be taken to address any failures. Avoid using URLs within the recommendation.\n\nFor localized documentation define markdown help.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rule-help/)",
"minLength": 1
},
"type": {
"type": "array",
"title": "Type pre-condition",
"description": "This rule only applies to objects that match the specifies types.",
"items": {
"type": "string",
"default": ""
},
"uniqueItems": true
},
"with": {
"type": "array",
"title": "Selector pre-condition",
"description": "This rule only applies to objects that match the specified selectors.",
"items": {
"type": "string",
"default": ""
},
"uniqueItems": true
},
"where": {
"type": "object",
"title": "Sub-selector pre-condition",
"description": "The rule only applies to objects that match the sub-selector condition.",
"markdownDescription": "The rule only applies to objects that match the sub-selector condition.\n\n[See help](https://microsoft.github.io/PSRule/v2/expressions/sub-selectors/)",
"oneOf": [
{
"$ref": "#/definitions/expressions"
}
]
}
},
"required": [
"condition"
],
"additionalProperties": false,
"default": {
"condition": {}
}
},
"ruleMetadata": {
"type": "object",
"title": "Metadata",
"description": "Additional information to identify the resource.",
"properties": {
"name": {
"type": "string",
"title": "Name",
"description": "The name of the resource. This must be unique.",
"markdownDescription": "The name of the resource. This must be unique.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/storing-rules/#naming-rules)",
"$ref": "#/definitions/resourceName"
},
"description": {
"type": "string",
"title": "Description",
"description": "A non-localized description of the resource. The description is intended to be a verbose description of the resource. If your resource documentation needs to include background information include it here. For localized documentation define markdown help.",
"markdownDescription": "A non-localized description of the resource.\n\nThe description is intended to be a verbose description of the resource. If your resource documentation needs to include background information include it here.\n\nFor localized documentation define markdown help.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rule-help/)",
"minLength": 1
},
"displayName": {
"type": "string",
"title": "Display name",
"description": "A non-localized display name for the resource. For localized documentation define markdown help.",
"markdownDescription": "A non-localized display name for the resource. For localized documentation define markdown help.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rule-help/)",
"minLength": 1
},
"link": {
"type": "string",
"title": "Online help",
"description": "A non-localized URL to documentation for the resource. URLs should be prefixed with https://. Relative URLs are not supported.",
"markdownDescription": "A non-localized URL to documentation for the resource. URLs should be prefixed with `https://`. Relative URLs are not supported.\n\n[See help](https://microsoft.github.io/PSRule/v2/authoring/writing-rule-help/)",
"pattern": "^https://"
},
"ref": {
"title": "Reference",
"description": "An optional stable opaque identifier of this resource for lookup. This must be unique if set.",
"$ref": "#/definitions/resourceName"
},
"annotations": {
"type": "object",
"title": "Annotations",
"description": "Additional annotations for the resource.",
"additionalProperties": true,
"defaultSnippets": [
{
"label": "Annotation key/ value",
"body": {
"${1:Key}": "${2:Value}"
}
}
]
},
"alias": {
"type": "array",
"title": "Aliases",
"description": "Alternative names this resource is known by.",
"items": {
"type": "string",
"title": "Alias",
"description": "An alternative name.",
"$ref": "#/definitions/resourceName"
},
"uniqueItems": true
},
"tags": {
"$ref": "#/definitions/resourceTags"
},
"labels": {
"type": "object",
"title": "Labels",
"description": "Any taxonomy references.",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"defaultSnippets": [
{
"label": "Reference key/ value",
"body": {
"${1:Key}": "${2:Value}"
}
},
{
"label": "Reference key/ multi-value",
"body": {
"${1:Key}": [
"${2:Value}"
]
}
}
]
}
},
"required": [
"name"
],
"additionalProperties": false
},
"selectorExpressionValueMultiString": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
]
},
"selectorExpressionValue": {
"oneOf": [
{
"type": "string",
"ztitle": "Value from string",
"zdescription": "A value to compare.",
"default": ""
},
{
"type": "boolean",
"ztitle": "Value from boolean",
"zdescription": "A value to compare.",
"default": true
},
{
"type": "integer",
"ztitle": "Value from integer",
"zdescription": "A value to compare.",
"default": 0
},
{
"type": "object",
"title": "Value for object",
"description": "A value to compare.",
"not": {
"required": [
"$"
]
}
},
{
"$ref": "#/definitions/fn"
}
]
},
"expressions": {
"type": "object",
"oneOf": [
{
"$ref": "#/definitions/expressions/definitions/operators/definitions/allOf"
},
{
"$ref": "#/definitions/expressions/definitions/operators/definitions/anyOf"
},
{
"$ref": "#/definitions/expressions/definitions/operators/definitions/not"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/exists"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/equals"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/notEquals"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/hasValue"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/match"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/notMatch"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/in"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/notIn"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/setOf"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/subset"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/count"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/notCount"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/less"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/lessOrEquals"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/greater"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/greaterOrEquals"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/startsWith"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/notStartsWith"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/endsWith"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/notEndsWith"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/contains"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/notContains"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/isString"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/isLower"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/isArray"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/isBoolean"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/isDateTime"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/isInteger"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/isNumeric"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/isUpper"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/hasSchema"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/version"
},
{
"$ref": "#/definitions/expressions/definitions/conditions/definitions/apiVersion"