code: func flattenClusterFailoverResourcesAdmissionControlPolicy(
  	d *schema.ResourceData,
  	obj *types.ClusterFailoverResourcesAdmissionControlPolicy,
  	version viapi.VSphereVersion,
  ) error {
  	// AutoComputePercentages is a vSphere >= 6.5 feature, but when it's
  	// enabled the admission control CPU/memory values will be auto-set and
  	// caused spurious diffs, so do a nil check to see if we have the value or
  	// if it's disabled before we set the values.
  	if obj.AutoComputePercentages == nil || !*obj.AutoComputePercentages {
  		err := structure.SetBatch(d, map[string]interface{}{
  			"ha_admission_control_resource_percentage_cpu":    obj.CpuFailoverResourcesPercent,
  			"ha_admission_control_resource_percentage_memory": obj.MemoryFailoverResourcesPercent,
  		})
  		if err != nil {
  			return err
  		}
  	}
  
  	if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6, Minor: 5}) {
  		return structure.SetBatch(d, map[string]interface{}{
  			"ha_admission_control_resource_percentage_auto_compute": obj.AutoComputePercentages,
  			"ha_admission_control_host_failure_tolerance":           obj.FailoverLevel,
  		})
  	}
  
  	return nil
  }
docs: // flattenClusterFailoverResourcesAdmissionControlPolicy saves a
  // ClusterFailoverResourcesAdmissionControlPolicy into the supplied
  // ResourceData.