client

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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(config Config) (*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.

type Config

type Config interface {
	InternalGitLabServerURL() string
	GitlabAPISecret() []byte
	GitlabClientConnectionTimeout() time.Duration
	GitlabJWTTokenExpiry() time.Duration
	DomainConfigSource() string
}

Config represents an interface that is configuration provider for client capable of comunicating with GitLab

type StubClient

type StubClient struct {
	File string
}

StubClient is a stubbed client used for testing

func (StubClient) GetLookup

func (c StubClient) GetLookup(ctx context.Context, host string) api.Lookup

GetLookup reads a test fixture and unmarshalls it

func (StubClient) Resolve

func (c StubClient) Resolve(ctx context.Context, host string) *api.Lookup

Resolve implements api.Resolver

Jump to

Keyboard shortcuts

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