github

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package github manages the configuration and execution of the Vault Secrets Plugin for GitHub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

func Factory(ctx context.Context, conf *logical.BackendConfig) (logical.Backend, error)

Factory creates a configured logical.Backend for the GitHub plugin.

Types

type Client

type Client struct {
	*Config
	// contains filtered or unexported fields
}

Client encapsulates an HTTP client for talking to the configured GitHub App.

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient returns a newly constructed client from the provided config and with sensible default transport settings. It will error if it fails to validate necessary configuration formats like URIs and PEM encoded private keys.

func (*Client) ListInstallations added in v2.2.2

func (c *Client) ListInstallations(ctx context.Context) (*logical.Response, error)

ListInstallations retrieves a list of App installations associated with the client. It returns a logical.Response containing a map where the keys are account names and the values are corresponding installation IDs. In case of an error during the fetch operation, it returns nil and the error.

func (*Client) RevokeToken

func (c *Client) RevokeToken(ctx context.Context, token string) (*logical.Response, error)

RevokeToken takes a valid access token and performs a revocation against GitHub's APIs. If there are any failures on the wire or parsing request and response object, an error is returned.

func (*Client) Token

func (c *Client) Token(ctx context.Context, tokReq *tokenRequest) (*logical.Response, error)

Token returns a valid access token. If there are any failures on the wire or parsing request and response object, an error is returned.

type Config

type Config struct {
	// PrvKey is the private for signing GitHub access token requests (JWTs).
	// NOTE: Should be in a PEM PKCS#1 RSAPrivateKey format.
	PrvKey string `json:"prv_key"`

	// BaseURL is the base URL for API requests.
	// Defaults to GitHub's public API.
	BaseURL string `json:"base_url"`

	// AppID is the application identifier of the GitHub App.
	AppID int `json:"app_id"`

	// ExcludeRepositoryMetadata controls filtering of the 'repositories' key
	// returned on repository-filtered tokens. It defaults to returning full
	// repository metadata but will return a minimised list of repository names
	// if set.
	ExcludeRepositoryMetadata bool `json:"exclude_repository_metadata"`
}

Config holds all configuration for the backend.

func NewConfig

func NewConfig() *Config

NewConfig returns a pre-configured Config struct with defaults.

func (*Config) Update

func (c *Config) Update(d *framework.FieldData) (bool, error)

Update updates the configuration from the given field data only when the data is different.

type Error

type Error string

Error is a simple immutable sentinel error implementation.

func (Error) Error

func (e Error) Error() string

Error is the marker interface for an error.

type PermissionSet

type PermissionSet struct {
	Name         string
	TokenRequest *tokenRequest
}

PermissionSet models the data and methods needed for storing and retrieving permission sets in Vault.

Jump to

Keyboard shortcuts

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