-
Notifications
You must be signed in to change notification settings - Fork 5
/
resources.go
155 lines (126 loc) · 3.46 KB
/
resources.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package dockerdriver
import (
"context"
"code.cloudfoundry.org/lager/v3"
"github.com/tedsuo/rata"
)
const (
ActivateRoute = "activate"
CreateRoute = "create"
GetRoute = "get"
ListRoute = "list"
MountRoute = "mount"
PathRoute = "path"
RemoveRoute = "remove"
UnmountRoute = "unmount"
CapabilitiesRoute = "capabilities"
)
var Routes = rata.Routes{
{Path: "/Plugin.Activate", Method: "POST", Name: ActivateRoute},
{Path: "/VolumeDriver.Create", Method: "POST", Name: CreateRoute},
{Path: "/VolumeDriver.Get", Method: "POST", Name: GetRoute},
{Path: "/VolumeDriver.List", Method: "POST", Name: ListRoute},
{Path: "/VolumeDriver.Mount", Method: "POST", Name: MountRoute},
{Path: "/VolumeDriver.Path", Method: "POST", Name: PathRoute},
{Path: "/VolumeDriver.Remove", Method: "POST", Name: RemoveRoute},
{Path: "/VolumeDriver.Unmount", Method: "POST", Name: UnmountRoute},
{Path: "/VolumeDriver.Capabilities", Method: "POST", Name: CapabilitiesRoute},
}
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
//counterfeiter:generate -o dockerdriverfakes/fake_env.go . Env
type Env interface {
Logger() lager.Logger
Context() context.Context
}
//counterfeiter:generate -o dockerdriverfakes/fake_matchable_driver_client.go . MatchableDriver
type MatchableDriver interface {
Matches(lager.Logger, string, *TLSConfig) bool
Driver
}
//counterfeiter:generate -o dockerdriverfakes/fake_driver_client.go . Driver
type Driver interface {
Activate(env Env) ActivateResponse
Get(env Env, getRequest GetRequest) GetResponse
List(env Env) ListResponse
Mount(env Env, mountRequest MountRequest) MountResponse
Path(env Env, pathRequest PathRequest) PathResponse
Unmount(env Env, unmountRequest UnmountRequest) ErrorResponse
Capabilities(env Env) CapabilitiesResponse
Provisioner
}
//counterfeiter:generate -o dockerdriverfakes/fake_provisioner.go . Provisioner
type Provisioner interface {
Create(env Env, createRequest CreateRequest) ErrorResponse
Remove(env Env, removeRequest RemoveRequest) ErrorResponse
}
type ActivateResponse struct {
Err string
Implements []string
}
type CreateRequest struct {
Name string
Opts map[string]interface{}
}
type MountRequest struct {
Name string
}
type MountResponse struct {
Err string
Mountpoint string
}
type ListResponse struct {
Volumes []VolumeInfo
Err string
}
type PathRequest struct {
Name string
}
type PathResponse struct {
Err string
Mountpoint string
}
type UnmountRequest struct {
Name string
}
type RemoveRequest struct {
Name string
}
type ErrorResponse struct {
Err string
}
type GetRequest struct {
Name string
}
type GetResponse struct {
Volume VolumeInfo
Err string
}
type CapabilitiesResponse struct {
Capabilities CapabilityInfo
}
type VolumeInfo struct {
Name string
Mountpoint string
MountCount int
}
type CapabilityInfo struct {
Scope string
}
type SafeError struct {
SafeDescription string `json:"SafeDescription"`
}
func (s SafeError) Error() string {
return s.SafeDescription
}
type TLSConfig struct {
InsecureSkipVerify bool `json:"InsecureSkipVerify"`
CAFile string `json:"CAFile"`
CertFile string `json:"CertFile"`
KeyFile string `json:"KeyFile"`
}
type DriverSpec struct {
Name string `json:"Name"`
Address string `json:"Addr"`
TLSConfig *TLSConfig `json:"TLSConfig"`
UniqueVolumeIds bool `json:"UniqueVolumeIds"`
}