Documentation ¶
Overview ¶
Package internal
Index ¶
- Constants
- func CreateEntry(entry *client.Secret) *client.Secret
- func CreateFolders(pathParts []string, parentId string)
- func EntryExistsByName(name string, parentId string) bool
- func FoldersExist(pathParts []string, parentId string) bool
- func GetEntry(id string) *client.Secret
- func GetEntryAttachments(entryID string) []client.Attachment
- func GetEntryIdByName(name string, parentId string) string
- func GetEntryIdForPath(path string) string
- func GetEntryWithPassword(id string) *client.Secret
- func GetFolder(name string, parentId string) *client.Folder
- func GetFolderForId(id string) *client.Folder
- func GetFolderIdFromPath(pathParts []string) string
- func GetLinkToEntry(id string) string
- func GetRoot() string
- func GetVault() client.Vault
- func OpaqueSecretToPatch(s *KubernetesOpaqueSecret) string
- func ParsePath(path string) ([]string, error)
- func PatchEntry(id string, jsonPatch string) *client.Secret
- func RandomizeData(s *KubernetesOpaqueSecret) []string
- func ResolveReferences(s *KubernetesOpaqueSecret, e *client.Secret) []string
- func UpdateStringData(path string, s *KubernetesOpaqueSecret, updatedKeys []string)
- func UploadAttachment(entryID string, attachment client.Attachment) *client.Attachment
- type KubernetesOpaqueSecret
- type Metadata
Constants ¶
const PasswordServerPassword = "password_server_password"
const PasswordServerUrl = "password_server_url"
const PasswordServerUsername = "password_server_username"
const RandomToken = "$RANDOM$"
const ReferenceQueryEndToken = "REF$"
const ReferenceQueryStartToken = "$REF"
Variables ¶
This section is empty.
Functions ¶
func CreateEntry ¶
CreateEntry Create new Password Server entry
func CreateFolders ¶
CreateFolders Create non-existing parts of the path delimited by '/' from provided root ID (root by default).
func EntryExistsByName ¶
EntryExistsByName checks whether an entry
func FoldersExist ¶
FoldersExist checks for existence of provided folders in an array in provided parent. If parent is not provided, root is assumed. Path parts represent folders in each other.
func GetEntryAttachments ¶
func GetEntryAttachments(entryID string) []client.Attachment
GetEntryAttachments returns a slice of file attachments for given entry ID.
func GetEntryIdByName ¶
GetEntryIdByName returns entry ID if it exists, otherwise empty string.
func GetEntryIdForPath ¶
GetEntryIdForPath returns Entry ID for a provided path, i.e. /foo/bar/entry-name.
func GetEntryWithPassword ¶
GetEntryWithPassword return Entry enriched with password (which is by default not present).
func GetFolderForId ¶
func GetFolderIdFromPath ¶
GetFolderIdFromPath returns folder ID of the last folder in provided path parts. The path is assumed to start at root.
func GetLinkToEntry ¶
GetLinkToEntry returns link to given Entry in the Web UI.
func OpaqueSecretToPatch ¶
func OpaqueSecretToPatch(s *KubernetesOpaqueSecret) string
OpaqueSecretToPatch generate a JSON patch string from Kubernetes Opaque Secret object.
func ParsePath ¶
ParsePath parses input string that should represent a path in the Password Server structure. The path should be along following style of a path: - foo/bar/baz - /foo/bar/baz/ - foo / bar / baz The result is an array of path parts or an error if parsing was unsuccessful.
func PatchEntry ¶
PatchEntry modifies existing entry with provided JSON fields and returns updated entry.
func RandomizeData ¶
func RandomizeData(s *KubernetesOpaqueSecret) []string
RandomizeData iterates of StringData in the Secret object and replaces 'random' tokens with random strings and return list of modified keys.
func ResolveReferences ¶
func ResolveReferences(s *KubernetesOpaqueSecret, e *client.Secret) []string
ResolveReferences takes an Opaque Secret object, presumably loaded from a YAML file. This might contain references to existing values in provided Entry objects. Example ... stringData:
another-password-field: $REF.ENTRY.Password.REF$
will look up Password field in the Entry object.
func UpdateStringData ¶
func UpdateStringData(path string, s *KubernetesOpaqueSecret, updatedKeys []string)
UpdateStringData in YAML file provided by path with string data in updated keys from provided secret.
func UploadAttachment ¶
func UploadAttachment(entryID string, attachment client.Attachment) *client.Attachment
UploadAttachment adds new file attachment to existing Entry and returns updated Attachment object.
Types ¶
type KubernetesOpaqueSecret ¶
type KubernetesOpaqueSecret struct { Type string `yaml:"type"` Metadata Metadata `yaml:"metadata"` StringData map[string]string `yaml:"stringData"` }
func ReadKubernetesOpaqueSecret ¶
func ReadKubernetesOpaqueSecret(path string) KubernetesOpaqueSecret
ReadKubernetesOpaqueSecret reads file on given path into a Kubernetes Opaque Secret object.