resource

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: EPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FogTypeIntMap = map[int]string{
	0: "auto",
	1: "x86",
	2: "arm",
}

FogTypeIntMap map Controller fog type to human readable fog type

View Source
var FogTypeStringMap = map[string]int64{
	"auto": 0,
	"x86":  1,
	"arm":  2,
}

FogTypeStringMap map human readable fog type to Controller fog type

Functions

func IsNoControlPlaneError

func IsNoControlPlaneError(err error) bool

Types

type Agent

type Agent interface {
	GetName() string
	GetUUID() string
	GetHost() string
	GetCreatedTime() string
	GetConfig() *AgentConfiguration
	GetControllerEndpoint() string
	SetName(string)
	SetUUID(string)
	SetHost(string)
	SetCreatedTime(string)
	SetConfig(*AgentConfiguration)
	Sanitize() error
	Clone() Agent
}

type AgentConfiguration

type AgentConfiguration struct {
	Name                      string  `json:"name,omitempty" yaml:"name"`
	Location                  string  `json:"location,omitempty" yaml:"location"`
	Latitude                  float64 `json:"latitude,omitempty" yaml:"latitude"`
	Longitude                 float64 `json:"longitude,omitempty" yaml:"longitude"`
	Description               string  `json:"description,omitempty" yaml:"description"`
	FogType                   *string `json:"fogType,omitempty" yaml:"agentType"`
	client.AgentConfiguration `yaml:",inline"`
}

AgentConfiguration contains configuration information for a deployed agent

type AgentScripts

type AgentScripts struct {
	install.AgentProcedures `yaml:",inline"`
	Directory               string `yaml:"dir"` // Location of scripts
}

type Application

type Application = apps.Application

type ApplicationTemplate

type ApplicationTemplate = apps.ApplicationTemplate

type Auth added in v1.2.0

type Auth struct {
	URL              string `yaml:"url"`
	Realm            string `yaml:"realm"`
	SSL              string `yaml:"ssl"`
	RealmKey         string `yaml:"realmKey"`
	ControllerClient string `yaml:"controllerClient"`
	ControllerSecret string `yaml:"controllerSecret"`
	ViewerClient     string `yaml:"viewerClient"`
}

type Container

type Container struct {
	Image       string      `yaml:"image,omitempty"`
	Credentials Credentials `yaml:"credentials,omitempty"` // Optional credentials if needed to pull images
}

type ControlPlane

type ControlPlane interface {
	GetUser() IofogUser
	GetControllers() []Controller
	GetController(string) (Controller, error)
	GetEndpoint() (string, error)
	UpdateController(Controller) error
	AddController(Controller) error
	DeleteController(string) error
	Sanitize() error
	Clone() ControlPlane
}

type Controller

type Controller interface {
	GetName() string
	GetEndpoint() string
	GetCreatedTime() string
	SetName(string)
	Sanitize() error
	Clone() Controller
}

type ControllerConfig

type ControllerConfig struct {
	PidBaseDir    string `yaml:"pidBaseDir,omitempty"`
	EcnViewerPort int    `yaml:"ecnViewerPort,omitempty"`
}

type Credentials

type Credentials struct {
	User     string `yaml:"user,omitempty"`
	Password string `yaml:"password,omitempty"`
}

Credentials credentials used to log into docker when deploying a local stack

type Database

type Database struct {
	Provider     string `yaml:"provider,omitempty"`
	Host         string `yaml:"host,omitempty"`
	Port         int    `yaml:"port,omitempty"`
	User         string `yaml:"user,omitempty"`
	Password     string `yaml:"password,omitempty"`
	DatabaseName string `yaml:"databaseName,omitempty"`
}

type Display

type Display = client.EdgeResourceDisplay

type EdgeResource

type EdgeResource struct {
	Name              string
	Version           string                     `yaml:"version"`
	Description       string                     `yaml:"description"`
	InterfaceProtocol string                     `yaml:"interfaceProtocol"`
	Interface         *EdgeResourceHTTPInterface `yaml:"interface,omitempty"` // TODO: Make this generic to support multiple interfaces protocols
	Display           *Display                   `yaml:"display,omitempty"`
	OrchestrationTags []string                   `yaml:"orchestrationTags"`
	Custom            map[string]interface{}     `yaml:"custom"`
}

type EdgeResourceHTTPInterface

type EdgeResourceHTTPInterface = client.HTTPEdgeResource

type HTTPEndpoint

type HTTPEndpoint = client.HTTPEndpoint

type IofogUser

