Add device capability and get authenticated device list
[platform/core/system/edge-orchestration.git] / patches / orchestration.patch
1 diff --git a/src/orchestrationapi/orchestration.go b/src/orchestrationapi/orchestration.go
2 index 60673bc..8af5a20 100644
3 --- a/src/orchestrationapi/orchestration.go
4 +++ b/src/orchestrationapi/orchestration.go
5 @@ -39,7 +39,7 @@ import (
6  
7  const logtag = "Orchestration"
8  
9 -// Orche is the interface implemented by orchestration start funciton
10 +// Orche is the interface implemented by orchestration start function
11  type Orche interface {
12         Start(deviceIDPath string, platform string, executionType string)
13  }
14 @@ -47,6 +47,10 @@ type Orche interface {
15  // OrcheExternalAPI is the interface implemented by external REST API
16  type OrcheExternalAPI interface {
17         RequestService(serviceInfo ReqeustService) ResponseService
18 +       GetAuthenticatedDeviceList(serviceName string, execType string) ([]string, error)
19 +       ReadCapability(ip string) (string, error)
20 +       WriteCapability(capJson string) error
21 +       RequestServiceOnDevice(serviceInfo ReqeustService, ip string) ResponseService
22  }
23  
24  // OrcheInternalAPI is the interface implemented by internal REST API
25 @@ -106,8 +110,10 @@ type OrchestrationBuilder struct {
26  
27         isSetClient bool
28         clientAPI   client.Clienter
29 -}
30  
31 +       isSetCapability bool
32 +       capabilityIns   configuremgr.CapabilityImpl
33 +}
34  // SetScoring registers the interface to handle resource scoring
35  func (o *OrchestrationBuilder) SetScoring(s scoringmgr.Scoring) {
36         o.isSetScoring = true
37 @@ -144,10 +150,15 @@ func (o *OrchestrationBuilder) SetClient(c client.Clienter) {
38         o.clientAPI = c
39  }
40  
41 -// Build registrers every interface to run orchestration
42 +func (o *OrchestrationBuilder) SetCapability(c configuremgr.CapabilityImpl) {
43 +       o.isSetCapability = true
44 +       o.capabilityIns = c
45 +}
46 +
47 +// Build registers every interface to run orchestration
48  func (o OrchestrationBuilder) Build() Orche {
49         if !o.isSetWatcher || !o.isSetDiscovery || !o.isSetScoring ||
50 -               !o.isSetService || !o.isSetExecutor || !o.isSetClient {
51 +               !o.isSetService || !o.isSetExecutor || !o.isSetClient || !o.isSetCapability {
52                 return nil
53         }
54  
55 @@ -157,6 +168,7 @@ func (o OrchestrationBuilder) Build() Orche {
56         orcheIns.watcher = o.watcherIns
57         orcheIns.serviceIns = o.serviceIns
58         orcheIns.clientAPI = o.clientAPI
59 +       orcheIns.capabilityIns = o.capabilityIns
60         resourceMonitorImpl = resourceutil.GetMonitoringInstance()
61  
62         orcheIns.notificationIns = notification.GetInstance()