Documentation ¶
Overview ¶
Package github contains all logic for implementing Github credential pooling
Description: Implements a static token transport for use in rate limit validation
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetToken ¶
func GetToken(ctx context.Context, creds []*Credential, logger logrus.FieldLogger) (cfg.SecretData, error)
GetToken returns a Github Token that is not rate-limited from a pool of Github Apps and Access Tokens.
Types ¶
type Credential ¶
type Credential struct { // Name is an optional field to supply to make it easier to identify a // set of credentials Name string // AppID is the ID of the Github App that this credential is tied to. // If this is set then PEM must also be set. AppID *int // InstallID is the install ID of the AppID provided above. Must be set // when AppID is set. InstallID *int // PEM is the private key of the Github App that this credential is // tied to. This should not be provided if AppID is 0. PEM cfg.SecretData // AccessToken is a Github Personal Access Token to be used. This must // be set if AppID is not set. AccessToken cfg.SecretData }
Credential is a type of credential to use when talking to Github
func (*Credential) GetToken ¶
func (c *Credential) GetToken(ctx context.Context) (cfg.SecretData, error)
GetToken returns a valid token from a credential and ensures it's not rate-limited if it is, or one cannot be obtained, then instead an error is returned.
Click to show internal directories.
Click to hide internal directories.