forked from IBM-Cloud/bluemix-go
/
properties.go
53 lines (44 loc) · 1.28 KB
/
properties.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
package containerv1
import (
"fmt"
"github.com/IBM-Cloud/bluemix-go/client"
)
//Vlan ...
type DCVlan struct {
ID string `json:"id"`
Properties DCVlanProperties `json:"properties"`
Type string `json:"type"`
}
//VlanProperties ...
type DCVlanProperties struct {
LocalDiskStorageCapability string `json:"local_disk_storage_capability"`
Location string `json:"location"`
Name string `json:"name"`
Note string `json:"note"`
PrimaryRouter string `json:"primary_router"`
SANStorageCapability string `json:"san_storage_capability"`
VlanNumber string `json:"vlan_number"`
VlanType string `json:"vlan_type"`
}
//Subnets interface
type Vlans interface {
List(datacenter string, target ClusterTargetHeader) ([]DCVlan, error)
}
type vlan struct {
client *client.Client
}
func newVlanAPI(c *client.Client) Vlans {
return &vlan{
client: c,
}
}
//GetVlans ...
func (r *vlan) List(datacenter string, target ClusterTargetHeader) ([]DCVlan, error) {
vlans := []DCVlan{}
rawURL := fmt.Sprintf("/v1/datacenters/%s/vlans", datacenter)
_, err := r.client.Get(rawURL, &vlans, target.ToMap())
if err != nil {
return nil, err
}
return vlans, err
}