forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_client_configuration_operation.go
56 lines (42 loc) · 1.38 KB
/
get_client_configuration_operation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package ravendb
import (
"net/http"
)
var (
// make sure GetClientConfigurationOperation implements IMaintenanceOperation
_ IMaintenanceOperation = &GetClientConfigurationOperation{}
)
type GetClientConfigurationOperation struct {
Command *GetClientConfigurationCommand
}
func NewGetClientConfigurationOperation() *GetClientConfigurationOperation {
return &GetClientConfigurationOperation{}
}
func (o *GetClientConfigurationOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error) {
o.Command = NewGetClientConfigurationCommand()
return o.Command, nil
}
type GetClientConfigurationCommand struct {
RavenCommandBase
Result *GetClientConfigurationCommandResult
}
func NewGetClientConfigurationCommand() *GetClientConfigurationCommand {
cmd := &GetClientConfigurationCommand{
RavenCommandBase: NewRavenCommandBase(),
}
return cmd
}
func (c *GetClientConfigurationCommand) CreateRequest(node *ServerNode) (*http.Request, error) {
url := node.URL + "/databases/" + node.Database + "/configuration/client"
return newHttpGet(url)
}
func (c *GetClientConfigurationCommand) SetResponse(response []byte, fromCache bool) error {
if len(response) == 0 {
return nil
}
return jsonUnmarshal(response, &c.Result)
}
type GetClientConfigurationCommandResult struct {
Etag int64 `json:"Etag"`
Configuration *ClientConfiguration `json:"Configuration"`
}