type IofogUser struct {
	Name            string `yaml:"name,omitempty"`
	Surname         string `yaml:"surname,omitempty"`
	Email           string `yaml:"email,omitempty"`
	Password        string `yaml:"password,omitempty"`
	SubscriptionKey string `yaml:"subscriptionKey,omitempty"`
}

IofogUser contains information about users registered against a controller

func (*IofogUser) EncodePassword

func (user *IofogUser) EncodePassword()

func (IofogUser) GetRawPassword

func (user IofogUser) GetRawPassword() string

type KubeImages

type KubeImages struct {
	Controller  string `yaml:"controller,omitempty"`
	Operator    string `yaml:"operator,omitempty"`
	Kubelet     string `yaml:"kubelet,omitempty"`
	PortManager string `yaml:"portManager,omitempty"`
	Router      string `yaml:"router,omitempty"`
	Proxy       string `yaml:"proxy,omitempty"`
}

type KubernetesControlPlane

type KubernetesControlPlane struct {
	KubeConfig     string                 `yaml:"config"`
	IofogUser      IofogUser              `yaml:"iofogUser"`
	ControllerPods []KubernetesController `yaml:"controllerPods,omitempty"`
	Database       Database               `yaml:"database"`
	Auth           Auth                   `yaml:"auth"`
	Services       Services               `yaml:"services,omitempty"`
	Replicas       Replicas               `yaml:"replicas,omitempty"`
	Images         KubeImages             `yaml:"images,omitempty"`
	Endpoint       string                 `yaml:"endpoint,omitempty"`
	Controller     ControllerConfig       `yaml:"controller,omitempty"`
}

func UnmarshallKubernetesControlPlane

func UnmarshallKubernetesControlPlane(file []byte) (controlPlane KubernetesControlPlane, err error)

func (*KubernetesControlPlane) AddController

func (cp *KubernetesControlPlane) AddController(baseController Controller) error

func (*KubernetesControlPlane) Clone

func (*KubernetesControlPlane) DeleteController

func (cp *KubernetesControlPlane) DeleteController(name string) error

func (*KubernetesControlPlane) GetController

func (cp *KubernetesControlPlane) GetController(name string) (ret Controller, err error)

func (*KubernetesControlPlane) GetControllers

func (cp *KubernetesControlPlane) GetControllers() (controllers []Controller)

func (*KubernetesControlPlane) GetEndpoint

func (cp *KubernetesControlPlane) GetEndpoint() (string, error)

func (*KubernetesControlPlane) GetUser

func (cp *KubernetesControlPlane) GetUser() IofogUser

func (*KubernetesControlPlane) Sanitize

func (cp *KubernetesControlPlane) Sanitize() (err error)

func (*KubernetesControlPlane) UpdateController

func (cp *KubernetesControlPlane) UpdateController(baseController Controller) error

func (*KubernetesControlPlane) ValidateKubeConfig

func (cp *KubernetesControlPlane) ValidateKubeConfig() error

type KubernetesController

type KubernetesController struct {
	PodName  string `yaml:"podName"`
	Endpoint string `yaml:"endpoint"`
	Created  string `yaml:"created,omitempty"`
	Status   string `yaml:"status,omitempty"`
}

func (*KubernetesController) Clone

func (ctrl *KubernetesController) Clone() Controller

func (*KubernetesController) GetCreatedTime

func (ctrl *KubernetesController) GetCreatedTime() string

func (*KubernetesController) GetEndpoint

func (ctrl *KubernetesController) GetEndpoint() string

func (*KubernetesController) GetName

func (ctrl *KubernetesController) GetName() string

func (*KubernetesController) Sanitize

func (ctrl *KubernetesController) Sanitize() error

func (*KubernetesController) SetName

func (ctrl *KubernetesController) SetName(name string)

type LocalAgent

type LocalAgent struct {
	Name               string              `yaml:"name,omitempty"`
	UUID               string              `yaml:"uuid,omitempty"`
	Container          Container           `yaml:"container,omitempty"`
	Created            string              `yaml:"created,omitempty"`
	Host               string              `yaml:"host,omitempty"`
	Config             *AgentConfiguration `yaml:"config,omitempty"`
	ControllerEndpoint string              `yaml:"controllerEndpoint,omitempty"`
}

func UnmarshallLocalAgent

func UnmarshallLocalAgent(file []byte) (agent LocalAgent, err error)

func (*LocalAgent) Clone

func (agent *LocalAgent) Clone() Agent

func (*LocalAgent) GetConfig

func (agent *LocalAgent) GetConfig() *AgentConfiguration

