Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateSecretID(request *CreateSecretRequest) string
- func GenerateSecretIDFromName(name string) string
- func InitSecretStore(store secret.Store, types secret.TypeList)
- func IsCASError(err error) bool
- func RandomString(genType string, length int) (res string, err error)
- func ValidateSecretType(s *SecretItemResponse, validType string) error
- type CreateSecretRequest
- type ListSecretsQuery
- type MismatchError
- type SecretItemResponse
Constants ¶
const ( TagKubeConfig = "KubeConfig" TagBanzaiHidden = "banzai:hidden" TagBanzaiReadonly = "banzai:readonly" )
Internal usage
const DefaultPasswordFormat = "randAlphaNum,12"
DefaultPasswordFormat is the format of passwords if not specified otherwise
Variables ¶
var ErrSecretNotExists = fmt.Errorf("There's no secret with this ID")
ErrSecretNotExists denotes 'Not Found' errors for secrets nolint: gochecknoglobals
var ForbiddenTags = []string{ TagKubeConfig, }
ForbiddenTags are not supported in secret creation nolint: gochecknoglobals
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 ¶
GenerateSecretIDFromName generates a "unique by name per organization" id for Secrets
func InitSecretStore ¶
InitSecretStore initializes the global secret store.
func IsCASError ¶
IsCASError detects if the underlying Vault error is caused by a CAS failure
func RandomString ¶
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 ¶
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