info:
description: "Edge Orchestration support to deliver distributed service process\
\ environment."
- version: "v1-20190307"
+ version: "v1-20190318"
title: "Edge Orchestration"
tags:
+- name: "Discovery Manager"
+ description: "Edge Discovery"
- name: "Device Resource"
description: "Device resource"
- name: "Service Manager"
schemes:
- "http"
paths:
+ /api/v1/discoverymgr/devices:
+ get:
+ tags:
+ - "Discovery Manager"
+ description: "Get result of Edge discovery"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ parameters: []
+ responses:
+ 200:
+ description: "Successful operation"
+ schema:
+ $ref: "#/definitions/DiscoveryEdgeList"
+ /api/v1/discoverymgr/devices/{deviceid}:
+ get:
+ tags:
+ - "Discovery Manager"
+ description: "Get result of Edge discovery"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ parameters:
+ - name: "deviceid"
+ in: "path"
+ description: "ID of Edge device"
+ required: true
+ type: "string"
+ x-exportParamName: "Deviceid"
+ responses:
+ 200:
+ description: "Successful operation"
+ schema:
+ $ref: "#/definitions/DiscoveryEdge"
/api/v1/device/resource/usage/cpu:
get:
tags:
description: "Successful operation"
schema:
$ref: "#/definitions/Disk"
- /api/v1/servicemgr/service:
+ /api/v1/servicemgr/services:
get:
tags:
- "Service Manager"
- description: "Get Service list"
+ description: "Get information of user service"
consumes:
- "application/json"
produces:
post:
tags:
- "Service Manager"
- description: "Create service"
+ description: "Create user app object"
consumes:
- "application/json"
produces:
parameters:
- in: "body"
name: "body"
- description: "Parameters for request service execution"
+ description: "Parameters for request user service creation"
required: false
schema:
$ref: "#/definitions/ServiceRequest"
200:
description: "Successful operation"
schema:
- $ref: "#/definitions/APIResponse"
+ $ref: "#/definitions/ServiceObjectList"
delete:
tags:
- "Service Manager"
- description: "Destroy service"
+ description: "Destroy user app object"
consumes:
- "application/json"
produces:
- "application/json"
- parameters: []
+ parameters:
+ - name: "appname"
+ in: "path"
+ description: "Name of user app to be destroied"
+ required: true
+ type: "string"
+ x-exportParamName: "Appname"
responses:
200:
description: "Successful operation"
schema:
$ref: "#/definitions/APIResponse"
- /api/v1/servicemgr/service/{serviceID}:
+ /api/v1/servicemgr/services/{serviceid}:
get:
tags:
- "Service Manager"
- description: "Get service information"
+ description: "Get information of micro-service"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ parameters:
+ - name: "serviceid"
+ in: "path"
+ description: "ID of micro-service"
+ required: true
+ type: "string"
+ x-exportParamName: "Serviceid"
+ responses:
+ 200:
+ description: "Successful operation"
+ schema:
+ $ref: "#/definitions/MicroServiceInfo"
+ post:
+ tags:
+ - "Service Manager"
+ description: "Execute requested service"
+ consumes:
+ - "application/json"
+ produces:
+ - "application/json"
+ parameters:
+ - name: "serviceid"
+ in: "path"
+ description: "ID of micro-service"
+ required: true
+ type: "string"
+ x-exportParamName: "Serviceid"
+ - in: "body"
+ name: "serviceParam"
+ description: "Parameters for request micro-service creation"
+ required: false
+ schema:
+ $ref: "#/definitions/MicroServiceRequest"
+ x-exportParamName: "ServiceParam"
+ responses:
+ 200:
+ description: "Successful operation"
+ schema:
+ $ref: "#/definitions/APIResponse"
+ delete:
+ tags:
+ - "Service Manager"
+ description: "Destroy requested micro-service"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- - name: "serviceID"
+ - name: "serviceid"
in: "path"
- description: "Name of service"
+ description: "ID of micro-service"
required: true
type: "string"
- x-exportParamName: "ServiceID"
+ x-exportParamName: "Serviceid"
responses:
200:
description: "Successful operation"
schema:
- $ref: "#/definitions/ServiceInfo"
+ $ref: "#/definitions/APIResponse"
definitions:
+ EdgeResource:
+ type: "string"
+ description: "H/W resource of Edge device can support"
+ DiscoveryEdge:
+ type: "object"
+ properties:
+ deviceID:
+ type: "string"
+ example: "edge-0001"
+ description: "Unique ID of Edge device"
+ deviceIPAddr:
+ type: "string"
+ example: "10.113.175.249"
+ description: "IP address of Edge device"
+ deviceProperties:
+ type: "array"
+ example:
+ - "display"
+ - "speaker"
+ description: "Edge resources"
+ items:
+ $ref: "#/definitions/EdgeResource"
+ status:
+ type: "string"
+ example: "Up"
+ description: "Status of Edge device"
+ example:
+ deviceIPAddr: "10.113.175.249"
+ deviceProperties:
+ - "display"
+ - "speaker"
+ deviceID: "edge-0001"
+ status: "Up"
+ DiscoveryEdgeList:
+ type: "array"
+ items:
+ $ref: "#/definitions/DiscoveryEdge"
CPU:
type: "object"
properties:
description: "User parameter of requesting service"
example:
arguments: "5"
- ServiceRequest:
+ MicroServiceRequest:
type: "object"
properties:
- serviceName:
- type: "string"
- example: "helloWorld_service"
- description: "Name of requested service"
- status:
- type: "string"
- example: "Start"
- description: "Status of requested service"
- type:
- type: "string"
- example: "CPU"
- description: "Type of resource for requested service"
systemParam:
$ref: "#/definitions/SystemParam"
userParam:
example:
userParam:
arguments: "5"
- serviceName: "helloWorld_service"
- type: "CPU"
systemParam:
port: "5432"
ipAddr: "127.0.0.1"
- status: "Start"
+ ServiceObject:
+ type: "object"
+ properties:
+ id:
+ type: "integer"
+ description: "Created ID of micro-service"
+ time:
+ type: "string"
+ description: "The time when micro-service created"
+ ServiceObjectList:
+ type: "object"
+ properties:
+ serviceList:
+ type: "array"
+ example:
+ - id: 2
+ time: "2019-03-14T13:43:38+09:00"
+ - id: 3
+ time: "2019-03-14T13:43:38+09:00"
+ items:
+ $ref: "#/definitions/ServiceObject"
+ example:
+ serviceList:
+ - id: 2
+ time: "2019-03-14T13:43:38+09:00"
+ - id: 3
+ time: "2019-03-14T13:43:38+09:00"
+ ServiceRequest:
+ type: "object"
+ properties:
+ appName:
+ type: "string"
+ example: "GreetWorldApp"
+ description: "Name of requested user service"
+ serviceName:
+ type: "string"
+ example: "HelloWorldService"
+ description: "Name of micro-services"
+ count:
+ type: "integer"
+ example: 2
+ description: "Count of micro-services"
+ example:
+ appName: "GreetWorldApp"
+ count: 2
+ serviceName: "HelloWorldService"
ServiceInfo:
type: "object"
properties:
+ appName:
+ type: "string"
+ example: "GreetWorldApp"
+ description: "Name of requested user service"
+ serviceList:
+ $ref: "#/definitions/MicroServiceList"
+ ServiceList:
+ type: "array"
+ items:
+ $ref: "#/definitions/ServiceInfo"
+ MicroServiceInfo:
+ type: "object"
+ properties:
serviceName:
type: "string"
- example: "helloWorld_service"
+ example: "HelloWorldService#1"
description: "Service name"
serviceID:
- type: "string"
- example: "helloWorld_service_deviceID_UUID"
+ type: "integer"
+ example: 2
description: "Unique ID of service"
status:
type: "string"
- example: "Start"
+ example: "started"
description: "Status of service"
deviceID:
type: "string"
example: "Edge_deviceID"
description: "DeviceID on which the service is operating"
example:
- serviceName: "helloWorld_service"
- serviceID: "helloWorld_service_deviceID_UUID"
+ serviceName: "HelloWorldService#1"
+ serviceID: 2
deviceID: "Edge_deviceID"
- status: "Start"
- ServiceList:
+ status: "started"
+ MicroServiceList:
type: "array"
items:
- $ref: "#/definitions/ServiceInfo"
+ $ref: "#/definitions/MicroServiceInfo"
+ example:
+ - serviceName: "HelloWorldService#1"
+ serviceID: 2
+ status: "started"
+ deviceID: "10.113.175.249"
+ - serviceName: "HelloWorldService#2"
+ serviceID: 3
+ status: "progressing"
+ deviceID: "10.113.175.239"
APIResponse:
type: "object"
properties:
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+import (
+ "net/http"
+)
+
+func ApiV1DiscoverymgrDevicesDeviceidGet(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
+
+func ApiV1DiscoverymgrDevicesGet(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
"net/http"
)
-func ApiV1ServicemgrServiceDelete(w http.ResponseWriter, r *http.Request) {
+func ApiV1ServicemgrServicesDelete(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}
-func ApiV1ServicemgrServiceGet(w http.ResponseWriter, r *http.Request) {
+func ApiV1ServicemgrServicesGet(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}
-func ApiV1ServicemgrServicePost(w http.ResponseWriter, r *http.Request) {
+func ApiV1ServicemgrServicesPost(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}
-func ApiV1ServicemgrServiceServiceIDGet(w http.ResponseWriter, r *http.Request) {
+func ApiV1ServicemgrServicesServiceidDelete(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
+
+func ApiV1ServicemgrServicesServiceidGet(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
+
+func ApiV1ServicemgrServicesServiceidPost(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type DiscoveryEdge struct {
+
+ // Unique ID of Edge device
+ DeviceID string `json:"deviceID,omitempty"`
+
+ // IP address of Edge device
+ DeviceIPAddr string `json:"deviceIPAddr,omitempty"`
+
+ // Edge resources
+ DeviceProperties []EdgeResource `json:"deviceProperties,omitempty"`
+
+ // Status of Edge device
+ Status string `json:"status,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type DiscoveryEdgeList struct {
+}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+// H/W resource of Edge device can support
+type EdgeResource struct {
+}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type MicroServiceInfo struct {
+
+ // Service name
+ ServiceName string `json:"serviceName,omitempty"`
+
+ // Unique ID of service
+ ServiceID int32 `json:"serviceID,omitempty"`
+
+ // Status of service
+ Status string `json:"status,omitempty"`
+
+ // DeviceID on which the service is operating
+ DeviceID string `json:"deviceID,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type MicroServiceList struct {
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type MicroServiceRequest struct {
+
+ SystemParam *SystemParam `json:"systemParam,omitempty"`
+
+ UserParam *UserParam `json:"userParam,omitempty"`
+}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
type ServiceInfo struct {
- // Service name
- ServiceName string `json:"serviceName,omitempty"`
+ // Name of requested user service
+ AppName string `json:"appName,omitempty"`
- // Unique ID of service
- ServiceID string `json:"serviceID,omitempty"`
-
- // Status of service
- Status string `json:"status,omitempty"`
-
- // DeviceID on which the service is operating
- DeviceID string `json:"deviceID,omitempty"`
+ ServiceList *MicroServiceList `json:"serviceList,omitempty"`
}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type ServiceObject struct {
+
+ // Created ID of micro-service
+ Id int32 `json:"id,omitempty"`
+
+ // The time when micro-service created
+ Time string `json:"time,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190318
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type ServiceObjectList struct {
+
+ ServiceList []ServiceObject `json:"serviceList,omitempty"`
+}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
type ServiceRequest struct {
- // Name of requested service
- ServiceName string `json:"serviceName,omitempty"`
-
- // Status of requested service
- Status string `json:"status,omitempty"`
+ // Name of requested user service
+ AppName string `json:"appName,omitempty"`
- // Type of resource for requested service
- Type_ string `json:"type,omitempty"`
-
- SystemParam *SystemParam `json:"systemParam,omitempty"`
+ // Name of micro-services
+ ServiceName string `json:"serviceName,omitempty"`
- UserParam *UserParam `json:"userParam,omitempty"`
+ // Count of micro-services
+ Count int32 `json:"count,omitempty"`
}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
},
Route{
- "ApiV1ServicemgrServiceDelete",
+ "ApiV1DiscoverymgrDevicesDeviceidGet",
+ strings.ToUpper("Get"),
+ "/api/v1/discoverymgr/devices/{deviceid}",
+ ApiV1DiscoverymgrDevicesDeviceidGet,
+ },
+
+ Route{
+ "ApiV1DiscoverymgrDevicesGet",
+ strings.ToUpper("Get"),
+ "/api/v1/discoverymgr/devices",
+ ApiV1DiscoverymgrDevicesGet,
+ },
+
+ Route{
+ "ApiV1ServicemgrServicesDelete",
strings.ToUpper("Delete"),
- "/api/v1/servicemgr/service",
- ApiV1ServicemgrServiceDelete,
+ "/api/v1/servicemgr/services",
+ ApiV1ServicemgrServicesDelete,
},
Route{
- "ApiV1ServicemgrServiceGet",
+ "ApiV1ServicemgrServicesGet",
strings.ToUpper("Get"),
- "/api/v1/servicemgr/service",
- ApiV1ServicemgrServiceGet,
+ "/api/v1/servicemgr/services",
+ ApiV1ServicemgrServicesGet,
},
Route{
- "ApiV1ServicemgrServicePost",
+ "ApiV1ServicemgrServicesPost",
strings.ToUpper("Post"),
- "/api/v1/servicemgr/service",
- ApiV1ServicemgrServicePost,
+ "/api/v1/servicemgr/services",
+ ApiV1ServicemgrServicesPost,
},
Route{
- "ApiV1ServicemgrServiceServiceIDGet",
+ "ApiV1ServicemgrServicesServiceidDelete",
+ strings.ToUpper("Delete"),
+ "/api/v1/servicemgr/services/{serviceid}",
+ ApiV1ServicemgrServicesServiceidDelete,
+ },
+
+ Route{
+ "ApiV1ServicemgrServicesServiceidGet",
strings.ToUpper("Get"),
- "/api/v1/servicemgr/service/{serviceID}",
- ApiV1ServicemgrServiceServiceIDGet,
+ "/api/v1/servicemgr/services/{serviceid}",
+ ApiV1ServicemgrServicesServiceidGet,
+ },
+
+ Route{
+ "ApiV1ServicemgrServicesServiceidPost",
+ strings.ToUpper("Post"),
+ "/api/v1/servicemgr/services/{serviceid}",
+ ApiV1ServicemgrServicesServiceidPost,
},
}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
writeJSONResponse(w, data, http.StatusOK)
}
-// APIV1ServicemgrServiceGet function
-func APIV1ServicemgrServiceGet(w http.ResponseWriter, r *http.Request) {
- log.Printf("[%s] APIV1ServicemgrServiceGet", logPrefix)
+// APIV1DiscoverymgrDevicesDeviceIDGet function
+func APIV1DiscoverymgrDevicesDeviceIDGet(w http.ResponseWriter, r *http.Request) {
+ log.Printf("[%s] APIV1DiscoverymgrDevicesDeviceIDGet", logPrefix)
+}
- w.Header().Set("Content-Type", "application/json; charset=UTF-8")
- w.WriteHeader(http.StatusOK)
+// APIV1DiscoverymgrDevicesGet function
+func APIV1DiscoverymgrDevicesGet(w http.ResponseWriter, r *http.Request) {
+ log.Printf("[%s] APIV1DiscoverymgrDevicesGet", logPrefix)
}
-// APIV1ServicemgrServiceServiceIDGet function
-func APIV1ServicemgrServiceServiceIDGet(w http.ResponseWriter, r *http.Request) {
- log.Printf("[%s] APIV1ServicemgrServiceServiceIDGet", logPrefix)
+// APIV1ServicemgrServicesDelete function
+func APIV1ServicemgrServicesDelete(w http.ResponseWriter, r *http.Request) {
+ log.Printf("[%s] APIV1ServicemgrServicesDelete", logPrefix)
+}
- w.Header().Set("Content-Type", "application/json; charset=UTF-8")
- w.WriteHeader(http.StatusOK)
+// APIV1ServicemgrServicesGet function
+func APIV1ServicemgrServicesGet(w http.ResponseWriter, r *http.Request) {
+ log.Printf("[%s] APIV1ServicemgrServicesGet", logPrefix)
}
// APIV1ServicemgrServicesPost function
serviceParam, err := servicemgr.CreateServiceHandler(w, r)
if err == nil {
data := servicemgr.Create(serviceParam)
- w.Header().Set("Content-Type", "application/json; charset=UTF-8")
writeJSONResponse(w, data, http.StatusOK)
} else {
- w.Header().Set("Content-Type", "application/json; charset=UTF-8")
- w.WriteHeader(http.StatusBadRequest)
+ writeJSONResponse(w, nil, http.StatusBadRequest)
}
}
-// APIV1ServicemgrServicesServiceIDPost function
-func APIV1ServicemgrServicesServiceIDPost(w http.ResponseWriter, r *http.Request) {
- log.Printf("[%s] APIV1ServicemgrServiceIDPost", logPrefix)
+// APIV1ServicemgrServicesServiceIDDelete function
+func APIV1ServicemgrServicesServiceIDDelete(w http.ResponseWriter, r *http.Request) {
+ log.Printf("[%s] APIV1ServicemgrServicesServiceIDDelete", logPrefix)
vars := mux.Vars(r)
serviceID := vars["serviceid"]
id, err := strconv.ParseUint(serviceID, 10, 64)
- exist, _ := servicemgr.ServiceNameMap.Get(id)
-
- if exist == nil || err != nil {
- smbytes, _ := json.Marshal(servicemgr.ServiceCreationResponse{"NOTFOUND"})
+ if len(serviceID) == 0 || err != nil {
+ 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) {
-
+// APIV1ServicemgrServicesServiceIDGet function
+func APIV1ServicemgrServicesServiceIDGet(w http.ResponseWriter, r *http.Request) {
+ log.Printf("[%s] APIV1ServicemgrServicesServiceIDGet", logPrefix)
}
-// APIV1ServicemgrServicesServiceIDDelete function
-func APIV1ServicemgrServicesServiceIDDelete(w http.ResponseWriter, r *http.Request) {
- log.Printf("[%s] APIV1ServicemgrServicesServiceIDDelete", logPrefix)
+// APIV1ServicemgrServicesServiceIDPost function
+func APIV1ServicemgrServicesServiceIDPost(w http.ResponseWriter, r *http.Request) {
+ log.Printf("[%s] APIV1ServicemgrServicesServiceIDPost", 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)
+ exist, _ := servicemgr.ServiceNameMap.Get(id)
+
+ if exist == nil || err != nil {
+ smbytes, _ := json.Marshal(servicemgr.ServiceCreationResponse{Return: "NOTFOUND"})
+ writeJSONResponse(w, smbytes, http.StatusBadRequest)
} else {
- go servicemgr.DeleteServiceHandler(w, r, id)
+ distService, _ := servicemgr.ExecuteServiceHandler(w, r, id)
+ go servicemgr.Run(distService, id)
- w.Header().Set("Content-Type", "application/json; charset=UTF-8")
- w.WriteHeader(http.StatusOK)
+ smbytes, _ := json.Marshal(servicemgr.ServiceCreationResponse{Return: "OK"})
+ writeJSONResponse(w, smbytes, http.StatusOK)
}
}
*
* Edge Orchestration support to deliver distributed service process environment.
*
- * API version: v1-20190307
+ * API version: v1-20190318
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Index function
func Index(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintf(w, "Edge Orchestration!!!")
+ fmt.Fprintf(w, "Hello World!")
}
var routes = Routes{
},
Route{
- "APIV1ServicemgrServicesServiceIDDelete",
- strings.ToUpper("Delete"),
- "/api/v1/servicemgr/services/{serviceid}",
- APIV1ServicemgrServicesServiceIDDelete,
+ "APIV1DiscoverymgrDevicesDeviceIDGet",
+ strings.ToUpper("Get"),
+ "/api/v1/discoverymgr/devices/{deviceid}",
+ APIV1DiscoverymgrDevicesDeviceIDGet,
},
Route{
- "APIV1ServicemgrServiceGet",
+ "APIV1DiscoverymgrDevicesGet",
strings.ToUpper("Get"),
- "/api/v1/servicemgr/service",
- APIV1ServicemgrServiceGet,
+ "/api/v1/discoverymgr/devices",
+ APIV1DiscoverymgrDevicesGet,
},
Route{
- "APIV1ServicemgrEventServiceIDPost",
- strings.ToUpper("Post"),
- "/api/v1/servicmgr/event/{serviceid}",
- APIV1ServicemgrEventServiceIDPost,
+ "APIV1ServicemgrServicesDelete",
+ strings.ToUpper("Delete"),
+ "/api/v1/servicemgr/services",
+ APIV1ServicemgrServicesDelete,
},
Route{
- "APIV1ServicemgrServicesServiceIDPost",
- strings.ToUpper("Post"),
- "/api/v1/servicemgr/services/{serviceid}",
- APIV1ServicemgrServicesServiceIDPost,
+ "APIV1ServicemgrServicesGet",
+ strings.ToUpper("Get"),
+ "/api/v1/servicemgr/services",
+ APIV1ServicemgrServicesGet,
},
Route{
},
Route{
- "APIV1ServicemgrServiceServiceIDGet",
+ "APIV1ServicemgrServicesServiceIDDelete",
+ strings.ToUpper("Delete"),
+ "/api/v1/servicemgr/services/{serviceid}",
+ APIV1ServicemgrServicesServiceIDDelete,
+ },
+
+ Route{
+ "APIV1ServicemgrServicesServiceIDGet",
strings.ToUpper("Get"),
- "/api/v1/servicemgr/service/{serviceid}",
- APIV1ServicemgrServiceServiceIDGet,
+ "/api/v1/servicemgr/services/{serviceid}",
+ APIV1ServicemgrServicesServiceIDGet,
+ },
+
+ Route{
+ "APIV1ServicemgrServicesServiceIDPost",
+ strings.ToUpper("Post"),
+ "/api/v1/servicemgr/services/{serviceid}",
+ APIV1ServicemgrServicesServiceIDPost,
},
}
Return string `json:"return"`
}
+// ServiceDestroyResponse structure
+type ServiceDestroyResponse struct {
+ Return string `json:"return"`
+}
+
// ServiceExecutionResponse structure
type ServiceExecutionResponse struct {
ServiceList []ServiceExecutionItem `json:"serviceList"`