Documentation ¶
Overview ¶
Package "usecases" addresses system actions in given use cases such as configuration, registration, authentication, orchestration, ...
Index ¶
- func ACServices(w http.ResponseWriter, r *http.Request, ua *components.UnitAsset, ...)
- func Configure(sys *components.System) ([]json.RawMessage, []components.Service, error)
- func ExtractDiscoveryForm(bodyBytes []byte) (sLoc forms.ServicePoint_v1, err error)
- func ExtractQuestForm(bodyBytes []byte) (rec forms.ServiceQuest_v1, err error)
- func FillDiscoveredServices(dsList []forms.ServiceRecord_v1, version string) (f forms.Form, err error)
- func FillQuestForm(sys *components.System, res components.UnitAsset, sDef, protocol string) forms.ServiceQuest_v1
- func GetActivitiesCost(serv *components.Service) (payload []byte, err error)
- func GetState(cer *components.Cervice, sys *components.System) (f forms.Form, err error)
- func HTTPProcessGetRequest(w http.ResponseWriter, r *http.Request, f forms.Form)
- func HTTPProcessSetRequest(w http.ResponseWriter, req *http.Request) (f forms.SignalA_v1a, err error)
- func Pack(f forms.Form, contentType string) (data []byte, err error)
- func RegisterServices(sys *components.System)
- func RequestCertificate(sys *components.System)
- func ResourceHandler(sys *components.System, w http.ResponseWriter, r *http.Request)
- func Search4Service(qf forms.ServiceQuest_v1, sys *components.System) (servLocation forms.ServicePoint_v1, err error)
- func Search4Services(cer *components.Cervice, sys *components.System) (err error)
- func ServQustForms() []string
- func ServRegReqExtract(bodyBytes []byte) (rec forms.ServiceRecord_v1, err error)
- func ServRegRespFillIn(rec forms.ServiceRecord_v1, version string) (payload []byte, err error)
- func ServiceRegistrationFormsList() []string
- func SetActivitiesCost(serv *components.Service, bodyBytes []byte) (err error)
- func SetState(cer *components.Cervice, sys *components.System, bodyBytes []byte) (err error)
- func SetoutServers(sys *components.System) (err error)
- func Unpack(data []byte, contentType string) (forms.Form, error)
- type ConfigFile2Sys
- type Sys2ConfigFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ACServices ¶
func ACServices(w http.ResponseWriter, r *http.Request, ua *components.UnitAsset, serviceP string)
ACServices handles the http requestfor the cost of a service
func Configure ¶
func Configure(sys *components.System) ([]json.RawMessage, []components.Service, error)
Configure read the system configuration JSON file to get the deployment details. If the file is missing, it generates a systemconfig file and shuts down the system
func ExtractDiscoveryForm ¶
func ExtractDiscoveryForm(bodyBytes []byte) (sLoc forms.ServicePoint_v1, err error)
ExtractDiscoveryForm is used by the Orchestrator and the authorized consumer system
func ExtractQuestForm ¶
func ExtractQuestForm(bodyBytes []byte) (rec forms.ServiceQuest_v1, err error)
ExtractQuestForm is used by the Service Registrar and Orchestrator when they receive a service query from a consumer system
func FillDiscoveredServices ¶
func FillDiscoveredServices(dsList []forms.ServiceRecord_v1, version string) (f forms.Form, err error)
FillDiscoveredServices returrns a json data byte array with a slice of matching services (e.g., Service Registrar)
func FillQuestForm ¶
func FillQuestForm(sys *components.System, res components.UnitAsset, sDef, protocol string) forms.ServiceQuest_v1
FillQuestForm described the sought service (e.g., RemoteSignal)
func GetActivitiesCost ¶
func GetActivitiesCost(serv *components.Service) (payload []byte, err error)
func GetState ¶
func GetState(cer *components.Cervice, sys *components.System) (f forms.Form, err error)
GetState request the current state of a unit asset (via the asset's service)
func HTTPProcessGetRequest ¶
HTTPProcessSetRequest processes a Get request
func HTTPProcessSetRequest ¶
func HTTPProcessSetRequest(w http.ResponseWriter, req *http.Request) (f forms.SignalA_v1a, err error)
HTTPProcessSetRequest processes a SET request
func Pack ¶
Pack serializes a form to a byte array for payolad shipment with serializaton format (sf) request
func RegisterServices ¶
func RegisterServices(sys *components.System)
RegisterServices keeps trach of the leading Service Registrar and keeps all services registered
func RequestCertificate ¶
func RequestCertificate(sys *components.System)
RequestCertificate generates the system's public key and a certificate signing request to be sent to the CA
func ResourceHandler ¶
func ResourceHandler(sys *components.System, w http.ResponseWriter, r *http.Request)
ResourceHandler break up the request in parts and finds out what is requested as in http://192.168.1.4:8700/photographer/picam/files/image_20240325-211555.jpg where photographer is part[1], picam is part[2](with len==3), files is part[3] (with len==4)
func Search4Service ¶
func Search4Service(qf forms.ServiceQuest_v1, sys *components.System) (servLocation forms.ServicePoint_v1, err error)
Search4Service requests from the core systems the address of resources's services that meet the need
func Search4Services ¶
func Search4Services(cer *components.Cervice, sys *components.System) (err error)
Search4Services requests from the core systems the address of resources' services that meet the need
func ServQustForms ¶
func ServQustForms() []string
ServRegForms returns the list of forms that the service registration handles
func ServRegReqExtract ¶
func ServRegReqExtract(bodyBytes []byte) (rec forms.ServiceRecord_v1, err error)
servRegReqExtract determines the corrrecet forrm in to which the raw json data is used to update the service based on entry into the data base [Receving @ ServiceRegistry]
func ServRegRespFillIn ¶
func ServRegRespFillIn(rec forms.ServiceRecord_v1, version string) (payload []byte, err error)
ServRegRespFillIn returrns a json data byte array with the data of the service to be registered in the form of choice [Sending @ ServiceRegistry]
func ServiceRegistrationFormsList ¶
func ServiceRegistrationFormsList() []string
ServiceRegistrationFormsList returns the list of foms that the service registration handles
func SetActivitiesCost ¶
func SetActivitiesCost(serv *components.Service, bodyBytes []byte) (err error)
SetActivitiesCost updates the service cost
func SetState ¶
func SetState(cer *components.Cervice, sys *components.System, bodyBytes []byte) (err error)
SetState puts a request to change the state of a unit asset (via the asset's service)
func SetoutServers ¶
func SetoutServers(sys *components.System) (err error)
SetoutServers setup the http and https servers and starts them
Types ¶
type ConfigFile2Sys ¶
type ConfigFile2Sys struct { CName string `json:"systemname"` CServices []components.Service `json:"services"` Protocols map[string]int `json:"protocolsNports"` PKIdetails pkix.Name `json:"distinguishedName"` CCoreS []components.CoreSystem `json:"coreSystems"` // contains filtered or unexported fields }
ConfigFile2Sys is used to extact out the information of the systemconfig.json file Since it does not know about the details of the Thing, it does not unmarsahll this information
type Sys2ConfigFile ¶
type Sys2ConfigFile struct { CName string `json:"systemname"` UAsset []components.UnitAsset `json:"unit_assets"` CServices []components.Service `json:"services"` Protocols map[string]int `json:"protocolsNports"` PKIdetails pkix.Name `json:"distinguishedName"` CCoreS []components.CoreSystem `json:"coreSystems"` }
Sys2ConfigFile is the stuct used to prepare the systemconfig.json file