Documentation
¶
Overview ¶
Package api defines the HTTP interface for the remote config backend
Index ¶
- Variables
- type API
- type Auth
- type HTTPClient
- func (c *HTTPClient) Fetch(ctx context.Context, request *pbgo.LatestConfigsRequest) (*pbgo.LatestConfigsResponse, error)
- func (c *HTTPClient) FetchOrgData(ctx context.Context) (*pbgo.OrgDataResponse, error)
- func (c *HTTPClient) FetchOrgStatus(ctx context.Context) (*pbgo.OrgStatusResponse, error)
- func (c *HTTPClient) NewWebSocket(ctx context.Context, endpointPath string, extraHeaders http.Header) (*websocket.Conn, error)
- func (c *HTTPClient) UpdateAPIKey(apiKey string)
- func (c *HTTPClient) UpdatePARJWT(jwt string)
Constants ¶
This section is empty.
Variables ¶
var ( // descriptive as possible (while not leaking data) to make RC onboarding easier ErrUnauthorized = errors.New("unauthorized. Please make sure your API key is valid and has the Remote Config scope") // ErrProxy is the error that will be logged if we suspect that there is a wrong proxy setup for remote-config. // It is displayed for any 4XX status code except 401 ErrProxy = errors.New("4XX status code. This might be related to the proxy settings. " + "Please make sure the agent can reach Remote Configuration with the proxy setup", ) // ErrGatewayTimeout is the error that will be logged if there is a gateway timeout ErrGatewayTimeout = errors.New("non-200 response code: 504") ErrServiceUnavailable = errors.New("non-200 response code: 503") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
Fetch(context.Context, *pbgo.LatestConfigsRequest) (*pbgo.LatestConfigsResponse, error)
FetchOrgData(context.Context) (*pbgo.OrgDataResponse, error)
FetchOrgStatus(context.Context) (*pbgo.OrgStatusResponse, error)
UpdatePARJWT(string)
UpdateAPIKey(string)
}
API is the interface to implement for a configuration fetcher
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient fetches configurations using HTTP requests
func NewHTTPClient ¶
NewHTTPClient returns a new HTTP configuration client
func (*HTTPClient) Fetch ¶
func (c *HTTPClient) Fetch(ctx context.Context, request *pbgo.LatestConfigsRequest) (*pbgo.LatestConfigsResponse, error)
Fetch remote configuration
func (*HTTPClient) FetchOrgData ¶
func (c *HTTPClient) FetchOrgData(ctx context.Context) (*pbgo.OrgDataResponse, error)
FetchOrgData org data
func (*HTTPClient) FetchOrgStatus ¶
func (c *HTTPClient) FetchOrgStatus(ctx context.Context) (*pbgo.OrgStatusResponse, error)
FetchOrgStatus returns the org and key status
func (*HTTPClient) NewWebSocket ¶ added in v0.70.0
func (c *HTTPClient) NewWebSocket(ctx context.Context, endpointPath string, extraHeaders http.Header) (*websocket.Conn, error)
NewWebSocket connects to the RC WebSocket backend and returns a new WebSocket connection or a connection / handshake error.
The "endpointPath" specifies the resource path to connect to, which is appended to the client baseURL. Any headers in "extraHeaders" are added into the handshake request after the standard auth headers
func (*HTTPClient) UpdateAPIKey ¶ added in v0.65.0
func (c *HTTPClient) UpdateAPIKey(apiKey string)
UpdateAPIKey allows for dynamic setting of a Private Action Runners JWT Token for authentication to the RC backend.
func (*HTTPClient) UpdatePARJWT ¶ added in v0.62.0
func (c *HTTPClient) UpdatePARJWT(jwt string)
UpdatePARJWT allows for dynamic setting of a Private Action Runners JWT Token for authentication to the RC backend.