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 (80 lines) | stat: -rw-r--r-- 1,748 bytes parent folder | download | duplicates (3)
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
72
73
74
75
76
77
78
79
80
/*
Package extradhcpopts allow to work with extra DHCP functionality of Neutron ports.

Example to Get a Port with Extra DHCP Options

	portID := "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2"
	var s struct {
		ports.Port
		extradhcpopts.ExtraDHCPOptsExt
	}

	err := ports.Get(networkClient, portID).ExtractInto(&s)
	if err != nil {
		panic(err)
	}

Example to Create a Port with Extra DHCP Options

	var s struct {
		ports.Port
		extradhcpopts.ExtraDHCPOptsExt
	}

	adminStateUp := true
	portCreateOpts := ports.CreateOpts{
		Name:         "dhcp-conf-port",
		AdminStateUp: &adminStateUp,
		NetworkID:    "a87cc70a-3e15-4acf-8205-9b711a3531b7",
		FixedIPs: []ports.IP{
			{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.2"},
		},
	}

	createOpts := extradhcpopts.CreateOptsExt{
		CreateOptsBuilder: portCreateOpts,
		ExtraDHCPOpts: []extradhcpopts.CreateExtraDHCPOpt{
			{
				OptName:  "optionA",
				OptValue: "valueA",
			},
		},
	}

	err := ports.Create(networkClient, createOpts).ExtractInto(&s)
	if err != nil {
		panic(err)
	}

Example to Update a Port with Extra DHCP Options

	var s struct {
		ports.Port
		extradhcpopts.ExtraDHCPOptsExt
	}

	portUpdateOpts := ports.UpdateOpts{
		Name: "updated-dhcp-conf-port",
		FixedIPs: []ports.IP{
			{SubnetID: "a0304c3a-4f08-4c43-88af-d796509c97d2", IPAddress: "10.0.0.3"},
		},
	}

	value := "valueB"
	updateOpts := extradhcpopts.UpdateOptsExt{
		UpdateOptsBuilder: portUpdateOpts,
		ExtraDHCPOpts: []extradhcpopts.UpdateExtraDHCPOpt{
			{
				OptName:  "optionB",
				OptValue: &value,
			},
		},
	}

	portID := "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2"
	err := ports.Update(networkClient, portID, updateOpts).ExtractInto(&s)
	if err != nil {
		panic(err)
	}
*/
package extradhcpopts