token

package
v5.9.12 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	Get() (string, error)
}

Provider represents the behaviour of obtaining a Buildkite token.

func Must

func Must(prov Provider, err error) Provider

Must is a helper function to ensure a Provider object can be successfully instantiated when calling any of the constructor functions provided by this package.

This helper is intended to be used at program startup to load the Provider implementation to be used. Such as:

var provider := token.Must(token.NewSSMProvider())

func NewInMemory

func NewInMemory(token string) (Provider, error)

NewInMemory constructs a Buildkite API token provider backed by a in-memory string.

func NewSSM

func NewSSM(client SSMClient, name string, opts ...SSMProviderOpt) (Provider, error)

NewEnvironment constructs a Buildkite API token provider backed by AWS Systems Manager parameter store.

func NewSecretsManager

func NewSecretsManager(client SecretsManagerClient, secretID string, opts ...SecretsManagerOpt) (Provider, error)

NewSecretsManager constructs a Buildkite API token provider backed by AWS Secrets Manager.

type SSMClient

type SSMClient interface {
	GetParameter(*ssm.GetParameterInput) (*ssm.GetParameterOutput, error)
}

SSMService represents the minimal subset of interactions required to retrieve a Buildkite API token from AWS Systems Manager parameter store.

type SSMProviderOpt

type SSMProviderOpt func(prov *ssmProvider) error

SSMProviderOpt represents a configuration option for the AWS SSM Buildkite token provider.

type SecretsManagerClient

type SecretsManagerClient interface {
	GetSecretValue(*secretsmanager.GetSecretValueInput) (*secretsmanager.GetSecretValueOutput, error)
}

SecretsManagerClient represents the minimal interactions required to retrieve a Buildkite API token from AWS Secrets Manager.

type SecretsManagerOpt

type SecretsManagerOpt func(opts *secretsManagerProvider) error

SecretsManagerOpt represents a configuration option for the AWS SecretsManager Buildkite token provider.

func WithSecretsManagerJSONSecret

func WithSecretsManagerJSONSecret(key string) SecretsManagerOpt

WithSecretsManagerJSONSecret instructs SecretsManager Buidlkite token provider that the token is stored within a JSON payload. The key parameter specifies the JSON field holding the secret value within the JSON blob.

This configuration option works for both AWS supported secret formats (SecretString and SecretBinary). However, for the later case, the binary payload must be a valid JSON document containing the 'key' field.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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