Compare commits

..

No commits in common. "a5a86f44c524d3411803a5af5a050fc0f68f69de" and "205b89de9eac6df9eee073d6f55f82f8c4a0cb24" have entirely different histories.

9 changed files with 264 additions and 270 deletions

View File

@ -47,9 +47,6 @@ func (o *SharedWorkspaceController) Put() {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
var res map[string]interface{}
id := o.Ctx.Input.Param(":id")
@ -78,9 +75,6 @@ func (o *SharedWorkspaceController) Post() {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
var res map[string]interface{}
json.Unmarshal(o.Ctx.Input.CopyBody(10000), &res)
@ -128,9 +122,6 @@ func (o *SharedWorkspaceController) Delete() {
tools.DELETE: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/:id",
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)) + "/oc/workflow/",
},
utils.PEER.String(): {
tools.POST: oclib.GetPath(oclib.LibDataEnum(oclib.PEER)) + "/oc/peer",
},
}
id := o.Ctx.Input.Param(":id")
caller := tools.NewHTTPCaller(paths)

View File

@ -1,6 +1,7 @@
package controllers
import (
oclib "cloud.o-forge.io/core/oc-lib"
"cloud.o-forge.io/core/oc-lib/tools"
beego "github.com/beego/beego/v2/server/web"
)
@ -27,6 +28,13 @@ func (c *VersionController) Status() {
errStr := ""
api := tools.API{}
state, code, err := api.GetState()
if state == tools.ALIVE {
state, _, err = api.CheckRemoteAPIs([]string{
"http://" + oclib.LibDataEnum(oclib.WORKSPACE).String() + oclib.GetPath(oclib.LibDataEnum(oclib.WORKSPACE)),
"http://" + oclib.LibDataEnum(oclib.WORKFLOW).String() + oclib.GetPath(oclib.LibDataEnum(oclib.WORKFLOW)),
})
}
if err != nil {
errStr = err.Error()
}

2
go.mod
View File

@ -11,7 +11,7 @@ require (
)
require (
cloud.o-forge.io/core/oc-lib v0.0.0-20240822065024-fb80e05d6a7b // indirect
cloud.o-forge.io/core/oc-lib v0.0.0-20240821093044-f64563c9ff06 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/beego/bee/v2 v2.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect

4
go.sum
View File

@ -116,10 +116,6 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20240813084212-4911e32ec215 h1:Ra1RbFC41IFxJ
cloud.o-forge.io/core/oc-lib v0.0.0-20240813084212-4911e32ec215/go.mod h1:tFM1H8v+lpHt+dTZAhYmYXu3eF+wOEd+HtcOiUbCCvQ=
cloud.o-forge.io/core/oc-lib v0.0.0-20240821093044-f64563c9ff06 h1:sYveE1C/0mpSr+ZmOYxuZ3fTWID7mr5hPiq0jQenv3Q=
cloud.o-forge.io/core/oc-lib v0.0.0-20240821093044-f64563c9ff06/go.mod h1:1hhYh5QWAbYw9cKplQ0ZD9PMgU8t6gPqiYF8sldv1HU=
cloud.o-forge.io/core/oc-lib v0.0.0-20240821140757-39030a0a80e8 h1:y4hngS1bedPKYXecTCcZk2WkuQNFazD11rMng9dmIzI=
cloud.o-forge.io/core/oc-lib v0.0.0-20240821140757-39030a0a80e8/go.mod h1:1hhYh5QWAbYw9cKplQ0ZD9PMgU8t6gPqiYF8sldv1HU=
cloud.o-forge.io/core/oc-lib v0.0.0-20240822065024-fb80e05d6a7b h1:A7NBwTXoHTg/oDbnxnnSdiT85kZY4VvhcbUeb3q7Irk=
cloud.o-forge.io/core/oc-lib v0.0.0-20240822065024-fb80e05d6a7b/go.mod h1:1hhYh5QWAbYw9cKplQ0ZD9PMgU8t6gPqiYF8sldv1HU=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=

View File

@ -33,7 +33,6 @@ func main() {
oclib.AddPath(oclib.LibDataEnum(oclib.SHARED_WORKSPACE), o.GetStringDefault("SHARED_WORKSPACE_URL", ":8091"))
oclib.AddPath(oclib.LibDataEnum(oclib.WORKSPACE), o.GetStringDefault("WORKSPACE_URL", ":8089"))
oclib.AddPath(oclib.LibDataEnum(oclib.WORKFLOW), o.GetStringDefault("WORKFLOW_URL", ":8088"))
oclib.AddPath(oclib.LibDataEnum(oclib.PEER), o.GetStringDefault("WORKFLOW_URL", ":8093"))
// Normal beego init
//if beego.BConfig.RunMode == "dev" {
beego.BConfig.WebConfig.DirectoryIndex = true

BIN
oc-shared

Binary file not shown.

View File

@ -14,13 +14,13 @@ import (
)
func init() {
ns := beego.NewNamespace("/oc",
beego.NSNamespace("/shared/workspace",
ns := beego.NewNamespace("/oc/shared/",
beego.NSNamespace("/workspace",
beego.NSInclude(
&controllers.SharedWorkspaceController{},
),
),
beego.NSNamespace("/shared/workspace/rule",
beego.NSNamespace("/workspace/rule",
beego.NSInclude(
&controllers.RuleController{},
),

View File

@ -13,12 +13,40 @@
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"basePath": "/oc",
"basePath": "/oc/shared/",
"paths": {
"/shared/workspace/": {
"/version/": {
"get": {
"tags": [
"shared/workspace"
"version"
],
"description": "get version\n\u003cbr\u003e",
"operationId": "VersionController.GetAll",
"responses": {
"200": {
"description": ""
}
}
}
},
"/version/status": {
"get": {
"tags": [
"version"
],
"description": "get status\n\u003cbr\u003e",
"operationId": "VersionController.Status",
"responses": {
"200": {
"description": ""
}
}
}
},
"/workspace/": {
"get": {
"tags": [
"workspace"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.GetAll",
@ -30,7 +58,7 @@
},
"post": {
"tags": [
"shared/workspace"
"workspace"
],
"description": "create shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Create",
@ -52,10 +80,10 @@
}
}
},
"/shared/workspace/rule/": {
"/workspace/rule/": {
"get": {
"tags": [
"shared/workspace/rule"
"workspace/rule"
],
"description": "find rule by id\n\u003cbr\u003e",
"operationId": "RuleController.GetAll",
@ -67,7 +95,7 @@
},
"post": {
"tags": [
"shared/workspace/rule"
"workspace/rule"
],
"description": "create rule\n\u003cbr\u003e",
"operationId": "RuleController.Create",
@ -89,10 +117,10 @@
}
}
},
"/shared/workspace/rule/search/{search}": {
"/workspace/rule/search/{search}": {
"get": {
"tags": [
"shared/workspace/rule"
"workspace/rule"
],
"description": "search rule\n\u003cbr\u003e",
"operationId": "RuleController.Search",
@ -112,10 +140,10 @@
}
}
},
"/shared/workspace/rule/{id}": {
"/workspace/rule/{id}": {
"get": {
"tags": [
"shared/workspace/rule"
"workspace/rule"
],
"description": "find rule by id\n\u003cbr\u003e",
"operationId": "RuleController.Get",
@ -136,7 +164,7 @@
},
"put": {
"tags": [
"shared/workspace/rule"
"workspace/rule"
],
"description": "create rules\n\u003cbr\u003e",
"operationId": "RuleController.Update",
@ -166,7 +194,7 @@
},
"delete": {
"tags": [
"shared/workspace/rule"
"workspace/rule"
],
"description": "delete the rule\n\u003cbr\u003e",
"operationId": "RuleController.Delete",
@ -186,10 +214,10 @@
}
}
},
"/shared/workspace/search/{search}": {
"/workspace/search/{search}": {
"get": {
"tags": [
"shared/workspace"
"workspace"
],
"description": "search shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Search",
@ -209,10 +237,10 @@
}
}
},
"/shared/workspace/{id}": {
"/workspace/{id}": {
"get": {
"tags": [
"shared/workspace"
"workspace"
],
"description": "find shared workspace by id\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Get",
@ -233,7 +261,7 @@
},
"put": {
"tags": [
"shared/workspace"
"workspace"
],
"description": "create shared workspaces\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Update",
@ -263,7 +291,7 @@
},
"delete": {
"tags": [
"shared/workspace"
"workspace"
],
"description": "delete the shared workspace\n\u003cbr\u003e",
"operationId": "SharedWorkspaceController.Delete",
@ -282,34 +310,6 @@
}
}
}
},
"/version/": {
"get": {
"tags": [
"version"
],
"description": "get version\n\u003cbr\u003e",
"operationId": "VersionController.GetAll",
"responses": {
"200": {
"description": ""
}
}
}
},
"/version/status": {
"get": {
"tags": [
"version"
],
"description": "get status\n\u003cbr\u003e",
"operationId": "VersionController.Status",
"responses": {
"200": {
"description": ""
}
}
}
}
},
"definitions": {
@ -328,11 +328,11 @@
},
"tags": [
{
"name": "shared/workspace",
"name": "workspace",
"description": "Operations about workspace\n"
},
{
"name": "shared/workspace/rule",
"name": "workspace/rule",
"description": "Operations about rule\n"
},
{

View File

@ -10,208 +10,8 @@ info:
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
basePath: /oc
basePath: /oc/shared/
paths:
/shared/workspace/:
get:
tags:
- shared/workspace
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.GetAll
responses:
"200":
description: '{shared_workspace} models.shared_workspace'
post:
tags:
- shared/workspace
description: |-
create shared workspace
<br>
operationId: SharedWorkspaceController.Create
parameters:
- in: body
name: data
description: body for data content (Json format)
required: true
schema:
$ref: '#/definitions/json'
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/shared/workspace/{id}:
get:
tags:
- shared/workspace
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Get
parameters:
- in: path
name: id
description: the id you want to get
required: true
type: string
responses:
"200":
description: '{shared workspace} models.shared_workspace'
put:
tags:
- shared/workspace
description: |-
create shared workspaces
<br>
operationId: SharedWorkspaceController.Update
parameters:
- in: path
name: id
description: the shared workspace id you want to get
required: true
type: string
- in: body
name: body
description: The shared workspace content
required: true
schema:
$ref: '#/definitions/models.workspace'
responses:
"200":
description: '{shared workspace} models.shared_workspace'
delete:
tags:
- shared/workspace
description: |-
delete the shared workspace
<br>
operationId: SharedWorkspaceController.Delete
parameters:
- in: path
name: id
description: The id you want to delete
required: true
type: string
responses:
"200":
description: '{shared workspace} delete success!'
/shared/workspace/rule/:
get:
tags:
- shared/workspace/rule
description: |-
find rule by id
<br>
operationId: RuleController.GetAll
responses:
"200":
description: '{rule} models.rule'
post:
tags:
- shared/workspace/rule
description: |-
create rule
<br>
operationId: RuleController.Create
parameters:
- in: body
name: data
description: body for data content (Json format)
required: true
schema:
$ref: '#/definitions/json'
responses:
"200":
description: '{rule} models.rule'
/shared/workspace/rule/{id}:
get:
tags:
- shared/workspace/rule
description: |-
find rule by id
<br>
operationId: RuleController.Get
parameters:
- in: path
name: id
description: the id you want to get
required: true
type: string
responses:
"200":
description: '{rule} models.rule'
put:
tags:
- shared/workspace/rule
description: |-
create rules
<br>
operationId: RuleController.Update
parameters:
- in: path
name: id
description: the rule id you want to get
required: true
type: string
- in: body
name: body
description: The rule content
required: true
schema:
$ref: '#/definitions/models.rule'
responses:
"200":
description: '{rule} models.rule'
delete:
tags:
- shared/workspace/rule
description: |-
delete the rule
<br>
operationId: RuleController.Delete
parameters:
- in: path
name: id
description: The id you want to delete
required: true
type: string
responses:
"200":
description: '{rule} delete success!'
/shared/workspace/rule/search/{search}:
get:
tags:
- shared/workspace/rule
description: |-
search rule
<br>
operationId: RuleController.Search
parameters:
- in: path
name: search
description: the word search you want to get
required: true
type: string
responses:
"200":
description: '{rule} models.rule'
/shared/workspace/search/{search}:
get:
tags:
- shared/workspace
description: |-
search shared workspace
<br>
operationId: SharedWorkspaceController.Search
parameters:
- in: path
name: search
description: the word search you want to get
required: true
type: string
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/version/:
get:
tags:
@ -234,6 +34,206 @@ paths:
responses:
"200":
description: ""
/workspace/:
get:
tags:
- workspace
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.GetAll
responses:
"200":
description: '{shared_workspace} models.shared_workspace'
post:
tags:
- workspace
description: |-
create shared workspace
<br>
operationId: SharedWorkspaceController.Create
parameters:
- in: body
name: data
description: body for data content (Json format)
required: true
schema:
$ref: '#/definitions/json'
responses:
"200":
description: '{shared workspace} models.shared_workspace'
/workspace/{id}:
get:
tags:
- workspace
description: |-
find shared workspace by id
<br>
operationId: SharedWorkspaceController.Get
parameters:
- in: path
name: id
description: the id you want to get
required: true
type: string
responses:
"200":
description: '{shared workspace} models.shared_workspace'
put:
tags:
- workspace
description: |-
create shared workspaces
<br>
operationId: SharedWorkspaceController.Update
parameters:
- in: path
name: id
description: the shared workspace id you want to get
required: true
type: string
- in: body
name: body
description: The shared workspace content
required: true
schema:
$ref: '#/definitions/models.workspace'
responses:
"200":
description: '{shared workspace} models.shared_workspace'
delete:
tags:
- workspace
description: |-
delete the shared workspace
<br>
operationId: SharedWorkspaceController.Delete
parameters:
- in: path
name: id
description: The id you want to delete
required: true
type: string
responses:
"200":
description: '{shared workspace} delete success!'
/workspace/rule/:
get:
tags:
- workspace/rule
description: |-
find rule by id
<br>
operationId: RuleController.GetAll
responses:
"200":
description: '{rule} models.rule'
post:
tags:
- workspace/rule
description: |-
create rule
<br>
operationId: RuleController.Create
parameters:
- in: body
name: data
description: body for data content (Json format)
required: true
schema:
$ref: '#/definitions/json'
responses:
"200":
description: '{rule} models.rule'
/workspace/rule/{id}:
get:
tags:
- workspace/rule
description: |-
find rule by id
<br>
operationId: RuleController.Get
parameters:
- in: path
name: id
description: the id you want to get
required: true
type: string
responses:
"200":
description: '{rule} models.rule'
put:
tags:
- workspace/rule
description: |-
create rules
<br>
operationId: RuleController.Update
parameters:
- in: path
name: id
description: the rule id you want to get
required: true
type: string
- in: body
name: body
description: The rule content
required: true
schema:
$ref: '#/definitions/models.rule'
responses:
"200":
description: '{rule} models.rule'
delete:
tags:
- workspace/rule
description: |-
delete the rule
<br>
operationId: RuleController.Delete
parameters:
- in: path
name: id
description: The id you want to delete
required: true
type: string
responses:
"200":
description: '{rule} delete success!'
/workspace/rule/search/{search}:
get:
tags:
- workspace/rule
description: |-
search rule
<br>
operationId: RuleController.Search
parameters:
- in: path
name: search
description: the word search you want to get
required: true
type: string
responses:
"200":
description: '{rule} models.rule'
/workspace/search/{search}:
get:
tags:
- workspace
description: |-
search shared workspace
<br>
operationId: SharedWorkspaceController.Search
parameters:
- in: path
name: search
description: the word search you want to get
required: true
type: string
responses:
"200":
description: '{shared workspace} models.shared_workspace'
definitions:
json:
title: json
@ -245,10 +245,10 @@ definitions:
title: workspace
type: object
tags:
- name: shared/workspace
- name: workspace
description: |
Operations about workspace
- name: shared/workspace/rule
- name: workspace/rule
description: |
Operations about rule
- name: version