github

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package github implements a sidecred.Provider for Github access tokens and deploy keys. It also implements a client for Github Apps, which is used to create the supported credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(client AppsAPI, options ...option) sidecred.Provider

New returns a new sidecred.Provider for Github credentials.

func WithDeployKeyRotationInterval

func WithDeployKeyRotationInterval(duration time.Duration) option

WithDeployKeyRotationInterval sets the interval at which deploy keys should be rotated.

func WithReposClientFactory

func WithReposClientFactory(f func(token string) RepositoriesAPI) option

WithReposClientFactory sets the function used to create new installation clients, and can be used to return test fakes.

Types

type AccessTokenRequestConfig

type AccessTokenRequestConfig struct {
	Owner string `json:"owner"`
}

AccessTokenRequestConfig ...

type AppsAPI

type AppsAPI interface {
	ListInstallations(ctx context.Context, opt *github.ListOptions) ([]*github.Installation, *github.Response, error)
	CreateInstallationToken(ctx context.Context, id int64, opt *github.InstallationTokenOptions) (*github.InstallationToken, *github.Response, error)
}

AppsAPI wraps the Github Apps API.

func NewAppsClient

func NewAppsClient(integrationID int64, privateKey string) (AppsAPI, error)

NewAppsClient returns a client for a Github App authenticated with a private key.

type DeployKeyRequestConfig

type DeployKeyRequestConfig struct {
	Owner      string `json:"owner"`
	Repository string `json:"repository"`
	Title      string `json:"title"`
	ReadOnly   bool   `json:"read_only"`
}

DeployKeyRequestConfig ...

type RepositoriesAPI

type RepositoriesAPI interface {
	ListKeys(ctx context.Context, owner string, repo string, opt *github.ListOptions) ([]*github.Key, *github.Response, error)
	CreateKey(ctx context.Context, owner string, repo string, key *github.Key) (*github.Key, *github.Response, error)
	DeleteKey(ctx context.Context, owner string, repo string, id int64) (*github.Response, error)
}

RepositoriesAPI wraps the Github repositories API.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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