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

     1  package ravendb
     2  
     3  import "net/http"
     4  
     5  var (
     6  	_ RavenCommand = &KillOperationCommand{}
     7  )
     8  
     9  // KillOperationCommand represents "kill operation" command
    10  type KillOperationCommand struct {
    11  	RavenCommandBase
    12  
    13  	id string
    14  }
    15  
    16  // NewKillOperationCommand returns new KillOperationCommand
    17  func NewKillOperationCommand(id string) (*KillOperationCommand, error) {
    18  	if id == "" {
    19  		return nil, newIllegalArgumentError("id cannot be empty")
    20  	}
    21  	cmd := &KillOperationCommand{
    22  		RavenCommandBase: NewRavenCommandBase(),
    23  
    24  		id: id,
    25  	}
    26  	cmd.ResponseType = RavenCommandResponseTypeEmpty
    27  
    28  	return cmd, nil
    29  }
    30  
    31  func (c *KillOperationCommand) createRequest(node *ServerNode) (*http.Request, error) {
    32  	url := node.URL + "/databases/" + node.Database + "/operations/kill?id=" + c.id
    33  
    34  	return newHttpPost(url, nil)
    35  }