Ubuntu Pastebin

Paste from dimitern at Fri, 26 Feb 2016 11:36:49 +0000

Download as text
 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
// Copyright 2016 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package state

// ipAddressDoc describes the persistent state of an IP address assigned to a
// link-layer network device.
type ipAddressDoc struct {
	// DocID is the IP address ID, prefixed by ModelUUID.
	DocID string `bson:"_id"`

	// ID is the ID of the IP address, which is generated from a sequence like
	// for machines and units.
	ID string `bson:"id"`

	// ModelUUID is the UUID of the model this IP address belongs to.
	ModelUUID string `bson:"model-uuid"`

	// ProviderID is a provider-specific ID of the IP address, prefixed by
	// ModelUUID. Empty when not supported by the provider.
	ProviderID string `bson:"providerid,omitempty"`

	// DeviceName is the name of the link-layer device this IP address belongs to.
	DeviceName string `bson:"device-name"`

	// MachineID is the ID of the machine this IP address's device belongs to.
	MachineID string `bson:"machine-id"`

	// SubnetID is the ID of the subnet this IP address belongs to.
	SubnetID string `bson:"subnet-id"`

	// ConfigMethod is the method used to configure this IP address.
	ConfigMethod IPAddressConfigMethod `bson:"config-method"`

	// Address is the value of the configured IP address.
	Address string `bson:"address"`

	// DNSServers contains a list of DNS nameservers that apply to this IP
	// address's device. Can be empty.
	DNSServers []string `bson:"dns-servers,omitempty"`

	// DNSDomains contains a list of DNS domain names used to qualify hostnames,
	// and can be empty.
	DNSDomains []string `bson:"dns-domains,omitempty"`

	// GatewayAddress is the IP address of the gateway this IP address's device
	// uses. Can be empty.
	GatewayAddress string `bson:"gateway-address,omitempty"`
}

// IPAddressConfigMethod is the method used to configure an IP address.
type IPAddressConfigMethod string

const (
	// UnknownIPAddress is used for IP addresses with unknown configuration type.
	UnknownIPAddress IPAddressConfigMethod = "unknown"

	// StaticIPAddress is used for statically configured addresses.
	StaticIPAddress IPAddressConfigMethod = "static"

	// DynamicIPAddress is used for addresses dynamically configured via DHCP.
	DynamicIPAddress IPAddressConfigMethod = "dynamic"

	// ManualIPAddress is used for manually configured addresses.
	ManualIPAddress IPAddressConfigMethod = "manual"
)

// IPAddress represents the state of a link-layer network device IP address.
type IPAddress struct {
	st  *State
	doc ipAddressDoc
}
Download as text