-
Notifications
You must be signed in to change notification settings - Fork 1
/
secret.go
53 lines (42 loc) · 1.21 KB
/
secret.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package certmagic_vault_storage
import (
. "fmt"
"strings"
)
const (
// vaultCertMagicCertificateDataPathFormat & vaultCertMagicCertificateMetadataPathFormat formatters are:
// 1st %s: SecretsPath
// 2nd %s: PathPrefix
// 3rd %s: key/prefix
vaultCertMagicCertificateDataPathFormat secretPathFormatType = "%s/data/%s/%s"
vaultCertMagicCertificateMetadataPathFormat secretPathFormatType = "%s/metadata/%s/%s"
)
type secretPathFormatType string
func (f secretPathFormatType) String(args ...interface{}) string {
return strings.ToLower(Sprintf(string(f), args...))
}
type response struct {
Data data `json:"data"`
}
type data struct {
Data certificateSecret `json:"data"`
Metadata metadata `json:"metadata"`
}
type certificateSecret struct {
Certmagic certMagicCertificateSecret `json:"certmagic"`
}
type certMagicCertificateSecret struct {
Data []byte `json:"data,omitempty"`
Lock *Time `json:"lock,omitempty"`
}
type metadata struct {
Destroyed bool `json:"destroyed"`
CreatedTime Time `json:"created_time"`
DeletionTime Time `json:"deletion_time"`
}
type listResponse struct {
Data listResponseData `json:"data"`
}
type listResponseData struct {
Keys []string `json:"keys"`
}