*.so
*.dylib
bin/*
+pkg/*
# Test binary, build with `go test -c`
*.test
--- /dev/null
+## Generating api server code with Swagger tool from JSON
+### Prerequisite
+Make sure Java version 1.8 or later is installed on your computer.
+To check java version, please open terminal and type
+```
+$ java -version
+java version "1.8.0_201"
+Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
+Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
+```
+### Code generate
+```
+$ java -jar swagger-codegen-cli.jar generate -i ../edge-orchestration-api.json -l go-server
+```
\ No newline at end of file
--- /dev/null
+# Swagger Codegen Ignore
+# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
--- /dev/null
+2.4.2
\ No newline at end of file
--- /dev/null
+# Go API Server for swagger
+
+Edge Orchestration support to deliver distributed service process environment.
+
+## Overview
+This server was generated by the [swagger-codegen]
+(https://github.com/swagger-api/swagger-codegen) project.
+By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub.
+-
+
+To see how to make this your own, look here:
+
+[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
+
+- API version: v1-20190307
+- Build date: 2019-03-14T13:19:12.241+09:00
+
+
+### Running the server
+To run the server, follow these simple steps:
+
+```
+go run main.go
+```
+
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+import (
+ "net/http"
+)
+
+func ApiV1DeviceResourceUsageCpuGet(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
+
+func ApiV1DeviceResourceUsageDiskGet(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
+
+func ApiV1DeviceResourceUsageMemoryGet(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
+
+func ApiV1DeviceResourceUsageNetworkGet(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+import (
+ "net/http"
+)
+
+func ApiV1ServicemgrServiceDelete(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) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
+
+func ApiV1ServicemgrServicePost(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) {
+ w.Header().Set("Content-Type", "application/json; charset=UTF-8")
+ w.WriteHeader(http.StatusOK)
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+import (
+ "log"
+ "net/http"
+ "time"
+)
+
+func Logger(inner http.Handler, name string) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ start := time.Now()
+
+ inner.ServeHTTP(w, r)
+
+ log.Printf(
+ "%s %s %s %s",
+ r.Method,
+ r.RequestURI,
+ name,
+ time.Since(start),
+ )
+ })
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type ApiResponse struct {
+
+ // Return the status of the request
+ Message string `json:"message,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type Cpu struct {
+
+ // Usage of CPU
+ Cpu string `json:"cpu,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type Disk struct {
+
+ // Usage of Disk
+ Network string `json:"network,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type Memory struct {
+
+ // Usage of Memory
+ Memory string `json:"memory,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type Network struct {
+
+ // Usage of Network
+ Network string `json:"network,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type ServiceInfo struct {
+
+ // Service name
+ ServiceName string `json:"serviceName,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"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type ServiceList struct {
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type ServiceRequest struct {
+
+ // Name of requested service
+ ServiceName string `json:"serviceName,omitempty"`
+
+ // Status of requested service
+ Status string `json:"status,omitempty"`
+
+ // Type of resource for requested service
+ Type_ string `json:"type,omitempty"`
+
+ SystemParam *SystemParam `json:"systemParam,omitempty"`
+
+ UserParam *UserParam `json:"userParam,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type SystemParam struct {
+
+ // IP Addr of device requesting service
+ IpAddr string `json:"ipAddr,omitempty"`
+
+ // Port number of device requesting service
+ Port string `json:"port,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+type UserParam struct {
+
+ // User parameter of requesting service
+ Arguments string `json:"arguments,omitempty"`
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package swagger
+
+import (
+ "fmt"
+ "net/http"
+ "strings"
+
+ "github.com/gorilla/mux"
+)
+
+type Route struct {
+ Name string
+ Method string
+ Pattern string
+ HandlerFunc http.HandlerFunc
+}
+
+type Routes []Route
+
+func NewRouter() *mux.Router {
+ router := mux.NewRouter().StrictSlash(true)
+ for _, route := range routes {
+ var handler http.Handler
+ handler = route.HandlerFunc
+ handler = Logger(handler, route.Name)
+
+ router.
+ Methods(route.Method).
+ Path(route.Pattern).
+ Name(route.Name).
+ Handler(handler)
+ }
+
+ return router
+}
+
+func Index(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintf(w, "Hello World!")
+}
+
+var routes = Routes{
+ Route{
+ "Index",
+ "GET",
+ "/",
+ Index,
+ },
+
+ Route{
+ "ApiV1DeviceResourceUsageCpuGet",
+ strings.ToUpper("Get"),
+ "/api/v1/device/resource/usage/cpu",
+ ApiV1DeviceResourceUsageCpuGet,
+ },
+
+ Route{
+ "ApiV1DeviceResourceUsageDiskGet",
+ strings.ToUpper("Get"),
+ "/api/v1/device/resource/usage/disk",
+ ApiV1DeviceResourceUsageDiskGet,
+ },
+
+ Route{
+ "ApiV1DeviceResourceUsageMemoryGet",
+ strings.ToUpper("Get"),
+ "/api/v1/device/resource/usage/memory",
+ ApiV1DeviceResourceUsageMemoryGet,
+ },
+
+ Route{
+ "ApiV1DeviceResourceUsageNetworkGet",
+ strings.ToUpper("Get"),
+ "/api/v1/device/resource/usage/network",
+ ApiV1DeviceResourceUsageNetworkGet,
+ },
+
+ Route{
+ "ApiV1ServicemgrServiceDelete",
+ strings.ToUpper("Delete"),
+ "/api/v1/servicemgr/service",
+ ApiV1ServicemgrServiceDelete,
+ },
+
+ Route{
+ "ApiV1ServicemgrServiceGet",
+ strings.ToUpper("Get"),
+ "/api/v1/servicemgr/service",
+ ApiV1ServicemgrServiceGet,
+ },
+
+ Route{
+ "ApiV1ServicemgrServicePost",
+ strings.ToUpper("Post"),
+ "/api/v1/servicemgr/service",
+ ApiV1ServicemgrServicePost,
+ },
+
+ Route{
+ "ApiV1ServicemgrServiceServiceIDGet",
+ strings.ToUpper("Get"),
+ "/api/v1/servicemgr/service/{serviceID}",
+ ApiV1ServicemgrServiceServiceIDGet,
+ },
+}
--- /dev/null
+/*
+ * Edge Orchestration
+ *
+ * Edge Orchestration support to deliver distributed service process environment.
+ *
+ * API version: v1-20190307
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package main
+
+import (
+ "log"
+ "net/http"
+
+ // WARNING!
+ // Change this to a fully-qualified import path
+ // once you place this file into your project.
+ // For example,
+ //
+ // sw "github.com/myname/myrepo/go"
+ //
+ sw "./go"
+)
+
+func main() {
+ log.Printf("Server started")
+
+ router := sw.NewRouter()
+
+ log.Fatal(http.ListenAndServe(":8080", router))
+}