apps

package
v3.4.12 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: EPL-2.0 Imports: 6 Imported by: 1

README

Deploy applications Package

This package contains executors to deploy iofog applications and microservices using the client package.

Usage

import (
	deploytypes "github.com/datasance/iofog-go-sdk/v3/pkg/deployapps"
	deploy "github.com/datasance/iofog-go-sdk/v3/pkg/deployapps/application"
)

// Create your Controller access structure
controller := deploytypes.IofogController{
  Endpoint: "127.0.0.1:51121",
	Email:    "user@domain.com",
	Password: "kj2gh0ooiwbug",
}

// Create your application structure
application := deploytypes.Application{
  Name: "my-app"
  //...Rest of the fields
}

// OR, read it from a yaml file
yamlFile, err := ioutil.ReadFile(filename)
if err != nil {
  return err
}
err = yaml.Unmarshal(yamlFile, &application)
if err != nil {
  return err
}

// Deploy
err = deploy.Execute(controller, application)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeployApplication

func DeployApplication(controller IofogController, application interface{}, name string) error

func DeployApplicationTemplate

func DeployApplicationTemplate(controller IofogController, controllerBaseURL *url.URL, template interface{}, name string) error

func DeployMicroservice

func DeployMicroservice(controller IofogController, microservice interface{}, appName, name string) error

func ParseFQMsvcName

func ParseFQMsvcName(fqName string) (appName, name string, err error)

Types

type AgentConfiguration

type AgentConfiguration struct {
	DockerURL                 *string   `yaml:"dockerUrl,omitempty" json:"dockerUrl,omitempty"`
	DiskLimit                 *int64    `yaml:"diskLimit,omitempty" json:"diskLimit,omitempty"`
	DiskDirectory             *string   `yaml:"diskDirectory,omitempty" json:"diskDirectory,omitempty"`
	MemoryLimit               *int64    `yaml:"memoryLimit,omitempty" json:"memoryLimit,omitempty"`
	CPULimit                  *int64    `yaml:"cpuLimit,omitempty" json:"cpuLimit,omitempty"`
	LogLimit                  *int64    `yaml:"logLimit,omitempty" json:"logLimit,omitempty"`
	LogDirectory              *string   `yaml:"logDirectory,omitempty" json:"logDirectory,omitempty"`
	LogFileCount              *int64    `yaml:"logFileCount,omitempty" json:"logFileCount,omitempty"`
	StatusFrequency           *float64  `yaml:"statusFrequency,omitempty" json:"statusFrequency,omitempty"`
	ChangeFrequency           *float64  `yaml:"changeFrequency,omitempty" json:"changeFrequency,omitempty"`
	DeviceScanFrequency       *float64  `yaml:"deviceScanFrequency,omitempty" json:"deviceScanFrequency,omitempty"`
	BluetoothEnabled          *bool     `yaml:"bluetoothEnabled,omitempty" json:"bluetoothEnabled,omitempty"`
	WatchdogEnabled           *bool     `yaml:"watchdogEnabled,omitempty" json:"watchdogEnabled,omitempty"`
	AbstractedHardwareEnabled *bool     `yaml:"abstractedHardwareEnabled,omitempty" json:"abstractedHardwareEnabled,omitempty"`
	RouterMode                *string   `yaml:"routerMode,omitempty" json:"routerMode,omitempty"`           // [edge, interior, none], default: edge
	RouterPort                *int      `yaml:"routerPort,omitempty" json:"routerPort,omitempty"`           // default: 5672
	UpstreamRouters           *[]string `yaml:"upstreamRouters,omitempty" json:"upstreamRouters,omitempty"` // ignored if routerMode: none
	NetworkRouter             *string   `yaml:"networkRouter,omitempty" json:"networkRouter,omitempty"`     // required if routerMone: none
}

+k8s:deepcopy-gen=true

func (*AgentConfiguration) DeepCopy

func (in *AgentConfiguration) DeepCopy() *AgentConfiguration

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentConfiguration.

func (*AgentConfiguration) DeepCopyInto

