Documentation ¶
Index ¶
- Variables
- func FromInt(i int) string
- func NewNATSCaller() *natsCaller
- type API
- func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error)
- func (a *API) CheckRemotePeer(url string) (State, map[string]int)
- func (a *API) Discovered(infos []*beego.ControllerInfo)
- func (a *API) GetState() (State, int, error)
- func (a *API) ListenRouter(exec func(msg map[string]interface{}))
- func (a *API) SubscribeRouter(infos []*beego.ControllerInfo)
- type APIStatus
- type APIStatusResponse
- type DataType
- type HTTPCaller
- func (caller *HTTPCaller) CallDelete(url string, subpath string) ([]byte, error)
- func (caller *HTTPCaller) CallForm(method string, url string, subpath string, body url.Values, ...) (*http.Response, error)
- func (caller *HTTPCaller) CallGet(url string, subpath string, types ...string) ([]byte, error)
- func (caller *HTTPCaller) CallPost(url string, subpath string, body map[string]interface{}, types ...string) ([]byte, error)
- func (caller *HTTPCaller) CallPut(url string, subpath string, body map[string]interface{}) ([]byte, error)
- func (caller *HTTPCaller) CallRaw(method string, url string, subpath string, body map[string]interface{}, ...) (*http.Response, error)
- type METHOD
- type NATSMethod
- type State
Constants ¶
This section is empty.
Variables ¶
var CATALOGAPI = "oc-catalog"
var DATACENTERAPI = "oc-datacenter"
var DefaultAPI = [...]string{ NOAPI, CATALOGAPI, CATALOGAPI, CATALOGAPI, CATALOGAPI, CATALOGAPI, WORKFLOWAPI, NOAPI, WORKSPACEAPI, CATALOGAPI, PEERSAPI, SHAREDAPI, SHAREDAPI, DATACENTERAPI, NOAPI, NOAPI, }
Bind the standard API name to the data type
var HTTPCallerInstance = &HTTPCaller{} // Singleton instance of the HTTPCaller
var NOAPI = ""
var PEERSAPI = "oc-peer"
var SHAREDAPI = "oc-shared"
var Str = [...]string{
"invalid",
"data_resource",
"processing_resource",
"storage_resource",
"compute_resource",
"workflow_resource",
"workflow",
"workflow_execution",
"workspace",
"resource_model",
"peer",
"collaborative_area",
"rule",
"booking",
"workflow_history",
"workspace_history",
}
Bind the standard data name to the data type
var UncatchedError = []error{} // Singleton instance of the api 500 error cache
* API is the Health Check API * it defines the health check methods
var WORKFLOWAPI = "oc-workflow"
var WORKSPACEAPI = "oc-workspace"
Functions ¶
func NewNATSCaller ¶
func NewNATSCaller() *natsCaller
NewNATSCaller creates a new instance of the NATS Caller
Types ¶
type API ¶
type API struct{}
func (*API) CheckRemoteAPIs ¶
CheckRemoteAPIs checks the state of remote APIs from your proper OC
func (*API) CheckRemotePeer ¶
CheckRemotePeer checks the state of a remote peer
func (*API) Discovered ¶
func (a *API) Discovered(infos []*beego.ControllerInfo)
func (*API) ListenRouter ¶
func (*API) SubscribeRouter ¶
func (a *API) SubscribeRouter(infos []*beego.ControllerInfo)
type APIStatus ¶
type APIStatus struct { Code int `json:"code"` // Code is the status code, where 0 is ALIVE, 1 is REDUCED_SERVICE, 2 is UNPROCESSABLE_ENTITY, 3 is DB_FALLOUT, 4 is TEAPOT, 5 is DEAD State string `json:"state"` // State is the state of the API (status shows as a string) (alive, reduced service, unprocessable entity, database fallout, some things boils in here, i'm probably a teapot, dead) Services map[string]string `json:"services"` // Services is the state of the services of the API (status shows as a string) (alive, reduced service, unprocessable entity, database fallout, some things boils in here, i'm probably a teapot, dead) }
* APIStatus is the status of the API * it defines the state of the API * Code is the status code, where 0 is ALIVE, 1 is REDUCED_SERVICE, 2 is UNPROCESSABLE_ENTITY, 3 is DB_FALLOUT, 4 is TEAPOT, 5 is DEAD
type APIStatusResponse ¶
APIStatusResponse is the response of the API status
type DataType ¶
type DataType int
const ( INVALID DataType = iota DATA_RESOURCE PROCESSING_RESOURCE STORAGE_RESOURCE COMPUTE_RESOURCE WORKFLOW_RESOURCE WORKFLOW WORKFLOW_EXECUTION WORKSPACE RESOURCE_MODEL PEER COLLABORATIVE_AREA RULE BOOKING WORKFLOW_HISTORY WORKSPACE_HISTORY )
DataType - Enum for the different types of resources in db accessible from the outside
type HTTPCaller ¶
type HTTPCaller struct { URLS map[DataType]map[METHOD]string // Map of the different methods and their urls Disabled bool // Disabled flag }
func NewHTTPCaller ¶
func NewHTTPCaller(urls map[DataType]map[METHOD]string) *HTTPCaller
NewHTTPCaller creates a new instance of the HTTP Caller
func (*HTTPCaller) CallDelete ¶
func (caller *HTTPCaller) CallDelete(url string, subpath string) ([]byte, error)
CallPut calls the DELETE method on the HTTP server
func (*HTTPCaller) CallForm ¶
func (caller *HTTPCaller) CallForm(method string, url string, subpath string, body url.Values, content_type string, fakeTLSTermination bool, cookies ...*http.Cookie) (*http.Response, error)
CallRaw calls the Raw method on the HTTP server
func (*HTTPCaller) CallPost ¶
func (caller *HTTPCaller) CallPost(url string, subpath string, body map[string]interface{}, types ...string) ([]byte, error)
CallPost calls the POST method on the HTTP server
type METHOD ¶
type METHOD int
HTTP Method Enum defines the different methods that can be used to interact with the HTTP server
type NATSMethod ¶
type NATSMethod int
NATS Method Enum defines the different methods that can be used to interact with the NATS server
const ( REMOVE NATSMethod = iota CREATE DISCOVERY )
func NameToMethod ¶
func NameToMethod(name string) NATSMethod
NameToMethod returns the NATSMethod enum value from a string
func (NATSMethod) GenerateKey ¶
func (d NATSMethod) GenerateKey(name string) string
GenerateKey generates a key for the NATSMethod usefull for standard key based on data name & method
func (NATSMethod) String ¶
func (d NATSMethod) String() string
String returns the string of the enum
type State ¶
type State int
const ( ALIVE State = iota REDUCED_SERVICE // occurs when some services are down UNPROCESSABLE_ENTITY // occurs when the database is up but the collections are not DB_FALLOUT // occurs when the database is down TEAPOT // well some things boils in here, i'm probably a teapot, occurs when uncatched errors are present (it's fun) DEAD // occurs when the peer is dead )
State is an enum that defines the state of the API