2020-02-21 10:47:46 -05:00
|
|
|
// Code generated by "mapstructure-to-hcl2 -type NIC,CreateConfig,DiskConfig"; DO NOT EDIT.
|
2020-01-07 19:59:31 -05:00
|
|
|
package iso
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/hcl/v2/hcldec"
|
|
|
|
"github.com/zclconf/go-cty/cty"
|
|
|
|
)
|
|
|
|
|
|
|
|
// FlatCreateConfig is an auto-generated flat version of CreateConfig.
|
|
|
|
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
|
|
|
type FlatCreateConfig struct {
|
HCL2: generate hcl tags with go-cty tags too (#9306)
This will allow to generate the config files:
```go
package main
import (
"fmt"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/hashicorp/packer/builder/alicloud/ecs"
)
func main() {
name := "name"
app := ecs.FlatConfig{
AlicloudImageName: &name,
ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
DiskName: &name,
},
}
f := hclwrite.NewEmptyFile()
block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
f.Body().AppendBlock(block)
fmt.Printf("%s", f.Bytes())
}
```
Will output:
```
source "something" "something" {
packer_user_variables = null
packer_sensitive_variables = null
image_name = "name"
image_share_account = null
image_unshare_account = null
image_copy_regions = null
image_copy_names = null
tags = null
tag = null
system_disk_mapping = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
image_disk_mappings = null
ssh_remote_tunnels = null
ssh_local_tunnels = null
ssh_public_key = null
ssh_private_key = null
}
```
This is a good first step for #9015 and #9282
fix #9304
2020-05-28 05:19:00 -04:00
|
|
|
Version *uint `mapstructure:"vm_version" cty:"vm_version" hcl:"vm_version"`
|
|
|
|
GuestOSType *string `mapstructure:"guest_os_type" cty:"guest_os_type" hcl:"guest_os_type"`
|
2020-07-10 06:25:46 -04:00
|
|
|
DiskControllerType []string `mapstructure:"disk_controller_type" cty:"disk_controller_type" hcl:"disk_controller_type"`
|
HCL2: generate hcl tags with go-cty tags too (#9306)
This will allow to generate the config files:
```go
package main
import (
"fmt"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/hashicorp/packer/builder/alicloud/ecs"
)
func main() {
name := "name"
app := ecs.FlatConfig{
AlicloudImageName: &name,
ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
DiskName: &name,
},
}
f := hclwrite.NewEmptyFile()
block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
f.Body().AppendBlock(block)
fmt.Printf("%s", f.Bytes())
}
```
Will output:
```
source "something" "something" {
packer_user_variables = null
packer_sensitive_variables = null
image_name = "name"
image_share_account = null
image_unshare_account = null
image_copy_regions = null
image_copy_names = null
tags = null
tag = null
system_disk_mapping = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
image_disk_mappings = null
ssh_remote_tunnels = null
ssh_local_tunnels = null
ssh_public_key = null
ssh_private_key = null
}
```
This is a good first step for #9015 and #9282
fix #9304
2020-05-28 05:19:00 -04:00
|
|
|
Storage []FlatDiskConfig `mapstructure:"storage" cty:"storage" hcl:"storage"`
|
|
|
|
NICs []FlatNIC `mapstructure:"network_adapters" cty:"network_adapters" hcl:"network_adapters"`
|
2020-07-13 20:25:56 -04:00
|
|
|
USBController []string `mapstructure:"usb_controller" cty:"usb_controller" hcl:"usb_controller"`
|
HCL2: generate hcl tags with go-cty tags too (#9306)
This will allow to generate the config files:
```go
package main
import (
"fmt"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/hashicorp/packer/builder/alicloud/ecs"
)
func main() {
name := "name"
app := ecs.FlatConfig{
AlicloudImageName: &name,
ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
DiskName: &name,
},
}
f := hclwrite.NewEmptyFile()
block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
f.Body().AppendBlock(block)
fmt.Printf("%s", f.Bytes())
}
```
Will output:
```
source "something" "something" {
packer_user_variables = null
packer_sensitive_variables = null
image_name = "name"
image_share_account = null
image_unshare_account = null
image_copy_regions = null
image_copy_names = null
tags = null
tag = null
system_disk_mapping = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
image_disk_mappings = null
ssh_remote_tunnels = null
ssh_local_tunnels = null
ssh_public_key = null
ssh_private_key = null
}
```
This is a good first step for #9015 and #9282
fix #9304
2020-05-28 05:19:00 -04:00
|
|
|
Notes *string `mapstructure:"notes" cty:"notes" hcl:"notes"`
|
2020-01-07 19:59:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// FlatMapstructure returns a new FlatCreateConfig.
|
|
|
|
// FlatCreateConfig is an auto-generated flat version of CreateConfig.
|
|
|
|
// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
|
|
|
|
func (*CreateConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } {
|
|
|
|
return new(FlatCreateConfig)
|
|
|
|
}
|
|
|
|
|
|
|
|
// HCL2Spec returns the hcl spec of a CreateConfig.
|
|
|
|
// This spec is used by HCL to read the fields of CreateConfig.
|
|
|
|
// The decoded values from this spec will then be applied to a FlatCreateConfig.
|
|
|
|
func (*FlatCreateConfig) HCL2Spec() map[string]hcldec.Spec {
|
|
|
|
s := map[string]hcldec.Spec{
|
2020-05-19 10:06:12 -04:00
|
|
|
"vm_version": &hcldec.AttrSpec{Name: "vm_version", Type: cty.Number, Required: false},
|
|
|
|
"guest_os_type": &hcldec.AttrSpec{Name: "guest_os_type", Type: cty.String, Required: false},
|
2020-07-10 06:25:46 -04:00
|
|
|
"disk_controller_type": &hcldec.AttrSpec{Name: "disk_controller_type", Type: cty.List(cty.String), Required: false},
|
2020-05-19 10:06:12 -04:00
|
|
|
"storage": &hcldec.BlockListSpec{TypeName: "storage", Nested: hcldec.ObjectSpec((*FlatDiskConfig)(nil).HCL2Spec())},
|
|
|
|
"network_adapters": &hcldec.BlockListSpec{TypeName: "network_adapters", Nested: hcldec.ObjectSpec((*FlatNIC)(nil).HCL2Spec())},
|
2020-07-13 20:25:56 -04:00
|
|
|
"usb_controller": &hcldec.AttrSpec{Name: "usb_controller", Type: cty.List(cty.String), Required: false},
|
2020-05-19 10:06:12 -04:00
|
|
|
"notes": &hcldec.AttrSpec{Name: "notes", Type: cty.String, Required: false},
|
2020-01-07 19:59:31 -05:00
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
2020-02-14 11:51:57 -05:00
|
|
|
|
2020-02-21 10:47:46 -05:00
|
|
|
// FlatDiskConfig is an auto-generated flat version of DiskConfig.
|
|
|
|
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
|
|
|
type FlatDiskConfig struct {
|
HCL2: generate hcl tags with go-cty tags too (#9306)
This will allow to generate the config files:
```go
package main
import (
"fmt"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/hashicorp/packer/builder/alicloud/ecs"
)
func main() {
name := "name"
app := ecs.FlatConfig{
AlicloudImageName: &name,
ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
DiskName: &name,
},
}
f := hclwrite.NewEmptyFile()
block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
f.Body().AppendBlock(block)
fmt.Printf("%s", f.Bytes())
}
```
Will output:
```
source "something" "something" {
packer_user_variables = null
packer_sensitive_variables = null
image_name = "name"
image_share_account = null
image_unshare_account = null
image_copy_regions = null
image_copy_names = null
tags = null
tag = null
system_disk_mapping = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
image_disk_mappings = null
ssh_remote_tunnels = null
ssh_local_tunnels = null
ssh_public_key = null
ssh_private_key = null
}
```
This is a good first step for #9015 and #9282
fix #9304
2020-05-28 05:19:00 -04:00
|
|
|
DiskSize *int64 `mapstructure:"disk_size" required:"true" cty:"disk_size" hcl:"disk_size"`
|
|
|
|
DiskThinProvisioned *bool `mapstructure:"disk_thin_provisioned" cty:"disk_thin_provisioned" hcl:"disk_thin_provisioned"`
|
|
|
|
DiskEagerlyScrub *bool `mapstructure:"disk_eagerly_scrub" cty:"disk_eagerly_scrub" hcl:"disk_eagerly_scrub"`
|
2020-07-10 06:25:46 -04:00
|
|
|
DiskControllerIndex *int `mapstructure:"disk_controller_index" cty:"disk_controller_index" hcl:"disk_controller_index"`
|
2020-02-21 10:47:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// FlatMapstructure returns a new FlatDiskConfig.
|
|
|
|
// FlatDiskConfig is an auto-generated flat version of DiskConfig.
|
|
|
|
// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
|
|
|
|
func (*DiskConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } {
|
|
|
|
return new(FlatDiskConfig)
|
|
|
|
}
|
|
|
|
|
|
|
|
// HCL2Spec returns the hcl spec of a DiskConfig.
|
|
|
|
// This spec is used by HCL to read the fields of DiskConfig.
|
|
|
|
// The decoded values from this spec will then be applied to a FlatDiskConfig.
|
|
|
|
func (*FlatDiskConfig) HCL2Spec() map[string]hcldec.Spec {
|
|
|
|
s := map[string]hcldec.Spec{
|
|
|
|
"disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false},
|
|
|
|
"disk_thin_provisioned": &hcldec.AttrSpec{Name: "disk_thin_provisioned", Type: cty.Bool, Required: false},
|
|
|
|
"disk_eagerly_scrub": &hcldec.AttrSpec{Name: "disk_eagerly_scrub", Type: cty.Bool, Required: false},
|
2020-07-10 06:25:46 -04:00
|
|
|
"disk_controller_index": &hcldec.AttrSpec{Name: "disk_controller_index", Type: cty.Number, Required: false},
|
2020-02-21 10:47:46 -05:00
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
2020-02-14 11:51:57 -05:00
|
|
|
// FlatNIC is an auto-generated flat version of NIC.
|
|
|
|
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
|
|
|
|
type FlatNIC struct {
|
HCL2: generate hcl tags with go-cty tags too (#9306)
This will allow to generate the config files:
```go
package main
import (
"fmt"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/hashicorp/packer/builder/alicloud/ecs"
)
func main() {
name := "name"
app := ecs.FlatConfig{
AlicloudImageName: &name,
ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
DiskName: &name,
},
}
f := hclwrite.NewEmptyFile()
block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
f.Body().AppendBlock(block)
fmt.Printf("%s", f.Bytes())
}
```
Will output:
```
source "something" "something" {
packer_user_variables = null
packer_sensitive_variables = null
image_name = "name"
image_share_account = null
image_unshare_account = null
image_copy_regions = null
image_copy_names = null
tags = null
tag = null
system_disk_mapping = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
image_disk_mappings = null
ssh_remote_tunnels = null
ssh_local_tunnels = null
ssh_public_key = null
ssh_private_key = null
}
```
This is a good first step for #9015 and #9282
fix #9304
2020-05-28 05:19:00 -04:00
|
|
|
Network *string `mapstructure:"network" cty:"network" hcl:"network"`
|
|
|
|
NetworkCard *string `mapstructure:"network_card" required:"true" cty:"network_card" hcl:"network_card"`
|
|
|
|
MacAddress *string `mapstructure:"mac_address" cty:"mac_address" hcl:"mac_address"`
|
|
|
|
Passthrough *bool `mapstructure:"passthrough" cty:"passthrough" hcl:"passthrough"`
|
2020-02-14 11:51:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// FlatMapstructure returns a new FlatNIC.
|
|
|
|
// FlatNIC is an auto-generated flat version of NIC.
|
|
|
|
// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
|
2020-03-17 07:30:36 -04:00
|
|
|
func (*NIC) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } {
|
|
|
|
return new(FlatNIC)
|
|
|
|
}
|
2020-02-14 11:51:57 -05:00
|
|
|
|
|
|
|
// HCL2Spec returns the hcl spec of a NIC.
|
|
|
|
// This spec is used by HCL to read the fields of NIC.
|
|
|
|
// The decoded values from this spec will then be applied to a FlatNIC.
|
|
|
|
func (*FlatNIC) HCL2Spec() map[string]hcldec.Spec {
|
|
|
|
s := map[string]hcldec.Spec{
|
|
|
|
"network": &hcldec.AttrSpec{Name: "network", Type: cty.String, Required: false},
|
|
|
|
"network_card": &hcldec.AttrSpec{Name: "network_card", Type: cty.String, Required: false},
|
|
|
|
"mac_address": &hcldec.AttrSpec{Name: "mac_address", Type: cty.String, Required: false},
|
|
|
|
"passthrough": &hcldec.AttrSpec{Name: "passthrough", Type: cty.Bool, Required: false},
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|