Documentation ¶
Index ¶
- Variables
- func Write(w io.Writer, extension string, root *Root) error
- func WriteFile(filename, format string, root *Root) (string, error)
- func WriteHCL(w io.Writer, root *Root) error
- func WriteJSON(w io.Writer, root *Root) error
- type AliasService
- type Association
- type AssociationType
- type Datacenter
- type Meta
- type Resource
- type ResourceType
- type Root
- type RootJSON
- type Service
- type ServiceJSON
- type X
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrorExtension = errors.New("extension must be either 'hcl' or 'json'")
)
Functions ¶
Types ¶
type AliasService ¶
type AliasService Service
type Association ¶
Association for any item
type AssociationType ¶
type AssociationType int
const ( Contains AssociationType = iota Egress Ingress )
func (AssociationType) String ¶
func (i AssociationType) String() string
type Datacenter ¶
type Datacenter struct { Name string `hcl:"name,label" json:"-"` Description string `hcl:"description" json:"description"` Default bool `hcl:"default,optional" json:"default"` }
Datacenter entity
type Meta ¶
type Meta struct { Role string `hcl:"role,optional" json:"role,omitempty"` Version string `hcl:"version,optional" json:"version,omitempty"` Software string `hcl:"software,optional" json:"software,omitempty"` Extra hcl.Body `hcl:",remain" json:"extra,omitempty"` }
Meta information
type Resource ¶
type Resource struct { Type string `hcl:"type,label" json:"-"` Name string `hcl:"name,label" json:"-"` Associations []Association `hcl:"association,block"` Location string `hcl:"location,optional" json:"location"` }
Resource (load balancers)
type ResourceType ¶
type ResourceType int
const ( Firewall ResourceType = iota LoadBalancer ServicePool ConsulCluster ConsulServer ConsulClient )
func (ResourceType) String ¶
func (i ResourceType) String() string
type Root ¶
type Root struct { Datacenters []*Datacenter `hcl:"datacenter,block"` Resources []*Resource `hcl:"resource,block"` Services []*Service `hcl:"service,block"` }
Root document and elements
func (*Root) MarshalJSON ¶
MarshalJSON to be compatible with the reader
type RootJSON ¶
type RootJSON struct { Datacenter map[string]*Datacenter `json:"datacenter"` Resources map[string]map[string]*Resource `json:"resource"` Services map[string]map[string]*Service `json:"service"` }
RootJSON : This should be the format supported
type Service ¶
type Service struct { Type string `hcl:"type,label" json:"-"` Name string `hcl:"name,label" json:"-"` Port int `hcl:"port,optional" json:"port,omitempty"` Address string `hcl:"address,optional" json:"address,omitempty"` Protocol string `hcl:"protocol,optional" json:"protocol,omitempty"` Meta []Meta `hcl:"meta,block" json:"meta,omitempty"` }
Service (representation of local stuff)
func (*Service) MarshalJSON ¶
type ServiceJSON ¶
type ServiceJSON struct { Meta interface{} `json:"meta,omitempty"` *AliasService }
Click to show internal directories.
Click to hide internal directories.