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 (73 lines) | stat: -rw-r--r-- 2,271 bytes parent folder | download | duplicates (2)
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
/*
Package provider gives access to the provider Neutron plugin, allowing
network extended attributes. The provider extended attributes for networks
enable administrative users to specify how network objects map to the
underlying networking infrastructure. These extended attributes also appear
when administrative users query networks.

For more information about extended attributes, see the NetworkExtAttrs
struct. The actual semantics of these attributes depend on the technology
back end of the particular plug-in. See the plug-in documentation and the
OpenStack Cloud Administrator Guide to understand which values should be
specific for each of these attributes when OpenStack Networking is deployed
with a particular plug-in. The examples shown in this chapter refer to the
Open vSwitch plug-in.

The default policy settings enable only users with administrative rights to
specify these parameters in requests and to see their values in responses. By
default, the provider network extension attributes are completely hidden from
regular tenants. As a rule of thumb, if these attributes are not visible in a
GET /networks/<network-id> operation, this implies the user submitting the
request is not authorized to view or manipulate provider network attributes.

Example to List Networks with Provider Information

	type NetworkWithProvider {
		networks.Network
		provider.NetworkProviderExt
	}

	var allNetworks []NetworkWithProvider

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

	err = networks.ExtractNetworksInto(allPages, &allNetworks)
	if err != nil {
		panic(err)
	}

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

Example to Create a Provider Network

	segments := []provider.Segment{
		provider.Segment{
			NetworkType:     "vxlan",
			PhysicalNetwork: "br-ex",
			SegmentationID:  615,
		},
	}

	iTrue := true
	networkCreateOpts := networks.CreateOpts{
		Name:         "provider-network",
		AdminStateUp: &iTrue,
		Shared:       &iTrue,
	}

	createOpts : provider.CreateOptsExt{
		CreateOptsBuilder: networkCreateOpts,
		Segments:          segments,
	}

	network, err := networks.Create(networkClient, createOpts).Extract()
	if err != nil {
		panic(err)
	}
*/
package provider