vsphere/internal/helper/customattribute/custom_attributes_helper.go
func ReadFromResource(client *govmomi.Client, entity *mo.ManagedEntity, d *schema.ResourceData) {
	customAttrs := make(map[string]interface{})
	if len(entity.CustomValue) > 0 {
		for _, fv := range entity.CustomValue {
			value := fv.(*types.CustomFieldStringValue).Value
			if value != "" {
				customAttrs[fmt.Sprint(fv.GetCustomFieldValue().Key)] = value
			}
		}
	}
	d.Set(ConfigKey, customAttrs)
}
func ReadFromResource(client *govmomi.Client, entity *mo.ManagedEntity, d *schema.ResourceData) {
	customAttrs := make(map[string]interface{})
	if len(entity.CustomValue) > 0 {
		for _, fv := range entity.CustomValue {
			value := fv.(*types.CustomFieldStringValue).Value
			if value != "" {
				customAttrs[fmt.Sprint(fv.GetCustomFieldValue().Key)] = value
			}
		}
	}
	d.Set(ConfigKey, customAttrs)
}
func ReadFromResource ( client * govmomi . Client , entity * mo . ManagedEntity , d * schema . ResourceData ) { customAttrs := make ( map [ string ] interface { } ) if len ( entity . CustomValue ) > 0 { for _ , fv := range entity . CustomValue { value := fv . ( * types . CustomFieldStringValue ) . Value if value != " " { customAttrs [ fmt . Sprint ( fv . GetCustomFieldValue ( ) . Key ) ] = value } } } d . Set ( ConfigKey , customAttrs ) }
// ReadFromResource reads the custom attributes from an object and saves the
// data into the supplied ResourceData.
//
// TODO: Add error handling and reporting to this method.
ReadFromResource reads the custom attributes from an object and saves the data into the supplied ResourceData . TODO : Add error handling and reporting to this method .