github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcaas/v2/virtual-interface/List.go (about) 1 package virtual_interface 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack" 7 ) 8 9 type ListOpts struct { 10 ID string `q:"id"` 11 } 12 13 type VirtualInterface struct { 14 ID string `json:"id"` 15 TenantID string `json:"tenant_id"` 16 Name string `json:"name"` 17 Description string `json:"description"` 18 DirectConnectID string `json:"direct_connect_id"` 19 VgwID string `json:"vgw_id"` 20 Type string `json:"type"` 21 ServiceType string `json:"service_type"` 22 VLAN int `json:"vlan"` 23 Bandwidth int `json:"bandwidth"` 24 LocalGatewayV4IP string `json:"local_gateway_v4_ip"` 25 RemoteGatewayV4IP string `json:"remote_gateway_v4_ip"` 26 RouteMode string `json:"route_mode"` 27 BGPASN int `json:"bgp_asn"` 28 BGPMD5 string `json:"bgp_md5"` 29 RemoteEPGroupID string `json:"remote_ep_group_id"` 30 ServiceEPGroupID string `json:"service_ep_group_id"` 31 CreateTime string `json:"create_time"` 32 Status string `json:"status"` 33 AdminStateUp bool `json:"admin_state_up"` 34 AddressFamily string `json:"address_family"` 35 EnableBFD bool `json:"enable_bfd"` 36 HealthCheckSourceIP string `json:"health_check_source_ip"` 37 RateLimit bool `json:"rate_limit"` 38 RouteLimit int `json:"route_limit"` 39 RegionID string `json:"region_id"` 40 EnableNQA bool `json:"enable_nqa"` 41 EnableGRE bool `json:"enable_gre"` 42 LocalGatewayV6IP string `json:"local_gateway_v6_ip"` 43 RemoteGatewayV6IP string `json:"remote_gateway_v6_ip"` 44 LocalGRETunnelIP string `json:"local_gre_tunnel_ip"` 45 RemoteGRETunnelIP string `json:"remote_gre_tunnel_ip"` 46 LagID string `json:"lag_id"` 47 } 48 49 func List(client *golangsdk.ServiceClient, opts ListOpts) ([]VirtualInterface, error) { 50 url, err := golangsdk.NewURLBuilder().WithEndpoints("dcaas", "virtual-interfaces").WithQueryParams(&opts).Build() 51 if err != nil { 52 return nil, err 53 } 54 55 // GET https://{Endpoint}/v2.0/{project_id}/virtual-interfaces?id={id} 56 raw, err := client.Get(client.ServiceURL(url.String()), nil, openstack.StdRequestOpts()) 57 if err != nil { 58 return nil, err 59 } 60 61 var res []VirtualInterface 62 err = extract.IntoSlicePtr(raw.Body, &res, "virtual_interfaces") 63 return res, err 64 }