Skip to content

Commit

Permalink
deprecation: kind field
Browse files Browse the repository at this point in the history
BREAKING: since #331 uplink will no longer forward the kind field to connected applications
  • Loading branch information
Devdutt Shenoi committed Apr 5, 2024
1 parent 3f9d2d9 commit d84d8a1
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ jobs:
target: aarch64-apple-darwin
- build: linux-arm-gnu
os: ubuntu-latest
rust: 1.69.0
rust: stable
target: armv7-unknown-linux-gnueabihf
- build: linux-aarch-musl
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-musl
- build: linux-aarch-gnu
os: ubuntu-latest
rust: 1.69.0
rust: stable
target: aarch64-unknown-linux-gnu
- build: windows
os: ubuntu-latest
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Actions are messages that uplink expects to receive from the broker and is execu
```js
{
"action_id": "...",
"kind": "...",
"name": "...",
"payload": "..."
}
Expand Down Expand Up @@ -121,7 +120,6 @@ Once enabled, Actions with the following JSON will trigger uplink to download th
```js
{
"action_id": "...",
"kind": "process",
"name": "update_firmware",
"payload": "{
\"url\": \"https://example.com/file\",
Expand All @@ -133,7 +131,6 @@ Once downloded, the payload JSON is updated with the file's on device path, as s
```js
{
"action_id": "...",
"kind": "process",
"name": "update_firmware",
"payload": "{
\"url\": \"https://example.com/file\",
Expand All @@ -148,7 +145,6 @@ With the help of tunshell, uplink allows you to remotely connect to a device she
```js
{
"action_id": "...",
"kind": "...",
"name": "tunshell",
"payload": "{
\"session\": \"...\",
Expand Down
1 change: 0 additions & 1 deletion docs/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ An `Action` is the term used to refer to messages that carry commands and other
```js
{
"action_id": "...", // An integer value that can be used to maintain indempotence
"kind": "...", // May hold values such as process, depending on end-use
"name": "...", // Name given to Action
"payload": "..." // Can contain JSON formatted data as a string
}
Expand Down
1 change: 0 additions & 1 deletion examples/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type ActionStatus struct {

type Action struct {
Id string `json:"action_id"`
Kind string `json:"timestamp"`
Name string `json:"name"`
Payload string `json:"payload"`
}
Expand Down
19 changes: 6 additions & 13 deletions tools/actions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ import (

type Action struct {
ID string `json:"action_id"`
Kind string `json:"kind"`
Command string `json:"name"`
Payload string `json:"payload"`
}

func NewAction(id, kind, command, payload string) *Action {
func NewAction(id, command, payload string) *Action {
action := Action{
ID: id,
Kind: kind,
Command: command,
Payload: payload,
}
Expand Down Expand Up @@ -75,34 +73,29 @@ func createAction(name string) *Action {
fmt.Println("action =", name, "id =", id)
switch name {
case "update_firmware":
kind := "process"
command := "tools/ota"
payload := `{"hello": "world"}`
action := NewAction(id, kind, command, payload)
action := NewAction(id, command, payload)
return action
case "stop_collector":
kind := "control"
command := name
payload := `{"hello": "world"}`
action := NewAction(id, kind, command, payload)
action := NewAction(id, command, payload)
return action
case "start_collector":
kind := "control"
command := name
payload := `{"args": ["simulator"]}`
action := NewAction(id, kind, command, payload)
action := NewAction(id, command, payload)
return action
case "stop_collector_stream":
kind := "control"
command := name
payload := `{"args": ["simulator", "gps"]}`
action := NewAction(id, kind, command, payload)
action := NewAction(id, command, payload)
return action
case "start_collector_strea":
kind := "control"
command := name
payload := `{"args": ["simulator", "gps"]}`
action := NewAction(id, kind, command, payload)
action := NewAction(id, command, payload)
return action
default:
fmt.Println("Invalid action")
Expand Down
2 changes: 0 additions & 2 deletions tools/tunshell/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ struct Config {
#[derive(Serialize)]
struct Action {
id: String,
kind: String,
name: String,
payload: String,
}
Expand Down Expand Up @@ -69,7 +68,6 @@ fn main() {
let action = Action {
id: "tunshell".to_string(),
name: "launch_shell".to_string(),
kind: "launch_shell".to_string(),
payload: serde_json::to_string(&Keys {
session: target_key,
relay: "eu.relay.tunshell.com".to_string(),
Expand Down

0 comments on commit d84d8a1

Please sign in to comment.