-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
hcl_spec.pb.go
1124 lines (1014 loc) · 36.2 KB
/
hcl_spec.pb.go
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
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: plugins/shared/hclspec/hcl_spec.proto
// Spec allows exposing the specification for an HCL body, allowing for parsing and
//validation.
//
//Certain expressions within a specification may use the following functions.
//The documentation for each spec type above specifies where functions may
//be used.
//
// `abs(number)` returns the absolute (positive) value of the given number.
// `coalesce(vals...)` returns the first non-null value given.
// `concat(lists...)` concatenates together all of the given lists to produce a new list.
// `hasindex(val, idx)` returns true if the expression `val[idx]` could succeed.
// `int(number)` returns the integer portion of the given number, rounding towards zero.
// `jsondecode(str)` interprets the given string as JSON and returns the resulting data structure.
// `jsonencode(val)` returns a JSON-serialized version of the given value.
// `length(collection)` returns the number of elements in the given collection (list, set, map, object, or tuple).
// `lower(string)` returns the given string with all uppercase letters converted to lowercase.
// `max(numbers...)` returns the greatest of the given numbers.
// `min(numbers...)` returns the smallest of the given numbers.
// `reverse(string)` returns the given string with all of the characters in reverse order.
// `strlen(string)` returns the number of characters in the given string.
// `substr(string, offset, length)` returns the requested substring of the given string.
// `upper(string)` returns the given string with all lowercase letters converted to uppercase.
//
//## Type Expressions
//
//Type expressions are used to describe the expected type of an attribute, as
//an additional validation constraint.
//
//A type expression uses primitive type names and compound type constructors.
//A type constructor builds a new type based on one or more type expression
//arguments.
//
//The following type names and type constructors are supported:
//
// `any` is a wildcard that accepts a value of any type. (In HCL terms, this
// is the _dynamic pseudo-type_.)
// `string` is a Unicode string.
// `number` is an arbitrary-precision floating point number.
// `bool` is a boolean value (`true` or `false`)
// `list(element_type)` constructs a list type with the given element type
// `set(element_type)` constructs a set type with the given element type
// `map(element_type)` constructs a map type with the given element type
// `object({name1 = element_type, name2 = element_type, ...})` constructs
// an object type with the given attribute types.
// `tuple([element_type, element_type, ...])` constructs a tuple type with
// the given element types. This can be used, for example, to require an
// array with a particular number of elements, or with elements of different
// types.
//
//`null` is a valid value of any type, and not a type itself.
package hclspec
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Spec defines the available specification types.
type Spec struct {
// Types that are valid to be assigned to Block:
//
// *Spec_Object
// *Spec_Array
// *Spec_Attr
// *Spec_BlockValue
// *Spec_BlockAttrs
// *Spec_BlockList
// *Spec_BlockSet
// *Spec_BlockMap
// *Spec_Default
// *Spec_Literal
Block isSpec_Block `protobuf_oneof:"block"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Spec) Reset() { *m = Spec{} }
func (m *Spec) String() string { return proto.CompactTextString(m) }
func (*Spec) ProtoMessage() {}
func (*Spec) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{0}
}
func (m *Spec) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Spec.Unmarshal(m, b)
}
func (m *Spec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Spec.Marshal(b, m, deterministic)
}
func (m *Spec) XXX_Merge(src proto.Message) {
xxx_messageInfo_Spec.Merge(m, src)
}
func (m *Spec) XXX_Size() int {
return xxx_messageInfo_Spec.Size(m)
}
func (m *Spec) XXX_DiscardUnknown() {
xxx_messageInfo_Spec.DiscardUnknown(m)
}
var xxx_messageInfo_Spec proto.InternalMessageInfo
type isSpec_Block interface {
isSpec_Block()
}
type Spec_Object struct {
Object *Object `protobuf:"bytes,1,opt,name=object,proto3,oneof"`
}
type Spec_Array struct {
Array *Array `protobuf:"bytes,2,opt,name=array,proto3,oneof"`
}
type Spec_Attr struct {
Attr *Attr `protobuf:"bytes,3,opt,name=Attr,proto3,oneof"`
}
type Spec_BlockValue struct {
BlockValue *Block `protobuf:"bytes,4,opt,name=block_value,json=blockValue,proto3,oneof"`
}
type Spec_BlockAttrs struct {
BlockAttrs *BlockAttrs `protobuf:"bytes,5,opt,name=block_attrs,json=blockAttrs,proto3,oneof"`
}
type Spec_BlockList struct {
BlockList *BlockList `protobuf:"bytes,6,opt,name=block_list,json=blockList,proto3,oneof"`
}
type Spec_BlockSet struct {
BlockSet *BlockSet `protobuf:"bytes,7,opt,name=block_set,json=blockSet,proto3,oneof"`
}
type Spec_BlockMap struct {
BlockMap *BlockMap `protobuf:"bytes,8,opt,name=block_map,json=blockMap,proto3,oneof"`
}
type Spec_Default struct {
Default *Default `protobuf:"bytes,9,opt,name=default,proto3,oneof"`
}
type Spec_Literal struct {
Literal *Literal `protobuf:"bytes,10,opt,name=literal,proto3,oneof"`
}
func (*Spec_Object) isSpec_Block() {}
func (*Spec_Array) isSpec_Block() {}
func (*Spec_Attr) isSpec_Block() {}
func (*Spec_BlockValue) isSpec_Block() {}
func (*Spec_BlockAttrs) isSpec_Block() {}
func (*Spec_BlockList) isSpec_Block() {}
func (*Spec_BlockSet) isSpec_Block() {}
func (*Spec_BlockMap) isSpec_Block() {}
func (*Spec_Default) isSpec_Block() {}
func (*Spec_Literal) isSpec_Block() {}
func (m *Spec) GetBlock() isSpec_Block {
if m != nil {
return m.Block
}
return nil
}
func (m *Spec) GetObject() *Object {
if x, ok := m.GetBlock().(*Spec_Object); ok {
return x.Object
}
return nil
}
func (m *Spec) GetArray() *Array {
if x, ok := m.GetBlock().(*Spec_Array); ok {
return x.Array
}
return nil
}
func (m *Spec) GetAttr() *Attr {
if x, ok := m.GetBlock().(*Spec_Attr); ok {
return x.Attr
}
return nil
}
func (m *Spec) GetBlockValue() *Block {
if x, ok := m.GetBlock().(*Spec_BlockValue); ok {
return x.BlockValue
}
return nil
}
func (m *Spec) GetBlockAttrs() *BlockAttrs {
if x, ok := m.GetBlock().(*Spec_BlockAttrs); ok {
return x.BlockAttrs
}
return nil
}
func (m *Spec) GetBlockList() *BlockList {
if x, ok := m.GetBlock().(*Spec_BlockList); ok {
return x.BlockList
}
return nil
}
func (m *Spec) GetBlockSet() *BlockSet {
if x, ok := m.GetBlock().(*Spec_BlockSet); ok {
return x.BlockSet
}
return nil
}
func (m *Spec) GetBlockMap() *BlockMap {
if x, ok := m.GetBlock().(*Spec_BlockMap); ok {
return x.BlockMap
}
return nil
}
func (m *Spec) GetDefault() *Default {
if x, ok := m.GetBlock().(*Spec_Default); ok {
return x.Default
}
return nil
}
func (m *Spec) GetLiteral() *Literal {
if x, ok := m.GetBlock().(*Spec_Literal); ok {
return x.Literal
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Spec) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*Spec_Object)(nil),
(*Spec_Array)(nil),
(*Spec_Attr)(nil),
(*Spec_BlockValue)(nil),
(*Spec_BlockAttrs)(nil),
(*Spec_BlockList)(nil),
(*Spec_BlockSet)(nil),
(*Spec_BlockMap)(nil),
(*Spec_Default)(nil),
(*Spec_Literal)(nil),
}
}
// Attr spec type reads the value of an attribute in the current body
// and returns that value as its result. It also creates validation constraints
// for the given attribute name and its value.
//
// ```hcl
// Attr {
// name = "document_root"
// type = string
// required = true
// }
// ```
//
// `Attr` spec blocks accept the following arguments:
//
// `name` (required) - The attribute name to expect within the HCL input file.
// This may be omitted when a default name selector is created by a parent
// `Object` spec, if the input attribute name should match the output JSON
// object property name.
//
// `type` (optional) - A [type expression](#type-expressions) that the given
// attribute value must conform to. If this argument is set, `hcldec` will
// automatically convert the given input value to this type or produce an
// error if that is not possible.
//
// `required` (optional) - If set to `true`, `hcldec` will produce an error
// if a value is not provided for the source attribute.
//
// `Attr` is a leaf spec type, so no nested spec blocks are permitted.
type Attr struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Required bool `protobuf:"varint,3,opt,name=required,proto3" json:"required,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Attr) Reset() { *m = Attr{} }
func (m *Attr) String() string { return proto.CompactTextString(m) }
func (*Attr) ProtoMessage() {}
func (*Attr) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{1}
}
func (m *Attr) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Attr.Unmarshal(m, b)
}
func (m *Attr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Attr.Marshal(b, m, deterministic)
}
func (m *Attr) XXX_Merge(src proto.Message) {
xxx_messageInfo_Attr.Merge(m, src)
}
func (m *Attr) XXX_Size() int {
return xxx_messageInfo_Attr.Size(m)
}
func (m *Attr) XXX_DiscardUnknown() {
xxx_messageInfo_Attr.DiscardUnknown(m)
}
var xxx_messageInfo_Attr proto.InternalMessageInfo
func (m *Attr) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Attr) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *Attr) GetRequired() bool {
if m != nil {
return m.Required
}
return false
}
// Block spec type applies one nested spec block to the contents of a
// block within the current body and returns the result of that spec. It also
// creates validation constraints for the given block type name.
//
// ```hcl
// Block {
// name = "logging"
//
// Object {
// Attr "level" {
// type = string
// }
// Attr "file" {
// type = string
// }
// }
// }
// ```
//
// `Block` spec blocks accept the following arguments:
//
// `name` (required) - The block type name to expect within the HCL
// input file. This may be omitted when a default name selector is created
// by a parent `Object` spec, if the input block type name should match the
// output JSON object property name.
//
// `required` (optional) - If set to `true`, `hcldec` will produce an error
// if a block of the specified type is not present in the current body.
//
// `Block` creates a validation constraint that there must be zero or one blocks
// of the given type name, or exactly one if `required` is set.
//
// `Block` expects a single nested spec block, which is applied to the body of
// the block of the given type when it is present.
type Block struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Required bool `protobuf:"varint,2,opt,name=required,proto3" json:"required,omitempty"`
Nested *Spec `protobuf:"bytes,3,opt,name=nested,proto3" json:"nested,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Block) Reset() { *m = Block{} }
func (m *Block) String() string { return proto.CompactTextString(m) }
func (*Block) ProtoMessage() {}
func (*Block) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{2}
}
func (m *Block) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Block.Unmarshal(m, b)
}
func (m *Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Block.Marshal(b, m, deterministic)
}
func (m *Block) XXX_Merge(src proto.Message) {
xxx_messageInfo_Block.Merge(m, src)
}
func (m *Block) XXX_Size() int {
return xxx_messageInfo_Block.Size(m)
}
func (m *Block) XXX_DiscardUnknown() {
xxx_messageInfo_Block.DiscardUnknown(m)
}
var xxx_messageInfo_Block proto.InternalMessageInfo
func (m *Block) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Block) GetRequired() bool {
if m != nil {
return m.Required
}
return false
}
func (m *Block) GetNested() *Spec {
if m != nil {
return m.Nested
}
return nil
}
// The BlockAttrs spec type is similar to an Attr spec block of a map type,
// but it produces a map from the attributes of a block rather than from an
// attribute's expression.
//
// ```hcl
// BlockAttrs {
// name = "variables"
// type = string
// required = false
// }
// ```
//
// This allows a map with user-defined keys to be produced within block syntax,
// but due to the constraints of that syntax it also means that the user will
// be unable to dynamically-generate either individual key names using key
// expressions or the entire map value using a `for` expression.
//
// `BlockAttrs` spec blocks accept the following arguments:
//
// `name` (required) - The block type name to expect within the HCL
// input file. This may be omitted when a default name selector is created
// by a parent `object` spec, if the input block type name should match the
// output JSON object property name.
//
// `type` (required) - The value type to require for each of the
// attributes within a matched block. The resulting value will be a JSON
// object whose property values are of this type.
//
// `required` (optional) - If `true`, an error will be produced if a block
// of the given type is not present. If `false` -- the default -- an absent
// block will be indicated by producing `null`.
type BlockAttrs struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Required bool `protobuf:"varint,3,opt,name=required,proto3" json:"required,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BlockAttrs) Reset() { *m = BlockAttrs{} }
func (m *BlockAttrs) String() string { return proto.CompactTextString(m) }
func (*BlockAttrs) ProtoMessage() {}
func (*BlockAttrs) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{3}
}
func (m *BlockAttrs) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockAttrs.Unmarshal(m, b)
}
func (m *BlockAttrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BlockAttrs.Marshal(b, m, deterministic)
}
func (m *BlockAttrs) XXX_Merge(src proto.Message) {
xxx_messageInfo_BlockAttrs.Merge(m, src)
}
func (m *BlockAttrs) XXX_Size() int {
return xxx_messageInfo_BlockAttrs.Size(m)
}
func (m *BlockAttrs) XXX_DiscardUnknown() {
xxx_messageInfo_BlockAttrs.DiscardUnknown(m)
}
var xxx_messageInfo_BlockAttrs proto.InternalMessageInfo
func (m *BlockAttrs) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *BlockAttrs) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *BlockAttrs) GetRequired() bool {
if m != nil {
return m.Required
}
return false
}
// BlockList spec type is similar to `Block`, but it accepts zero or
// more blocks of a specified type rather than requiring zero or one. The
// result is a JSON array with one entry per block of the given type.
//
// ```hcl
// BlockList {
// name = "log_file"
//
// Object {
// Attr "level" {
// type = string
// }
// Attr "filename" {
// type = string
// required = true
// }
// }
// }
// ```
//
// `BlockList` spec blocks accept the following arguments:
//
// `name` (required) - The block type name to expect within the HCL
// input file. This may be omitted when a default name selector is created
// by a parent `Object` spec, if the input block type name should match the
// output JSON object property name.
//
// `min_items` (optional) - If set to a number greater than zero, `hcldec` will
// produce an error if fewer than the given number of blocks are present.
//
// `max_items` (optional) - If set to a number greater than zero, `hcldec` will
// produce an error if more than the given number of blocks are present. This
// attribute must be greater than or equal to `min_items` if both are set.
//
// `Block` creates a validation constraint on the number of blocks of the given
// type that must be present.
//
// `Block` expects a single nested spec block, which is applied to the body of
// each matching block to produce the resulting list items.
type BlockList struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
MinItems uint64 `protobuf:"varint,2,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
MaxItems uint64 `protobuf:"varint,3,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
Nested *Spec `protobuf:"bytes,4,opt,name=nested,proto3" json:"nested,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BlockList) Reset() { *m = BlockList{} }
func (m *BlockList) String() string { return proto.CompactTextString(m) }
func (*BlockList) ProtoMessage() {}
func (*BlockList) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{4}
}
func (m *BlockList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockList.Unmarshal(m, b)
}
func (m *BlockList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BlockList.Marshal(b, m, deterministic)
}
func (m *BlockList) XXX_Merge(src proto.Message) {
xxx_messageInfo_BlockList.Merge(m, src)
}
func (m *BlockList) XXX_Size() int {
return xxx_messageInfo_BlockList.Size(m)
}
func (m *BlockList) XXX_DiscardUnknown() {
xxx_messageInfo_BlockList.DiscardUnknown(m)
}
var xxx_messageInfo_BlockList proto.InternalMessageInfo
func (m *BlockList) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *BlockList) GetMinItems() uint64 {
if m != nil {
return m.MinItems
}
return 0
}
func (m *BlockList) GetMaxItems() uint64 {
if m != nil {
return m.MaxItems
}
return 0
}
func (m *BlockList) GetNested() *Spec {
if m != nil {
return m.Nested
}
return nil
}
// BlockSet spec type behaves the same as BlockList except that
// the result is in no specific order and any duplicate items are removed.
//
// ```hcl
// BlockSet {
// name = "log_file"
//
// Object {
// Attr "level" {
// type = string
// }
// Attr "filename" {
// type = string
// required = true
// }
// }
// }
// ```
//
// The contents of `BlockSet` are the same as for `BlockList`.
type BlockSet struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
MinItems uint64 `protobuf:"varint,2,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
MaxItems uint64 `protobuf:"varint,3,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
Nested *Spec `protobuf:"bytes,4,opt,name=nested,proto3" json:"nested,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BlockSet) Reset() { *m = BlockSet{} }
func (m *BlockSet) String() string { return proto.CompactTextString(m) }
func (*BlockSet) ProtoMessage() {}
func (*BlockSet) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{5}
}
func (m *BlockSet) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockSet.Unmarshal(m, b)
}
func (m *BlockSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BlockSet.Marshal(b, m, deterministic)
}
func (m *BlockSet) XXX_Merge(src proto.Message) {
xxx_messageInfo_BlockSet.Merge(m, src)
}
func (m *BlockSet) XXX_Size() int {
return xxx_messageInfo_BlockSet.Size(m)
}
func (m *BlockSet) XXX_DiscardUnknown() {
xxx_messageInfo_BlockSet.DiscardUnknown(m)
}
var xxx_messageInfo_BlockSet proto.InternalMessageInfo
func (m *BlockSet) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *BlockSet) GetMinItems() uint64 {
if m != nil {
return m.MinItems
}
return 0
}
func (m *BlockSet) GetMaxItems() uint64 {
if m != nil {
return m.MaxItems
}
return 0
}
func (m *BlockSet) GetNested() *Spec {
if m != nil {
return m.Nested
}
return nil
}
// BlockMap spec type is similar to `Block`, but it accepts zero or
// more blocks of a specified type rather than requiring zero or one. The
// result is a JSON object, or possibly multiple nested JSON objects, whose
// properties are derived from the labels set on each matching block.
//
// ```hcl
// BlockMap {
// name = "log_file"
// labels = ["filename"]
//
// Object {
// Attr "level" {
// type = string
// required = true
// }
// }
// }
// ```
//
// `BlockMap` spec blocks accept the following arguments:
//
// `name` (required) - The block type name to expect within the HCL
// input file. This may be omitted when a default name selector is created
// by a parent `Object` spec, if the input block type name should match the
// output JSON object property name.
//
// `labels` (required) - A list of user-oriented block label names. Each entry
// in this list creates one level of object within the output value, and
// requires one additional block header label on any child block of this type.
// Block header labels are the quoted strings that appear after the block type
// name but before the opening `{`.
//
// `Block` creates a validation constraint on the number of labels that blocks
// of the given type must have.
//
// `Block` expects a single nested spec block, which is applied to the body of
// each matching block to produce the resulting map items.
type BlockMap struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Labels []string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty"`
Nested *Spec `protobuf:"bytes,3,opt,name=nested,proto3" json:"nested,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *BlockMap) Reset() { *m = BlockMap{} }
func (m *BlockMap) String() string { return proto.CompactTextString(m) }
func (*BlockMap) ProtoMessage() {}
func (*BlockMap) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{6}
}
func (m *BlockMap) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BlockMap.Unmarshal(m, b)
}
func (m *BlockMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_BlockMap.Marshal(b, m, deterministic)
}
func (m *BlockMap) XXX_Merge(src proto.Message) {
xxx_messageInfo_BlockMap.Merge(m, src)
}
func (m *BlockMap) XXX_Size() int {
return xxx_messageInfo_BlockMap.Size(m)
}
func (m *BlockMap) XXX_DiscardUnknown() {
xxx_messageInfo_BlockMap.DiscardUnknown(m)
}
var xxx_messageInfo_BlockMap proto.InternalMessageInfo
func (m *BlockMap) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *BlockMap) GetLabels() []string {
if m != nil {
return m.Labels
}
return nil
}
func (m *BlockMap) GetNested() *Spec {
if m != nil {
return m.Nested
}
return nil
}
// Literal spec type returns a given literal value, and creates no
// validation constraints. It is most commonly used with the `Default` spec
// type to create a fallback value, but can also be used e.g. to fill out
// required properties in an `Object` spec that do not correspond to any
// construct in the input configuration.
//
// ```hcl
// Literal {
// value = "hello world"
// }
// ```
//
// `Literal` spec blocks accept the following argument:
//
// `value` (required) - The value to return. This attribute may be an expression
// that uses [functions](#spec-definition-functions).
//
// `Literal` is a leaf spec type, so no nested spec blocks are permitted.
type Literal struct {
Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Literal) Reset() { *m = Literal{} }
func (m *Literal) String() string { return proto.CompactTextString(m) }
func (*Literal) ProtoMessage() {}
func (*Literal) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{7}
}
func (m *Literal) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Literal.Unmarshal(m, b)
}
func (m *Literal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Literal.Marshal(b, m, deterministic)
}
func (m *Literal) XXX_Merge(src proto.Message) {
xxx_messageInfo_Literal.Merge(m, src)
}
func (m *Literal) XXX_Size() int {
return xxx_messageInfo_Literal.Size(m)
}
func (m *Literal) XXX_DiscardUnknown() {
xxx_messageInfo_Literal.DiscardUnknown(m)
}
var xxx_messageInfo_Literal proto.InternalMessageInfo
func (m *Literal) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
// Default spec type evaluates a sequence of nested specs in turn and
// returns the result of the first one that produces a non-null value.
// It creates no validation constraints of its own, but passes on the validation
// constraints from its first nested block.
//
// ```hcl
// Default {
// Attr {
// name = "private"
// type = bool
// }
// Literal {
// value = false
// }
// }
// ```
//
// A `Default` spec block must have at least one nested spec block, and should
// generally have at least two since otherwise the `Default` wrapper is a no-op.
//
// The second and any subsequent spec blocks are _fallback_ specs. These exhibit
// their usual behavior but are not able to impose validation constraints on the
// current body since they are not evaluated unless all prior specs produce
// `null` as their result.
type Default struct {
Primary *Spec `protobuf:"bytes,1,opt,name=primary,proto3" json:"primary,omitempty"`
Default *Spec `protobuf:"bytes,2,opt,name=default,proto3" json:"default,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Default) Reset() { *m = Default{} }
func (m *Default) String() string { return proto.CompactTextString(m) }
func (*Default) ProtoMessage() {}
func (*Default) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{8}
}
func (m *Default) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Default.Unmarshal(m, b)
}
func (m *Default) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Default.Marshal(b, m, deterministic)
}
func (m *Default) XXX_Merge(src proto.Message) {
xxx_messageInfo_Default.Merge(m, src)
}
func (m *Default) XXX_Size() int {
return xxx_messageInfo_Default.Size(m)
}
func (m *Default) XXX_DiscardUnknown() {
xxx_messageInfo_Default.DiscardUnknown(m)
}
var xxx_messageInfo_Default proto.InternalMessageInfo
func (m *Default) GetPrimary() *Spec {
if m != nil {
return m.Primary
}
return nil
}
func (m *Default) GetDefault() *Spec {
if m != nil {
return m.Default
}
return nil
}
// Object spec type is the most commonly used at the root of a spec file.
// Its result is a JSON object whose properties are set based on any nested
// spec blocks:
//
// ```hcl
// Object {
// Attr "name" {
// type = "string"
// }
// Block "address" {
// Object {
// Attr "street" {
// type = "string"
// }
// # ...
// }
// }
// }
// ```
//
// Nested spec blocks inside `Object` must always have an extra block label
// `"name"`, `"address"` and `"street"` in the above example) that specifies
// the name of the property that should be created in the JSON object result.
// This label also acts as a default name selector for the nested spec, allowing
// the `Attr` blocks in the above example to omit the usually-required `name`
// argument in cases where the HCL input name and JSON output name are the same.
//
// An `Object` spec block creates no validation constraints, but it passes on
// any validation constraints created by the nested specs.
type Object struct {
Attributes map[string]*Spec `protobuf:"bytes,1,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Object) Reset() { *m = Object{} }
func (m *Object) String() string { return proto.CompactTextString(m) }
func (*Object) ProtoMessage() {}
func (*Object) Descriptor() ([]byte, []int) {
return fileDescriptor_28863966909039be, []int{9}
}
func (m *Object) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Object.Unmarshal(m, b)
}
func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Object.Marshal(b, m, deterministic)
}
func (m *Object) XXX_Merge(src proto.Message) {
xxx_messageInfo_Object.Merge(m, src)
}
func (m *Object) XXX_Size() int {
return xxx_messageInfo_Object.Size(m)
}
func (m *Object) XXX_DiscardUnknown() {
xxx_messageInfo_Object.DiscardUnknown(m)
}
var xxx_messageInfo_Object proto.InternalMessageInfo
func (m *Object) GetAttributes() map[string]*Spec {