github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcaas/v2/virtual-gateway/List.go (about) 1 package virtual_gateway 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack" 7 ) 8 9 type ListOpts struct { 10 // virtual gateway by ID 11 Id string `q:"id,omitempty"` 12 } 13 14 // List is used to obtain the virtual gateway list 15 func List(client *golangsdk.ServiceClient, opts ListOpts) ([]VirtualGateway, error) { 16 url, err := golangsdk.NewURLBuilder().WithEndpoints("dcaas", "virtual-gateways").WithQueryParams(&opts).Build() 17 if err != nil { 18 return nil, err 19 } 20 21 // GET https://{Endpoint}/v2.0/{project_id}/virtual-gateways 22 raw, err := client.Get(client.ServiceURL(url.String()), nil, openstack.StdRequestOpts()) 23 if err != nil { 24 return nil, err 25 } 26 27 var res []VirtualGateway 28 err = extract.IntoSlicePtr(raw.Body, &res, "virtual_gateways") 29 return res, err 30 } 31 32 type VirtualGateway struct { 33 ID string `json:"id"` 34 TenantID string `json:"tenant_id"` 35 Name string `json:"name"` 36 Description string `json:"description"` 37 VPCID string `json:"vpc_id"` 38 LocalEPGroupID string `json:"local_ep_group_id"` 39 DeviceID string `json:"device_id"` 40 RedundantDeviceID string `json:"redundant_device_id"` 41 Type string `json:"type"` 42 IPSecBandwidth int `json:"ipsec_bandwidth"` 43 Status string `json:"status"` 44 AdminStateUp bool `json:"admin_state_up"` 45 BGPASN int `json:"bgp_asn"` 46 RegionID string `json:"region_id"` 47 LocalEPGroupIPv6ID string `json:"local_ep_group_ipv6_id"` 48 }