vsphere/virtual_machine_config_structure.go
func schemaVirtualMachineResourceAllocation() map[string]*schema.Schema {
	s := make(map[string]*schema.Schema)
	shareLevelFmt := "The allocation level for %s resources. Can be one of high, low, normal, or custom."
	shareCountFmt := "The amount of shares to allocate to %s for a custom share level."
	limitFmt := "The maximum amount of memory (in MB) or CPU (in MHz) that this virtual machine can consume, regardless of available resources."
	reservationFmt := "The amount of memory (in MB) or CPU (in MHz) that this virtual machine is guaranteed."

	for _, t := range virtualMachineResourceAllocationTypeValues {
		shareLevelKey := fmt.Sprintf("%s_share_level", t)
		shareCountKey := fmt.Sprintf("%s_share_count", t)
		limitKey := fmt.Sprintf("%s_limit", t)
		reservationKey := fmt.Sprintf("%s_reservation", t)

		s[shareLevelKey] = &schema.Schema{
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.SharesLevelNormal),
			Description:  fmt.Sprintf(shareLevelFmt, t),
			ValidateFunc: validation.StringInSlice(sharesLevelAllowedValues, false),
		}
		s[shareCountKey] = &schema.Schema{
			Type:         schema.TypeInt,
			Optional:     true,
			Computed:     true,
			Description:  fmt.Sprintf(shareCountFmt, t),
			ValidateFunc: validation.IntAtLeast(0),
		}
		s[limitKey] = &schema.Schema{
			Type:         schema.TypeInt,
			Optional:     true,
			Default:      -1,
			Description:  fmt.Sprintf(limitFmt, t),
			ValidateFunc: validation.IntAtLeast(-1),
		}
		s[reservationKey] = &schema.Schema{
			Type:         schema.TypeInt,
			Optional:     true,
			Description:  fmt.Sprintf(reservationFmt, t),
			ValidateFunc: validation.IntAtLeast(0),
		}
	}

	return s
}
func schemaVirtualMachineResourceAllocation() map[string]*schema.Schema {
	s := make(map[string]*schema.Schema)
	shareLevelFmt := "The allocation level for %s resources. Can be one of high, low, normal, or custom."
	shareCountFmt := "The amount of shares to allocate to %s for a custom share level."
	limitFmt := "The maximum amount of memory (in MB) or CPU (in MHz) that this virtual machine can consume, regardless of available resources."
	reservationFmt := "The amount of memory (in MB) or CPU (in MHz) that this virtual machine is guaranteed."

	for _, t := range virtualMachineResourceAllocationTypeValues {
		shareLevelKey := fmt.Sprintf("%s_share_level", t)
		shareCountKey := fmt.Sprintf("%s_share_count", t)
		limitKey := fmt.Sprintf("%s_limit", t)
		reservationKey := fmt.Sprintf("%s_reservation", t)

		s[shareLevelKey] = &schema.Schema{
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.SharesLevelNormal),
			Description:  fmt.Sprintf(shareLevelFmt, t),
			ValidateFunc: validation.StringInSlice(sharesLevelAllowedValues, false),
		}
		s[shareCountKey] = &schema.Schema{
			Type:         schema.TypeInt,
			Optional:     true,
			Computed:     true,
			Description:  fmt.Sprintf(shareCountFmt, t),
			ValidateFunc: validation.IntAtLeast(0),
		}
		s[limitKey] = &schema.Schema{
			Type:         schema.TypeInt,
			Optional:     true,
			Default:      -1,
			Description:  fmt.Sprintf(limitFmt, t),
			ValidateFunc: validation.IntAtLeast(-1),
		}
		s[reservationKey] = &schema.Schema{
			Type:         schema.TypeInt,
			Optional:     true,
			Description:  fmt.Sprintf(reservationFmt, t),
			ValidateFunc: validation.IntAtLeast(0),
		}
	}

	return s
}
func schemaVirtualMachineResourceAllocation ( ) map [ string ] * schema . Schema { s := make ( map [ string ] * schema . Schema ) shareLevelFmt := " " shareCountFmt := " " limitFmt := " " reservationFmt := " " for _ , t := range virtualMachineResourceAllocationTypeValues { shareLevelKey := fmt . Sprintf ( " " , t ) shareCountKey := fmt . Sprintf ( " " , t ) limitKey := fmt . Sprintf ( " " , t ) reservationKey := fmt . Sprintf ( " " , t ) s [ shareLevelKey ] = & schema . Schema { Type : schema . TypeString , Optional : true , Default : string ( types . SharesLevelNormal ) , Description : fmt . Sprintf ( shareLevelFmt , t ) , ValidateFunc : validation . StringInSlice ( sharesLevelAllowedValues , false ) , } s [ shareCountKey ] = & schema . Schema { Type : schema . TypeInt , Optional : true , Computed : true , Description : fmt . Sprintf ( shareCountFmt , t ) , ValidateFunc : validation . IntAtLeast ( 0 ) , } s [ limitKey ] = & schema . Schema { Type : schema . TypeInt , Optional : true , Default : - 1 , Description : fmt . Sprintf ( limitFmt , t ) , ValidateFunc : validation . IntAtLeast ( - 1 ) , } s [ reservationKey ] = & schema . Schema { Type : schema . TypeInt , Optional : true , Description : fmt . Sprintf ( reservationFmt , t ) , ValidateFunc : validation . IntAtLeast ( 0 ) , } } return s }
// schemaVirtualMachineResourceAllocation returns the respective schema keys
// for the various kinds of resource allocation settings available to a virtual
// machine. This is an abridged version of ResourceAllocationInfo with only the
// keys present that make sense for virtual machines.
schemaVirtualMachineResourceAllocation returns the respective schema keys for the various kinds of resource allocation settings available to a virtual machine . This is an abridged version of ResourceAllocationInfo with only the keys present that make sense for virtual machines .