Esempio n. 1
0
func (c *Client) GetBackend(bk engine.BackendKey) (*engine.Backend, error) {
	response, err := c.Get(c.endpoint("backends", bk.Id), url.Values{})
	if err != nil {
		return nil, err
	}
	return engine.BackendFromJSON(response)
}
Esempio n. 2
0
func (n *ng) GetBackend(key engine.BackendKey) (*engine.Backend, error) {
	backendKey := n.path("backends", key.Id, "backend")

	bytes, err := n.getVal(backendKey)
	if err != nil {
		return nil, err
	}
	return engine.BackendFromJSON([]byte(bytes), key.Id)
}
Esempio n. 3
0
func parseBackendPack(v []byte) (*engine.Backend, error) {
	var bp *backendReadPack
	if err := json.Unmarshal(v, &bp); err != nil {
		return nil, err
	}
	if bp == nil || len(bp.Backend) == 0 {
		return nil, &scroll.MissingFieldError{Field: "Backend"}
	}
	return engine.BackendFromJSON(bp.Backend)
}