func (*LocalAgent) GetControllerEndpoint

func (agent *LocalAgent) GetControllerEndpoint() string

func (*LocalAgent) GetCreatedTime

func (agent *LocalAgent) GetCreatedTime() string

func (*LocalAgent) GetHost

func (agent *LocalAgent) GetHost() string

func (*LocalAgent) GetName

func (agent *LocalAgent) GetName() string

func (*LocalAgent) GetUUID

func (agent *LocalAgent) GetUUID() string

func (*LocalAgent) Sanitize

func (agent *LocalAgent) Sanitize() error

func (*LocalAgent) SetConfig

func (agent *LocalAgent) SetConfig(config *AgentConfiguration)

func (*LocalAgent) SetCreatedTime

func (agent *LocalAgent) SetCreatedTime(time string)

func (*LocalAgent) SetHost

func (agent *LocalAgent) SetHost(host string)

func (*LocalAgent) SetName

func (agent *LocalAgent) SetName(name string)

func (*LocalAgent) SetUUID

func (agent *LocalAgent) SetUUID(uuid string)

type LocalControlPlane

type LocalControlPlane struct {
	IofogUser  IofogUser        `yaml:"iofogUser"`
	Controller *LocalController `yaml:"controller,omitempty"`
}

func UnmarshallLocalControlPlane

func UnmarshallLocalControlPlane(file []byte) (controlPlane LocalControlPlane, err error)

func (*LocalControlPlane) AddController

func (cp *LocalControlPlane) AddController(baseController Controller) error

func (*LocalControlPlane) Clone

func (cp *LocalControlPlane) Clone() ControlPlane

func (*LocalControlPlane) DeleteController

func (cp *LocalControlPlane) DeleteController(string) error

func (*LocalControlPlane) GetController

func (cp *LocalControlPlane) GetController(name string) (Controller, error)

func (*LocalControlPlane) GetControllers

func (cp *LocalControlPlane) GetControllers() []Controller

func (*LocalControlPlane) GetEndpoint

func (cp *LocalControlPlane) GetEndpoint() (string, error)

func (*LocalControlPlane) GetUser

func (cp *LocalControlPlane) GetUser() IofogUser

func (*LocalControlPlane) Sanitize

func (cp *LocalControlPlane) Sanitize() error

func (*LocalControlPlane) UpdateController

func (cp *LocalControlPlane) UpdateController(baseController Controller) error

type LocalController

type LocalController struct {
	Name      string    `yaml:"name"`
	Endpoint  string    `yaml:"endpoint"`
	Container Container `yaml:"container"`
	Created   string    `yaml:"created,omitempty"`
}

func UnmarshallLocalController

func UnmarshallLocalController(file []byte) (controller LocalController, err error)

func (*LocalController) Clone

func (ctrl *LocalController) Clone() Controller

func (*LocalController) GetCreatedTime

func (ctrl *LocalController) GetCreatedTime() string

func (*LocalController) GetEndpoint

func (ctrl *LocalController) GetEndpoint() string

func (*LocalController) GetName

func (ctrl *LocalController) GetName() string

func (*LocalController) Sanitize

func (ctrl *LocalController) Sanitize() error

func (*LocalController) SetName

func (ctrl *LocalController) SetName(name string)

type Microservice

type Microservice = apps.Microservice

type Namespace

type Namespace struct {
	Name                   string                  `yaml:"name,omitempty"`
	KubernetesControlPlane *KubernetesControlPlane `yaml:"k8sControlPlane,omitempty"`
	RemoteControlPlane     *RemoteControlPlane     `yaml:"remoteControlPlane,omitempty"`
	LocalControlPlane      *LocalControlPlane      `yaml:"localControlPlane,omitempty"`
	LocalAgents            []LocalAgent            `yaml:"localAgents,omitempty"`
	RemoteAgents           []RemoteAgent           `yaml:"remoteAgents,omitempty"`
	Volumes                []Volume                `yaml:"volumes,omitempty"`
	Created                string                  `yaml:"created,omitempty"`
	// contains filtered or unexported fields
}

Namespace is the fundamental type for managing an ECN's resources. Namespace's public getters will all return copies of resources. Namespace's API is intended to be used in parallel, hence the mutex.

func (*Namespace) AddAgent

func (ns *Namespace) AddAgent(baseAgent Agent) error

func (*Namespace) AddVolume

func (ns *Namespace) AddVolume(volume *Volume) error

func (*Namespace) Clone

func (ns *Namespace) Clone() *Namespace

func (*Namespace) DeleteAgent

