types

package
v0.0.0-...-d3e8332 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultNatsURL is a default NATS URL
	DefaultNatsURL = "nats://nats:4222"
	// DefaultNatsMaxReconnect is a default NATS Max Reconnect Count
	DefaultNatsMaxReconnect = 6
	// DefaultNatsReconnectWait is a default NATS Reconnect Wait Time in Seconds
	DefaultNatsReconnectWait = 10
	// DefaultNatsRequestTimeout is a default NATS Request Timeout in Seconds
	DefaultNatsRequestTimeout = 10

	// DefaultNatsQueueGroup is a default NATS Queue Group
	DefaultNatsQueueGroup = "interactivesession_queue_group"
	// DefaultNatsWildcardSubject is a default NATS subject to subscribe
	DefaultNatsWildcardSubject = string(cacao_common_service.NatsSubjectInteractiveSession) + ".>"

	// DefaultNatsClientID is a default NATS Client ID
	DefaultNatsClientID = "interactivesession-service"
	// DefaultNatsClusterID is a default NATS Cluster ID
	DefaultNatsClusterID = "cacao-cluster"

	// DefaultNatsDurableName is a default NATS Durable Name
	DefaultNatsDurableName = "interactivesession_durable"

	// DefaultMongoDBURL is a default MongoDB URL
	DefaultMongoDBURL = "mongodb://localhost:27017"
	// DefaultMongoDBName is a default MongoDB Name
	DefaultMongoDBName = "cacao-interactivesession"
	// DefaultInteractiveSessionMongoDBCollectionName is a default MongoDB Collection Name
	DefaultInteractiveSessionMongoDBCollectionName = "interactivesession"
)
View Source
const (
	// DefaultChannelBufferSize is a default buffer size for a channel used between adapters and domain
	DefaultChannelBufferSize = 100
)
View Source
const InteractiveSessionCreateStartedEvent = cacao_common.EventTypePrefix + "InteractiveSession.CreateStarted"

InteractiveSessionCreateStartedEvent is event type that indicate the interactive session is created (persisted), but has not finished (success or failed).

TODO move to cacao-common/service

Variables

This section is empty.

Functions

func ConvertToListItemModel

func ConvertToListItemModel(interactiveSession InteractiveSession) cacao_common_service.InteractiveSessionModel

ConvertToListItemModel converts InteractiveSession to InteractiveSessionListItemModel

func ConvertToModel

ConvertToModel converts InteractiveSession to InteractiveSessionModel

Types

type Config

type Config struct {
	// NATS
	Messaging messaging2.NatsStanMsgConfig

	// MongoDB
	MongoDBConfig                           cacao_common_db.MongoDBConfig
	InteractiveSessionMongoDBCollectionName string

	// Guacamole
	GuacamoleForceHTTP     bool
	MasterSSHKey           string
	GuacamoleServers       []GuacamoleServer
	GuacamoleEncryptionKey []byte
	GuacamoleLiteAuthKey   string
	VNCDefaultPassword     string
}

Config is the configuration settings, which can be used by the Domain object or Adapters

func FromEnvConfig

func FromEnvConfig(envConfig EnvConfig) (Config, error)

FromEnvConfig creates a Config object from EnvConfig. This will perform validation on EnvConfig and populate default values.

type EnvConfig

type EnvConfig struct {
	LogLevel string `envconfig:"LOG_LEVEL" default:"debug"`

	// NATS
	Messaging messaging2.NatsStanMsgConfig

	// MongoDB
	MongoDBConfig cacao_common_db.MongoDBConfig

	GuacamoleForceHTTP bool `envconfig:"ISESSION_GUAC_FORCE_HTTP"`

	MasterSSHKey                 string `envconfig:"ISESSION_MASTER_SSH_KEY" required:"true"`
	GuacamoleServersEnv          string `envconfig:"ISESSION_GUAC_SERVERS" required:"true"`
	GuacamoleEncryptionKeyBase64 string `envconfig:"ISESSION_GUAC_ENCRYPTION_KEY" required:"true"`
	GuacamoleLiteAuthKey         string `envconfig:"ISESSION_GUAC_AUTH_KEY" required:"true"`
	VNCDefaultPassword           string `envconfig:"ISESSION_VNC_DEFAULT_PASSWORD"`
}

EnvConfig are configuration that can be set via environment variables

type GuacamoleLiteConnection

type GuacamoleLiteConnection struct {
	Type     string                `json:"type"`
	Settings GuacamoleLiteSettings `json:"settings"`
}

GuacamoleLiteConnection ...

type GuacamoleLiteConnectionWrapper

type GuacamoleLiteConnectionWrapper struct {
	Connection GuacamoleLiteConnection `json:"connection"`
}

GuacamoleLiteConnectionWrapper ...

type GuacamoleLiteSettings

type GuacamoleLiteSettings struct {
	Hostname            string `json:"hostname"`
	Port                string `json:"port,omitempty"`
	Username            string `json:"username"`
	InstanceUsername    string `json:"instance_username"`
	Password            string `json:"password,omitempty"`
	PrivateKey          string `json:"private-key,omitempty"`
	Security            string `json:"security"`
	IgnoreCert          bool   `json:"ignore-cert"`
	EnableSFTP          bool   `json:"enable-sftp"`
	DisableSFTPDownload int    `json:"sftp-disable-download"`
	DisableSFTPUpload   int    `json:"sftp-disable-upload"`
	SFTPRootDirectory   string `json:"sftp-root-directory"`
}

GuacamoleLiteSettings ...

type GuacamoleLiteTokenObject

type GuacamoleLiteTokenObject struct {
	Iv    string `json:"iv"`
	Value string `json:"value"`
}

GuacamoleLiteTokenObject ...

type GuacamoleServer

type GuacamoleServer struct {
	CloudID string `json:"cloud_id"`
	Address string `json:"address"`
}

GuacamoleServer is an interface used to represent a Guacamole Server

type InteractiveSession

type InteractiveSession struct {
	ID                    cacao_common.ID                                 `bson:"_id" json:"id,omitempty"`
	Owner                 string                                          `bson:"owner" json:"owner,omitempty"`
	InstanceID            string                                          `bson:"instance_id" json:"instance_id,omitempty"`
	InstanceAddress       string                                          `bson:"instance_address" json:"instance_address,omitempty"`
	InstanceAdminUsername string                                          `bson:"instance_admin_username" json:"instance_admin_username,omitempty"`
	CloudID               string                                          `bson:"cloud_id" json:"cloud_id,omitempty"`
	Protocol              cacao_common_service.InteractiveSessionProtocol `bson:"protocol" json:"protocol,omitempty"`
	RedirectURL           string                                          `bson:"redirect_url" json:"redirect_url,omitempty"`
	State                 cacao_common_service.InteractiveSessionState    `bson:"state" json:"state,omitempty"`
	CreatedAt             time.Time                                       `bson:"created_at" json:"created_at,omitempty"`
	UpdatedAt             time.Time                                       `bson:"updated_at" json:"updated_at,omitempty"`
}

InteractiveSession is a struct for storing interactive session information

func ConvertFromModel

ConvertFromModel converts InteractiveSessionModel to InteractiveSession

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL