vsphere/virtual_machine_config_structure.go
func flattenVirtualMachineResourceAllocation(d *schema.ResourceData, obj *types.ResourceAllocationInfo, key string) error {
	shareLevelKey := fmt.Sprintf("%s_share_level", key)
	shareCountKey := fmt.Sprintf("%s_share_count", key)
	limitKey := fmt.Sprintf("%s_limit", key)
	reservationKey := fmt.Sprintf("%s_reservation", key)

	structure.SetInt64Ptr(d, limitKey, obj.Limit)
	structure.SetInt64Ptr(d, reservationKey, obj.Reservation)
	if obj.Shares != nil {
		d.Set(shareLevelKey, obj.Shares.Level)
		d.Set(shareCountKey, obj.Shares.Shares)
	}
	return nil
}
func flattenVirtualMachineResourceAllocation(d *schema.ResourceData, obj *types.ResourceAllocationInfo, key string) error {
	shareLevelKey := fmt.Sprintf("%s_share_level", key)
	shareCountKey := fmt.Sprintf("%s_share_count", key)
	limitKey := fmt.Sprintf("%s_limit", key)
	reservationKey := fmt.Sprintf("%s_reservation", key)

	structure.SetInt64Ptr(d, limitKey, obj.Limit)
	structure.SetInt64Ptr(d, reservationKey, obj.Reservation)
	if obj.Shares != nil {
		d.Set(shareLevelKey, obj.Shares.Level)
		d.Set(shareCountKey, obj.Shares.Shares)
	}
	return nil
}
// flattenVirtualMachineResourceAllocation reads various fields from a
// ResourceAllocationInfo and sets appropriate keys in the
// supplied ResourceData.