func (ns *Namespace) DeleteAgent(name string) error

func (*Namespace) DeleteAgents

func (ns *Namespace) DeleteAgents()

func (*Namespace) DeleteControlPlane

func (ns *Namespace) DeleteControlPlane()

func (*Namespace) DeleteController

func (ns *Namespace) DeleteController(name string) (err error)

func (*Namespace) DeleteVolume

func (ns *Namespace) DeleteVolume(name string) error

func (*Namespace) GetAgent

func (ns *Namespace) GetAgent(name string) (Agent, error)

func (*Namespace) GetAgents

func (ns *Namespace) GetAgents() (agents []Agent)

func (*Namespace) GetControlPlane

func (ns *Namespace) GetControlPlane() (ControlPlane, error)

GetControlPlane will return a deep copy of the Namespace's ControlPlane

func (*Namespace) GetControllers

func (ns *Namespace) GetControllers() []Controller

GetControllers will return a slice of deep copied Controllers

func (*Namespace) GetVolume

func (ns *Namespace) GetVolume(name string) (volume Volume, err error)

func (*Namespace) GetVolumes

func (ns *Namespace) GetVolumes() (volumes []Volume)

func (*Namespace) SetControlPlane

func (ns *Namespace) SetControlPlane(baseControlPlane ControlPlane)

func (*Namespace) UpdateAgent

func (ns *Namespace) UpdateAgent(baseAgent Agent) error

func (*Namespace) UpdateVolume

func (ns *Namespace) UpdateVolume(volume *Volume)

type NoControlPlaneError

type NoControlPlaneError struct {
	// contains filtered or unexported fields
}

func NewNoControlPlaneError

func NewNoControlPlaneError(namespace string) NoControlPlaneError

func (NoControlPlaneError) Error

func (err NoControlPlaneError) Error() string

type NoKubeConfigError

type NoKubeConfigError struct {
	// contains filtered or unexported fields
}

func NewNoKubeConfigError

func NewNoKubeConfigError(resource string) *NoKubeConfigError

func (*NoKubeConfigError) Error

func (err *NoKubeConfigError) Error() string

type NoSSHConfigError

type NoSSHConfigError struct {
	// contains filtered or unexported fields
}

func NewNoSSHConfigError

func NewNoSSHConfigError(resource string) *NoSSHConfigError

func (*NoSSHConfigError) Error

func (err *NoSSHConfigError) Error() string

type Package

type Package struct {
	Version string `yaml:"version,omitempty"`
	Repo    string `yaml:"repo,omitempty"`
	Token   string `yaml:"token,omitempty"`
}

type Registry

type Registry struct {
	URL          *string `yaml:"url"`
	Private      *bool   `yaml:"private"`
	Username     *string `yaml:"username"`
	Password     *string `yaml:"password"`
	Email        *string `yaml:"email"`
	RequiresCert *bool   `yaml:"requiresCert"`
	Certificate  *string `yaml:"certificate,omitempty"`
	ID           int     `yaml:"id"`
}

type RemoteAgent

type RemoteAgent struct {
	Name               string              `yaml:"name"`
	Host               string              `yaml:"host"`
	SSH                SSH                 `yaml:"ssh"`
	UUID               string              `yaml:"uuid,omitempty"`
	Created            string              `yaml:"created,omitempty"`
	Package            Package             `yaml:"package,omitempty"`
	Config             *AgentConfiguration `yaml:"config,omitempty"`
	Scripts            *AgentScripts       `yaml:"scripts,omitempty"`
	ControllerEndpoint string              `yaml:"controllerEndpoint,omitempty"`
}

func UnmarshallRemoteAgent

func UnmarshallRemoteAgent(file []byte) (agent RemoteAgent, err error)

func (*RemoteAgent) Clone

func (agent *RemoteAgent) Clone() Agent

func (*RemoteAgent) GetConfig

func (agent *RemoteAgent) GetConfig() *AgentConfiguration

func (*RemoteAgent) GetControllerEndpoint

func (agent *RemoteAgent) GetControllerEndpoint() string

func (*RemoteAgent) GetCreatedTime

func (agent *RemoteAgent) GetCreatedTime() string

func (*RemoteAgent) GetHost

func (agent *RemoteAgent) GetHost() string

func (*RemoteAgent) GetName

func (agent *RemoteAgent) GetName() string

func (*RemoteAgent) GetUUID

func (agent *RemoteAgent) GetUUID() string

func (*RemoteAgent) Sanitize

func (agent *RemoteAgent) Sanitize() (err error)

