func networkExtensions(client *gophercloud.ServiceClient) (map[string]bool, error) {
	seen := make(map[string]bool)

	pager := extensions.List(client)
	err := pager.EachPage(func(page pagination.Page) (bool, error) {
		exts, err := extensions.ExtractExtensions(page)
		if err != nil {
			return false, err
		}
		for _, ext := range exts {
			seen[ext.Alias] = true
		}
		return true, nil
	})

	return seen, err
}
Exemple #2
0
func TestListExts(t *testing.T) {
	Setup(t)
	defer Teardown()

	pager := extensions.List(Client)
	err := pager.EachPage(func(page pagination.Page) (bool, error) {
		t.Logf("--- Page ---")

		exts, err := extensions.ExtractExtensions(page)
		th.AssertNoErr(t, err)

		for _, ext := range exts {
			t.Logf("Extension: Name [%s] Description [%s]", ext.Name, ext.Description)
		}

		return true, nil
	})
	th.CheckNoErr(t, err)
}