-
Notifications
You must be signed in to change notification settings - Fork 26
/
health.go
47 lines (41 loc) · 1.1 KB
/
health.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Code generated by goagen v1.4.3, DO NOT EDIT.
//
// API "feedpushr": health Resource Client
//
// Command:
// $ goagen
// --design=github.com/ncarlier/feedpushr/v3/design
// --out=/home/nicolas/workspace/feedpushr/autogen
// --version=v1.4.3
package client
import (
"context"
"fmt"
"net/http"
"net/url"
)
// GetHealthPath computes a request path to the get action of health.
func GetHealthPath() string {
return fmt.Sprintf("/v2/healthz")
}
// Perform health check.
func (c *Client) GetHealth(ctx context.Context, path string) (*http.Response, error) {
req, err := c.NewGetHealthRequest(ctx, path)
if err != nil {
return nil, err
}
return c.Client.Do(ctx, req)
}
// NewGetHealthRequest create the request corresponding to the get action endpoint of the health resource.
func (c *Client) NewGetHealthRequest(ctx context.Context, path string) (*http.Request, error) {
scheme := c.Scheme
if scheme == "" {
scheme = "http"
}
u := url.URL{Host: c.Host, Scheme: scheme, Path: path}
req, err := http.NewRequestWithContext(ctx, "GET", u.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}