core

package
v1.1.20 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Year is the number of hours per year.
	Year = daysInYear * hoursInDay * time.Hour
	// Week is the number of hours per week.
	Week = daysInWeek * hoursInDay * time.Hour
	// Day is the number of hours per day.
	Day = hoursInDay * time.Hour
	// Hour is one hour.
	Hour = time.Hour
	// Minute is one minute.
	Minute = time.Minute
	// Second is one second.
	Second = time.Second
)

Variables

View Source
var ErrAPIError = erx.New("Vault API", "failed to interact with Vault API")

ErrAPIError is returned for any error encountered while interacting with the Vault API.

View Source
var ErrDoesNotExist = erx.New("Vault API", "vault object does not exist")

ErrDoesNotExist is returned by all apis when a vault object doesn't exist.

View Source
var ErrHTTPError = erx.New("Vault API", "failed to send or receive HTTP request")

ErrHTTPError is returned for any error encountered while sending or receiving HTTP requests.

View Source
var ErrSetupFailed = erx.New("Vault API", "failed to initialize Vault API")

ErrSetupFailed is returned when the Vault API instanced failed to initialize.

Functions

This section is empty.

Types

type API

type API interface {
	RequestAPI
	LoggingAPI
}

func NewCoreAPI

func NewCoreAPI(address string, opts ...Option) (API, error)

type AuthData

type AuthData struct {
	ClientToken   string       `json:"client_token"`
	Accessor      string       `json:"accessor"`
	Policies      []string     `json:"policies"`
	LeaseDuration int          `json:"lease_duration"`
	Renewable     bool         `json:"renewable"`
	Metadata      AuthMetadata `json:"metadata"`
}

type AuthMetadata

type AuthMetadata struct {
	Role                     string `json:"role"`
	ServiceAccountName       string `json:"service_account_name"`
	ServiceAccountNamespace  string `json:"service_account_namespace"`
	ServiceAccountSecretName string `json:"service_account_secret_name"`
	ServiceAccountUID        string `json:"service_account_uid"`
}

type AuthProvider

type AuthProvider interface {
	Authenticate(core API) (*AuthResponse, error)
}

type AuthResponse

type AuthResponse struct {
	Auth AuthData `json:"auth"`
}

type EnvVar

type EnvVar string

func (EnvVar) FetchStringValue

func (e EnvVar) FetchStringValue() (string, error)

type ErrorResponse

type ErrorResponse struct {
	Errors []string `json:"errors"`
}

type File

type File string

func (File) FetchStringValue

func (f File) FetchStringValue() (string, error)

type LoggingAPI

type LoggingAPI interface {
	Log() logr.Logger
}

type MountPath

type MountPath string

func (MountPath) GetMountPath

func (k MountPath) GetMountPath() (string, error)

type MountPathEntity

type MountPathEntity interface {
	GetMountPath() (string, error)
}

type Option

type Option func(api *api) error

func WithAuthProvider

func WithAuthProvider(provider AuthProvider) Option

func WithCACerts

func WithCACerts(cas ...string) Option

func WithToken

func WithToken(token string) Option

func WithTokenAuth

func WithTokenAuth() Option

type PolicyName

type PolicyName string

func (PolicyName) GetPolicyName

func (p PolicyName) GetPolicyName() (string, error)

type PolicyNameEntity

type PolicyNameEntity interface {
	GetPolicyName() (string, error)
}

type RequestAPI

type RequestAPI interface {
	MakeRequest(method RequestType, path string, request httpclient.Encodable, response httpclient.Decodeable) error
	GetVaultAddress(path ...string) string
}

type RequestType

type RequestType string
const (
	// MethodGet is a http GET request.
	MethodGet RequestType = "GET"
	// MethodDelete is a http DELETE request.
	MethodDelete RequestType = "DELETE"
	// MethodPost is a http POST request.
	MethodPost RequestType = "POST"
	// MethodPut is a http PUT request.
	MethodPut RequestType = "PUT"
	// MethodList is a http LIST request.
	MethodList RequestType = "LIST"
)

type RoleName

type RoleName string

func (RoleName) GetRoleName

func (r RoleName) GetRoleName() (string, error)

type RoleNameEntity

type RoleNameEntity interface {
	GetRoleName() (string, error)
}

type RolePoliciesEntity

type RolePoliciesEntity interface {
	GetRolePolicies() ([]PolicyName, error)
}

type SecretPath

type SecretPath string

func (SecretPath) GetSecretPath

func (k SecretPath) GetSecretPath() (string, error)

type SecretPathEntity

type SecretPathEntity interface {
	GetSecretPath() (string, error)
}

type StringSource

type StringSource interface {
	FetchStringValue() (string, error)
}

type Value

type Value string

func (Value) FetchStringValue

func (v Value) FetchStringValue() (string, error)

type VaultHTTPError

type VaultHTTPError struct {
	StatusCode  int
	VaultErrors []string
	// contains filtered or unexported fields
}

type VaultTTL

type VaultTTL struct {
	TTL time.Duration
}

func NewTTL

func NewTTL(ttl time.Duration) *VaultTTL

func (*VaultTTL) MarshalJSON

func (v *VaultTTL) MarshalJSON() ([]byte, error)

func (*VaultTTL) UnmarshalJSON

func (v *VaultTTL) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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