func (c *Client) GetHost(hk engine.HostKey) (*engine.Host, error) {
	response, err := c.Get(c.endpoint("hosts", hk.Name), url.Values{})
	if err != nil {
		return nil, err
	}
	return engine.HostFromJSON(response)
}
示例#2
0
func parseHostPack(v []byte) (*engine.Host, error) {
	var hp hostReadPack
	if err := json.Unmarshal(v, &hp); err != nil {
		return nil, err
	}
	if len(hp.Host) == 0 {
		return nil, &scroll.MissingFieldError{Field: "Host"}
	}
	return engine.HostFromJSON(hp.Host)
}