File: doc.go

package info (click to toggle)
golang-github-gophercloud-gophercloud 0.0~git20180917.45f1c769-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,768 kB
  • sloc: sh: 98; makefile: 14
file content (71 lines) | stat: -rw-r--r-- 1,524 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
package floatingips enables management and retrieval of Floating IPs from the
OpenStack Networking service.

Example to List Floating IPs

	listOpts := floatingips.ListOpts{
		FloatingNetworkID: "a6917946-38ab-4ffd-a55a-26c0980ce5ee",
	}

	allPages, err := floatingips.List(networkClient, listOpts).AllPages()
	if err != nil {
		panic(err)
	}

	allFIPs, err := floatingips.ExtractFloatingIPs(allPages)
	if err != nil {
		panic(err)
	}

	for _, fip := range allFIPs {
		fmt.Printf("%+v\n", fip)
	}

Example to Create a Floating IP

	createOpts := floatingips.CreateOpts{
		FloatingNetworkID: "a6917946-38ab-4ffd-a55a-26c0980ce5ee",
	}

	fip, err := floatingips.Create(networkingClient, createOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Update a Floating IP

	fipID := "2f245a7b-796b-4f26-9cf9-9e82d248fda7"
	portID := "76d0a61b-b8e5-490c-9892-4cf674f2bec8"

	updateOpts := floatingips.UpdateOpts{
		PortID: &portID,
	}

	fip, err := floatingips.Update(networkingClient, fipID, updateOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Disassociate a Floating IP with a Port

	fipID := "2f245a7b-796b-4f26-9cf9-9e82d248fda7"

	updateOpts := floatingips.UpdateOpts{
		PortID: nil,
	}

	fip, err := floatingips.Update(networkingClient, fipID, updateOpts).Extract()
	if err != nil {
		panic(err)
	}

Example to Delete a Floating IP

	fipID := "2f245a7b-796b-4f26-9cf9-9e82d248fda7"
	err := floatingips.Delete(networkClient, fipID).ExtractErr()
	if err != nil {
		panic(err)
	}
*/
package floatingips