|
|
|
@ -20,14 +20,23 @@ func printSecret(w writer, v *yaml.Secret) {
|
|
|
|
|
w.WriteString("---")
|
|
|
|
|
w.WriteTagValue("version", v.Version)
|
|
|
|
|
w.WriteTagValue("kind", v.Kind)
|
|
|
|
|
w.WriteTagValue("type", toSecretType(v.Type))
|
|
|
|
|
|
|
|
|
|
if len(v.Data) > 0 {
|
|
|
|
|
w.WriteTagValue("type", toSecretType(v.Type))
|
|
|
|
|
w.WriteTagValue("name", v.Name)
|
|
|
|
|
printData(w, v.Data)
|
|
|
|
|
}
|
|
|
|
|
if len(v.External) > 0 {
|
|
|
|
|
w.WriteTagValue("type", toSecretType(v.Type))
|
|
|
|
|
w.WriteTagValue("name", v.Name)
|
|
|
|
|
printExternalData(w, v.External)
|
|
|
|
|
}
|
|
|
|
|
if isSecretGetEmpty(v.Get) == false {
|
|
|
|
|
w.WriteTagValue("type", v.Type)
|
|
|
|
|
w.WriteTagValue("name", v.Name)
|
|
|
|
|
w.WriteByte('\n')
|
|
|
|
|
printGet(w, v.Get)
|
|
|
|
|
}
|
|
|
|
|
w.WriteByte('\n')
|
|
|
|
|
w.WriteByte('\n')
|
|
|
|
|
}
|
|
|
|
@ -43,6 +52,16 @@ func toSecretType(s string) string {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// helper function prints the get block.
|
|
|
|
|
func printGet(w writer, v yaml.SecretGet) {
|
|
|
|
|
w.WriteTag("get")
|
|
|
|
|
w.IndentIncrease()
|
|
|
|
|
w.WriteTagValue("path", v.Path)
|
|
|
|
|
w.WriteTagValue("name", v.Name)
|
|
|
|
|
w.WriteTagValue("key", v.Key)
|
|
|
|
|
w.IndentDecrease()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// helper function prints the external data.
|
|
|
|
|
func printExternalData(w writer, d map[string]yaml.ExternalData) {
|
|
|
|
|
var keys []string
|
|
|
|
@ -92,3 +111,11 @@ func printData(w writer, d map[string]string) {
|
|
|
|
|
|
|
|
|
|
// replace spaces and newlines.
|
|
|
|
|
var spaceReplacer = strings.NewReplacer(" ", "", "\n", "")
|
|
|
|
|
|
|
|
|
|
// helper function returns true if the secret get
|
|
|
|
|
// object is empty.
|
|
|
|
|
func isSecretGetEmpty(v yaml.SecretGet) bool {
|
|
|
|
|
return v.Key == "" &&
|
|
|
|
|
v.Name == "" &&
|
|
|
|
|
v.Path == ""
|
|
|
|
|
}
|
|
|
|
|