//randomMaxTargets returns random sub set of max length targets
485311
func randomMaxTargets(targets []fab.ProposalProcessor, max int) []fab.ProposalProcessor {
	if len(targets) <= max {
		return targets
	}
	for i := range targets {
		j := rand.Intn(i + 1)
		targets[i], targets[j] = targets[j], targets[i]
	}
	return targets[:max]
}
920182
func (s *ListTargetsByRuleOutput) SetTargets(v []*Target) *ListTargetsByRuleOutput {
	s.Targets = v
	return s
}
962642
func (s *RegisterTargetsInput) SetTargets(v []*TargetDescription) *RegisterTargetsInput {
	s.Targets = v
	return s
}
40764
func (s *UpdateMaintenanceWindowTargetOutput) SetTargets(v []*Target) *UpdateMaintenanceWindowTargetOutput {
	s.Targets = v
	return s
}
506461
func BuildLayerTargets(path, target string) ([]string, error) {
	layerStems := []string{}
	layers, err := ioutil.ReadDir(path)
	if err != nil {
		return layerStems, err
	}
	for _, layer := range layers {
		if layer.IsDir() {
			layerStems = append(layerStems, filepath.Join(path, layer.Name(), target))
		}
	}
	return layerStems, nil
}
761501
func (c *Client) ListTargets(ctx context.Context, filter influxdb.ScraperTargetFilter) (list []influxdb.ScraperTarget, err error) {
	list = make([]influxdb.ScraperTarget, 0)
	err = c.db.View(func(tx *bolt.Tx) (err error) {
		cur := tx.Bucket(scraperBucket).Cursor()
		for k, v := cur.First(); k != nil; k, v = cur.Next() {
			target := new(influxdb.ScraperTarget)
			if err = json.Unmarshal(v, target); err != nil {
				return err
			}
			if err != nil {
				return err
			}
			if filter.IDs != nil {
				if _, ok := filter.IDs[target.ID]; !ok {
					continue
				}
			}
			if filter.Name != nil && target.Name != *filter.Name {
				continue
			}
			if filter.Org != nil {
				o, err := c.findOrganizationByName(ctx, tx, *filter.Org)
				if err != nil {
					return err
				}
				if target.OrgID != o.ID {
					continue
				}
			}
			if filter.OrgID != nil {
				o, err := c.findOrganizationByID(ctx, tx, *filter.OrgID)
				if err != nil {
					return err
				}
				if target.OrgID != o.ID {
					continue
				}
			}
			list = append(list, *target)
		}
		return err
	})
	if err != nil {
		return nil, &influxdb.Error{
			Op:  getOp(influxdb.OpListTargets),
			Err: err,
		}
	}
	return list, err
}
1242573
func (s *CreateDeploymentInput) SetTargetInstances(v *TargetInstances) *CreateDeploymentInput {
	s.TargetInstances = v
	return s
}
179706
func (s *TcpRouteAction) SetWeightedTargets(v []*WeightedTarget) *TcpRouteAction {
	s.WeightedTargets = v
	return s
}
386571
func (s *CreateCrawlerInput) SetTargets(v *CrawlerTargets) *CreateCrawlerInput {
	s.Targets = v
	return s
}
635134
func (s *CreateSoftwareUpdateJobInput) SetUpdateTargets(v []*string) *CreateSoftwareUpdateJobInput {
	s.UpdateTargets = v
	return s
}
270322
func (s *StartAutomationExecutionInput) SetTargets(v []*Target) *StartAutomationExecutionInput {
	s.Targets = v
	return s
}
486405
func (s *UpdateMaintenanceWindowInput) SetAllowUnassociatedTargets(v bool) *UpdateMaintenanceWindowInput {
	s.AllowUnassociatedTargets = &v
	return s
}
710126
func (s *StartAutomationExecutionInput) SetTargetMaps(v []map[string][]*string) *StartAutomationExecutionInput {
	s.TargetMaps = v
	return s
}
1204163
func (d *Database) WriteTargets(dst interface{}, columns []string, targets []interface{}) error {
	if len(columns) != len(targets) {
		return fmt.Errorf("meddler.WriteTargets: mismatch in number of columns (%d) and targets (%d)",
			len(columns), len(targets))
	}

	data, err := getFields(reflect.TypeOf(dst))
	if err != nil {
		return err
	}
	structVal := reflect.ValueOf(dst).Elem()

	for i, name := range columns {
		if field, present := data.fields[name]; present {
			fieldAddr := structVal.Field(field.index).Addr().Interface()
			err := field.meddler.PostRead(fieldAddr, targets[i])
			if err != nil {
				return fmt.Errorf("meddler.WriteTargets: PostRead error on column [%s]: %v", name, err)
			}
		} else {
			// not destination, so throw this away
			if Debug {
				log.Printf("meddler.WriteTargets: column [%s] not found in struct", name)
			}
		}
	}

	return nil
}
486169
func (s *StepExecution) SetTargets(v []*Target) *StepExecution {
	s.Targets = v
	return s
}
206849
func (s *MaintenanceWindowTask) SetTargets(v []*Target) *MaintenanceWindowTask {
	s.Targets = v
	return s
}
1013169
func (s *MaintenanceWindowTarget) SetTargets(v []*Target) *MaintenanceWindowTarget {
	s.Targets = v
	return s
}