aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/vault/api/sys_seal.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/vault/api/sys_seal.go')
-rw-r--r--vendor/github.com/hashicorp/vault/api/sys_seal.go69
1 files changed, 0 insertions, 69 deletions
diff --git a/vendor/github.com/hashicorp/vault/api/sys_seal.go b/vendor/github.com/hashicorp/vault/api/sys_seal.go
deleted file mode 100644
index 7cc32ac..0000000
--- a/vendor/github.com/hashicorp/vault/api/sys_seal.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package api
-
-import "context"
-
-func (c *Sys) SealStatus() (*SealStatusResponse, error) {
- r := c.c.NewRequest("GET", "/v1/sys/seal-status")
- return sealStatusRequest(c, r)
-}
-
-func (c *Sys) Seal() error {
- r := c.c.NewRequest("PUT", "/v1/sys/seal")
-
- ctx, cancelFunc := context.WithCancel(context.Background())
- defer cancelFunc()
- resp, err := c.c.RawRequestWithContext(ctx, r)
- if err == nil {
- defer resp.Body.Close()
- }
- return err
-}
-
-func (c *Sys) ResetUnsealProcess() (*SealStatusResponse, error) {
- body := map[string]interface{}{"reset": true}
-
- r := c.c.NewRequest("PUT", "/v1/sys/unseal")
- if err := r.SetJSONBody(body); err != nil {
- return nil, err
- }
-
- return sealStatusRequest(c, r)
-}
-
-func (c *Sys) Unseal(shard string) (*SealStatusResponse, error) {
- body := map[string]interface{}{"key": shard}
-
- r := c.c.NewRequest("PUT", "/v1/sys/unseal")
- if err := r.SetJSONBody(body); err != nil {
- return nil, err
- }
-
- return sealStatusRequest(c, r)
-}
-
-func sealStatusRequest(c *Sys, r *Request) (*SealStatusResponse, error) {
- ctx, cancelFunc := context.WithCancel(context.Background())
- defer cancelFunc()
- resp, err := c.c.RawRequestWithContext(ctx, r)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- var result SealStatusResponse
- err = resp.DecodeJSON(&result)
- return &result, err
-}
-
-type SealStatusResponse struct {
- Type string `json:"type"`
- Sealed bool `json:"sealed"`
- T int `json:"t"`
- N int `json:"n"`
- Progress int `json:"progress"`
- Nonce string `json:"nonce"`
- Version string `json:"version"`
- ClusterName string `json:"cluster_name,omitempty"`
- ClusterID string `json:"cluster_id,omitempty"`
- RecoverySeal bool `json:"recovery_seal"`
-}