本文整理汇总了Golang中github.com/hooklift/terraform-provider-vix/provider/vix.VM.CPUs方法的典型用法代码示例。如果您正苦于以下问题:Golang VM.CPUs方法的具体用法?Golang VM.CPUs怎么用?Golang VM.CPUs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/hooklift/terraform-provider-vix/provider/vix.VM
的用法示例。
在下文中一共展示了VM.CPUs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: tf_to_vix
// Maps Terraform attributes to provider's structs
func tf_to_vix(d *schema.ResourceData, vm *vix.VM) error {
var err error
vm.Name = d.Get("name").(string)
vm.Description = d.Get("description").(string)
vm.CPUs = uint(d.Get("cpus").(int))
vm.Memory = d.Get("memory").(string)
vm.UpgradeVHardware = d.Get("upgrade_vhardware").(bool)
vm.LaunchGUI = d.Get("gui").(bool)
vm.SharedFolders = d.Get("sharedfolders").(bool)
vm.ToolsInitTimeout, err = time.ParseDuration(d.Get("tools_init_timeout").(string))
// Maps any defined networks to VIX provider's data types
err = net_tf_to_vix(d, vm)
if err != nil {
return fmt.Errorf("Error mapping TF network adapter resource to VIX data types: %s", err)
}
if i := d.Get("image.#").(int); i > 0 {
prefix := "image.0."
vm.Image = vix.Image{
URL: d.Get(prefix + "url").(string),
Checksum: d.Get(prefix + "checksum").(string),
ChecksumType: d.Get(prefix + "checksum_type").(string),
Password: d.Get(prefix + "password").(string),
}
}
err = cdrom_tf_to_vix(d, vm)
if err != nil {
return fmt.Errorf("Error mapping TF cdrom resource to VIX data types: %s", err)
}
return nil
}