github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/elb/v3/ipgroups/List.go (about) 1 package ipgroups 2 3 import ( 4 "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 "github.com/opentelekomcloud/gophertelekomcloud/openstack" 7 "github.com/opentelekomcloud/gophertelekomcloud/openstack/common/structs" 8 ) 9 10 type ListOpts struct { 11 Limit int `q:"limit"` 12 Marker string `q:"marker"` 13 PageReverse bool `q:"page_reverse"` 14 15 ID []string `q:"id"` 16 Name []string `q:"name"` 17 Description []string `q:"description"` 18 IpList []string `q:"ip_list"` 19 } 20 21 // List is used to obtain the parameter ipGroup list 22 func List(client *golangsdk.ServiceClient, opts ListOpts) ([]IpGroup, error) { 23 url, err := golangsdk.NewURLBuilder().WithEndpoints("ipgroups").WithQueryParams(&opts).Build() 24 if err != nil { 25 return nil, err 26 } 27 28 // GET https://{Endpoint}/v3/{project_id}/backups 29 raw, err := client.Get(client.ServiceURL(url.String()), nil, openstack.StdRequestOpts()) 30 if err != nil { 31 return nil, err 32 } 33 34 var res []IpGroup 35 err = extract.IntoSlicePtr(raw.Body, &res, "ipgroups") 36 return res, err 37 } 38 39 // IpGroup The IP address can contain IP addresses or CIDR blocks. 40 // 0.0.0.0 will be considered the same as 0.0.0.0/32. If you enter both 0.0.0.0 and 0.0.0.0/32, 41 // only one will be kept. 0:0:0:0:0:0:0:1 will be considered the same as ::1 and ::1/128. 42 // If you enter 0:0:0:0:0:0:0:1, ::1 and ::1/128, only one will be kept. 43 type IpGroup struct { 44 // The unique ID for the IpGroup. 45 ID string `json:"id"` 46 // Specifies the IP address group name. 47 Name string `json:"name"` 48 // Provides remarks about the IP address group. 49 Description string `json:"description"` 50 // Specifies the project ID of the IP address group. 51 ProjectId string `json:"project_id"` 52 // Specifies the IP addresses or CIDR blocks in the IP address group. [] indicates any IP address. 53 IpList []IpInfo `json:"ip_list"` 54 // Lists the IDs of listeners with which the IP address group is associated. 55 Listeners []structs.ResourceRef `json:"listeners"` 56 // Specifies the time when the IP address group was created. 57 CreatedAt string `json:"created_at"` 58 // Specifies the time when the IP address group was updated. 59 UpdatedAt string `json:"updated_at"` 60 } 61 type IpInfo struct { 62 // Specifies the IP addresses in the IP address group. 63 Ip string `json:"ip"` 64 // Provides remarks about the IP address group. 65 Description string `json:"description"` 66 }