func (in *AgentConfiguration) DeepCopyInto(out *AgentConfiguration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Application

type Application struct {
	Name          string               `yaml:"name" json:"name"`
	Microservices []Microservice       `yaml:"microservices,omitempty" json:"microservices,omitempty"`
	Routes        []Route              `yaml:"routes,omitempty" json:"routes,omitempty"`
	ID            int                  `yaml:"id,omitempty" json:"id,omitempty"`
	Template      *ApplicationTemplate `yaml:"template,omitempty" json:"template,omitempty"`
}

Application contains information for configuring an application +k8s:deepcopy-gen=true

func (*Application) DeepCopy

func (in *Application) DeepCopy() *Application

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Application.

func (*Application) DeepCopyInto

func (in *Application) DeepCopyInto(out *Application)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ApplicationData

type ApplicationData struct {
	MicroserviceByName map[string]*client.MicroserviceInfo
	AgentsByName       map[string]*client.AgentInfo
	CatalogByID        map[int]*client.CatalogItemInfo
	RegistryByID       map[int]*client.RegistryInfo
	CatalogByName      map[string]*client.CatalogItemInfo
	FlowInfo           *client.FlowInfo
}

ApplicationData is data fetched from controller at init time

type ApplicationTemplate

type ApplicationTemplate struct {
	Name        string                   `yaml:"name,omitempty"`
	Description string                   `yaml:"description,omitempty"`
	Variables   []TemplateVariable       `yaml:"variables,omitempty"`
	Application *ApplicationTemplateInfo `yaml:"application,omitempty"`
}

ApplicationTemplate contains information for configuring an application template +k8s:deepcopy-gen=true

func (*ApplicationTemplate) DeepCopy

func (in *ApplicationTemplate) DeepCopy() *ApplicationTemplate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTemplate.

func (*ApplicationTemplate) DeepCopyInto

func (in *ApplicationTemplate) DeepCopyInto(out *ApplicationTemplate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ApplicationTemplateInfo

type ApplicationTemplateInfo struct {
	Microservices []Microservice `yaml:"microservices"`
	Routes        []Route        `yaml:"routes"`
}

ApplicationTemplateInfo contains microservice and route details for template +k8s:deepcopy-gen=true

func (*ApplicationTemplateInfo) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTemplateInfo.

func (*ApplicationTemplateInfo) DeepCopyInto

func (in *ApplicationTemplateInfo) DeepCopyInto(out *ApplicationTemplateInfo)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Applications

type Applications struct {
	Applications []Application `yaml:"applications" json:"applications"`
}

Applications is a list of applications +k8s:deepcopy-gen=true

func (*Applications) DeepCopy

func (in *Applications) DeepCopy() *Applications

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Applications.

func (*Applications) DeepCopyInto

func (in *Applications) DeepCopyInto(out *Applications)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CatalogItem

type CatalogItem struct {
	ID            int    `yaml:"id" json:"id"`
	X86           string `yaml:"x86" json:"x86"`
	ARM           string `yaml:"arm" json:"arm"`
	Registry      string `yaml:"registry" json:"registry"`
	Name          string `yaml:"name" json:"name"`
	Description   string `yaml:"description" json:"description"`
	ConfigExample string `yaml:"configExample" json:"configExample"`
}

CatalogItem contains information about a catalog item +k8s:deepcopy-gen=true

func (*CatalogItem) DeepCopy

func (in *CatalogItem) DeepCopy() *CatalogItem

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CatalogItem.

func (*CatalogItem) DeepCopyInto

func (in *CatalogItem) DeepCopyInto(out *CatalogItem)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConflictError

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

ConflictError export

func NewConflictError

func NewConflictError(msg string) (err *ConflictError)

NewConflictError export

func (*ConflictError) Error

func (err *ConflictError) Error() string

Error export

type Error

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

func NewError

func NewError(msg string) (err *Error)

func (*Error) Error

func (err *Error) Error() string

type HTTPError

type HTTPError struct {
	Code int
	// contains filtered or unexported fields
}

HTTPError export

func NewHTTPError

func NewHTTPError(message string, code int) (err *HTTPError)

NewHTTPError export

func (*HTTPError) Error

func (err *HTTPError) Error() string

Error export

type Header struct {
	APIVersion string         `yaml:"apiVersion" json:"apiVersion"`
	Kind       Kind           `yaml:"kind" json:"kind"`
	Metadata   HeaderMetadata `yaml:"metadata" json:"metadata"`
	Spec       interface{}    `yaml:"spec" json:"spec"`
}

Header contains k8s yaml header

type HeaderMetadata

type HeaderMetadata struct {
	Name      string `yaml:"name" json:"name"`
	Namespace string `yaml:"namespace" json:"namespace"`
}

HeaderMetadata contains k8s metadata +k8s:deepcopy-gen=true

func (*HeaderMetadata) DeepCopy

func (in *HeaderMetadata) DeepCopy() *HeaderMetadata

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeaderMetadata.

func (*HeaderMetadata) DeepCopyInto

func (in *HeaderMetadata) DeepCopyInto(out *HeaderMetadata)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type InputError

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

InputError export

func NewInputError

func NewInputError(message string) (err *InputError)

NewInputError export

func (*InputError) Error

func (err *InputError) Error() string

Error export

type InternalError

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

InternalError export

func NewInternalError

func NewInternalError(message string) (err *InternalError)

NewInternalError export

func (*InternalError) Error

func (err *InternalError) Error() string

Error export

type IofogController

type IofogController struct {
	Email    string `yaml:"email" json:"email"`
	Password string `yaml:"password" json:"password"`
	Endpoint string `yaml:"endpoint" json:"endpoint"`
	Token    string `yaml:"token" json:"token"`
}

IofogController contains informations needed to connect to the controller +k8s:deepcopy-gen=true

func (*IofogController) DeepCopy

func (in *IofogController) DeepCopy() *IofogController

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IofogController.

func (*IofogController) DeepCopyInto

func (in *IofogController) DeepCopyInto(out *IofogController)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type IofogHeader

type IofogHeader Header

IofogHeader represent the file structure

type Kind

type Kind string

Kind contains available types

const (
	ApplicationKind         Kind = "Application"
	ApplicationTemplateKind Kind = "ApplicationTemplate"
	MicroserviceKind        Kind = "Microservice"
	RouteKind               Kind = "Route"
)

Available kind of deploy

type Microservice

type Microservice struct {
	UUID        string                `yaml:"uuid" json:"uuid"`
	Name        string                `yaml:"name" json:"name"`
	Agent       MicroserviceAgent     `yaml:"agent" json:"agent"`
	Images      *MicroserviceImages   `yaml:"images,omitempty" json:"images,omitempty"`
	Container   MicroserviceContainer `yaml:"container,omitempty" json:"container,omitempty"`
	Config      NestedMap             `yaml:"config" json:"config"`
	Flow        *string               `yaml:"flow,omitempty" json:"flow,omitempty"`
	Application *string               `yaml:"application,omitempty" json:"application,omitempty"`
	Created     string                `yaml:"created,omitempty" json:"created,omitempty"`
	Rebuild     interface{}           `yaml:"rebuild,omitempty" json:"rebuild,omitempty"` // +k8s:deepcopy-gen=ignore
}

Microservice contains information for configuring a microservice +k8s:deepcopy-gen=true

func (*Microservice) DeepCopy

func (in *Microservice) DeepCopy() *Microservice

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Microservice.

func (*Microservice) DeepCopyInto

func (in *Microservice) DeepCopyInto(out *Microservice)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroserviceAgent

type MicroserviceAgent struct {
	Name   string             `yaml:"name" json:"name"`
	Config AgentConfiguration `yaml:"config" json:"config"`
}

MicroserviceAgent contains information about required agent configuration for a microservice +k8s:deepcopy-gen=true

func (*MicroserviceAgent) DeepCopy

func (in *MicroserviceAgent) DeepCopy() *MicroserviceAgent

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroserviceAgent.

func (*MicroserviceAgent) DeepCopyInto

func (in *MicroserviceAgent) DeepCopyInto(out *MicroserviceAgent)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroserviceContainer

type MicroserviceContainer struct {
	Commands       []string                     `yaml:"commands,omitempty" json:"commands,omitempty"`
	Volumes        *[]MicroserviceVolumeMapping `yaml:"volumes,omitempty" json:"volumes,omitempty"`
	Env            *[]MicroserviceEnvironment   `yaml:"env,omitempty" json:"env,omitempty"`
	ExtraHosts     *[]MicroserviceExtraHost     `yaml:"extraHosts,omitempty" json:"extraHosts,omitempty"`
	Ports          []MicroservicePortMapping    `yaml:"ports" json:"ports"`
	RootHostAccess interface{}                  `yaml:"rootHostAccess" json:"rootHostAccess"` // +k8s:deepcopy-gen=ignore
	Runtime        string                       `yaml:"runtime,omitempty" json:"runtime,omitempty"`
	Platform       string                       `yaml:"platform,omitempty" json:"platform,omitempty"`
	RunAsUser      string                       `yaml:"runAsUser,omitempty" json:"runAsUser,omitempty"`
	CdiDevices     []string                     `yaml:"cdiDevices,omitempty" json:"cdiDevices,omitempty"`
}

MicroserviceContainer contains information for configuring a microservice container +k8s:deepcopy-gen=true

func (*MicroserviceContainer) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroserviceContainer.

func (*MicroserviceContainer) DeepCopyInto

func (in *MicroserviceContainer) DeepCopyInto(out *MicroserviceContainer)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroserviceEnvironment

type MicroserviceEnvironment struct {
	Key   string `yaml:"key" json:"key"`
	Value string `yaml:"value" json:"value"`
}

+k8s:deepcopy-gen=true

func (*MicroserviceEnvironment) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroserviceEnvironment.

func (*MicroserviceEnvironment) DeepCopyInto

func (in *MicroserviceEnvironment) DeepCopyInto(out *MicroserviceEnvironment)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroserviceExtraHost

type MicroserviceExtraHost struct {
	Name    string `yaml:"name" json:"name,omitempty"`
	Address string `yaml:"address" json:"address,omitempty"`
	Value   string `yaml:"value" json:"value,omitempty"`
}

+k8s:deepcopy-gen=true

func (*MicroserviceExtraHost) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroserviceExtraHost.

func (*MicroserviceExtraHost) DeepCopyInto

func (in *MicroserviceExtraHost) DeepCopyInto(out *MicroserviceExtraHost)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroserviceImages

type MicroserviceImages struct {
	CatalogID int    `yaml:"catalogId" json:"catalogId"`
	X86       string `yaml:"x86" json:"x86"`
	ARM       string `yaml:"arm" json:"arm"`
	Registry  string `yaml:"registry" json:"registry"`
}

MicroserviceImages contains information about the images for a microservice +k8s:deepcopy-gen=true

func (*MicroserviceImages) DeepCopy

func (in *MicroserviceImages) DeepCopy() *MicroserviceImages

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroserviceImages.

func (*MicroserviceImages) DeepCopyInto

func (in *MicroserviceImages) DeepCopyInto(out *MicroserviceImages)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroservicePortMapping

type MicroservicePortMapping struct {
	Internal int64                       `json:"internal"`
	External int64                       `json:"external"`
	Public   *MicroservicePublicPortInfo `yaml:"public,omitempty" json:"public,omitempty"`
	Protocol string                      `json:"protocol,omitempty"`
}

+k8s:deepcopy-gen=true

func (*MicroservicePortMapping) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroservicePortMapping.

func (*MicroservicePortMapping) DeepCopyInto

func (in *MicroservicePortMapping) DeepCopyInto(out *MicroservicePortMapping)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroservicePublicPortInfo

type MicroservicePublicPortInfo struct {
	Schemes  []string                          `json:"schemes"`
	Links    []string                          `json:"links"`
	Protocol string                            `json:"protocol"`
	Enabled  bool                              `json:"enabled"`
	Router   *MicroservicePublicPortRouterInfo `yaml:"router,omitempty" json:"router,omitempty"`
}

+k8s:deepcopy-gen=true

func (*MicroservicePublicPortInfo) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroservicePublicPortInfo.

func (*MicroservicePublicPortInfo) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroservicePublicPortRouterInfo

type MicroservicePublicPortRouterInfo struct {
	Port int64  `json:"port"`
	Host string `json:"host"`
}

+k8s:deepcopy-gen=true

func (*MicroservicePublicPortRouterInfo) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroservicePublicPortRouterInfo.

func (*MicroservicePublicPortRouterInfo) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MicroserviceVolumeMapping

type MicroserviceVolumeMapping struct {
	HostDestination      string `yaml:"hostDestination" json:"hostDestination"`
	ContainerDestination string `yaml:"containerDestination" json:"containerDestination"`
	AccessMode           string `yaml:"accessMode" json:"accessMode"`
	Type                 string `yaml:"type,omitempty" json:"type,omitempty"`
}

+k8s:deepcopy-gen=true

func (*MicroserviceVolumeMapping) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroserviceVolumeMapping.

func (*MicroserviceVolumeMapping) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Microservices

type Microservices struct {
	Microservices []Microservice `yaml:"microservices" json:"microservices"`
}

Microservices is a list of Microservice +k8s:deepcopy-gen=true

func (*Microservices) DeepCopy

func (in *Microservices) DeepCopy() *Microservices

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Microservices.

func (*Microservices) DeepCopyInto

func (in *Microservices) DeepCopyInto(out *Microservices)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NestedMap

type NestedMap map[string]interface{}

func (NestedMap) DeepCopy

func (j NestedMap) DeepCopy() NestedMap

type NotFoundError

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

NotFoundError export

func NewNotFoundError

func NewNotFoundError(msg string) (err *NotFoundError)

NewNotFoundError export

func (*NotFoundError) Error

func (err *NotFoundError) Error() string

Error export

type Route

type Route struct {
	Name string `yaml:"name" json:"name"`
	From string `yaml:"from" json:"from"`
	To   string `yaml:"to" json:"to"`
}

Route contains information about a route from one microservice to another +k8s:deepcopy-gen=true

func (*Route) DeepCopy

func (in *Route) DeepCopy() *Route

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route.

func (*Route) DeepCopyInto

func (in *Route) DeepCopyInto(out *Route)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TemplateVariable

type TemplateVariable struct {
	Key          string      `yaml:"key"`
	Description  string      `yaml:"description"`
	DefaultValue interface{} `yaml:"defaultValue,omitempty"` // +k8s:deepcopy-gen=ignore
	Value        interface{} `yaml:"value,omitempty"`        // +k8s:deepcopy-gen=ignore
}

TemplateVariable contains a key-value pair +k8s:deepcopy-gen=true

func (*TemplateVariable) DeepCopy

func (in *TemplateVariable) DeepCopy() *TemplateVariable

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateVariable.

func (*TemplateVariable) DeepCopyInto

func (in *TemplateVariable) DeepCopyInto(out *TemplateVariable)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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