// Add a list of URIs with the same extract and cache configuration. Scheduler must have
// --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection.
324237
func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) Job {
	for _, value := range values {
		j.jobConfig.TaskConfig.MesosFetcherUris = append(j.jobConfig.TaskConfig.MesosFetcherUris,
			&aurora.MesosFetcherURI{Value: value, Extract: &extract, Cache: &cache})
	}
	return j
}
1182929
func (g *Generator) SetLinuxResourcesCPUShares(shares uint64) {
	g.InitConfigLinuxResourcesCPU()
	g.Config.Linux.Resources.CPU.Shares = &shares
}
1204865
func (pool *TxPool) AddLocals(txs []*types.Transaction) []error {
	return pool.addTxs(txs, !pool.config.NoLocals)
}
905607
func (c *Conn) AddAlias(index string, alias string) (BaseResponse, error) {
	var url string
	var retval BaseResponse

	if len(index) > 0 {
		url = "/_aliases"
	} else {
		return retval, fmt.Errorf("You must specify an index to create the alias on")
	}

	jsonAliases := JsonAliases{}
	jsonAliasAdd := JsonAliasAdd{}
	jsonAliasAdd.Add.Alias = alias
	jsonAliasAdd.Add.Index = index
	jsonAliases.Actions = append(jsonAliases.Actions, jsonAliasAdd)
	requestBody, err := json.Marshal(jsonAliases)

	if err != nil {
		return retval, err
	}

	body, err := c.DoCommand("POST", url, nil, requestBody)
	if err != nil {
		return retval, err
	}

	jsonErr := json.Unmarshal(body, &retval)
	if jsonErr != nil {
		return retval, jsonErr
	}

	return retval, err
}
919913
func (b *BindataAssets) addCacheHeaders(filename string, w http.ResponseWriter) error {
	w.Header().Add("Cache-Control", "public, max-age=3600")
	fi, err := AssetInfo(filename)
	if err != nil {
		return err
	}

	hour, minute, second := fi.ModTime().Clock()
	etag := fmt.Sprintf(`"%d%d%d%d%d"`, fi.Size(), fi.ModTime().Day(), hour, minute, second)

	w.Header().Set("ETag", etag)
	return nil
}
676051
func (g *Cloud) ListURLMaps() ([]*compute.UrlMap, error) {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newURLMapMetricContext("list")
	v, err := g.c.UrlMaps().List(ctx, filter.None)
	return v, mc.Observe(err)
}
296674
func addHeaders(req *http.Request, header http.Header) {
	for key, values := range header {
		for _, value := range values {
			req.Header.Add(key, value)
		}
	}
}
509701
func (si *SolrInterface) Add(docs []Document, chunk_size int, params *url.Values) (*SolrUpdateResponse, error) {
	result := &SolrUpdateResponse{Success: true}
	responses := M{}
	chunks := makeAddChunks(docs, chunk_size)

	for i := 0; i < len(chunks); i++ {
		res, err := si.Update(chunks[i], params)
		if err != nil {
			return nil, err
		}
		result.Success = result.Success && res.Success
		responses[fmt.Sprintf("chunk_%d", i+1)] = M{
			"result":  res.Result,
			"success": res.Success,
			"total":   len(chunks[i]["add"].([]Document))}
	}
	result.Result = responses
	return result, nil
}
813585
func (s *ISOService) ListIsos(p *ListIsosParams) (*ListIsosResponse, error) {
	resp, err := s.cs.newRequest("listIsos", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListIsosResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
262050
func NewMesosScheduler(master string, uid string, privateKeyFile io.Reader) (scheduler.Scheduler, error) {
	//Create the object
	m := &mesosScheduler{
		master: master,
		uid:    uid,
	}

	//Parse and validate the private key
	if err := m.parsePrivateKey(privateKeyFile); err != nil {
		return nil, err
	}

	//Build the transport
	tr := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
			DualStack: true,
		}).DialContext,
		MaxIdleConns:          100,
		IdleConnTimeout:       90 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,
	}

	//If requested ignore the TLS verify
	if viper.GetBool("mesos-skipverify") {
		if tr.TLSClientConfig == nil {
			tr.TLSClientConfig = &tls.Config{
				InsecureSkipVerify: true,
			}
		} else {
			tr.TLSClientConfig.InsecureSkipVerify = true
		}
	}
	client := http.DefaultClient
	client.Transport = tr
	m.client = client

	//Check to see if you can communicate with the Mesos Master
	if _, _, err := m.getMesosMaster(); err != nil {
		return nil, err
	}

	//Create initial authorization token
	if err := m.createAuthorizationToken(); err != nil {
		return nil, err
	}

	return m, nil
}
606152
func (self *RawDispatcher) AddResourceSeparateUdid(node *RestNode, name string, wireExample interface{}, index RestIndex,
	find RestFindUdid, post RestPost, put RestPutUdid, del RestDeleteUdid) {
	t := self.validateType(wireExample)
	obj := &restObjUdid{
		restShared: restShared{
			typ:   t,
			name:  name,
			index: index,
			post:  post,
		},
		find: find,
		del:  del,
		put:  put,
	}
	node.ResUdid[strings.ToLower(name)] = obj
}
595668
func (nd *Node) addAlias(aliasToAdd *Host) {
	// Aliases are only referenced in the cluster tend goroutine,
	// so synchronization is not necessary.
	aliases := nd.GetAliases()
	if aliases == nil {
		aliases = []*Host{}
	}

	aliases = append(aliases, aliasToAdd)
	nd.setAliases(aliases)
}
799993
func (c *Client) AddUnits(args AddUnitsParams) ([]string, error) {
	if len(args.AttachStorage) > 0 {
		if args.NumUnits != 1 {
			return nil, errors.New("cannot attach existing storage when more than one unit is requested")
		}
		if c.BestAPIVersion() < 5 {
			return nil, errors.New("this juju controller does not support AttachStorage")
		}
	}
	attachStorage := make([]string, len(args.AttachStorage))
	for i, id := range args.AttachStorage {
		if !names.IsValidStorage(id) {
			return nil, errors.NotValidf("storage ID %q", id)
		}
		attachStorage[i] = names.NewStorageTag(id).String()
	}
	results := new(params.AddApplicationUnitsResults)
	err := c.facade.FacadeCall("AddUnits", params.AddApplicationUnits{
		ApplicationName: args.ApplicationName,
		NumUnits:        args.NumUnits,
		Placement:       args.Placement,
		Policy:          args.Policy,
		AttachStorage:   attachStorage,
	}, results)
	return results.Units, err
}
57532
func ListAll(
	ctx context.Context,
	bucket gcs.Bucket,
	req *gcs.ListObjectsRequest) (
	objects []*gcs.Object,
	runs []string,
	err error) {
	for {
		// Grab one set of results.
		var listing *gcs.Listing
		if listing, err = bucket.ListObjects(ctx, req); err != nil {
			return
		}

		// Accumulate the results.
		objects = append(objects, listing.Objects...)
		runs = append(runs, listing.CollapsedRuns...)

		// Are we done?
		if listing.ContinuationToken == "" {
			break
		}

		req.ContinuationToken = listing.ContinuationToken
	}

	return
}
279747
func (c *Client) AddMetricBatches(batches []params.MetricBatchParam) (map[string]error, error) {
	parameters := params.MetricBatchParams{
		Batches: batches,
	}
	results := new(params.ErrorResults)
	err := c.facade.FacadeCall("AddMetricBatches", parameters, results)
	if err != nil {
		return nil, errors.Trace(err)
	}
	resultMap := make(map[string]error)
	for i, result := range results.Results {
		resultMap[batches[i].Batch.UUID] = result.Error
	}
	return resultMap, nil
}
1225618
func addArgs(r AddRequest) redis.Args {
	args := redis.Args{r.Job.Queue, r.Job.Data, int(r.Timeout / time.Millisecond)}

	if r.Replicate > 0 {
		args = args.Add("REPLICATE", r.Replicate)
	}

	if r.Delay > 0 {
		args = args.Add("DELAY", int64(r.Delay.Seconds()))
	}

	if r.Retry > 0 {
		args = args.Add("RETRY", int64(r.Retry.Seconds()))
	}

	if r.TTL > 0 {
		args = args.Add("TTL", int64(r.TTL.Seconds()))
	}

	if r.Maxlen > 0 {
		args = args.Add("MAXLEN", r.Maxlen)
	}

	if r.Async {
		args = args.Add("ASYNC")
	}
	return args
}
1149724
func (cache *schedulerCache) addNodeImageStates(node *v1.Node, nodeInfo *schedulernodeinfo.NodeInfo) {
	newSum := make(map[string]*schedulernodeinfo.ImageStateSummary)

	for _, image := range node.Status.Images {
		for _, name := range image.Names {
			// update the entry in imageStates
			state, ok := cache.imageStates[name]
			if !ok {
				state = &imageState{
					size:  image.SizeBytes,
					nodes: sets.NewString(node.Name),
				}
				cache.imageStates[name] = state
			} else {
				state.nodes.Insert(node.Name)
			}
			// create the imageStateSummary for this image
			if _, ok := newSum[name]; !ok {
				newSum[name] = cache.createImageStateSummary(state)
			}
		}
	}
	nodeInfo.SetImageStates(newSum)
}