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: 11 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"`
	Email EmailAuth `json:"email"`

	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 EmailAuth

type EmailAuth struct {
	AuthFile string `json:"auth"`
	Auth     EmailAuthData
}

EmailAuth contains the file path and EmailAuthData.

func (EmailAuth) String

func (r EmailAuth) String() string

type EmailAuthData

type EmailAuthData struct {
	common.JSONConfig
	Account  string `json:"account"`
	Password string `json:"password"`
	Server   string `json:"server"`
	Port     int    `json:"port"`
}

EmailAuthData contains the config and keys to access the server used to send emails.

func GetEmailAuth

func GetEmailAuth() EmailAuthData

GetEmailAuth returns the full path and filename of the Email Auth data.

func (EmailAuthData) String

func (r EmailAuthData) String() string

type EmailConfig

type EmailConfig struct {
	To           []string `json:"to"`
	From         []string `json:"from"`
	Subject      string   `json:"subject"`
	TemplateFile string   `json:"template"`
	// contains filtered or unexported fields
}

EmailConfig contains the data used to send email to a Provider. It also includes the parsed email template used to format all emails sent to this Provider.

func (EmailConfig) Address

func (r EmailConfig) Address() (to, from []string, subject string)

Address returns the EmailConfig parameters necessary to send an email.

func (EmailConfig) String

func (r EmailConfig) String() string

func (EmailConfig) Template

func (r EmailConfig) Template() (tmpl *template.Template)

Template returns a pointer to the parsed Template object.

type EmailSender

type EmailSender interface {
	Address() (to, from []string, subject string)
	Template() (tmpl *template.Template)
}

EmailSender is an interface to the EmailConfig information.

type Provider

type Provider struct {
	ID           int                 //
	Name         string              `json:"name"`
	Email        *EmailConfig        `json:"email"`
	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 ServiceID.

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