Example #1
0
func NewHTTPClient(c *http.Client) (API, error) {
	svc, err := schema.New(c)
	if err != nil {
		return nil, err
	}
	return &HTTPClient{svc: svc}, nil
}
Example #2
0
func NewHTTPClient(c *http.Client, ep url.URL) (API, error) {
	svc, err := schema.New(c)
	if err != nil {
		return nil, err
	}

	// append a slash so the schema.Service knows this is the root path
	ep.Path = path.Join(ep.Path, "fleet", "v1") + "/"
	svc.BasePath = ep.String()

	return &HTTPClient{svc: svc}, nil
}
Example #3
0
func NewHTTPClient(c *http.Client, endpoint string) (API, error) {
	svc, err := schema.New(c)
	if err != nil {
		return nil, err
	}

	ep, err := url.Parse(endpoint)
	if err != nil {
		return nil, err
	}

	// append a slash so the schema.Service knows this is the root path
	ep.Path = path.Join(ep.Path, "v1-alpha") + "/"
	svc.BasePath = ep.String()

	return &HTTPClient{svc: svc}, nil
}