Documentation ¶
Overview ¶
Package service is the definition of the microservice.
The Service definition is used to automate bootstrap microservices, automate communication between separate services and to provide a human readable definition of a service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( //ErrNoPort when no port has been set for service ErrNoPort = errors.New("No port set") //ErrNoHost when no host has been set for service ErrNoHost = errors.New("No host set") )
Functions ¶
This section is empty.
Types ¶
type APIDefinition ¶
type APIDefinition struct { // Type represents the type of API definition (swagger, apiblueprint) Type string `json:"type,omitempty" yaml:"Type"` // LocationType defines how to find the API definition (url, vcs) LocationType string `json:"locationType,omitempty" yaml:"LocationType"` // VCS defines the API definition as found in a VCS repository VCS `json:"vcs,omitempty" yaml:"VCS"` // URL gives API Definition's location on the web URL string `json:"url,omitempty" yaml:"URL"` }
APIDefinition Defines how to access the API
type Config ¶
type Config struct { // Key name for variable Key string `json:"key" yaml:"Key"` // Required configuration variable Required bool `json:"required,omitempty" yaml:"Required"` // Description: A human readable description of the value. Description string `json:"description" yaml:"Description"` }
Config represents one configuration value
type Flag ¶
type Flag struct { // Key is the flag designation for the command line flag. Key string `json:"key" yaml:"Key"` // Env is an environment variable that can bes set in lieu of the flag. // CLI flag always overrides environment variable. Env string `json:"env" yaml:"Env"` // Description is the human readable description of the flag. Description string `json:"description" yaml:"Description"` // Required defines flag as required. Required bool `json:"required" yaml:"Required"` }
Flag represents a single command line flag.
type Flags ¶
type Flags []Flag
Flags represents a slice of Flags.
func (Flags) RequiredKeys ¶
RequiredKeys returns a slice required flag keys.
type Service ¶
type Service struct { // Title: Title for service. Title string `json:"title" yaml:"Title"` // Domain: Domain of the Service many times the github user or organization. Domain string `json:"domain" yaml:"Domain"` // Version: Version of the Service. Version string `json:"version" yaml:"Version"` // Type: Category or type of the Service. Type string `json:"type" yaml:"Type"` // Protocol: Protocol of the service. Protocol string `json:"protocol" yaml:"Protocol"` // APIDefinition: APIDefinition of the service. APIDefinition `json:"apiDefinition" yaml:"APIDefinition"` // Private: True if the Service is for internal use only. Private bool `json:"private" yaml:"Private"` // Requires: An array of Services that are required for this Service, // must contain Title, Domain, and Version. Requires []Service `json:"requires,omitempty" yaml:"Requires"` // Configs: An array of configurations this service can use. Configs `json:"configs,omitempty" yaml:"Configs"` // Parameters: An array of parameters to call this Service. Flags `json:"flags,omitempty" yaml:"Flags"` // Port: The Port this service will serve from. Only applies to local instance. Port string `json:"-" yaml:"-"` // Host: The hostname from which this service will serve from. Only applies to local instance. Host string `json:"-" yaml:"-"` }
Service definition
func LoadFromFile ¶
LoadFromFile gets a new Service from yaml service definition file.
func LoadFromJSON ¶
LoadFromJSON loads to new Service from json bytes service definition
func (*Service) LoadFromFile ¶
LoadFromFile loads yaml service definition file into current service.
func (*Service) LoadFromJSON ¶
LoadFromJSON loads service definition into current Service
type VCS ¶
type VCS struct { // Location is the VCS endpoint Location string `json:"location,omitempty" yaml:"Location"` // Type is the VCS type (git, hg) Type string `json:"type,omitempty" yaml:"Type"` // File is where to find the definition in relation to the root of the repository File string `json:"file,omitempty" yaml:"File"` }
VCS holds the information to load an API Definition from a VCS repository