2020-07-08 22:09:19 +00:00
package main
2021-10-30 11:17:33 +00:00
import (
"encoding/json"
"github.com/rosti-cz/node-api/apps"
)
2021-04-25 22:57:05 +00:00
2020-08-06 22:36:40 +00:00
// Path where authorized keys are
const sshPubKeysLocation = "/srv/.ssh/authorized_keys"
2021-04-25 22:57:05 +00:00
// RequestMessage message
type RequestMessage struct {
AppName string ` json:"name" `
Type string ` json:"type" `
Payload string ` json:"payload" `
}
type StateMessage struct {
AppName string ` json:"name" ` // Name of the related application stored in the main database
Error bool ` json:"error" ` // True if the message is an error message
Message string ` json:"message" `
}
func ( s * StateMessage ) JSON ( ) ( [ ] byte , error ) {
return json . Marshal ( s )
}
// ReplyMessage is returned as reply to a message that requires replying
type ReplyMessage struct {
AppName string ` json:"name,omitempty" `
Error bool ` json:"error,omitempty" ` // True if this message is an error message and in that case Payload is string with an error message, otherwise it's standard response
Payload interface { } ` json:"payload" `
}
2020-07-09 22:27:23 +00:00
// Message represents response with information about results of something
2020-07-08 22:09:19 +00:00
type Message struct {
2020-07-30 20:46:09 +00:00
// Message with different kind of information. Usually it's error message generated by dependencies or stdlib or simply ok.
// Example: ok
// Required: false
Message string ` json:"message,omitempty" `
// If there are any errors all of them are listed here.
// Required: false
Errors [ ] string ` json:"errors,omitempty" `
2020-07-08 22:09:19 +00:00
}
2020-07-25 22:34:16 +00:00
// data passed into the template
type templateData struct {
Token string
}
2020-08-06 22:36:40 +00:00
// Password is request structure you can use to pass password for app user in the container
type Password struct {
Password string ` json:"password" `
}
2020-08-20 23:00:24 +00:00
// QuickServices comes from client and say what technology or service enable in the container
type QuickServices struct {
Python bool ` json:"python" `
Node bool ` json:"node" `
PHP bool ` json:"php" `
2021-04-02 16:10:34 +00:00
Ruby bool ` json:"ruby" `
Deno bool ` json:"deno" `
2020-08-20 23:00:24 +00:00
Memcached bool ` json:"memcached" `
Redis bool ` json:"redis" `
}
2021-10-30 11:17:33 +00:00
// SnapshotMetadata is snapshot structure encapsulation that combines key and metadata about the snapshot
type SnapshotMetadata struct {
Key string ` json:"key" `
Metadata apps . Snapshot ` json:"metadata" `
}
// SnapshotsMetadata is returned by handlers
type SnapshotsMetadata [ ] SnapshotMetadata