-
Notifications
You must be signed in to change notification settings - Fork 12
/
types.go
79 lines (68 loc) · 2.62 KB
/
types.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Copyright (C) 2021-2023, Kubefirst
This program is licensed under MIT.
See the LICENSE file for more details.
*/
package vault
import vaultapi "github.com/hashicorp/vault/api"
// HealthResponse specifies the content of a health response from a vault API
// https://developer.hashicorp.com/vault/api-docs/system/health#sample-response
type HealthResponse struct {
Initialized bool `json:"initialized"`
Sealed bool `json:"sealed"`
Standby bool `json:"standby"`
PerformanceStandby bool `json:"performance_standby"`
ReplicationPerformanceMode string `json:"replication_performance_mode"`
ReplicationDRMode string `json:"replication_dr_mode"`
ServerTimeUTC int `json:"server_time_utc"`
Version string `json:"version"`
ClusterName string `json:"cluster_name"`
ClusterID string `json:"cluster_id"`
}
// InitRequest specifies the content of an `init` operation against a vault API
// https://developer.hashicorp.com/vault/api-docs/system/init#sample-payload
type InitRequest struct {
SecretShares int `json:"secret_shares"`
SecretThreshold int `json:"secret_threshold"`
}
// InitResponse specifies the content of an `init` operation response from a vault API
// https://developer.hashicorp.com/vault/api-docs/system/init#sample-response-1
type InitResponse struct {
Keys []string `json:"keys"`
KeysBase64 []string `json:"keys_base64"`
RootToken string `json:"root_token"`
}
type RaftJoinRequest struct {
LeaderAPIAddress string `json:"leader_api_addr"`
}
type RaftJoinResponse struct {
}
// UnsealRequest specifies the content of an `unseal` operation against a vault API
// https://developer.hashicorp.com/vault/api-docs/system/unseal#sample-payload
type UnsealRequest struct {
Key string `json:"key"`
}
// UnsealResponse specifies the content of an `unseal` operation response from a vault API
// t holds the threshold and n holds the number of shares
// https://developer.hashicorp.com/vault/api-docs/system/unseal#sample-response
type UnsealResponse struct {
Sealed bool `json:"sealed"`
T int `json:"t"`
N int `json:"n"`
Progress int `json:"progress"`
Version string `json:"version"`
ClusterName string `json:"cluster_name"`
ClusterID string `json:"cluster_id"`
}
type VaultUnsealOptions struct {
HighAvailability bool
HighAvailabilityType string
Nodes int
RaftLeader bool
RaftFollower bool
UseAPI bool
VaultAPIAddress string
}
type VaultConfiguration struct {
Config vaultapi.Config
}