// Payloads2TrackArgs converts the provided payload info into arguments
// for the Track API endpoint.
550799
func Payloads2TrackArgs(payloads []payload.Payload) params.TrackPayloadArgs {
	var args params.TrackPayloadArgs
	for _, pl := range payloads {
		fullPayload := payload.FullPayloadInfo{Payload: pl}
		arg := api.Payload2api(fullPayload)
		args.Payloads = append(args.Payloads, arg)
	}
	return args
}
1274270
func (c *RemindersInfoCall) ValidateArgs() error {
	if len(c.reminder) <= 0 {
		return errors.New(`required field reminder not initialized`)
	}
	return nil
}
35338
func (c *GroupsRepliesCall) ValidateArgs() error {
	if len(c.channel) <= 0 {
		return errors.New(`required field channel not initialized`)
	}
	if len(c.threadTimestamp) <= 0 {
		return errors.New(`required field threadTimestamp not initialized`)
	}
	return nil
}
1069017
func validateArgs() error {
	if flag.NArg() > 0 {
		return fmt.Errorf("%s does not take parameters (did you mean -input?)", os.Args[0])
	}

	if args.bambooOut && args.xunitnetOut {
		return fmt.Errorf("-bamboo and -xunitnet are mutually exclusive")
	}

	return nil
}
1263969
func LabelArgs(labelStrings []string) map[string]string {
	labels := make(map[string]string, len(labelStrings))
	for _, label := range labelStrings {
		parts := strings.SplitN(label, "=", 2)
		key := parts[0]
		value := "true"
		if len(parts) > 1 {
			value = parts[1]
		}

		labels[key] = value
	}

	return labels
}
1281365
func NewGetStackTraceArgs(stackTraceID runtime.StackTraceID) *GetStackTraceArgs {
	args := new(GetStackTraceArgs)
	args.StackTraceID = stackTraceID
	return args
}
806129
func (uf UnitFacade) Untrack(args params.Entities) (params.PayloadResults, error) {
	var r params.PayloadResults
	for _, entity := range args.Entities {
		id, err := api.API2ID(entity.Tag)
		if err != nil {
			return r, errors.Trace(err)
		}

		err = uf.backend.Untrack(id)
		res := newPayloadResult(id, err)
		r.Results = append(r.Results, res)
	}
	return r, nil
}
1309765
func jsonParamsToArgsWS(rpcFunc *RPCFunc, params json.RawMessage, wsCtx types.WSRPCContext) ([]reflect.Value, error) {
	values, err := jsonParamsToArgs(rpcFunc, params, 1)
	if err != nil {
		return nil, err
	}
	return append([]reflect.Value{reflect.ValueOf(wsCtx)}, values...), nil
}
485247
func (m *MockTrackBranchCommandAPI) TrackBranch(arg0 string, arg1 []string) error {
	ret := m.ctrl.Call(m, "TrackBranch", arg0, arg1)
	ret0, _ := ret[0].(error)
	return ret0
}
1029649
func (s *CreateConfigurationSetInput) SetTrackingOptions(v *TrackingOptions) *CreateConfigurationSetInput {
	s.TrackingOptions = v
	return s
}
609124
func (c *ChannelsJoinCall) ValidateArgs() error {
	if len(c.name) <= 0 {
		return errors.New(`required field name not initialized`)
	}
	return nil
}
1280976
func (c UnitFacadeClient) Untrack(fullIDs ...string) ([]payload.Result, error) {
	logger.Tracef("Calling untrack API: %q", fullIDs)

	ids, err := c.lookUp(fullIDs)
	if err != nil {
		return nil, errors.Trace(err)
	}
	args := internal.IDs2UntrackArgs(ids)

	var rs params.PayloadResults
	if err := c.FacadeCall("Untrack", &args, &rs); err != nil {
		return nil, err
	}

	return api2results(rs)
}
891143
func jsonParamsToArgs(rpcFunc *RPCFunc, cdc *amino.Codec, raw []byte) ([]reflect.Value, error) {
	const argsOffset = 1

	// TODO: Make more efficient, perhaps by checking the first character for '{' or '['?
	// First, try to get the map.
	var m map[string]json.RawMessage
	err := json.Unmarshal(raw, &m)
	if err == nil {
		return mapParamsToArgs(rpcFunc, cdc, m, argsOffset)
	}

	// Otherwise, try an array.
	var a []json.RawMessage
	err = json.Unmarshal(raw, &a)
	if err == nil {
		return arrayParamsToArgs(rpcFunc, cdc, a, argsOffset)
	}

	// Otherwise, bad format, we cannot parse
	return nil, errors.Errorf("Unknown type for JSON params: %v. Expected map or array", err)
}
365007
func (r *SearchRequest) TrackTotalHits(trackTotalHits interface{}) *SearchRequest {
	r.searchSource = r.searchSource.TrackTotalHits(trackTotalHits)
	return r
}
865664
func Payload2api(p payload.FullPayloadInfo) params.Payload {
	labels := make([]string, len(p.Labels))
	copy(labels, p.Labels)

	var unitTag string
	if p.Unit != "" {
		unitTag = names.NewUnitTag(p.Unit).String()
	}
	var machineTag string
	if p.Machine != "" {
		machineTag = names.NewMachineTag(p.Machine).String()
	}

	return params.Payload{
		Class:   p.Name,
		Type:    p.Type,
		ID:      p.ID,
		Status:  p.Status,
		Labels:  labels,
		Unit:    unitTag,
		Machine: machineTag,
	}
}
1076972
func (up UnitPayloads) Track(pl payload.Payload) error {

	// XXX OMFG payload/context/register.go:83 launches bad data
	// which flies on a majestic unvalidated arc right through the
	// system until it lands here. This code should be:
	//
	//    if pl.Unit != up.unit {
	//        return errors.NotValidf("unexpected Unit %q", pl.Unit)
	//    }
	//
	// ...but is instead:
	pl.Unit = up.unit

	if err := pl.Validate(); err != nil {
		return errors.Trace(err)
	}

	doc := nsPayloads.asDoc(payload.FullPayloadInfo{
		Payload: pl,
		Machine: up.machine,
	})
	change := payloadTrackChange{doc}
	if err := Apply(up.db, change); err != nil {
		return errors.Trace(err)
	}
	return nil
}
860511
func NewSetInstrumentationBreakpointArgs(eventName string) *SetInstrumentationBreakpointArgs {
	args := new(SetInstrumentationBreakpointArgs)
	args.EventName = eventName
	return args
}