gitlab

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsForbidden

func IsForbidden(err error) bool

Types

type CacheOptions

type CacheOptions struct {
	CacheTTL      time.Duration
	CacheErrorTTL time.Duration
}

CacheOptions holds cache behaviour configuration.

type CachingClient

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

CachingClient wraps ClientInterface to add caching.

func NewCachingClient

func NewCachingClient(client ClientInterface, agentInfoCacheOptions CacheOptions, projectInfoCacheOptions CacheOptions) *CachingClient

func (*CachingClient) GetAgentInfo

func (c *CachingClient) GetAgentInfo(ctx context.Context, agentMeta *api.AgentMeta) (*api.AgentInfo, error)

func (*CachingClient) GetProjectInfo

func (c *CachingClient) GetProjectInfo(ctx context.Context, agentMeta *api.AgentMeta, projectId string) (*api.ProjectInfo, error)

func (*CachingClient) Run

func (c *CachingClient) Run(ctx context.Context)

type Client

type Client struct {
	Backend    *url.URL
	HTTPClient HTTPClient
	AuthSecret []byte
	UserAgent  string
}

func NewClient

func NewClient(backend *url.URL, authSecret []byte, userAgent string) *Client

func (*Client) GetAgentInfo

func (c *Client) GetAgentInfo(ctx context.Context, meta *api.AgentMeta) (*api.AgentInfo, error)

func (*Client) GetProjectInfo

func (c *Client) GetProjectInfo(ctx context.Context, meta *api.AgentMeta, projectId string) (*api.ProjectInfo, error)

type ClientError

type ClientError struct {
	Kind       ErrorKind
	StatusCode int
}

func (*ClientError) Error

func (c *ClientError) Error() string

type ClientInterface

type ClientInterface interface {
	GetAgentInfo(ctx context.Context, agentMeta *api.AgentMeta) (*api.AgentInfo, error)
	GetProjectInfo(ctx context.Context, agentMeta *api.AgentMeta, projectId string) (*api.ProjectInfo, error)
}

type ErrorKind

type ErrorKind int
const (
	ErrorKindOther ErrorKind = iota
	ErrorKindForbidden
)

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

Directories

Path Synopsis
Mocks for GitLab client.
Mocks for GitLab client.

Jump to

Keyboard shortcuts

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