// Do executes the operation.
486026
func (b *CreateIndexService) Do() (*CreateIndexResult, error) {
	if b.index == "" {
		return nil, errors.New("missing index name")
	}

	// Build url
	path, err := uritemplates.Expand("/{index}", map[string]string{
		"index": b.index,
	})
	if err != nil {
		return nil, err
	}

	params := make(url.Values)
	if b.pretty {
		params.Set("pretty", "1")
	}
	if b.masterTimeout != "" {
		params.Set("master_timeout", b.masterTimeout)
	}
	if b.timeout != "" {
		params.Set("timeout", b.timeout)
	}

	// Setup HTTP request body
	var body interface{}
	if b.bodyJson != nil {
		body = b.bodyJson
	} else {
		body = b.bodyString
	}

	// Get response
	res, err := b.client.PerformRequest("PUT", path, params, body)
	if err != nil {
		return nil, err
	}

	ret := new(CreateIndexResult)
	if err := json.Unmarshal(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
1229751
func (re *JSRE) Do(fn func(*otto.Otto)) {
	done := make(chan bool)
	req := &evalReq{fn, done}
	re.evalQueue <- req
	<-done
}
302488
func (c *Client) do(req *http.Request, v interface{}) (*Response, error) {
	resp, err := httpDo(req)

	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	response := newResponse(resp)

	err = checkResponse(response)
	if err != nil {
		// Return response in case caller need to debug it.
		return response, err
	}

	if v != nil {
		err = json.Unmarshal(response.Body, v)
		if err != nil {
			return response, err
		}
	}

	return response, nil
}
1132246
func (s *IndicesGetService) Do() (map[string]*IndicesGetResponse, error) {
	// Check pre-conditions
	if err := s.Validate(); err != nil {
		return nil, err
	}

	// Get URL for request
	path, params, err := s.buildURL()
	if err != nil {
		return nil, err
	}

	// Get HTTP response
	res, err := s.client.PerformRequest("GET", path, params, nil)
	if err != nil {
		return nil, err
	}

	// Return operation response
	var ret map[string]*IndicesGetResponse
	if err := json.Unmarshal(res.Body, &ret); err != nil {
		return nil, err
	}
	return ret, nil
}
44462
func (s *SearchShardsService) Do(ctx context.Context) (*SearchShardsResponse, error) {
	// Check pre-conditions
	if err := s.Validate(); err != nil {
		return nil, err
	}

	// Get URL for request
	path, params, err := s.buildURL()
	if err != nil {
		return nil, err
	}

	// Get HTTP response
	res, err := s.client.PerformRequest(ctx, PerformRequestOptions{
		Method: "GET",
		Path:   path,
		Params: params,
	})
	if err != nil {
		return nil, err
	}

	// Return operation response
	ret := new(SearchShardsResponse)
	if err := s.client.decoder.Decode(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
982860
func (c *Client) Do(ctx context.Context, req *APIRequest, v interface{}, responseType string) (*APIResponse, error) {
	var err error
	var resp *http.Response

	req.HTTP = req.HTTP.WithContext(ctx)

	if resp, err = c.client.Do(req.HTTP); err != nil {
		return nil, err
	}

	r := &APIResponse{
		Request: req,
		HTTP:    resp,
	}

	if v != nil {
		if r.Body, err = readDoResponseBody(v, &r.HTTP.Body, responseType); err != nil {
			return nil, err
		}
	}

	if err = CheckResponse(r); err != nil {
		return r, err
	}

	return r, err
}
598039
func Do(ctx context.Context, tasks ...Task) error {
	n := len(tasks)

	done := make(chan error, n)
	for i, task := range tasks {
		go func(task Task) {
			err := task()
			if err != nil {
				done <- errors.WithMessage(err, fmt.Sprintf("task %d", i+1))
				return
			}
			done <- nil
		}(task)
	}

	for i := 0; i < n; i++ {
		select {
		case err := <-done:
			if err != nil {
				return errors.WithStack(err)
			}
		case <-ctx.Done():
			return werrors.ErrCancelled
		}
	}
	return nil
}
989807
func (r *Request) Do() error {
	return r.collector.scrape(r.URL.String(), r.Method, r.Depth, r.Body, r.Ctx, *r.Headers, !r.collector.AllowURLRevisit)
}
1332446
func Do(p plugin.Handler, data []byte) int {
	ctx := context.TODO()
	ret := 1
	r := new(dns.Msg)
	if err := r.Unpack(data); err != nil {
		ret = 0
	}

	if _, err := p.ServeDNS(ctx, &test.ResponseWriter{}, r); err != nil {
		ret = 1
	}

	return ret
}
1000198
func (c *ClusterClient) Do(args ...interface{}) *Cmd {
	cmd := NewCmd(args...)
	c.Process(cmd)
	return cmd
}
285998
func (c *vstConnection) Do(ctx context.Context, req driver.Request) (driver.Response, error) {
	resp, err := c.do(ctx, req, c.transport)
	if err != nil {
		return nil, driver.WithStack(err)
	}
	return resp, nil
}
1042605
func (c *Client) do(req *http.Request, remote string, via []*http.Request) (*http.Response, error) {
	return c.client.Do(req)
}
527574
func (d *Do) do() {
	for {
		// Check context
		if d.ctx.Err() != nil {
			return
		}

		// Lock cond here in case a func is added between retrieving l and doing the if on it
		d.cond.L.Lock()

		// Get number of funcs in queue
		d.mq.Lock()
		l := len(d.queue)
		d.mq.Unlock()

		// No queued funcs
		if l == 0 {
			d.cond.Wait()
			d.cond.L.Unlock()
			continue
		}
		d.cond.L.Unlock()

		// Get first func
		d.mq.Lock()
		fn := d.queue[0]
		d.mq.Unlock()

		// Execute func
		fn()

		// Remove first func
		d.mq.Lock()
		d.queue = d.queue[1:]
		d.mq.Unlock()
	}
}
856262
func (c *Client) Do(req *http.Request) (*http.Response, error) {
	return c.client.Do(req)
}
1118379
func (ppl *Pipeline) Do(cmd string, args ...interface{}) error {
	cmd = strings.ToLower(cmd)
	if strings.Contains(cmd, "subscribe") {
		return errors.New(ErrUseSubscription, errorMessages)
	}
	err := ppl.ensureProtocol()
	if err != nil {
		return err
	}
	if ppl.database.monitoring {
		m := monitoring.BeginMeasuring(identifier.Identifier("redis", "command", cmd))
		defer m.EndMeasuring()
	}
	err = ppl.resp.sendCommand(cmd, args...)
	logCommand(cmd, args, err, ppl.database.logging)
	if err != nil {
		return err
	}
	ppl.counter++
	return err
}
524583
func (g *Group) Do(f func(*Statement)) *Statement {
	s := Do(f)
	g.items = append(g.items, s)
	return s
}
611329
func (r *Request) Do() bool {
	if r.do != nil {
		return *r.do
	}

	r.do = new(bool)

	if o := r.Req.IsEdns0(); o != nil {
		*r.do = o.Do()
		return *r.do
	}
	*r.do = false
	return false
}