diff --git a/controllers/version.go b/controllers/version.go index 9620dab..1f7ae37 100644 --- a/controllers/version.go +++ b/controllers/version.go @@ -1,7 +1,6 @@ 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" ) @@ -28,13 +27,6 @@ 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() } diff --git a/go.mod b/go.mod index f0109a5..2e5d581 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( ) require ( - cloud.o-forge.io/core/oc-lib v0.0.0-20240821093044-f64563c9ff06 // indirect + cloud.o-forge.io/core/oc-lib v0.0.0-20240822065024-fb80e05d6a7b // 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 diff --git a/go.sum b/go.sum index 8bfbbf7..9581b8b 100644 --- a/go.sum +++ b/go.sum @@ -116,6 +116,10 @@ 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= diff --git a/oc-shared b/oc-shared index 8fb8073..99f0b30 100755 Binary files a/oc-shared and b/oc-shared differ diff --git a/routers/router.go b/routers/router.go index 46589fb..c60c144 100644 --- a/routers/router.go +++ b/routers/router.go @@ -14,13 +14,13 @@ import ( ) func init() { - ns := beego.NewNamespace("/oc/shared/", - beego.NSNamespace("/workspace", + ns := beego.NewNamespace("/oc", + beego.NSNamespace("/shared/workspace", beego.NSInclude( &controllers.SharedWorkspaceController{}, ), ), - beego.NSNamespace("/workspace/rule", + beego.NSNamespace("/shared/workspace/rule", beego.NSInclude( &controllers.RuleController{}, ), diff --git a/swagger/swagger.json b/swagger/swagger.json index fbeb580..561766a 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -13,40 +13,12 @@ "url": "http://www.apache.org/licenses/LICENSE-2.0.html" } }, - "basePath": "/oc/shared/", + "basePath": "/oc", "paths": { - "/version/": { + "/shared/workspace/": { "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": "" - } - } - } - }, - "/workspace/": { - "get": { - "tags": [ - "workspace" + "shared/workspace" ], "description": "find shared workspace by id\n\u003cbr\u003e", "operationId": "SharedWorkspaceController.GetAll", @@ -58,7 +30,7 @@ }, "post": { "tags": [ - "workspace" + "shared/workspace" ], "description": "create shared workspace\n\u003cbr\u003e", "operationId": "SharedWorkspaceController.Create", @@ -80,10 +52,10 @@ } } }, - "/workspace/rule/": { + "/shared/workspace/rule/": { "get": { "tags": [ - "workspace/rule" + "shared/workspace/rule" ], "description": "find rule by id\n\u003cbr\u003e", "operationId": "RuleController.GetAll", @@ -95,7 +67,7 @@ }, "post": { "tags": [ - "workspace/rule" + "shared/workspace/rule" ], "description": "create rule\n\u003cbr\u003e", "operationId": "RuleController.Create", @@ -117,10 +89,10 @@ } } }, - "/workspace/rule/search/{search}": { + "/shared/workspace/rule/search/{search}": { "get": { "tags": [ - "workspace/rule" + "shared/workspace/rule" ], "description": "search rule\n\u003cbr\u003e", "operationId": "RuleController.Search", @@ -140,10 +112,10 @@ } } }, - "/workspace/rule/{id}": { + "/shared/workspace/rule/{id}": { "get": { "tags": [ - "workspace/rule" + "shared/workspace/rule" ], "description": "find rule by id\n\u003cbr\u003e", "operationId": "RuleController.Get", @@ -164,7 +136,7 @@ }, "put": { "tags": [ - "workspace/rule" + "shared/workspace/rule" ], "description": "create rules\n\u003cbr\u003e", "operationId": "RuleController.Update", @@ -194,7 +166,7 @@ }, "delete": { "tags": [ - "workspace/rule" + "shared/workspace/rule" ], "description": "delete the rule\n\u003cbr\u003e", "operationId": "RuleController.Delete", @@ -214,10 +186,10 @@ } } }, - "/workspace/search/{search}": { + "/shared/workspace/search/{search}": { "get": { "tags": [ - "workspace" + "shared/workspace" ], "description": "search shared workspace\n\u003cbr\u003e", "operationId": "SharedWorkspaceController.Search", @@ -237,10 +209,10 @@ } } }, - "/workspace/{id}": { + "/shared/workspace/{id}": { "get": { "tags": [ - "workspace" + "shared/workspace" ], "description": "find shared workspace by id\n\u003cbr\u003e", "operationId": "SharedWorkspaceController.Get", @@ -261,7 +233,7 @@ }, "put": { "tags": [ - "workspace" + "shared/workspace" ], "description": "create shared workspaces\n\u003cbr\u003e", "operationId": "SharedWorkspaceController.Update", @@ -291,7 +263,7 @@ }, "delete": { "tags": [ - "workspace" + "shared/workspace" ], "description": "delete the shared workspace\n\u003cbr\u003e", "operationId": "SharedWorkspaceController.Delete", @@ -310,6 +282,34 @@ } } } + }, + "/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": "workspace", + "name": "shared/workspace", "description": "Operations about workspace\n" }, { - "name": "workspace/rule", + "name": "shared/workspace/rule", "description": "Operations about rule\n" }, { diff --git a/swagger/swagger.yml b/swagger/swagger.yml index 3bc2698..74a8474 100644 --- a/swagger/swagger.yml +++ b/swagger/swagger.yml @@ -10,8 +10,208 @@ info: license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html -basePath: /oc/shared/ +basePath: /oc paths: + /shared/workspace/: + get: + tags: + - shared/workspace + description: |- + find shared workspace by id +
+ operationId: SharedWorkspaceController.GetAll + responses: + "200": + description: '{shared_workspace} models.shared_workspace' + post: + tags: + - shared/workspace + description: |- + create shared workspace +
+ 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 +
+ 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 +
+ 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 +
+ 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 +
+ operationId: RuleController.GetAll + responses: + "200": + description: '{rule} models.rule' + post: + tags: + - shared/workspace/rule + description: |- + create rule +
+ 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 +
+ 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 +
+ 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 +
+ 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 +
+ 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 +
+ 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: @@ -34,206 +234,6 @@ paths: responses: "200": description: "" - /workspace/: - get: - tags: - - workspace - description: |- - find shared workspace by id -
- operationId: SharedWorkspaceController.GetAll - responses: - "200": - description: '{shared_workspace} models.shared_workspace' - post: - tags: - - workspace - description: |- - create shared workspace -
- 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 -
- 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 -
- 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 -
- 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 -
- operationId: RuleController.GetAll - responses: - "200": - description: '{rule} models.rule' - post: - tags: - - workspace/rule - description: |- - create rule -
- 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 -
- 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 -
- 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 -
- 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 -
- 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 -
- 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: workspace +- name: shared/workspace description: | Operations about workspace -- name: workspace/rule +- name: shared/workspace/rule description: | Operations about rule - name: version