github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcaas/v2/direct-connect/List.go (about) 1 package direct_connect 2 3 import ( 4 "fmt" 5 6 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 7 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 8 "github.com/opentelekomcloud/gophertelekomcloud/openstack" 9 ) 10 11 type DirectConnect struct { 12 ID string `json:"id"` 13 TenantID string `json:"tenant_id"` 14 Name string `json:"name"` 15 Description string `json:"description"` 16 PortType string `json:"port_type"` 17 Bandwidth int `json:"bandwidth"` 18 Location string `json:"location"` 19 PeerLocation string `json:"peer_location"` 20 DeviceID string `json:"device_id"` 21 InterfaceName string `json:"interface_name"` 22 RedundantID string `json:"redundant_id"` 23 Provider string `json:"provider"` 24 ProviderStatus string `json:"provider_status"` 25 Type string `json:"type"` 26 HostingID string `json:"hosting_id"` 27 VLAN int `json:"vlan"` 28 ChargeMode string `json:"charge_mode"` 29 ApplyTime string `json:"apply_time"` 30 CreateTime string `json:"create_time"` 31 DeleteTime string `json:"delete_time"` 32 OrderID string `json:"order_id"` 33 ProductID string `json:"product_id"` 34 Status string `json:"status"` 35 AdminStateUp bool `json:"admin_state_up"` 36 SpecCode string `json:"spec_code"` 37 Applicant string `json:"applicant"` 38 Mobile string `json:"mobile"` 39 Email string `json:"email"` 40 RegionID string `json:"region_id"` 41 ServiceKey string `json:"service_key"` 42 CableLabel string `json:"cable_label"` 43 PeerPortType string `json:"peer_port_type"` 44 PeerProvider string `json:"peer_provider"` 45 OnestopProductID string `json:"onestop_product_id"` 46 BuildingLineProductID string `json:"building_line_product_id"` 47 LastOnestopProductID string `json:"last_onestop_product_id"` 48 PeriodType int `json:"period_type"` 49 PeriodNum int `json:"period_num"` 50 Reason string `json:"reason"` 51 VGWType string `json:"vgw_type"` 52 LagID string `json:"lag_id"` 53 } 54 55 // List is used to obtain the DirectConnects list 56 func List(c *golangsdk.ServiceClient, id string) ([]DirectConnect, error) { 57 58 // GET https://{Endpoint}/v2.0/dcaas/direct-connects?id={id} 59 raw, err := c.Get(c.ServiceURL(fmt.Sprintf("dcaas/direct-connects?id=%s", id)), nil, openstack.StdRequestOpts()) 60 if err != nil { 61 return nil, err 62 } 63 64 var res []DirectConnect 65 err = extract.IntoSlicePtr(raw.Body, &res, "direct_connects") 66 return res, err 67 }