secret

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagKubeConfig     = "KubeConfig"
	TagBanzaiHidden   = "banzai:hidden"
	TagBanzaiReadonly = "banzai:readonly"
)

Internal usage

View Source
const DefaultPasswordFormat = "randAlphaNum,12"

DefaultPasswordFormat is the format of passwords if not specified otherwise

Variables

View Source
var ErrSecretNotExists = fmt.Errorf("There's no secret with this ID")

ErrSecretNotExists denotes 'Not Found' errors for secrets nolint: gochecknoglobals

View Source
var ForbiddenTags = []string{
	TagKubeConfig,
}

ForbiddenTags are not supported in secret creation nolint: gochecknoglobals

View Source
var Store *secretStore

Store object that wraps up vault logical store nolint: gochecknoglobals

Functions

func GenerateSecretID

func GenerateSecretID(request *CreateSecretRequest) string

GenerateSecretID generates a "unique by name per organization" id for Secrets

func GenerateSecretIDFromName

func GenerateSecretIDFromName(name string) string

GenerateSecretIDFromName generates a "unique by name per organization" id for Secrets

func InitSecretStore

func InitSecretStore(store secret.Store, types secret.TypeList)

InitSecretStore initializes the global secret store.

func IsCASError

func IsCASError(err error) bool

IsCASError detects if the underlying Vault error is caused by a CAS failure

func RandomString

func RandomString(genType string, length int) (res string, err error)

RandomString creates a random string whose length is the number of characters specified.

func ValidateSecretType

func ValidateSecretType(s *SecretItemResponse, validType string) error

ValidateSecretType validates the secret type

Types

type CreateSecretRequest

type CreateSecretRequest struct {
	Name      string            `json:"name" binding:"required" mapstructure:"name"`
	Type      string            `json:"type" binding:"required" mapstructure:"type"`
	Values    map[string]string `json:"values" binding:"required" mapstructure:"values"`
	Tags      []string          `json:"tags,omitempty" mapstructure:"tags"`
	UpdatedBy string            `json:"updatedBy,omitempty" mapstructure:"updatedBy"`

	// Verify secret if the type has a verifier
	Verify bool `json:"-" mapstructure:"-"`
}

CreateSecretRequest param for secretStore.Store Only fields with `mapstructure` tag are getting written to Vault

func (*CreateSecretRequest) MarshalJSON

func (r *CreateSecretRequest) MarshalJSON() ([]byte, error)

type ListSecretsQuery

type ListSecretsQuery struct {
	Type   string   `form:"type" json:"type"`
	IDs    []string `form:"ids" json:"ids"`
	Tags   []string `form:"tags" json:"tags"`
	Values bool     `form:"values" json:"values"`
}

ListSecretsQuery represent a secret listing filter

type MismatchError

type MismatchError struct {
	Err        error
	SecretType string
	ValidType  string
}

MismatchError describe a secret error where the given and expected secret type is not equal

func (MismatchError) BadRequest

func (MismatchError) BadRequest() bool

func (MismatchError) Error

func (m MismatchError) Error() string

func (MismatchError) ServiceError

func (MismatchError) ServiceError() bool

type SecretItemResponse

type SecretItemResponse struct {
	ID        string            `json:"id"`
	Name      string            `json:"name" mapstructure:"name"`
	Type      string            `json:"type" mapstructure:"type"`
	Values    map[string]string `json:"values" mapstructure:"values"`
	Tags      []string          `json:"tags" mapstructure:"tags"`
	Version   int               `json:"version"`
	UpdatedAt time.Time         `json:"updatedAt"`
	UpdatedBy string            `json:"updatedBy,omitempty" mapstructure:"updatedBy"`
}

SecretItemResponse for GetSecret

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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