internal

package
v0.1.0-snapshot Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package internal

Index

Constants

View Source
const PasswordServerPassword = "password_server_password"
View Source
const PasswordServerUrl = "password_server_url"
View Source
const PasswordServerUsername = "password_server_username"
View Source
const RandomToken = "$RANDOM$"
View Source
const ReferenceQueryEndToken = "REF$"
View Source
const ReferenceQueryStartToken = "$REF"

Variables

This section is empty.

Functions

func CreateEntry

func CreateEntry(entry *client.Secret) *client.Secret

CreateEntry Create new Password Server entry

func CreateFolders

func CreateFolders(pathParts []string, parentId string)

CreateFolders Create non-existing parts of the path delimited by '/' from provided root ID (root by default).

func EntryExistsByName

func EntryExistsByName(name string, parentId string) bool

EntryExistsByName checks whether an entry

func FoldersExist

func FoldersExist(pathParts []string, parentId string) bool

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 GetEntry

func GetEntry(id string) *client.Secret

GetEntry Get secret entry for given ID.

func GetEntryAttachments

func GetEntryAttachments(entryID string) []client.Attachment

GetEntryAttachments returns a slice of file attachments for given entry ID.

func GetEntryIdByName

func GetEntryIdByName(name string, parentId string) string

GetEntryIdByName returns entry ID if it exists, otherwise empty string.

func GetEntryIdForPath

func GetEntryIdForPath(path string) string

GetEntryIdForPath returns Entry ID for a provided path, i.e. /foo/bar/entry-name.

func GetEntryWithPassword

func GetEntryWithPassword(id string) *client.Secret

GetEntryWithPassword return Entry enriched with password (which is by default not present).

func GetFolder

func GetFolder(name string, parentId string) *client.Folder

GetFolder Return client.Folder object for given name and parent folder ID.

func GetFolderForId

func GetFolderForId(id string) *client.Folder

func GetFolderIdFromPath

func GetFolderIdFromPath(pathParts []string) string

GetFolderIdFromPath returns folder ID of the last folder in provided path parts. The path is assumed to start at root.

func GetLinkToEntry

func GetLinkToEntry(id string) string

GetLinkToEntry returns link to given Entry in the Web UI.

func GetRoot

func GetRoot() string

GetRoot Return UUID of the root folder.

func GetVault

func GetVault() client.Vault

func OpaqueSecretToPatch

func OpaqueSecretToPatch(s *KubernetesOpaqueSecret) string

OpaqueSecretToPatch generate a JSON patch string from Kubernetes Opaque Secret object.

func ParsePath

func ParsePath(path string) ([]string, error)

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

func PatchEntry(id string, jsonPatch string) *client.Secret

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.

type Metadata

type Metadata struct {
	Name string `yaml:"name"`
}

Jump to

Keyboard shortcuts

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