api

package
v0.86.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 17 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package api defines the HTTP interface for the remote config backend

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnauthorized is the error that will be logged for the customer to see in case of a 401. We make it as
	// 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 is the error that will be logged if there is the service is unavailable
	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 Auth

type Auth struct {
	APIKey    string
	PARJWT    string
	AppKey    string
	UseAppKey bool
}

Auth defines the possible Authentication data to access the RC backend

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

HTTPClient fetches configurations using HTTP requests

func NewHTTPClient

func NewHTTPClient(auth Auth, cfg model.Reader, baseURL *url.URL) (*HTTPClient, error)

NewHTTPClient returns a new HTTP configuration client

func (*HTTPClient) BaseURL added in v0.80.0

func (c *HTTPClient) BaseURL() (*url.URL, error)

BaseURL returns the HTTP endpoint address to the RC backend.

func (*HTTPClient) Fetch

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) Headers added in v0.80.0

func (c *HTTPClient) Headers() http.Header

Headers returns a copy of the HTTP headers configured for RC backend requests, including API credentials.

func (*HTTPClient) Transport added in v0.80.0

func (c *HTTPClient) Transport() (*http.Transport, error)

Transport returns a pointer to the transport (TLS + Proxy) configuration.

Callers MUST NOT modify the returned data.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL