Skip to content

Commit

Permalink
feat: add api
Browse files Browse the repository at this point in the history
Signed-off-by: richardli1598 <[email protected]>
  • Loading branch information
richardli1598 committed Aug 20, 2023
1 parent 6fbfe61 commit 17103d1
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 1 deletion.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
# nasone
NAS External Service Unified Configuration Center

Take you to the land of light, the city of freedom(A unified external service management system for NAS).

# demo

action element demo:
```yaml
kind: action
name: remoteInstallNginx
description: xxx
parameter:
ip: x1
sshUser: x2
sshPasword: x3
os: ubuntu
image: xxxx
```
full workflow demo:
```yaml
name: exposeLocalService
kind: workflow
on: dispatch #dispatch/period/trigger
- use: action/nginxInstall
with:
ip: 192.168.1.6
sshUser: root
sshPassword: root
os: ubuntu
- use: action/frpServerInstall
with:
ip: 192.168.1.6
sshUser: root
sshPassword: root
os: ubuntu
- use: action/frpClientInstall
with:
ip: 192.168.1.2
sshUser: root
sshPassword: root
os: ubuntu
- use: action/exportLocalService
with:
localPort: 45
remotePort: 80
dns: video.opennaslab.com
```
21 changes: 21 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2023 The opennaslab Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicabl e law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

func main() {

}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module opennaslab.io/bifrost

go 1.20
56 changes: 56 additions & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
Copyright 2023 The opennaslab Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicabl e law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package api

type Action struct {
Kind string `json:"kind"`
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]string `json:"parameters,omitempty"`
Image string `json:"image"`
}

type WorkflowType string

const (
DispatchWorklow WorkflowType = "dispatch"
PeriodicWorkflow WorkflowType = "periodic"
// MixedWorkflow means both dispatch and periodic
MixedWorkflow WorkflowType = "mixed"
)

type Workflow struct {
Kind string `json:"kind"`
Name string `json:"name"`
On WorkflowType `json:"on"`
// +optional
Schedule string `json:"schedule,omitempty"`
Actions []WorkflowActionElement `json:"actions"`
Status WorkflowStatus `json:"status,omitempty"`
}

type WorkflowActionElement struct {
Use string `json:"use"`
With map[string]string `json:"with"`
}

type WorkflowStatus struct {
NextExecutionTime string `json:"nextExecutionTime"`
Finished bool `json:"finished"`
StepIndex int32 `json:"stepIndex"`
Message string `json:"message"`
}

0 comments on commit 17103d1

Please sign in to comment.