gitlab

package
v0.0.0-...-81b6cf0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

README

URL Source

The URL source reads config from a url.

It uses the Content-Type header as the format e.g application/json becomes json. The content itself is not touched. If we can't find a format we'll use the encoder format.

New Source

Specify url source with url. Defaults to http://localhost:8080/config.

urlSource := url.NewSource(
	url.WithURL("http://api.example.com/config"),
)

Load Source

Load the source into config

// Create new config
conf := config.NewConfig()

// Load gitlab source
conf.Load(urlSource)

Documentation

Overview

Package gitlab loads changesets from a gitlab

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTlsConfig   = tls.Config{}
	DefaultToken       = "Js7dM2To3gL-ZzAaNU93"
	DefaultEndpoint, _ = url.Parse("http://gitlab.icloudcity.com")
	DefaultBranch      = "master"
	DefaultFormat      = "json"
	DefaultTimeout     = time.Second * 5
	DefaultRetries     = 10
	DefaultInterval    = time.Second * 1
)

Functions

func NewSource

func NewSource(projectId int, files string, opts ...source.Option) source.Source

func RespSha256

func RespSha256(response *http.Response) string

func WithBranch

func WithBranch(u string) source.Option

func WithEndpoint

func WithEndpoint(u url.URL) source.Option

func WithInterval

func WithInterval(u time.Duration) source.Option

func WithRetries

func WithRetries(u int) source.Option

func WithTimeout

func WithTimeout(u time.Duration) source.Option

func WithTlsConfig

func WithTlsConfig(u tls.Config) source.Option

func WithToken

func WithToken(u string) source.Option

Types

type GitlabSource

type GitlabSource struct {
	ProjectId int
	Files     string
	Endpoint  *url.URL
	Branch    string
	Client    *http.Client
	Token     string
	Header    http.Header
	Interval  time.Duration
	Retries   int
	// contains filtered or unexported fields
}

func (*GitlabSource) APIV4Url

func (u *GitlabSource) APIV4Url() string

func (*GitlabSource) Read

func (u *GitlabSource) Read() (*source.ChangeSet, error)

func (*GitlabSource) String

func (u *GitlabSource) String() string

func (*GitlabSource) Watch

func (u *GitlabSource) Watch() (source.Watcher, error)

Jump to

Keyboard shortcuts

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