mirror of
https://github.com/kemko/nomad.git
synced 2026-01-09 11:55:42 +03:00
vendor
This commit is contained in:
47
vendor/github.com/hashicorp/consul/api/snapshot.go
generated
vendored
Normal file
47
vendor/github.com/hashicorp/consul/api/snapshot.go
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// Snapshot can be used to query the /v1/snapshot endpoint to take snapshots of
|
||||
// Consul's internal state and restore snapshots for disaster recovery.
|
||||
type Snapshot struct {
|
||||
c *Client
|
||||
}
|
||||
|
||||
// Snapshot returns a handle that exposes the snapshot endpoints.
|
||||
func (c *Client) Snapshot() *Snapshot {
|
||||
return &Snapshot{c}
|
||||
}
|
||||
|
||||
// Save requests a new snapshot and provides an io.ReadCloser with the snapshot
|
||||
// data to save. If this doesn't return an error, then it's the responsibility
|
||||
// of the caller to close it. Only a subset of the QueryOptions are supported:
|
||||
// Datacenter, AllowStale, and Token.
|
||||
func (s *Snapshot) Save(q *QueryOptions) (io.ReadCloser, *QueryMeta, error) {
|
||||
r := s.c.newRequest("GET", "/v1/snapshot")
|
||||
r.setQueryOptions(q)
|
||||
|
||||
rtt, resp, err := requireOK(s.c.doRequest(r))
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
qm := &QueryMeta{}
|
||||
parseQueryMeta(resp, qm)
|
||||
qm.RequestTime = rtt
|
||||
return resp.Body, qm, nil
|
||||
}
|
||||
|
||||
// Restore streams in an existing snapshot and attempts to restore it.
|
||||
func (s *Snapshot) Restore(q *WriteOptions, in io.Reader) error {
|
||||
r := s.c.newRequest("PUT", "/v1/snapshot")
|
||||
r.body = in
|
||||
r.setWriteOptions(q)
|
||||
_, _, err := requireOK(s.c.doRequest(r))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
4
vendor/vendor.json
vendored
4
vendor/vendor.json
vendored
@@ -521,8 +521,8 @@
|
||||
{
|
||||
"checksumSHA1": "efWxWe8blQflfYZFU1WSIks2Tbw=",
|
||||
"path": "github.com/hashicorp/consul-template/manager",
|
||||
"revision": "4b35cc8bdd61e1a7387f7974c8e8ac8ebe9b9376",
|
||||
"revisionTime": "2017-01-14T21:20:18Z"
|
||||
"revision": "7c612ca82dcd04029034dc93fa780b330d0d556f",
|
||||
"revisionTime": "2017-01-17T17:45:35Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "oskgb0WteBKOItG8NNDduM7E/D0=",
|
||||
|
||||
Reference in New Issue
Block a user