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

     1  package ravendb
     2  
     3  import (
     4  	"net/http"
     5  )
     6  
     7  var (
     8  	_ IMaintenanceOperation = &GetIdentitiesOperation{}
     9  )
    10  
    11  type GetIdentitiesOperation struct {
    12  	Command *GetIdentitiesCommand
    13  }
    14  
    15  func NewGetIdentitiesOperation() *GetIdentitiesOperation {
    16  	return &GetIdentitiesOperation{}
    17  }
    18  
    19  func (o *GetIdentitiesOperation) GetCommand(conventions *DocumentConventions) (RavenCommand, error) {
    20  	o.Command = NewGetIdentitiesCommand()
    21  	return o.Command, nil
    22  }
    23  
    24  type GetIdentitiesCommand struct {
    25  	RavenCommandBase
    26  
    27  	Result map[string]int
    28  }
    29  
    30  func NewGetIdentitiesCommand() *GetIdentitiesCommand {
    31  	cmd := &GetIdentitiesCommand{
    32  		RavenCommandBase: NewRavenCommandBase(),
    33  	}
    34  	cmd.IsReadRequest = true
    35  	return cmd
    36  }
    37  
    38  func (c *GetIdentitiesCommand) createRequest(node *ServerNode) (*http.Request, error) {
    39  	url := node.URL + "/databases/" + node.Database + "/debug/identities"
    40  
    41  	return newHttpGet(url)
    42  
    43  }
    44  
    45  func (c *GetIdentitiesCommand) setResponse(response []byte, fromCache bool) error {
    46  	return jsonUnmarshal(response, &c.Result)
    47  }