gocd

package
v0.0.0-...-5cc8c04 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reconcile

func Reconcile(g ConfigRepoInterface, logger log.Logger, prefix string, gocdRepos []ConfigRepo, ghRepos []*github.Repository) error

Reconcile ensures that repos that have been removed from Github, or are no longer found when they had the topic to match removed, are also removed from GoCD

Types

type AllConfigRepos

type AllConfigRepos struct {
	Links    map[string]map[string]string `json:"_links,omitempty"`
	Embedded map[string][]ConfigRepo      `json:"_embedded,omitempty"`
}

AllConfigRepos contains the response from GoCD containing all config repos

type ConfigRepo

type ConfigRepo struct {
	Links         map[string]map[string]string `json:"_links,omitempty"`
	ID            string                       `json:"id"`
	PluginID      string                       `json:"plugin_id"`
	Material      repoMaterial                 `json:"material"`
	Configuration []interface{}                `json:"configuration,omitempty"`
}

ConfigRepo is a representation of a GoCD config repo

type ConfigRepoInterface

type ConfigRepoInterface interface {
	GetConfigRepos() ([]ConfigRepo, error)
	GetConfigRepo(*github.Repository, string) (ConfigRepo, error)
	CreateConfigRepo(*github.Repository, string) (ConfigRepo, error)
	DeleteConfigRepo(*ConfigRepo, string) (*http.Response, error)
}

ConfigRepoInterface provides implementations that interact with GoCD

func New

func New(ctx context.Context, config map[string]string, hc *http.Client, logger log.Logger) ConfigRepoInterface

New returns a GoCD Client

type GoCD

type GoCD struct {
	URL      string
	User     string
	Password string
	// contains filtered or unexported fields
}

GoCD provides GoCD funcs

func (*GoCD) CreateConfigRepo

func (g *GoCD) CreateConfigRepo(repo *github.Repository, prefix string) (ConfigRepo, error)

CreateConfigRepo creates a previously non-existent config repo

func (*GoCD) DeleteConfigRepo

func (g *GoCD) DeleteConfigRepo(repo *ConfigRepo, prefix string) (*http.Response, error)

DeleteConfigRepo removes a config repo from GoCD

func (*GoCD) GetConfigRepo

func (g *GoCD) GetConfigRepo(repo *github.Repository, prefix string) (ConfigRepo, error)

GetConfigRepo retrieves an existing config repo

func (*GoCD) GetConfigRepos

func (g *GoCD) GetConfigRepos() ([]ConfigRepo, error)

GetConfigRepos populates the GoCD struct with config repos

func (*GoCD) NewRequest

func (g *GoCD) NewRequest(verb string, path string, headers http.Header, body io.Reader) (*http.Request, error)

NewRequest creates a new request to the GoCD server and returns it, it populates it with the necessary headers and auth creds

Jump to

Keyboard shortcuts

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