-
Notifications
You must be signed in to change notification settings - Fork 15
/
local_stub.go
202 lines (182 loc) · 6.83 KB
/
local_stub.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
//+build !libvirt
/*
* Copyright 2018, CS Systemes d'Information, http://www.c-s.fr
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package local
import (
"fmt"
"github.com/CS-SI/SafeScale/lib/server/iaas"
"github.com/CS-SI/SafeScale/lib/server/iaas/providers"
providerapi "github.com/CS-SI/SafeScale/lib/server/iaas/providers/api"
"github.com/CS-SI/SafeScale/lib/server/iaas/resources"
"github.com/CS-SI/SafeScale/lib/server/iaas/resources/enums/HostState"
"github.com/CS-SI/SafeScale/lib/server/iaas/resources/userdata"
)
var errorStr = "libvirt Driver is not enabled, use the libvirt option while compiling (make libvirt all)"
// provider is the implementation of the local driver regarding to the api.Provider
type provider struct {
tenantParameters map[string]interface{}
}
//AuthOptions fields are the union of those recognized by each identity implementation and provider.
type AuthOptions struct {
}
// CfgOptions configuration options
type CfgOptions struct {
}
func (provider *provider) Build(params map[string]interface{}) (providerapi.Provider, error) {
provider.tenantParameters = map[string]interface{}{}
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetAuthenticationOptions() (providers.Config, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetConfigurationOptions() (providers.Config, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) ListAvailabilityZones() (map[string]bool, error) {
return nil, fmt.Errorf(errorStr)
}
// ListRegions returns a list with the regions available
func (provider *provider) ListRegions() ([]string, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) ListImages(all bool) ([]resources.Image, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetImage(id string) (*resources.Image, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetTemplate(id string) (*resources.HostTemplate, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) ListTemplates(all bool) ([]resources.HostTemplate, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) CreateKeyPair(name string) (*resources.KeyPair, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetKeyPair(id string) (*resources.KeyPair, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) ListKeyPairs() ([]resources.KeyPair, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) DeleteKeyPair(id string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) CreateNetwork(req resources.NetworkRequest) (*resources.Network, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetNetwork(id string) (*resources.Network, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetNetworkByName(name string) (*resources.Network, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) ListNetworks() ([]*resources.Network, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) DeleteNetwork(id string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) CreateGateway(req resources.GatewayRequest) (*resources.Host, *userdata.Content, error) {
return nil, nil, fmt.Errorf(errorStr)
}
func (provider *provider) DeleteGateway(string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) CreateVIP(networkID string, description string) (*resources.VIP, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) AddPublicIPToVIP(vip *resources.VIP) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) BindHostToVIP(vip *resources.VIP, host *resources.Host) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) UnbindHostFromVIP(vip *resources.VIP, host *resources.Host) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) DeleteVIP(vip *resources.VIP) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) CreateHost(request resources.HostRequest) (*resources.Host, *userdata.Content, error) {
return nil, nil, fmt.Errorf(errorStr)
}
func (provider *provider) ResizeHost(id string, request resources.SizingRequirements) (*resources.Host, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) InspectHost(interface{}) (*resources.Host, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetHostByName(string) (*resources.Host, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetHostState(interface{}) (HostState.Enum, error) {
return HostState.ERROR, fmt.Errorf(errorStr)
}
func (provider *provider) ListHosts() ([]*resources.Host, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) DeleteHost(id string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) StartHost(id string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) StopHost(id string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) RebootHost(id string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) CreateVolume(request resources.VolumeRequest) (*resources.Volume, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) GetVolume(id string) (*resources.Volume, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) ListVolumes() ([]resources.Volume, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) DeleteVolume(id string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) CreateVolumeAttachment(request resources.VolumeAttachmentRequest) (string, error) {
return "", fmt.Errorf(errorStr)
}
func (provider *provider) GetVolumeAttachment(serverID, id string) (*resources.VolumeAttachment, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) ListVolumeAttachments(serverID string) ([]resources.VolumeAttachment, error) {
return nil, fmt.Errorf(errorStr)
}
func (provider *provider) DeleteVolumeAttachment(serverID, id string) error {
return fmt.Errorf(errorStr)
}
func (provider *provider) GetName() string {
return "local_disabled"
}
func (provider *provider) GetTenantParameters() map[string]interface{} {
return nil
}
// GetCapabilities returns the capabilities of the provider
func (provider *provider) GetCapabilities() providers.Capabilities {
return providers.Capabilities{}
}
func init() {
// log.Debug("Registering fake local provider")
iaas.Register("local", &provider{})
}