Documentation
¶
Index ¶
- func ClearResources()
- type Microgateway
- func (m *Microgateway) AddResource(app *api.App, inputSettings ...map[string]interface{}) (map[string]interface{}, error)
- func (m *Microgateway) NewResponse(isError bool) *Response
- func (m *Microgateway) NewService(name string, act interface{}) *Service
- func (m *Microgateway) NewStep(service *Service) *Step
- type Output
- type Response
- type Service
- type ServiceFunc
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Microgateway ¶
type Microgateway struct { Name string `json:"name" jsonschema:"required"` Steps []*Step `json:"steps" jsonschema:"required,minItems=1"` Responses []*Response `json:"responses,omitempty"` Services []*Service `json:"services,omitempty" jsonschema:"uniqueItems=true"` }
Microgateway defines a microgateway
func (*Microgateway) AddResource ¶
func (m *Microgateway) AddResource(app *api.App, inputSettings ...map[string]interface{}) (map[string]interface{}, error)
AddResource adds the microgateway resource to the app and returns the action settings
func (*Microgateway) NewResponse ¶
func (m *Microgateway) NewResponse(isError bool) *Response
NewResponse adds a new response to the microgateway
func (*Microgateway) NewService ¶
func (m *Microgateway) NewService(name string, act interface{}) *Service
NewService adds a new service to the microgateway
func (*Microgateway) NewStep ¶
func (m *Microgateway) NewStep(service *Service) *Step
NewStep adds a new execution step to the microgateway
type Output ¶
type Output struct { Code interface{} `json:"code,omitempty"` Data interface{} `json:"data" jsonschema:"additionalProperties"` }
Output defines response output values back to a trigger event.
type Response ¶
type Response struct { Condition string `json:"if,omitempty"` Error bool `json:"error" jsonschema:"required"` Output Output `json:"output,omitempty" jsonschema:"required"` }
Response defines response handling rules.
func (*Response) SetCode ¶
func (r *Response) SetCode(code interface{})
SetCode sets the status code for the response
type Service ¶
type Service struct { Name string `json:"name" jsonschema:"required"` Ref string `json:"ref" jsonschema:"required"` Description string `json:"description,omitempty"` Settings map[string]interface{} `json:"settings,omitempty" jsonschema:"additionalProperties"` Handler ServiceFunc `json:"-"` }
Service defines a functional target that may be invoked by a step in an execution flow.
func (*Service) AddSetting ¶
AddSetting adds a setting to the service
func (*Service) SetDescription ¶
SetDescription sets the description of the service
type ServiceFunc ¶
ServiceFunc is a function to be called for a service
type Step ¶
type Step struct { Condition string `json:"if,omitempty"` Service string `json:"service" jsonschema:"required"` Input map[string]interface{} `json:"input,omitempty" jsonschema:"additionalProperties"` HaltCondition string `json:"halt,omitempty"` }
Step conditionally defines a step in a route's execution flow.