api

package
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

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 = fmt.Errorf("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 = fmt.Errorf(
		"4XX status code. This might be related to the proxy settings. " +
			"Please make sure the agent can reach Remote Configuration with the proxy setup",
	)
)

Functions

This section is empty.

Types

type API

API is the interface to implement for a configuration fetcher

type Auth

type Auth struct {
	APIKey    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) 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

Jump to

Keyboard shortcuts

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