github

package
v1.3.22 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package github provides a GitHub provider.

Index

Constants

View Source
const Name = "github"

Name of the provider.

Variables

This section is empty.

Functions

func Delete added in v1.2.3

func Delete(ctx context.Context, v *GitHub, secrets ...string) error

Delete secrets.

Types

type GitHub

type GitHub struct {
	*provider.Provider `json:"-" validate:"required"`

	Owner string `json:"owner" validate:"required"`
	Repo  string `json:"repo"  validate:"required"`
	Token string `json:"-"     validate:"required"`
	// contains filtered or unexported fields
}

GitHub provider definition.

func New

func New(
	override, rawValue bool,
	owner, repo string,
) (*GitHub, error)

New returns a new GitHub provider.

func (*GitHub) GetRepository

func (v *GitHub) GetRepository(ctx context.Context) (*Repository, error)

GetRepository retrieves the repository information.

func (*GitHub) Load

func (v *GitHub) Load(ctx context.Context, opts ...option.LoadKeyFunc) (map[string]string, error)

Load retrieves the configuration, and exports it to the environment.

NOTE: Not all providers allow loading secrets, for example, GitHub. They are designed to be write-only stores of information. This is a security measure to prevent exposure of sensitive data.

func (*GitHub) Write

func (v *GitHub) Write(ctx context.Context, values map[string]interface{}, opts ...option.WriteFunc) error

Write stores a new secret.

NOTE: Not all providers support writing secrets.

type PublicKeyResponse

type PublicKeyResponse struct {
	Key   string `json:"key"`
	KeyID string `json:"key_id"`
}

PublicKeyResponse is the response from the GitHub API.

type Repository

type Repository struct {
	ID     int    `json:"id"`
	NodeID string `json:"node_id"`
}

Repository is the repository information.

type SecretInformation

type SecretInformation struct {
	MountPath  string `json:"-" validate:"required"`
	SecretPath string `json:"-" validate:"required"`
}

SecretInformation is the information about a secret, where to retrieve it.

type SecretRequest

type SecretRequest struct {
	EncryptedValue string `json:"encrypted_value"`
	KeyID          string `json:"key_id"`
}

SecretRequest is the request to store a new secret.

type SecretsResponse added in v1.2.3

type SecretsResponse struct {
	TotalCount int                     `json:"total_count"`
	Secrets    []SecretsResponseSecret `json:"secrets"`
}

SecretsResponse is the response from listing secrets.

func List added in v1.2.3

func List(ctx context.Context, v *GitHub) (*SecretsResponse, error)

List secrets.

type SecretsResponseSecret added in v1.2.3

type SecretsResponseSecret struct {
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

SecretsResponseSecret is the secret information from the GitHub API.

type Target added in v1.2.15

type Target string

Target of the request.

const (
	// Actions const.
	Actions Target = "actions"

	// Codespaces const.
	Codespaces Target = "codespaces"
)

func (Target) String added in v1.2.15

func (t Target) String() string

String implements the Stringer interface.

type VariableRequest added in v1.2.3

type VariableRequest struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

VariableRequest is the request to store a new secret.

Jump to

Keyboard shortcuts

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