func (*RemoteAgent) SetConfig

func (agent *RemoteAgent) SetConfig(config *AgentConfiguration)

func (*RemoteAgent) SetCreatedTime

func (agent *RemoteAgent) SetCreatedTime(time string)

func (*RemoteAgent) SetHost

func (agent *RemoteAgent) SetHost(host string)

func (*RemoteAgent) SetName

func (agent *RemoteAgent) SetName(name string)

func (*RemoteAgent) SetUUID

func (agent *RemoteAgent) SetUUID(uuid string)

func (*RemoteAgent) ValidateSSH

func (agent *RemoteAgent) ValidateSSH() error

type RemoteControlPlane

type RemoteControlPlane struct {
	IofogUser           IofogUser                 `yaml:"iofogUser"`
	Controllers         []RemoteController        `yaml:"controllers"`
	Database            Database                  `yaml:"database"`
	Package             Package                   `yaml:"package,omitempty"`
	SystemAgent         Package                   `yaml:"systemAgent,omitempty"`
	SystemMicroservices RemoteSystemMicroservices `yaml:"systemMicroservices,omitempty"`
}

func UnmarshallRemoteControlPlane

func UnmarshallRemoteControlPlane(file []byte) (controlPlane RemoteControlPlane, err error)

func (*RemoteControlPlane) AddController

func (cp *RemoteControlPlane) AddController(baseController Controller) error

func (*RemoteControlPlane) Clone

func (cp *RemoteControlPlane) Clone() ControlPlane

func (*RemoteControlPlane) DeleteController

func (cp *RemoteControlPlane) DeleteController(name string) error

func (*RemoteControlPlane) GetController

func (cp *RemoteControlPlane) GetController(name string) (ret Controller, err error)

func (*RemoteControlPlane) GetControllers

func (cp *RemoteControlPlane) GetControllers() (controllers []Controller)

func (*RemoteControlPlane) GetEndpoint

func (cp *RemoteControlPlane) GetEndpoint() (string, error)

func (*RemoteControlPlane) GetUser

func (cp *RemoteControlPlane) GetUser() IofogUser

func (*RemoteControlPlane) Sanitize

func (cp *RemoteControlPlane) Sanitize() (err error)

func (*RemoteControlPlane) UpdateController

func (cp *RemoteControlPlane) UpdateController(baseController Controller) error

type RemoteController

type RemoteController struct {
	ControllerConfig
	Name     string `yaml:"name"`
	Host     string `yaml:"host"`
	SSH      SSH    `yaml:"ssh,omitempty"`
	Endpoint string `yaml:"endpoint,omitempty"`
	Created  string `yaml:"created,omitempty"`
}

func UnmarshallRemoteController

func UnmarshallRemoteController(file []byte) (controller RemoteController, err error)

func (*RemoteController) Clone

func (ctrl *RemoteController) Clone() Controller

func (*RemoteController) GetCreatedTime

func (ctrl *RemoteController) GetCreatedTime() string

func (*RemoteController) GetEndpoint

func (ctrl *RemoteController) GetEndpoint() string

func (*RemoteController) GetName

func (ctrl *RemoteController) GetName() string

func (*RemoteController) Sanitize

func (ctrl *RemoteController) Sanitize() (err error)

func (*RemoteController) SetName

func (ctrl *RemoteController) SetName(name string)

func (*RemoteController) ValidateSSH

func (ctrl *RemoteController) ValidateSSH() error

type RemoteSystemMicroservices

type RemoteSystemMicroservices = install.RemoteSystemMicroservices

type Replicas

type Replicas struct {
	Controller int32 `yaml:"controller"`
}

type Route

type Route = apps.Route

type SSH

type SSH struct {
	User    string `yaml:"user,omitempty"`
	Port    int    `yaml:"port,omitempty"`
	KeyFile string `yaml:"keyFile,omitempty"`
}

type Service

type Service struct {
	Type string `json:"type,omitempty"`
	IP   string `json:"ip,omitempty"`
}

type Services

type Services struct {
	Controller Service `json:"controller,omitempty"`
	Router     Service `json:"router,omitempty"`
	Proxy      Service `json:"proxy,omitempty"`
}

type Volume

type Volume struct {
	Name        string   `json:"name" yaml:"name"`
	Agents      []string `json:"agents" yaml:"agents"`
	Source      string   `json:"source" yaml:"source"`
	Destination string   `json:"destination" yaml:"destination"`
	Permissions string   `json:"permissions" yaml:"permissions"`
}

Jump to

Keyboard shortcuts

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