// ApplyFormatter execute the formatter
556383
func (format *Base64Decode) ApplyFormatter(msg *core.Message) error {
	decoded, err := format.getDecodedContent(format.GetAppliedContent(msg))
	if err != nil {
		return err
	}

	format.SetAppliedContent(msg, decoded)
	return nil
}
407116
func (format *GrokToJSON) ApplyFormatter(msg *core.Message) error {
	content := format.GetAppliedContent(msg)

	values, err := format.applyGrok(string(content[:]))
	if err != nil {
		return err
	}

	serialized, err := json.Marshal(values)
	if err != nil {
		return err
	}

	format.SetAppliedContent(msg, serialized)
	return nil
}
631799
func (s *ImportJobResource) SetFormat(v string) *ImportJobResource {
	s.Format = &v
	return s
}
240946
func (s *ContentTypeProfile) SetFormat(v string) *ContentTypeProfile {
	s.Format = &v
	return s
}
409497
func IntValueFormatter(v interface{}) string {
	switch v.(type) {
	case int:
		return strconv.Itoa(v.(int))
	case int64:
		return strconv.FormatInt(v.(int64), 10)
	case float32:
		return strconv.FormatInt(int64(v.(float32)), 10)
	case float64:
		return strconv.FormatInt(int64(v.(float64)), 10)
	default:
		return ""
	}
}
1200049
func (s *ListTypesInput) SetFormat(v string) *ListTypesInput {
	s.Format = &v
	return s
}
444228
func (s *CreateThreatIntelSetInput) SetFormat(v string) *CreateThreatIntelSetInput {
	s.Format = &v
	return s
}
916886
func NewFormatter(verb, format string) (Formatter, error) {
	switch verb {
	case "color":
		return newColorFormatter(format)
	case "id":
		return newSequenceFormatter(format), nil
	case "level":
		return newLevelFormatter(format), nil
	case "message":
		return newMessageFormatter(format), nil
	case "module":
		return newModuleFormatter(format), nil
	case "shortfunc":
		return newShortFuncFormatter(format), nil
	case "time":
		return newTimeFormatter(format), nil
	default:
		return nil, fmt.Errorf("unknown verb: %s", verb)
	}
}
390903
func (s *BusinessReportSchedule) SetFormat(v string) *BusinessReportSchedule {
	s.Format = &v
	return s
}
367197
func applyTransform(str string, transform sf) (out string) {
	out = ""

	for idx, line := range strings.Split(str, "\n") {
		out += transform(idx, line)
	}

	return
}
936927
func (format *RegExp) ApplyFormatter(msg *core.Message) error {
	content := format.GetAppliedContent(msg)
	matches := format.expression.FindSubmatchIndex(content)
	transformed := format.expression.Expand([]byte{}, format.template, content, matches)

	format.SetAppliedContent(msg, transformed)
	return nil
}
819636
func (t *Template) Apply(line string, joiner string) (string, map[string]string, string, error) {
	fields := strings.Split(line, t.separator)
	var (
		measurement []string
		tags        = make(map[string][]string)
		field       []string
	)

	// Set any default tags
	for k, v := range t.defaultTags {
		tags[k] = append(tags[k], v)
	}

	// See if an invalid combination has been specified in the template:
	for _, tag := range t.parts {
		if tag == "measurement*" {
			t.greedyMeasurement = true
		} else if tag == "field*" {
			t.greedyField = true
		}
	}
	if t.greedyField && t.greedyMeasurement {
		return "", nil, "",
			fmt.Errorf("either 'field*' or 'measurement*' can be used in each "+
				"template (but not both together): %q",
				strings.Join(t.parts, joiner))
	}

	for i, tag := range t.parts {
		if i >= len(fields) {
			continue
		}
		if tag == "" {
			continue
		}

		switch tag {
		case "measurement":
			measurement = append(measurement, fields[i])
		case "field":
			field = append(field, fields[i])
		case "field*":
			field = append(field, fields[i:]...)
			break
		case "measurement*":
			measurement = append(measurement, fields[i:]...)
			break
		default:
			tags[tag] = append(tags[tag], fields[i])
		}
	}

	// Convert to map of strings.
	outtags := make(map[string]string)
	for k, values := range tags {
		outtags[k] = strings.Join(values, joiner)
	}

	return strings.Join(measurement, joiner), outtags, strings.Join(field, joiner), nil
}
666448
func (s *ImportJobRequest) SetFormat(v string) *ImportJobRequest {
	s.Format = &v
	return s
}
608031
func (s *JobParameters) SetFormat(v string) *JobParameters {
	s.Format = &v
	return s
}
668101
func PercentValueFormatter(v interface{}) string {
	if typed, isTyped := v.(float64); isTyped {
		return FloatValueFormatterWithFormat(typed*100.0, DefaultPercentValueFormat)
	}
	return ""
}
1221104
func (format *Envelope) ApplyFormatter(msg *core.Message) error {
	prefixLen := len(format.prefix)
	postfixLen := len(format.postfix)
	content := format.GetAppliedContent(msg)
	offset := 0

	payload := make([]byte, prefixLen+len(content)+postfixLen)

	if prefixLen > 0 {
		offset = copy(payload, format.prefix)
	}

	offset += copy(payload[offset:], content)

	if postfixLen > 0 {
		copy(payload[offset:], format.postfix)
	}

	format.SetAppliedContent(msg, payload)
	return nil
}
1312786
func MakeJSONFormatter() MessageFormatter {
	return func(m message.Composer) (string, error) {
		out, err := json.Marshal(m.Raw())
		if err != nil {
			return "", err
		}

		return string(out), nil
	}
}