github

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

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. It will error if it fails to validate necessary configuration formats like URIs and PEM encoded private keys.

func (*Client) Token

func (c *Client) Token(ctx context.Context, opts *tokenOptions) (*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 {
	// AppID is the application identifier of the GitHub App.
	AppID int `json:"app_id"`

	// InsID is the installation identifier of the GitHub App.
	InsID int `json:"ins_id"`

	// 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"`
}

Config holds all configuration for the backend.

func NewConfig

func NewConfig() *Config

NewConfig returns a pre-configured Config struct.

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.

Jump to

Keyboard shortcuts

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