forked from rexray/gocsi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
identity.go
61 lines (49 loc) · 1.25 KB
/
identity.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
package gocsi
import (
"golang.org/x/net/context"
"google.golang.org/grpc"
"github.com/codedellemc/gocsi/csi"
)
const (
// FMGetSupportedVersions is the full method name for the
// eponymous RPC message.
FMGetSupportedVersions = "/" + Namespace +
".Identity/" +
"GetSupportedVersions"
// FMGetPluginInfo is the full method name for the
// eponymous RPC message.
FMGetPluginInfo = "/" + Namespace +
".Identity/" +
"GetPluginInfo"
)
// GetSupportedVersions issues a
// GetSupportedVersions request
// to a CSI controller.
func GetSupportedVersions(
ctx context.Context,
c csi.IdentityClient,
callOpts ...grpc.CallOption) ([]*csi.Version, error) {
req := &csi.GetSupportedVersionsRequest{}
res, err := c.GetSupportedVersions(ctx, req, callOpts...)
if err != nil {
return nil, err
}
return res.GetResult().SupportedVersions, nil
}
// GetPluginInfo issues a
// GetPluginInfo request
// to a CSI controller.
func GetPluginInfo(
ctx context.Context,
c csi.IdentityClient,
version *csi.Version,
callOpts ...grpc.CallOption) (*csi.GetPluginInfoResponse_Result, error) {
req := &csi.GetPluginInfoRequest{
Version: version,
}
res, err := c.GetPluginInfo(ctx, req, callOpts...)
if err != nil {
return nil, err
}
return res.GetResult(), nil
}