// SetFields sets value to fieldValue using tag as key in valMap
342837
func setFields(fieldValue reflect.Value, val parse.Parser) error {
	if fieldValue.CanSet() {
		fieldValue.Set(reflect.ValueOf(val).Elem().Convert(fieldValue.Type()))
	} else {
		return fmt.Errorf("%s is not settable", fieldValue.Type().String())
	}
	return nil
}
764722
func (p *Provider) SetCustomFields(fields []string) *Provider {
	p.Fields = strings.Join(fields, ",")
	return p
}
515512
func setField(fr *Frame, x Value, name string, y Value) error {
	if x, ok := x.(HasSetField); ok {
		err := x.SetField(name, y)
		return err
	}
	return fmt.Errorf("can't assign to .%s field of %s", name, x.Type())
}
747833
func (s *SortCriterion) SetField(v string) *SortCriterion {
	s.Field = &v
	return s
}
214464
func (s *UpdateFileSystemOutput) SetTags(v []*Tag) *UpdateFileSystemOutput {
	s.Tags = v
	return s
}
1100324
func (s *TagFilter) SetTagValues(v []*string) *TagFilter {
	s.TagValues = v
	return s
}
253426
func (s *AffectedEntity) SetTags(v map[string]*string) *AffectedEntity {
	s.Tags = v
	return s
}
1130159
func (s *UntagQueueInput) SetTagKeys(v []*string) *UntagQueueInput {
	s.TagKeys = v
	return s
}
1222294
func (s *JobManifestSpec) SetFields(v []*string) *JobManifestSpec {
	s.Fields = v
	return s
}
827302
func (s *Expression) SetTags(v *TagValues) *Expression {
	s.Tags = v
	return s
}
1027601
func (s *CreateLocationEfsInput) SetTags(v []*TagListEntry) *CreateLocationEfsInput {
	s.Tags = v
	return s
}
1238705
func (s *UntagRoleInput) SetTagKeys(v []*string) *UntagRoleInput {
	s.TagKeys = v
	return s
}
748493
func setFieldByTag(x interface{}, tag, val string, override bool) {
	i, ok := tags(x)[tag]
	if !ok {
		return
	}
	v := reflect.ValueOf(x).Elem()
	f := v.Field(i)
	if override || f.Interface().(string) == "" {
		f.Set(reflect.ValueOf(val))
	}
}
1236703
func (s *NFSFileShareInfo) SetTags(v []*Tag) *NFSFileShareInfo {
	s.Tags = v
	return s
}
174684
func (s *PlacementStrategy) SetField(v string) *PlacementStrategy {
	s.Field = &v
	return s
}
691547
func (s *CSVOutput) SetQuoteFields(v string) *CSVOutput {
	s.QuoteFields = &v
	return s
}
1263783
func (m *Meta) setField(k string, v starlark.Value) (err error) {
	ptr := m.fieldsMap()[k]
	if ptr == nil {
		return fmt.Errorf("set_meta: no such meta key %q", k)
	}

	// On success, mark the field as modified.
	defer func() {
		if err == nil {
			m.touch(ptr)
		}
	}()

	switch ptr := ptr.(type) {
	case *string:
		if str, ok := v.(starlark.String); ok {
			*ptr = str.GoString()
			return nil
		}
		return fmt.Errorf("set_meta: got %s, expecting string", v.Type())

	case *bool:
		if b, ok := v.(starlark.Bool); ok {
			*ptr = bool(b)
			return nil
		}
		return fmt.Errorf("set_meta: got %s, expecting bool", v.Type())

	case *[]string:
		if iterable, ok := v.(starlark.Iterable); ok {
			iter := iterable.Iterate()
			defer iter.Done()

			var vals []string
			for x := starlark.Value(nil); iter.Next(&x); {
				if str, ok := x.(starlark.String); ok {
					vals = append(vals, str.GoString())
				} else {
					return fmt.Errorf("set_meta: got %s, expecting string", x.Type())
				}
			}

			*ptr = vals
			return nil
		}
		return fmt.Errorf("set_meta: got %s, expecting an iterable", v.Type())

	default:
		panic("impossible")
	}
}