github.com/altipla-consulting/ravendb-go-client@v0.1.3/stop_indexing_operation.go (about)

     1  package ravendb
     2  
     3  import (
     4  	"net/http"
     5  )
     6  
     7  var _ IVoidMaintenanceOperation = &StopIndexingOperation{}
     8  
     9  type StopIndexingOperation struct {
    10  	Command *StopIndexingCommand
    11  }
    12  
    13  func NewStopIndexingOperation() *StopIndexingOperation {
    14  	return &StopIndexingOperation{}
    15  }
    16  
    17  func (o *StopIndexingOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error) {
    18  	o.Command = NewStopIndexingCommand()
    19  	return o.Command, nil
    20  }
    21  
    22  var (
    23  	_ RavenCommand = &StopIndexingCommand{}
    24  )
    25  
    26  type StopIndexingCommand struct {
    27  	RavenCommandBase
    28  }
    29  
    30  func NewStopIndexingCommand() *StopIndexingCommand {
    31  	cmd := &StopIndexingCommand{
    32  		RavenCommandBase: NewRavenCommandBase(),
    33  	}
    34  	cmd.ResponseType = RavenCommandResponseTypeEmpty
    35  	return cmd
    36  }
    37  
    38  func (c *StopIndexingCommand) createRequest(node *ServerNode) (*http.Request, error) {
    39  	url := node.URL + "/databases/" + node.Database + "/admin/indexes/stop"
    40  
    41  	return newHttpPost(url, nil)
    42  }