github.com/ravendb/ravendb-go-client@v0.0.0-20240229102137-4474ee7aa0fa/serverwide/operations/operation_boostrap.go (about) 1 package operations 2 3 import ( 4 "encoding/json" 5 "github.com/ravendb/ravendb-go-client" 6 "net/http" 7 ) 8 9 type OperationBootstrap struct { 10 } 11 12 func (o *OperationBootstrap) GetCommand(conventions *ravendb.DocumentConventions) (ravendb.RavenCommand, error) { 13 return &bootstrapCommand{ 14 RaftCommandBase: ravendb.RaftCommandBase{ 15 RavenCommandBase: ravendb.RavenCommandBase{ 16 ResponseType: ravendb.RavenCommandResponseTypeObject, 17 }, 18 }, 19 parent: o, 20 }, nil 21 } 22 23 type bootstrapCommand struct { 24 ravendb.RaftCommandBase 25 parent *OperationBootstrap 26 } 27 28 func (c *bootstrapCommand) CreateRequest(node *ravendb.ServerNode) (*http.Request, error) { 29 url := node.URL + "/admin/cluster/bootstrap" 30 return ravendb.NewHttpPost(url, []byte{}) 31 } 32 33 func (c *bootstrapCommand) SetResponse(response []byte, fromCache bool) error { 34 return json.Unmarshal(response, c.parent) 35 }