vault

package
v0.0.0-...-689dbae Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VAULT_TOKEN = "root-token"
)

Variables

View Source
var (
	ErrCertIssueFailed = errors.New("failed to issue new certificate from vault")
)

Functions

func StartTestDevVaultInTest

func StartTestDevVaultInTest(t *testing.T, ctx context.Context) (vserver *VaultServer, vclient *Vault, err error)

Types

type AuthRole

type AuthRole struct {
	BoundServiceAccounts []string `json:"bound_service_accounts"`
	MaxJWTExp            int      `json:"max_jwt_exp"`
	Policies             []string `json:"policies"`
}

type AuthRoleResp

type AuthRoleResp struct {
	Data AuthRole `json:"data"`
}

type Certs

type Certs struct {
	CA          string
	Certificate string
	Key         string
}

type GeneralResp

type GeneralResp struct {
	Data map[string]interface{} `json:"data"`
}

type Vault

type Vault struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(vaultaddr string, caCertBytes []byte) (vaultClient *Vault, err error)

func NewClientWithContext

func NewClientWithContext(ctx context.Context, vaultaddr string, caCertBytes []byte) (vaultClient *Vault, err error)

func (*Vault) AddAuthJWTConfig

func (v *Vault) AddAuthJWTConfig(authPath, oidcDiscoveryUrl, boundIssuer string) (err error)

func (*Vault) AddAuthRoleIAMType

func (v *Vault) AddAuthRoleIAMType(authPath string, roleName string, policies []string, serviceAccounts []string) (err error)

func (*Vault) AddAuthRoleJWTType

func (v *Vault) AddAuthRoleJWTType(authPath, roleName string, policies []string, boundAudiences []string, sub string, userClaim string, ttl string) (err error)

func (*Vault) EnableAuth

func (v *Vault) EnableAuth(authMethod string) (err error)

func (*Vault) EnableAuthByPath

func (v *Vault) EnableAuthByPath(authPath string, authMethod string) (err error)

func (*Vault) GetAuthRole

func (v *Vault) GetAuthRole(authPath string, roleName string) (authRole AuthRole, err error)

func (*Vault) GetAuthType

func (v *Vault) GetAuthType(authPath string) (authType string, err error)

func (*Vault) GetHealthStatus

func (v *Vault) GetHealthStatus() (*vaultapi.HealthResponse, error)

func (*Vault) GetInitStatus

func (v *Vault) GetInitStatus() (init bool, err error)

func (*Vault) GetPolicy

func (v *Vault) GetPolicy(policyName string) (policyContent string, err error)

func (*Vault) GetRawAuthRole

func (v *Vault) GetRawAuthRole(authMethod, roleName string) (authRole map[string]interface{}, err error)

func (*Vault) GetToken

func (v *Vault) GetToken() string

func (*Vault) Initialize

func (v *Vault) Initialize() (resp []byte, err error)

func (*Vault) IssueNewCertificate

func (v *Vault) IssueNewCertificate(vaultpki VaultPKI) (certs Certs, err error)

func (*Vault) SetPolicy

func (v *Vault) SetPolicy(policyName string, policyContent string) (err error)

func (*Vault) SetToken

func (v *Vault) SetToken(token string)

type VaultPKI

type VaultPKI struct {
	Path    string
	Role    string
	CN      string
	CertTTL string
}

type VaultServer

type VaultServer struct {
	*testvault.VaultContainer
}

func (*VaultServer) Execute

func (v *VaultServer) Execute(ctx context.Context, command string) ([]byte, error)

Jump to

Keyboard shortcuts

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