Merge lp:~gz/juju-core/add_state_address into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | Martin Packman |
Approved revision: | no longer in the source branch. |
Merged at revision: | 1488 |
Proposed branch: | lp:~gz/juju-core/add_state_address |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
68 lines (+59/-0) 2 files modified
state/address.go (+36/-0) state/address_test.go (+23/-0) |
To merge this branch: | bzr merge lp:~gz/juju-core/add_state_address |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+174823@code.launchpad.net |
Commit message
Add state/address.go for machine location data
Add data structure for describing machine addresses. This is the
first step towards deprecating PublicAddress and PrivateAddress
in unitDoc and storing a list of addresses in machineDoc instead.
The structure uses a single field that may contain either a hostname
or an address. The plan is for a New constructor to correctly flag
the type of location.
https:/
R=fwereade, jameinel
Description of the change
Add state/address.go for machine location data
Add data structure for describing machine addresses. This is the
first step towards deprecating PublicAddress and PrivateAddress
in unitDoc and storing a list of addresses in machineDoc instead.
The structure uses a single field that may contain either a hostname
or an address. The plan is for a New constructor to correctly flag
the type of location.
Suggestions on naming of things welcome.
Reviewers: mp+174823_ code.launchpad. net,
Message:
Please take a look.
Description:
Add state/address.go for machine location data
Add data structure for describing machine addresses. This is the
first step towards deprecating PublicAddress and PrivateAddress
in unitDoc and storing a list of addresses in machineDoc instead.
The structure uses a single field that may contain either a hostname
or an address. The plan is for a New constructor to correctly flag
the type of location.
Suggestions on naming of things welcome.
https:/ /code.launchpad .net/~gz/ juju-core/ add_state_ address/ +merge/ 174823
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/11284044/
Affected files:
A [revision details]
A state/address.go
Index: [revision details] 20130715152550- v4p859yzf8o5a3c a
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: state/address.go
=== added file 'state/address.go'
--- state/address.go 1970-01-01 00:00:00 +0000
+++ state/address.go 2013-07-15 16:45:38 +0000
@@ -0,0 +1,36 @@
+// Copyright 2013 Canonical Ltd.
+// Licensed under the AGPLv3, see LICENCE file for details.
+
+package state
+
+// AddressType represents the possible ways of specifying a machine
location by
+// either a hostname resolvable by dns lookup, or ipv4 or ipv6 address.
+type AddressType string
+
+const (
+ HostName AddressType = "hostname"
+ Ipv4Address AddressType = "ipv4"
+ Ipv6Address AddressType = "ipv6"
+)
+
+// NetworkScope denotes the context a location may apply to. If a name or
+// address can be reached from the wider internet, it is considered
public. A
+// private network address is either specific to the cloud or cloud subnet
a
+// machine belongs to, or to the machine itself for containers.
+type NetworkScope string
+
+const (
+ NetworkUnknown NetworkScope = ""
+ NetworkPublic NetworkScope = "public"
+ NetworkCloudLocal NetworkScope = "local-cloud"
+ NetworkMachineLocal NetworkScope = "local-machine"
+)
+
+// Address represents the location of a machine, including metadata about
what
+// kind of location the address describes.
+type Address struct {
+ Name string
+ Type AddressType
+ NetworkName string `bson:",omitempty"`
+ NetworkScope string `bson:",omitempty"`
+}