github.com/IBM-Cloud/bluemix-go@v0.0.0-20240314082800-4e02a69b84b2/api/container/containerv1/properties.go (about) 1 package containerv1 2 3 import ( 4 "fmt" 5 6 "github.com/IBM-Cloud/bluemix-go/client" 7 ) 8 9 //Vlan ... 10 type DCVlan struct { 11 ID string `json:"id"` 12 Properties DCVlanProperties `json:"properties"` 13 Type string `json:"type"` 14 } 15 16 //VlanProperties ... 17 type DCVlanProperties struct { 18 LocalDiskStorageCapability string `json:"local_disk_storage_capability"` 19 Location string `json:"location"` 20 Name string `json:"name"` 21 Note string `json:"note"` 22 PrimaryRouter string `json:"primary_router"` 23 SANStorageCapability string `json:"san_storage_capability"` 24 VlanNumber string `json:"vlan_number"` 25 VlanType string `json:"vlan_type"` 26 } 27 28 //Subnets interface 29 type Vlans interface { 30 List(datacenter string, target ClusterTargetHeader) ([]DCVlan, error) 31 } 32 33 type vlan struct { 34 client *client.Client 35 } 36 37 func newVlanAPI(c *client.Client) Vlans { 38 return &vlan{ 39 client: c, 40 } 41 } 42 43 //GetVlans ... 44 func (r *vlan) List(datacenter string, target ClusterTargetHeader) ([]DCVlan, error) { 45 vlans := []DCVlan{} 46 rawURL := fmt.Sprintf("/v1/datacenters/%s/vlans", datacenter) 47 _, err := r.client.Get(rawURL, &vlans, target.ToMap()) 48 if err != nil { 49 return nil, err 50 } 51 52 return vlans, err 53 }