// buildDeleteRequest is an internal method to prepare a "DELETE" request that will send to OpsGenie.
969353
func (cli *OpsGenieClient) buildDeleteRequest(uri string, request interface{}) goreq.Request {
	req := cli.buildGetRequest(uri, request)
	req.Method = "DELETE"
	return req
}
327025
func (c *Client) DeleteRecord(domainID string, recordID string) error {
	body := bytes.NewBuffer(nil)
	path := destroy.endpoint(domainID, recordID)
	req, err := c.NewRequest("DELETE", path, body, "")
	if err != nil {
		return err
	}

	_, err = checkResp(c.HTTP.Do(req))
	if err != nil {
		return fmt.Errorf("Unable to find record %s", recordID)
	}

	// The request was successful
	return nil
}
120547
func BuildRequest(opts interface{}, parent string) (map[string]interface{}, error) {
	b, err := gophercloud.BuildRequestBody(opts, "")
	if err != nil {
		return nil, err
	}

	b = AddValueSpecs(b)

	return map[string]interface{}{parent: b}, nil
}
1271792
func (m *MockLambdaAPI) DeleteAliasRequest(arg0 *lambda.DeleteAliasInput) (*request.Request, *lambda.DeleteAliasOutput) {
	ret := m.ctrl.Call(m, "DeleteAliasRequest", arg0)
	ret0, _ := ret[0].(*request.Request)
	ret1, _ := ret[1].(*lambda.DeleteAliasOutput)
	return ret0, ret1
}
1305640
func (g *alertsServer) Delete(ctx context.Context,
	request *api.SdkAlertsDeleteRequest) (*api.SdkAlertsDeleteResponse, error) {
	if g.alert() == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	queries := request.GetQueries()
	if queries == nil {
		return nil, status.Error(codes.InvalidArgument, "Must provide at least one query")
	}

	// if input has deadline, ensure graceful exit within that deadline.
	deadline, ok := ctx.Deadline()
	var cancel context.CancelFunc
	if ok {
		// create a new context that will get done on deadline
		ctx, cancel = context.WithTimeout(ctx, deadline.Sub(time.Now()))
		defer cancel()
	}

	group, _ := errgroup.WithContext(ctx)
	errChan := make(chan error)

	resp := new(api.SdkAlertsDeleteResponse)

	filters := getFilters(queries)

	// spawn err-group process.
	group.Go(func() error {
		return g.alert().Delete(filters...)
	})

	// wait for err-group processes to be done
	go func() {
		errChan <- group.Wait()
	}()

	// wait only as long as context deadline allows
	select {
	case err := <-errChan:
		if err != nil {
			return nil, status.Errorf(codes.Internal, "error deleting alerts: %v", err)
		} else {
			return resp, nil
		}
	case <-ctx.Done():
		return nil, status.Error(codes.DeadlineExceeded,
			"Deadline is reached, server side func exiting")
	}
}
637160
func (v bulkDeleteRequestCommand) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson8092efb6EncodeGithubComOlivereElastic1(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
484916
func (r *Request) Build() {
	if !r.built {
		r.Handlers.Build.Run(r)
		r.built = true
		if r.Error != nil {
			return
		}
		r.Handlers.Sign.Run(r)
	}
}
694211
func ValidateBuildRequest(request *buildapi.BuildRequest) field.ErrorList {
	return validation.ValidateObjectMeta(&request.ObjectMeta, true, kpath.ValidatePathSegmentName, field.NewPath("metadata"))
}
420857
func (cli *OpsGenieClient) buildGetRequest(uri string, request interface{}) goreq.Request {
	req := cli.buildCommonRequestProps()
	req.Method = "GET"
	req.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"
	uri = cli.OpsGenieAPIUrl() + uri
	if request != nil {
		v, _ := goquery.Values(request)
		req.Uri = uri + "?" + v.Encode()
	} else {
		req.Uri = uri
	}

	logging.Logger().Info("Executing OpsGenie request to [" + uri + "] with parameters: ")
	return req
}
1002141
func buildRequest(proxyEvent *Event, ctx *apex.Context) (*http.Request, error) {
	// Reconstruct the request URL
	u, err := url.Parse(proxyEvent.Path)
	if err != nil {
		return nil, fmt.Errorf("Parse request path: %s", err)
	}
	q := u.Query()
	for k, v := range proxyEvent.QueryStringParameters {
		q.Set(k, v)
	}
	u.RawQuery = q.Encode()

	// Decode the request body
	dec := proxyEvent.Body
	if proxyEvent.IsBase64Encoded {
		data, err2 := base64.StdEncoding.DecodeString(dec)
		if err2 != nil {
			return nil, fmt.Errorf("Decode base64 request body: %s", err2)
		}
		dec = string(data)
	}

	// Create a new request object
	req, err := http.NewRequest(proxyEvent.HTTPMethod, u.String(), strings.NewReader(dec))
	if err != nil {
		return nil, fmt.Errorf("Create request: %s", err)
	}

	// Copy event headers to request
	for k, v := range proxyEvent.Headers {
		req.Header.Set(k, v)
	}

	// Store the original event and context in the request headers
	proxyEvent.Body = "... truncated"
	hbody, err := json.Marshal(proxyEvent)
	if err != nil {
		return nil, fmt.Errorf("Marshal proxy event: %s", err)
	}
	req.Header.Set("X-ApiGatewayProxy-Event", string(hbody))
	if ctx != nil {
		req.Header.Set("X-ApiGatewayProxy-Context", string(ctx.ClientContext))
	}

	// Map additional request information
	req.Host = proxyEvent.Headers["Host"]

	return req, nil
}
294823
func Convert_v1_BuildRequest_To_build_BuildRequest(in *v1.BuildRequest, out *build.BuildRequest, s conversion.Scope) error {
	return autoConvert_v1_BuildRequest_To_build_BuildRequest(in, out, s)
}
1353882
func (b *OpenAPI2Builder) build(document *openapiv2.Document) (err error) {
	// Collect service type descriptions from Definitions section.
	if document.Definitions != nil {
		for _, pair := range document.Definitions.AdditionalProperties {
			t, err := b.buildTypeFromDefinition(pair.Name, pair.Value)
			if err != nil {
				return err
			}
			b.model.addType(t)
		}
	}
	// Collect service method descriptions from Paths section.
	if document.Paths != nil {
		for _, pair := range document.Paths.Path {
			v := pair.Value
			if v.Get != nil {
				b.buildMethodFromOperation(v.Get, "GET", pair.Name)
			}
			if v.Post != nil {
				b.buildMethodFromOperation(v.Post, "POST", pair.Name)
			}
			if v.Put != nil {
				b.buildMethodFromOperation(v.Put, "PUT", pair.Name)
			}
			if v.Delete != nil {
				b.buildMethodFromOperation(v.Delete, "DELETE", pair.Name)
			}
		}
	}
	return err
}
1232939
func BuildRequestError(err error) (int, ApiErrors) {
	var apiErrors ApiErrors
	switch err.(type) {
	case validator.ValidationErrors:
		for _, v := range err.(validator.ValidationErrors) {
			var validationError Error
			validationError.Param = toSnakeCase(v.Field)
			validationError.Detail = "Field validation for " + toSnakeCase(v.Field) + " failed on the " + v.Tag + " tag."
			if v.Tag == "required" {
				validationError.Message = "This field is required"
			}
			if v.Tag == "email" {
				validationError.Message = "Invalid email address. Valid e-mail can contain only latin letters, numbers, '@' and '.'"
			}
			if v.Tag == "url" {
				validationError.Message = "Invalid URL address. Valid URL start with http:// or https://"
			}
			apiErrors.Errors = append(apiErrors.Errors, validationError)
		}
		return http.StatusBadRequest, apiErrors
	default:
		apiErrors.Errors = append(apiErrors.Errors, Error{
			Detail: err.Error(),
		})
		return http.StatusBadRequest, apiErrors
	}
}
812484
func (s *HTTPServer) preparedQueryDelete(id string, resp http.ResponseWriter, req *http.Request) (interface{}, error) {
	args := structs.PreparedQueryRequest{
		Op: structs.PreparedQueryDelete,
		Query: &structs.PreparedQuery{
			ID: id,
		},
	}
	s.parseDC(req, &args.Datacenter)
	s.parseToken(req, &args.Token)

	var reply string
	if err := s.agent.RPC("PreparedQuery.Apply", &args, &reply); err != nil {
		return nil, err
	}
	return nil, nil
}
957906
func (s *DeleteService) Do() (*DeleteResult, error) {
	if s.index == "" {
		return nil, ErrMissingIndex
	}
	if s._type == "" {
		return nil, ErrMissingType
	}
	if s.id == "" {
		return nil, ErrMissingId
	}

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

	// Parameters
	params := make(url.Values)
	if s.refresh != nil {
		params.Set("refresh", fmt.Sprintf("%v", *s.refresh))
	}
	if s.version != nil {
		params.Set("version", fmt.Sprintf("%d", *s.version))
	}
	if s.routing != "" {
		params.Set("routing", fmt.Sprintf("%s", s.routing))
	}
	if s.pretty {
		params.Set("pretty", fmt.Sprintf("%v", s.pretty))
	}

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

	// Return response
	ret := new(DeleteResult)
	if err := json.Unmarshal(res.Body, ret); err != nil {
		return nil, err
	}
	return ret, nil
}
193242
func DoRegularRequest(requestVerb, url string, ro *RequestOptions) (*Response, error) {
	return buildResponse(buildRequest(requestVerb, url, ro, nil))
}
270067
func (o *LDAPQueryOnAttribute) buildDNQuery(dn string, attributes []string) *ldap.SearchRequest {
	var controls []ldap.Control
	if o.PageSize > 0 {
		controls = append(controls, ldap.NewControlPaging(uint32(o.PageSize)))
	}
	return ldap.NewSearchRequest(
		dn,
		ldap.ScopeBaseObject, // over-ride original
		int(o.DerefAliases),
		0, // allowed return size - indicates no limit
		o.TimeLimit,
		false,             // not types only
		"(objectClass=*)", // filter that returns all values
		attributes,
		controls,
	)
}