github

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 13 Imported by: 0

README

Github Provider

TODO

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(app App, 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"`
	Repositories []string               `json:"repositories,omitempty"`
	Permissions  *githubapp.Permissions `json:"permissions,omitempty"`
	TokenName    string                 `json:"token_name,omitempty"`
}

AccessTokenRequestConfig ...

func (*AccessTokenRequestConfig) Validate added in v0.11.0

func (c *AccessTokenRequestConfig) Validate() error

Validate implements sidecred.Validatable.

type App added in v0.5.0

type App interface {
	CreateInstallationToken(owner string, repositories []string, permissions *githubapp.Permissions) (*githubapp.Token, error)
}

App is the interface that needs to be satisfied by the Github App implementation.

type DeployKeyRequestConfig

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

DeployKeyRequestConfig ...

func (*DeployKeyRequestConfig) Validate added in v0.11.0

func (c *DeployKeyRequestConfig) Validate() error

Validate implements sidecred.Validatable.

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