client

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectionErrorMsg = "failed to connect to internal Pages API"

ConnectionErrorMsg to be returned with `gc.Status` if Pages fails to connect to the internal GitLab API, times out or a 401 given that the credentials used are wrong

Variables

View Source
var ErrUnauthorizedAPI = errors.New("pages endpoint unauthorized")

ErrUnauthorizedAPI is returned when resolving a domain with the GitLab API returns a http.StatusUnauthorized. This happens if the common secret file is not synced between gitlab-pages and gitlab-rails servers. See https://gitlab.com/gitlab-org/gitlab-pages/-/issues/535 for more details.

Functions

This section is empty.

Types

type Client

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

Client is a HTTP client to access Pages internal API

func NewClient

func NewClient(baseURL string, secretKey []byte, connectionTimeout, jwtTokenExpiry time.Duration) (*Client, error)

NewClient initializes and returns new Client baseUrl is appConfig.InternalGitLabServer secretKey is appConfig.GitLabAPISecretKey

func NewFromConfig

func NewFromConfig(cfg *config.GitLab) (*Client, error)

NewFromConfig creates a new client from Config struct

func (*Client) GetLookup

func (gc *Client) GetLookup(ctx context.Context, host string) api.Lookup

GetLookup returns a VirtualDomain configuration wrapped into a Lookup for a given host

func (*Client) Resolve

func (gc *Client) Resolve(ctx context.Context, host string) *api.Lookup

Resolve returns a VirtualDomain configuration wrapped into a Lookup for a given host. It implements api.Resolve type.

Jump to

Keyboard shortcuts

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