-
Notifications
You must be signed in to change notification settings - Fork 568
/
admin.go
30 lines (27 loc) · 1021 Bytes
/
admin.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
package client
import (
"github.com/pachyderm/pachyderm/v2/src/admin"
"github.com/pachyderm/pachyderm/v2/src/internal/errors"
"github.com/pachyderm/pachyderm/v2/src/pfs"
"github.com/pachyderm/pachyderm/v2/src/version/versionpb"
)
// InspectCluster retrieves cluster state
func (c APIClient) InspectCluster() (*admin.ClusterInfo, error) {
clusterInfo, err := c.AdminAPIClient.InspectCluster(c.Ctx(), &admin.InspectClusterRequest{})
if err != nil {
return nil, errors.Wrap(err, "failed to inspect cluster")
}
return clusterInfo, nil
}
// InspectCluster retrieves cluster state, and sends the server its version for the server to
// validate.
func (c APIClient) InspectClusterWithVersionAndProject(v *versionpb.Version, p *pfs.Project) (*admin.ClusterInfo, error) {
clusterInfo, err := c.AdminAPIClient.InspectCluster(c.Ctx(), &admin.InspectClusterRequest{
ClientVersion: v,
CurrentProject: p,
})
if err != nil {
return nil, errors.Wrap(err, "failed to inspect cluster")
}
return clusterInfo, nil
}