Пример #1
0
func testListIPs(t *testing.T, c *gophercloud.ServiceClient) string {
	allPages, err := publicips.List(c).AllPages()
	th.AssertNoErr(t, err)
	allip, err := publicips.ExtractPublicIPs(allPages)
	fmt.Printf("Listing all public IPs: %+v\n\n", allip)
	var ipID string
	if len(allip) > 0 {
		ipID = allip[0].ID
	}
	return ipID
}
Пример #2
0
func testListIPsForServer(t *testing.T, c *gophercloud.ServiceClient, sID string) {
	allPages, err := publicips.ListForServer(c, sID).AllPages()
	th.AssertNoErr(t, err)
	allip, err := publicips.ExtractPublicIPs(allPages)
	fmt.Printf("Listing all public IPs for server (%s): %+v\n\n", sID, allip)
}