github.com/hashicorp/packer@v1.14.3/hcl2template/shim/mock.hcl2spec.go (about)

     1  // Code generated by "packer-sdc mapstructure-to-hcl2"; DO NOT EDIT.
     2  
     3  package hcl2shim
     4  
     5  import (
     6  	"github.com/hashicorp/hcl/v2/hcldec"
     7  	"github.com/zclconf/go-cty/cty"
     8  )
     9  
    10  // FlatMockConfig is an auto-generated flat version of MockConfig.
    11  // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
    12  type FlatMockConfig struct {
    13  	NotSquashed          *string                `mapstructure:"not_squashed" cty:"not_squashed" hcl:"not_squashed"`
    14  	String               *string                `mapstructure:"string" cty:"string" hcl:"string"`
    15  	Int                  *int                   `mapstructure:"int" cty:"int" hcl:"int"`
    16  	Int64                *int64                 `mapstructure:"int64" cty:"int64" hcl:"int64"`
    17  	Bool                 *bool                  `mapstructure:"bool" cty:"bool" hcl:"bool"`
    18  	Trilean              *bool                  `mapstructure:"trilean" cty:"trilean" hcl:"trilean"`
    19  	Duration             *string                `mapstructure:"duration" cty:"duration" hcl:"duration"`
    20  	MapStringString      map[string]string      `mapstructure:"map_string_string" cty:"map_string_string" hcl:"map_string_string"`
    21  	SliceString          []string               `mapstructure:"slice_string" cty:"slice_string" hcl:"slice_string"`
    22  	SliceSliceString     [][]string             `mapstructure:"slice_slice_string" cty:"slice_slice_string" hcl:"slice_slice_string"`
    23  	NamedMapStringString NamedMapStringString   `mapstructure:"named_map_string_string" cty:"named_map_string_string" hcl:"named_map_string_string"`
    24  	NamedString          *NamedString           `mapstructure:"named_string" cty:"named_string" hcl:"named_string"`
    25  	Tags                 []FlatMockTag          `mapstructure:"tag" cty:"tag" hcl:"tag"`
    26  	Datasource           *string                `mapstructure:"data_source" cty:"data_source" hcl:"data_source"`
    27  	Nested               *FlatNestedMockConfig  `mapstructure:"nested" cty:"nested" hcl:"nested"`
    28  	NestedSlice          []FlatNestedMockConfig `mapstructure:"nested_slice" cty:"nested_slice" hcl:"nested_slice"`
    29  }
    30  
    31  // FlatMapstructure returns a new FlatMockConfig.
    32  // FlatMockConfig is an auto-generated flat version of MockConfig.
    33  // Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
    34  func (*MockConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } {
    35  	return new(FlatMockConfig)
    36  }
    37  
    38  // HCL2Spec returns the hcl spec of a MockConfig.
    39  // This spec is used by HCL to read the fields of MockConfig.
    40  // The decoded values from this spec will then be applied to a FlatMockConfig.
    41  func (*FlatMockConfig) HCL2Spec() map[string]hcldec.Spec {
    42  	s := map[string]hcldec.Spec{
    43  		"not_squashed":            &hcldec.AttrSpec{Name: "not_squashed", Type: cty.String, Required: false},
    44  		"string":                  &hcldec.AttrSpec{Name: "string", Type: cty.String, Required: false},
    45  		"int":                     &hcldec.AttrSpec{Name: "int", Type: cty.Number, Required: false},
    46  		"int64":                   &hcldec.AttrSpec{Name: "int64", Type: cty.Number, Required: false},
    47  		"bool":                    &hcldec.AttrSpec{Name: "bool", Type: cty.Bool, Required: false},
    48  		"trilean":                 &hcldec.AttrSpec{Name: "trilean", Type: cty.Bool, Required: false},
    49  		"duration":                &hcldec.AttrSpec{Name: "duration", Type: cty.String, Required: false},
    50  		"map_string_string":       &hcldec.AttrSpec{Name: "map_string_string", Type: cty.Map(cty.String), Required: false},
    51  		"slice_string":            &hcldec.AttrSpec{Name: "slice_string", Type: cty.List(cty.String), Required: false},
    52  		"slice_slice_string":      &hcldec.AttrSpec{Name: "slice_slice_string", Type: cty.List(cty.List(cty.String)), Required: false},
    53  		"named_map_string_string": &hcldec.AttrSpec{Name: "named_map_string_string", Type: cty.Map(cty.String), Required: false},
    54  		"named_string":            &hcldec.AttrSpec{Name: "named_string", Type: cty.String, Required: false},
    55  		"tag":                     &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*FlatMockTag)(nil).HCL2Spec())},
    56  		"data_source":             &hcldec.AttrSpec{Name: "data_source", Type: cty.String, Required: false},
    57  		"nested":                  &hcldec.BlockSpec{TypeName: "nested", Nested: hcldec.ObjectSpec((*FlatNestedMockConfig)(nil).HCL2Spec())},
    58  		"nested_slice":            &hcldec.BlockListSpec{TypeName: "nested_slice", Nested: hcldec.ObjectSpec((*FlatNestedMockConfig)(nil).HCL2Spec())},
    59  	}
    60  	return s
    61  }
    62  
    63  // FlatMockTag is an auto-generated flat version of MockTag.
    64  // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
    65  type FlatMockTag struct {
    66  	Key   *string `mapstructure:"key" cty:"key" hcl:"key"`
    67  	Value *string `mapstructure:"value" cty:"value" hcl:"value"`
    68  }
    69  
    70  // FlatMapstructure returns a new FlatMockTag.
    71  // FlatMockTag is an auto-generated flat version of MockTag.
    72  // Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
    73  func (*MockTag) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } {
    74  	return new(FlatMockTag)
    75  }
    76  
    77  // HCL2Spec returns the hcl spec of a MockTag.
    78  // This spec is used by HCL to read the fields of MockTag.
    79  // The decoded values from this spec will then be applied to a FlatMockTag.
    80  func (*FlatMockTag) HCL2Spec() map[string]hcldec.Spec {
    81  	s := map[string]hcldec.Spec{
    82  		"key":   &hcldec.AttrSpec{Name: "key", Type: cty.String, Required: false},
    83  		"value": &hcldec.AttrSpec{Name: "value", Type: cty.String, Required: false},
    84  	}
    85  	return s
    86  }
    87  
    88  // FlatNestedMockConfig is an auto-generated flat version of NestedMockConfig.
    89  // Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
    90  type FlatNestedMockConfig struct {
    91  	String               *string              `mapstructure:"string" cty:"string" hcl:"string"`
    92  	Int                  *int                 `mapstructure:"int" cty:"int" hcl:"int"`
    93  	Int64                *int64               `mapstructure:"int64" cty:"int64" hcl:"int64"`
    94  	Bool                 *bool                `mapstructure:"bool" cty:"bool" hcl:"bool"`
    95  	Trilean              *bool                `mapstructure:"trilean" cty:"trilean" hcl:"trilean"`
    96  	Duration             *string              `mapstructure:"duration" cty:"duration" hcl:"duration"`
    97  	MapStringString      map[string]string    `mapstructure:"map_string_string" cty:"map_string_string" hcl:"map_string_string"`
    98  	SliceString          []string             `mapstructure:"slice_string" cty:"slice_string" hcl:"slice_string"`
    99  	SliceSliceString     [][]string           `mapstructure:"slice_slice_string" cty:"slice_slice_string" hcl:"slice_slice_string"`
   100  	NamedMapStringString NamedMapStringString `mapstructure:"named_map_string_string" cty:"named_map_string_string" hcl:"named_map_string_string"`
   101  	NamedString          *NamedString         `mapstructure:"named_string" cty:"named_string" hcl:"named_string"`
   102  	Tags                 []FlatMockTag        `mapstructure:"tag" cty:"tag" hcl:"tag"`
   103  	Datasource           *string              `mapstructure:"data_source" cty:"data_source" hcl:"data_source"`
   104  }
   105  
   106  // FlatMapstructure returns a new FlatNestedMockConfig.
   107  // FlatNestedMockConfig is an auto-generated flat version of NestedMockConfig.
   108  // Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
   109  func (*NestedMockConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } {
   110  	return new(FlatNestedMockConfig)
   111  }
   112  
   113  // HCL2Spec returns the hcl spec of a NestedMockConfig.
   114  // This spec is used by HCL to read the fields of NestedMockConfig.
   115  // The decoded values from this spec will then be applied to a FlatNestedMockConfig.
   116  func (*FlatNestedMockConfig) HCL2Spec() map[string]hcldec.Spec {
   117  	s := map[string]hcldec.Spec{
   118  		"string":                  &hcldec.AttrSpec{Name: "string", Type: cty.String, Required: false},
   119  		"int":                     &hcldec.AttrSpec{Name: "int", Type: cty.Number, Required: false},
   120  		"int64":                   &hcldec.AttrSpec{Name: "int64", Type: cty.Number, Required: false},
   121  		"bool":                    &hcldec.AttrSpec{Name: "bool", Type: cty.Bool, Required: false},
   122  		"trilean":                 &hcldec.AttrSpec{Name: "trilean", Type: cty.Bool, Required: false},
   123  		"duration":                &hcldec.AttrSpec{Name: "duration", Type: cty.String, Required: false},
   124  		"map_string_string":       &hcldec.AttrSpec{Name: "map_string_string", Type: cty.Map(cty.String), Required: false},
   125  		"slice_string":            &hcldec.AttrSpec{Name: "slice_string", Type: cty.List(cty.String), Required: false},
   126  		"slice_slice_string":      &hcldec.AttrSpec{Name: "slice_slice_string", Type: cty.List(cty.List(cty.String)), Required: false},
   127  		"named_map_string_string": &hcldec.AttrSpec{Name: "named_map_string_string", Type: cty.Map(cty.String), Required: false},
   128  		"named_string":            &hcldec.AttrSpec{Name: "named_string", Type: cty.String, Required: false},
   129  		"tag":                     &hcldec.BlockListSpec{TypeName: "tag", Nested: hcldec.ObjectSpec((*FlatMockTag)(nil).HCL2Spec())},
   130  		"data_source":             &hcldec.AttrSpec{Name: "data_source", Type: cty.String, Required: false},
   131  	}
   132  	return s
   133  }