forked from docker/machine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notsupported.go
89 lines (69 loc) · 1.95 KB
/
notsupported.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
package drivers
import (
"fmt"
"github.com/leoh0/machine/libmachine/mcnflag"
"github.com/leoh0/machine/libmachine/state"
)
type DriverNotSupported struct {
*BaseDriver
Name string
}
type NotSupported struct {
DriverName string
}
func (e NotSupported) Error() string {
return fmt.Sprintf("Driver %q not supported on this platform.", e.DriverName)
}
// NewDriverNotSupported creates a placeholder Driver that replaces
// a driver that is not supported on a given platform. eg fusion on linux.
func NewDriverNotSupported(driverName, hostName, storePath string) Driver {
return &DriverNotSupported{
BaseDriver: &BaseDriver{
MachineName: hostName,
StorePath: storePath,
},
Name: driverName,
}
}
func (d *DriverNotSupported) DriverName() string {
return d.Name
}
func (d *DriverNotSupported) PreCreateCheck() error {
return NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) GetCreateFlags() []mcnflag.Flag {
return nil
}
func (d *DriverNotSupported) SetConfigFromFlags(flags DriverOptions) error {
return NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) GetURL() (string, error) {
return "", NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) GetSSHHostname() (string, error) {
return "", NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) GetState() (state.State, error) {
return state.Error, NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) Create() error {
return NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) Remove() error {
return NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) Start() error {
return NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) Stop() error {
return NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) Restart() error {
return NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) Kill() error {
return NotSupported{d.DriverName()}
}
func (d *DriverNotSupported) Upgrade() error {
return NotSupported{d.DriverName()}
}