@@ -140,3 +140,53 @@ func DeleteBandwidthLimitRule(c *gophercloud.ServiceClient, policyID, ruleID str
140140 _ , r .Err = c .Delete (deleteBandwidthLimitRuleURL (c , policyID , ruleID ), nil )
141141 return
142142}
143+
144+ // DSCPMarkingRulesListOptsBuilder allows extensions to add additional parameters to the
145+ // List request.
146+ type DSCPMarkingRulesListOptsBuilder interface {
147+ ToDSCPMarkingRulesListQuery () (string , error )
148+ }
149+
150+ // DSCPMarkingRulesListOpts allows the filtering and sorting of paginated collections through
151+ // the Neutron API. Filtering is achieved by passing in struct field values
152+ // that map to the DSCPMarking attributes you want to see returned.
153+ // SortKey allows you to sort by a particular DSCPMarkingRule attribute.
154+ // SortDir sets the direction, and is either `asc' or `desc'.
155+ // Marker and Limit are used for the pagination.
156+ type DSCPMarkingRulesListOpts struct {
157+ ID string `q:"id"`
158+ TenantID string `q:"tenant_id"`
159+ DSCPMark int `q:"dscp_mark"`
160+ Limit int `q:"limit"`
161+ Marker string `q:"marker"`
162+ SortKey string `q:"sort_key"`
163+ SortDir string `q:"sort_dir"`
164+ Tags string `q:"tags"`
165+ TagsAny string `q:"tags-any"`
166+ NotTags string `q:"not-tags"`
167+ NotTagsAny string `q:"not-tags-any"`
168+ }
169+
170+ // ToDSCPMarkingRulesListQuery formats a ListOpts into a query string.
171+ func (opts DSCPMarkingRulesListOpts ) ToDSCPMarkingRulesListQuery () (string , error ) {
172+ q , err := gophercloud .BuildQueryString (opts )
173+ return q .String (), err
174+ }
175+
176+ // ListDSCPMarkingRules returns a Pager which allows you to iterate over a collection of
177+ // DSCPMarkingRules. It accepts a ListOpts struct, which allows you to filter and sort
178+ // the returned collection for greater efficiency.
179+ func ListDSCPMarkingRules (c * gophercloud.ServiceClient , policyID string , opts DSCPMarkingRulesListOptsBuilder ) pagination.Pager {
180+ url := listDSCPMarkingRulesURL (c , policyID )
181+ if opts != nil {
182+ query , err := opts .ToDSCPMarkingRulesListQuery ()
183+ if err != nil {
184+ return pagination.Pager {Err : err }
185+ }
186+ url += query
187+ }
188+ return pagination .NewPager (c , url , func (r pagination.PageResult ) pagination.Page {
189+ return DSCPMarkingRulePage {pagination.LinkedPageBase {PageResult : r }}
190+
191+ })
192+ }
0 commit comments