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
|
// Copyright 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package state
import (
"launchpad.net/juju-core/instance"
)
// address represents the location of a machine, including metadata about what
// kind of location the address describes.
type address struct {
value string
addresstype instance.AddressType
networkname string `bson:",omitempty"`
networkscope instance.NetworkScope `bson:",omitempty"`
}
func NewAddress(addr instance.Address) address {
stateaddr := address{
value: addr.Value,
addresstype: addr.Type,
networkname: addr.NetworkName,
networkscope: addr.NetworkScope,
}
return stateaddr
}
func (addr *address) InstanceAddress() instance.Address {
instanceaddr := instance.Address{
Value: addr.value,
Type: addr.addresstype,
NetworkName: addr.networkname,
NetworkScope: addr.networkscope,
}
return instanceaddr
}
|