func expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec(d *schema.ResourceData) []types.DistributedVirtualSwitchHostMemberConfigSpec {
	var specs []types.DistributedVirtualSwitchHostMemberConfigSpec
	o, n := d.GetChange("host")
	os := o.(*schema.Set)
	ns := n.(*schema.Set)

	// Make an intersection set. These hosts have not changed so we don't bother
	// with them.
	is := os.Intersection(ns)
	os = os.Difference(is)
	ns = ns.Difference(is)

	// Our old and new sets now have an accurate description of hosts that may
	// have been added, removed, or changed. Add removed and modified hosts
	// first.
	for _, oe := range os.List() {
		om := oe.(map[string]interface{})
		var found bool
		for _, ne := range ns.List() {
			nm := ne.(map[string]interface{})
			if nm["host_system_id"] == om["host_system_id"] {
				found = true
			}
		}
		if !found {
			spec := expandDistributedVirtualSwitchHostMemberConfigSpec(om)
			spec.Operation = string(types.ConfigSpecOperationRemove)
			specs = append(specs, spec)
		}
	}

	// Process new hosts now. These are ones that are only present in the new
	// set.
	for _, ne := range ns.List() {
		nm := ne.(map[string]interface{})
		var found bool
		for _, oe := range os.List() {
			om := oe.(map[string]interface{})
			if om["host_system_id"] == nm["host_system_id"] {
				found = true
			}
		}
		spec := expandDistributedVirtualSwitchHostMemberConfigSpec(nm)
		if !found {
			spec.Operation = string(types.ConfigSpecOperationAdd)
		} else {
			spec.Operation = string(types.ConfigSpecOperationEdit)
		}
		specs = append(specs, spec)
	}

	// Done!
	return specs
}
func expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec(d *schema.ResourceData) []types.DistributedVirtualSwitchHostMemberConfigSpec {
	var specs []types.DistributedVirtualSwitchHostMemberConfigSpec
	o, n := d.GetChange("host")
	os := o.(*schema.Set)
	ns := n.(*schema.Set)

	
	
	is := os.Intersection(ns)
	os = os.Difference(is)
	ns = ns.Difference(is)

	
	
	
	for _, oe := range os.List() {
		om := oe.(map[string]interface{})
		var found bool
		for _, ne := range ns.List() {
			nm := ne.(map[string]interface{})
			if nm["host_system_id"] == om["host_system_id"] {
				found = true
			}
		}
		if !found {
			spec := expandDistributedVirtualSwitchHostMemberConfigSpec(om)
			spec.Operation = string(types.ConfigSpecOperationRemove)
			specs = append(specs, spec)
		}
	}

	
	
	for _, ne := range ns.List() {
		nm := ne.(map[string]interface{})
		var found bool
		for _, oe := range os.List() {
			om := oe.(map[string]interface{})
			if om["host_system_id"] == nm["host_system_id"] {
				found = true
			}
		}
		spec := expandDistributedVirtualSwitchHostMemberConfigSpec(nm)
		if !found {
			spec.Operation = string(types.ConfigSpecOperationAdd)
		} else {
			spec.Operation = string(types.ConfigSpecOperationEdit)
		}
		specs = append(specs, spec)
	}

	
	return specs
}
func expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec ( d * schema . ResourceData ) [ ] types . DistributedVirtualSwitchHostMemberConfigSpec { var specs [ ] types . DistributedVirtualSwitchHostMemberConfigSpec o , n := d . GetChange ( " " ) os := o . ( * schema . Set ) ns := n . ( * schema . Set ) // Make an intersection set. These hosts have not changed so we don't bother // with them. is := os . Intersection ( ns ) os = os . Difference ( is ) ns = ns . Difference ( is ) // Our old and new sets now have an accurate description of hosts that may // have been added, removed, or changed. Add removed and modified hosts // first. for _ , oe := range os . List ( ) { om := oe . ( map [ string ] interface { } ) var found bool for _ , ne := range ns . List ( ) { nm := ne . ( map [ string ] interface { } ) if nm [ " " ] == om [ " " ] { found = true } } if ! found { spec := expandDistributedVirtualSwitchHostMemberConfigSpec ( om ) spec . Operation = string ( types . ConfigSpecOperationRemove ) specs = append ( specs , spec ) } } // Process new hosts now. These are ones that are only present in the new // set. for _ , ne := range ns . List ( ) { nm := ne . ( map [ string ] interface { } ) var found bool for _ , oe := range os . List ( ) { om := oe . ( map [ string ] interface { } ) if om [ " " ] == nm [ " " ] { found = true } } spec := expandDistributedVirtualSwitchHostMemberConfigSpec ( nm ) if ! found { spec . Operation = string ( types . ConfigSpecOperationAdd ) } else { spec . Operation = string ( types . ConfigSpecOperationEdit ) } specs = append ( specs , spec ) } // Done! return specs }
// expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec expands all host
// entires for a VMware DVS, detecting if a host spec needs to be added,
// removed, or updated as well. The whole slice is returned.
expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec expands all host entires for a VMware DVS detecting if a host spec needs to be added removed or updated as well . The whole slice is returned .