-
Notifications
You must be signed in to change notification settings - Fork 8
/
api.go
67 lines (57 loc) · 1.2 KB
/
api.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
// Package pkg contains all API functionality and helpers.
package pkg
import (
"go.anx.io/go-anxcloud/pkg/client"
"go.anx.io/go-anxcloud/pkg/clouddns"
"go.anx.io/go-anxcloud/pkg/ipam"
"go.anx.io/go-anxcloud/pkg/lbaas"
"go.anx.io/go-anxcloud/pkg/test"
"go.anx.io/go-anxcloud/pkg/vlan"
"go.anx.io/go-anxcloud/pkg/vsphere"
)
// API contains all API calls structured their location in the API.
type API interface {
IPAM() ipam.API
Test() test.API
VLAN() vlan.API
VSphere() vsphere.API
CloudDNS() clouddns.API
LBaaS() lbaas.API
}
type api struct {
ipam ipam.API
test test.API
vlan vlan.API
vsphere vsphere.API
clouddns clouddns.API
lbaas lbaas.API
}
func (a api) LBaaS() lbaas.API {
return a.lbaas
}
func (a api) IPAM() ipam.API {
return a.ipam
}
func (a api) Test() test.API {
return a.test
}
func (a api) VLAN() vlan.API {
return a.vlan
}
func (a api) VSphere() vsphere.API {
return a.vsphere
}
func (a api) CloudDNS() clouddns.API {
return a.clouddns
}
// NewAPI creates a new API instance with the given client.
func NewAPI(c client.Client) API {
return &api{
ipam.NewAPI(c),
test.NewAPI(c),
vlan.NewAPI(c),
vsphere.NewAPI(c),
clouddns.NewAPI(c),
lbaas.NewAPI(c),
}
}