-
Notifications
You must be signed in to change notification settings - Fork 0
/
identity.go
55 lines (44 loc) · 1.71 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
package driver
import (
"context"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/protobuf/ptypes/wrappers"
)
var _ csi.IdentityServer = &UpCloudIdentityServer{}
// UpCloudIdentityServer
type UpCloudIdentityServer struct {
Driver *UpCloudDriver
}
func NewUpCloudIdentityServer(driver *UpCloudDriver) *UpCloudIdentityServer {
return &UpCloudIdentityServer{driver}
}
// GetPluginInfo returns basic plugin data
func (upCloudIdentity *UpCloudIdentityServer) GetPluginInfo(context.Context, *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
upCloudIdentity.Driver.log.Info("UpCloudIdentityServer.GetPluginInfo called")
res := &csi.GetPluginInfoResponse{
Name: upCloudIdentity.Driver.drivername,
VendorVersion: upCloudIdentity.Driver.version,
}
return res, nil
}
// GetPluginCapabilities returns plugins available capabilities
func (upCloudIdentity *UpCloudIdentityServer) GetPluginCapabilities(_ context.Context, req *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
upCloudIdentity.Driver.log.Infof("upCloudIdentityServer.GetPluginCapabilities called with request : %v", req)
return &csi.GetPluginCapabilitiesResponse{
Capabilities: []*csi.PluginCapability{
{
Type: &csi.PluginCapability_Service_{
Service: &csi.PluginCapability_Service{
Type: csi.PluginCapability_Service_CONTROLLER_SERVICE,
},
},
},
},
}, nil
}
func (upCloudIdentity *UpCloudIdentityServer) Probe(_ context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error) {
upCloudIdentity.Driver.log.Infof("upCloudIdentityServer.Probe called with request : %v", req)
return &csi.ProbeResponse{
Ready: &wrappers.BoolValue{Value: true},
}, nil
}