gh

package
v0.0.0-...-d275bc5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppToken

func GetAppToken(credentials config.GithubAppCredentials) (string, error)

GetAppToken takes a Github App ID and Client Secret in PEM format as inputs, and returns an access token that can be used with the Github API.

Types

type OrgClient

type OrgClient struct {
	// contains filtered or unexported fields
}

OrgClient is used for making administrative changes to a given Github org.

func NewOrgClient

func NewOrgClient(credentials config.GithubAppCredentials, org string) *OrgClient

NewOrgClient constructs a new OrgClient using the supplied credentials.

func (*OrgClient) ApprovePATRequest

func (oc *OrgClient) ApprovePATRequest(ctx context.Context, repo string) error

ApprovePATRequest approves a waiting request for access for a token for a specific snap.

type PAT

type PAT struct {
	ID    string
	Name  string
	Token string
	// contains filtered or unexported fields
}

PAT represents a Github Personal Access Token.

func (*PAT) Delete

func (p *PAT) Delete(pc *PATClient) error

Delete removes the PAT from the Github account.

type PATClient

type PATClient struct {
	// contains filtered or unexported fields
}

PATClient represents an http.Client that can be logged into Github, retaining any session cookies, and used for listing, creating, and deleting PATs.

func NewPATClient

func NewPATClient(credentials config.LoginCredentials) *PATClient

NewPATClient constructs a new PATClient and returns it.

func (*PATClient) Create

func (pc *PATClient) Create(name string, repos []string, resourceOwner string) (*PAT, error)

Create adds a new PAT to the logged in account scoped to the specified repos. At present the scope cannot be modified, and gives metadata read access, and contents read/write access. Token expiry defaults to now + 1 year.

func (*PATClient) List

func (pc *PATClient) List(filter string) ([]*PAT, error)

List returns a list of PATs associated with a Github account. The filter arg will ensure that only tokens containing the filter param in their name feature in the list.

type RepoClient

type RepoClient struct {
	// contains filtered or unexported fields
}

RepoClient is used for manipulating secrets and environments in Github repositories.

func NewRepoClient

func NewRepoClient(token string, org string) *RepoClient

NewRepoClient constructs a new RepoClient with the specified credentials.

func (*RepoClient) SetEnvSecret

func (rc *RepoClient) SetEnvSecret(ctx context.Context, repo string, track config.Track, secretName, secretValue string) error

SetEnvSecret sets a secret in the specified environment for the specified repo. If the environment does not exist, it is created.

Jump to

Keyboard shortcuts

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