github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/delegate.go (about) 1 package extensions 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 common "github.com/huaweicloud/golangsdk/openstack/common/extensions" 6 "github.com/huaweicloud/golangsdk/pagination" 7 ) 8 9 // Extension is a single OpenStack extension. 10 type Extension struct { 11 common.Extension 12 } 13 14 // GetResult wraps a GetResult from common. 15 type GetResult struct { 16 common.GetResult 17 } 18 19 // ExtractExtensions interprets a Page as a slice of Extensions. 20 func ExtractExtensions(page pagination.Page) ([]Extension, error) { 21 inner, err := common.ExtractExtensions(page) 22 if err != nil { 23 return nil, err 24 } 25 outer := make([]Extension, len(inner)) 26 for index, ext := range inner { 27 outer[index] = Extension{ext} 28 } 29 return outer, nil 30 } 31 32 // Get retrieves information for a specific extension using its alias. 33 func Get(c *golangsdk.ServiceClient, alias string) GetResult { 34 return GetResult{common.Get(c, alias)} 35 } 36 37 // List returns a Pager which allows you to iterate over the full collection of extensions. 38 // It does not accept query parameters. 39 func List(c *golangsdk.ServiceClient) pagination.Pager { 40 return common.List(c) 41 }