Merge branch 'master' into EDGE-142
author차지원/Service Innovation Lab(SR)/Engineer/삼성전자 <jw_wonny.cha@samsung.com>
Tue, 19 Mar 2019 06:38:46 +0000 (15:38 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 19 Mar 2019 06:38:46 +0000 (15:38 +0900)
1  2 
register_service.sh
src/restapi/v1/restapi.go
src/servicemgr/types.go

@@@ -13,9 -12,7 +13,10 @@@ ZMQ_VERSION="zmq_4_x
  
  export GOARCH=amd64
  export GOPATH=$GOPATH:$BASE_DIR:$BASE_DIR/vendor
 -go build -a -ldflags '-extldflags "-static"' -o $BASE_DIR/bin/$SERVICE_BIN orchestration || exit 1
 +
- go build -tags $ZMQ_VERSION -a -o $BASE_DIR/bin/$SERVICE_BIN orchestration
++go build -tags $ZMQ_VERSION -a -o $BASE_DIR/bin/$SERVICE_BIN orchestration || exit 1
 +# go build -tags $ZMQ_VERSION -a -ldflags '-extldflags "-static"' -o $BASE_DIR/bin/$SERVICE_BIN orchestration
++
  ls -al $BASE_DIR/bin
  
  echo ""
@@@ -96,40 -98,24 +98,42 @@@ func APIV1ServicemgrServicesServiceIDDe
        id, err := strconv.ParseUint(serviceID, 10, 64)
  
        if len(serviceID) == 0 || err != nil {
-               smbytes, _ := json.Marshal(servicemgr.ServiceCreationResponse{"NOTFOUND"})
+               smbytes, _ := json.Marshal(servicemgr.ServiceDestroyResponse{Return: "NOTFOUND"})
                writeJSONResponse(w, smbytes, http.StatusBadRequest)
        } else {
-               distService, _ := servicemgr.ExecuteServiceHandler(w, r, id)
-               go servicemgr.Run(distService, id)
+               go servicemgr.DeleteServiceHandler(w, r, id)
  
-               w.Header().Set("Content-Type", "application/json; charset=UTF-8")
-               smbytes, _ := json.Marshal(servicemgr.ServiceCreationResponse{"OK"})
-               writeJSONResponse(w, smbytes, http.StatusBadRequest)
+               smbytes, _ := json.Marshal(servicemgr.ServiceDestroyResponse{Return: "OK"})
+               writeJSONResponse(w, smbytes, http.StatusOK)
        }
  }
 +// APIV1ServicemgrEventServiceIDPost function
 +func APIV1ServicemgrEventServiceIDPost(w http.ResponseWriter, r *http.Request) {
 +      log.Printf("[%s] APIV1ServicemgrEventServiceIDPost", logPrefix)
 +
 +      vars := mux.Vars(r)
 +      serviceID := vars["serviceid"]
 +      id, err := strconv.ParseUint(serviceID, 10, 64)
 +
 +      if len(serviceID) == 0 || err != nil {
 +              w.Header().Set("Content-Type", "application/json; charset=UTF-8")
 +              w.WriteHeader(http.StatusBadRequest)
 +      } else {
 +              servicemgr.DataPathHandler(w, r, id)
 +
 +              w.Header().Set("Content-Type", "application/json; charset=UTF-8")
 +              w.WriteHeader(http.StatusOK)
 +      }
 +}
  
- // APIV1ServicemgrServicesServiceIDDelete function
- func APIV1ServicemgrServicesServiceIDDelete(w http.ResponseWriter, r *http.Request) {
-       log.Printf("[%s] APIV1ServicemgrServicesServiceIDDelete", logPrefix)
+ // APIV1ServicemgrServicesServiceIDGet function
+ func APIV1ServicemgrServicesServiceIDGet(w http.ResponseWriter, r *http.Request) {
+       log.Printf("[%s] APIV1ServicemgrServicesServiceIDGet", logPrefix)
+ }
+ // APIV1ServicemgrServicesServiceIDPost function
+ func APIV1ServicemgrServicesServiceIDPost(w http.ResponseWriter, r *http.Request) {
+       log.Printf("[%s] APIV1ServicemgrServicesServiceIDPost", logPrefix)
  
        vars := mux.Vars(r)
        serviceID := vars["serviceid"]
@@@ -34,12 -59,17 +34,17 @@@ type ErrorType struct 
  
  // ServiceCreationResponse structure
  type ServiceCreationResponse struct {
 -      Return string `json:"return"`
 +      Return string `json:"Return"`
  }
  
+ // ServiceDestroyResponse structure
+ type ServiceDestroyResponse struct {
+       Return string `json:"return"`
+ }
  // ServiceExecutionResponse structure
  type ServiceExecutionResponse struct {
 -      ServiceList []ServiceExecutionItem `json:"serviceList"`
 +      ServiceList []ServiceExecutionItem `json:"ServiceList"`
  }
  
  // ServiceExecutionItem structrue