data

package
v0.0.0-...-58575ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adapter

func Adapter() (name, atype, address string)

Adapter returns the adapter configuration.

func AdapterName

func AdapterName() string

AdapterName returns the adapter name.

func GetMonitorAddress

func GetMonitorAddress() string

GetMonitorAddress returns the Telemetry Address from the config file.

func Init

func Init(configFile string) error

Init loads the config files.

func ServiceFromID

func ServiceFromID(srvID structs.ServiceID) (nsrv structs.NService, err error)

ServiceFromID returns the NService data for the specified ServiceID.

func ServicesAll

func ServicesAll() (*structs.NServices, error)

ServicesAll returns a list of ALL services.

func ServicesArea

func ServicesArea(area string) (*structs.NServices, error)

ServicesArea returns a list of all services available for the specified Area.

func ShowConfigData

func ShowConfigData() string

ShowConfigData dumps configData using spew.

func SplitMID

func SplitMID(mid string) (*Area, *Provider, error)

SplitMID breaks down an MID, and returns pointers to the Area and Provider.

Types

type AdapterData

type AdapterData struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Address string `json:"address"`
}

AdapterData contains all of the config data.

type Area

type Area struct {
	ID        string
	Name      string      `json:"name"`
	Providers []*Provider `json:"providers"`
}

Area is a Service Area. It contains an index list of all of the Service Providers for this Area.

func (Area) String

func (a Area) String() string

type ConfigData

type ConfigData struct {
	Loaded  bool
	Adapter AdapterData `json:"adapter"`
	Monitor struct {
		Address string `json:"address"`
	} `json:"monitor"`
	Categories []string         `json:"serviceCategories"`
	Areas      map[string]*Area `json:"serviceAreas"`
	// contains filtered or unexported fields
}

ConfigData is a list of all the Service Areas. It contains an indexed list of all the Service Areas. The index is the *lowercase* area name.

func (*ConfigData) Load

func (pd *ConfigData) Load(file []byte) error

Load loads the specified byte slice into the ConfigData structures.

func (ConfigData) String

func (pd ConfigData) String() string

String returns the represeentation of the ConfigData custom type.

type Provider

type Provider struct {
	ID           int                 //
	Name         string              `json:"name"`
	URL          string              `json:"url"`
	APIVersion   string              `json:"apiVersion"`
	Key          string              `json:"key"`
	ResponseType string              `json:"responseType"`
	Services     []*structs.NService `json:"services"`
}

Provider is the data for each Service Provider. It contains an index list of all of the Services provided by this Provider.

func MIDProvider

func MIDProvider(MID structs.ServiceID) (Provider, error)

MIDProvider returns the Provider data for the specified MidAdpID.

func RouteProvider

func RouteProvider(route structs.NRoute) (Provider, error)

RouteProvider returns the Provider data for the specified NRoute.

func (Provider) String

func (p Provider) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL