vsphere/resource_vsphere_compute_cluster_vm_affinity_rule.go
func expandClusterAffinityRuleSpec(d *schema.ResourceData, meta interface{}) (*types.ClusterAffinityRuleSpec, error) {
	client, err := resourceVSphereComputeClusterVMGroupClient(meta)
	if err != nil {
		return nil, err
	}

	results, err := virtualmachine.MOIDsForUUIDs(
		client,
		structure.SliceInterfacesToStrings(d.Get("virtual_machine_ids").(*schema.Set).List()),
	)
	if err != nil {
		return nil, err
	}

	obj := &types.ClusterAffinityRuleSpec{
		ClusterRuleInfo: types.ClusterRuleInfo{
			Enabled:     structure.GetBool(d, "enabled"),
			Mandatory:   structure.GetBool(d, "mandatory"),
			Name:        d.Get("name").(string),
			UserCreated: structure.BoolPtr(true),
		},
		Vm: results.ManagedObjectReferences(),
	}
	return obj, nil
}
func expandClusterAffinityRuleSpec(d *schema.ResourceData, meta interface{}) (*types.ClusterAffinityRuleSpec, error) {
	client, err := resourceVSphereComputeClusterVMGroupClient(meta)
	if err != nil {
		return nil, err
	}

	results, err := virtualmachine.MOIDsForUUIDs(
		client,
		structure.SliceInterfacesToStrings(d.Get("virtual_machine_ids").(*schema.Set).List()),
	)
	if err != nil {
		return nil, err
	}

	obj := &types.ClusterAffinityRuleSpec{
		ClusterRuleInfo: types.ClusterRuleInfo{
			Enabled:     structure.GetBool(d, "enabled"),
			Mandatory:   structure.GetBool(d, "mandatory"),
			Name:        d.Get("name").(string),
			UserCreated: structure.BoolPtr(true),
		},
		Vm: results.ManagedObjectReferences(),
	}
	return obj, nil
}
func expandClusterAffinityRuleSpec ( d * schema . ResourceData , meta interface { } ) ( * types . ClusterAffinityRuleSpec , error ) { client , err := resourceVSphereComputeClusterVMGroupClient ( meta ) if err != nil { return nil , err } results , err := virtualmachine . MOIDsForUUIDs ( client , structure . SliceInterfacesToStrings ( d . Get ( " " ) . ( * schema . Set ) . List ( ) ) , ) if err != nil { return nil , err } obj := & types . ClusterAffinityRuleSpec { ClusterRuleInfo : types . ClusterRuleInfo { Enabled : structure . GetBool ( d , " " ) , Mandatory : structure . GetBool ( d , " " ) , Name : d . Get ( " " ) . ( string ) , UserCreated : structure . BoolPtr ( true ) , } , Vm : results . ManagedObjectReferences ( ) , } return obj , nil }
// expandClusterAffinityRuleSpec reads certain ResourceData keys and returns a
// ClusterAffinityRuleSpec.
expandClusterAffinityRuleSpec reads certain ResourceData keys and returns a ClusterAffinityRuleSpec .