<commit_before>package main

import (
	"bufio"
	"encoding/xml"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"os"
	"path"
	"time"

	"github.com/AndyNortrup/GoSplunk"
)

const APP_NAME string = "TA-FitnessTrackers"
const ENFORCE_CERT_VALIDATION string = "force_cert_validation"

type FitnessInput struct {
	*splunk.ModInputConfig
	reader io.Reader //Location to read configurations from
	writer io.Writer //Location to write configurations to
}

//Write the scheme to input.writer
func (input *FitnessInput) ReturnScheme() {
	arguments := append([]splunk.Argument{}, splunk.Argument{
		Name:        ENFORCE_CERT_VALIDATION,
		Title:       "ForceCertValidation",
		Description: "If true the input requires certificate validation when making REST calls to Splunk",
		DataType:    "boolean",
	},
		splunk.Argument{
			Name:        strategyParamName,
			Title:       "FitnessService",
			Description: "Enter the name of the Fitness Service to be polled.  Options are: 'GoogleFitness', 'FitBit', 'Microsoft'",
			DataType:    "string",
		})

	scheme := &splunk.Scheme{
		Title:                 "Google Fitness",
		Description:           "Retrieves fitness data from Google Fitness.",
		UseExternalValidation: true,
		StreamingMode:         "simple",
		Args:                  arguments,
	}

	enc := xml.NewEncoder(input.writer)
	enc.Indent("   ", "   ")
	if err := enc.Encode(scheme); err != nil {
		fmt.Printf("error: %v\n", err)
	}
}

func (input *FitnessInput) ValidateScheme() (bool, string) {
	config, err := splunk.ReadModInputConfig(input.reader)
	if err != nil {
		return false, "Unable to parse configuration." + err.Error()
	}

	for _, stanza := range config.Stanzas {
		for _, param := range stanza.Params {
			//Check that the parameter STRAGEGY_PARAM_NAME is one of our defined
			// strategies for getting data
			if param.Name == strategyParamName &&
				!(param.Value == string(strategyGoogle) ||
					param.Value == strategyFitbit ||
					param.Value == strategyMicrosoft) {
				return false, "Improper service '" + param.Value + "' name indicated."
			}
		}
	}
	return true, ""<commit_msg>Changed the input name and description in the scheme<commit_after>package main

import (
	"bufio"
	"encoding/xml"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"os"
	"path"
	"time"

	"github.com/AndyNortrup/GoSplunk"
)

const APP_NAME string = "TA-FitnessTrackers"
const ENFORCE_CERT_VALIDATION string = "force_cert_validation"

type FitnessInput struct {
	*splunk.ModInputConfig
	reader io.Reader //Location to read configurations from
	writer io.Writer //Location to write configurations to
}

//Write the scheme to input.writer
func (input *FitnessInput) ReturnScheme() {
	arguments := append([]splunk.Argument{}, splunk.Argument{
		Name:        ENFORCE_CERT_VALIDATION,
		Title:       "ForceCertValidation",
		Description: "If true the input requires certificate validation when making REST calls to Splunk",
		DataType:    "boolean",
	},
		splunk.Argument{
			Name:        strategyParamName,
			Title:       "FitnessService",
			Description: "Enter the name of the Fitness Service to be polled.  Options are: 'GoogleFitness', 'FitBit', 'Microsoft'",
			DataType:    "string",
		})

	scheme := &splunk.Scheme{
		Title:                 "Fitness Trackers",
		Description:           "Retrieves fitness data from Google Fitness and fitbit.",
		UseExternalValidation: true,
		StreamingMode:         "simple",
		Args:                  arguments,
	}

	enc := xml.NewEncoder(input.writer)
	enc.Indent("   ", "   ")
	if err := enc.Encode(scheme); err != nil {
		fmt.Printf("error: %v\n", err)
	}
}

func (input *FitnessInput) ValidateScheme() (bool, string) {
	config, err := splunk.ReadModInputConfig(input.reader)
	if err != nil {
		return false, "Unable to parse configuration." + err.Error()
	}

	for _, stanza := range config.Stanzas {
		for _, param := range stanza.Params {
			//Check that the parameter STRAGEGY_PARAM_NAME is one of our defined
			// strategies for getting data
			if param.Name == strategyParamName &&
				!(param.Value == string(strategyGoogle) ||
					param.Value == strategyFitbit ||
					param.Value == strategyMicrosoft) {
				return false, "Improper service '" + param.Value + "' name indicated."
			}
		}
	}
	return true, ""
{'fraction_non_alphanumeric': 0.11873226111636707, 'fraction_numerical': 0.0, 'mean_word_length': 3.4375655823714584, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7546332', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1322, 'n_words': 374}