// List returns a Pager which allows you to iterate over the full collection of extensions. // It does not accept query parameters. func List(c *gophercloud.ServiceClient) pagination.Pager { return common.List(c).WithPageCreator(func(r pagination.PageResult) pagination.Page { return ExtensionPage{ ExtensionPage: common.ExtensionPage{SinglePageBase: pagination.SinglePageBase(r)}, } }) }
func TestList(t *testing.T) { th.SetupHTTP() defer th.TeardownHTTP() HandleListExtensionsSuccessfully(t) count := 0 extensions.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) { count++ actual, err := extensions.ExtractExtensions(page) th.AssertNoErr(t, err) th.AssertDeepEquals(t, ExpectedExtensions, actual) return true, nil }) th.CheckEquals(t, 1, count) }
func TestExtensionsList(t *testing.T) { client, err := clients.NewNetworkV2Client() if err != nil { t.Fatalf("Unable to create a network client: %v", err) } allPages, err := extensions.List(client).AllPages() if err != nil { t.Fatalf("Unable to list extensions: %v", err) } allExtensions, err := extensions.ExtractExtensions(allPages) if err != nil { t.Fatalf("Unable to extract extensions: %v", err) } for _, extension := range allExtensions { openstack.PrintExtension(t, &extension) } }
// List returns a Pager which allows you to iterate over the full collection of extensions. // It does not accept query parameters. func List(c *gophercloud.ServiceClient) pagination.Pager { return common.List(c) }