func (c *Client) GetFrontend(fk engine.FrontendKey) (*engine.Frontend, error) { response, err := c.Get(c.endpoint("frontends", fk.Id), url.Values{}) if err != nil { return nil, err } return engine.FrontendFromJSON(c.Registry.GetRouter(), response) }
func (n *ng) GetFrontend(key engine.FrontendKey) (*engine.Frontend, error) { frontendKey := n.path("frontends", key.Id, "frontend") bytes, err := n.getVal(frontendKey) if err != nil { return nil, err } return engine.FrontendFromJSON(n.registry.GetRouter(), []byte(bytes), key.Id) }
func parseFrontendPack(router router.Router, v []byte) (*engine.Frontend, time.Duration, error) { var fp frontendReadPack if err := json.Unmarshal(v, &fp); err != nil { return nil, 0, err } if len(fp.Frontend) == 0 { return nil, 0, &scroll.MissingFieldError{Field: "Frontend"} } f, err := engine.FrontendFromJSON(router, fp.Frontend) if err != nil { return nil, 0, err } var ttl time.Duration if fp.TTL != "" { ttl, err = time.ParseDuration(fp.TTL) if err != nil { return nil, 0, err } } return f, ttl, nil }