client

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: 14 Imported by: 4

README

Client Package

This package provides an HTTP client to communicate with ioFog Controller's REST API.

You can view see the full REST API specification at iofog.org.

Usage

First, instantiate a client instance and log in with your credentials.

// Connect to Controller REST API
ctrl := client.New(endpoint)

// Create login request
loginRequest := client.LoginRequest{
	Email:    "user@domain.com",
	Password: "kj2gh0ooiwbug",
}

// Login
if err := ctrl.Login(loginRequest); err != nil {
	return err
}

Next, call any of the functions available from your client instance.

// Get Controller status
if resp, err = ctrlClient.GetStatus(); err != nil {
    return err
}

// Print the response
println(resp.Status)

Documentation

Index

Constants

View Source
const (
	TCP  = "tcp"
	HTTP = "http"
)
View Source
const (
	ControllerPort       = 51121
	ControllerPortString = "51121"
	DefaultRouterName    = "default-router"
)

String and numeric values of TCP ports used accross ioFog

Variables

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

AgentTypeAgentTypeIDDict Map from string agent type to numeric id

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

AgentTypeIDAgentTypeDict Map from numeric id agent type to string agent type

View Source
var IsVerbose bool

IsVerbose will Toggle HTTP output

View Source
var RegistryTypeIDRegistryTypeDict = map[int]string{
	1: "remote",
	2: "local",
}

RegistryTypeIDRegistryTypeDict Map from numeric id registry type to string

View Source
var RegistryTypeRegistryTypeIDDict = map[string]int{
	"remote": 1,
	"local":  2,
}

RegistryTypeRegistryTypeIDDict Map from string registry type to numeric id

Functions

func SetGlobalRetries

func SetGlobalRetries(retries Retries)

func SetVerbosity

func SetVerbosity(verbose bool)

func Verbose

func Verbose(msg string)

Types

type AgentConfiguration

type AgentConfiguration struct {
	DockerURL                 *string   `json:"dockerUrl,omitempty" yaml:"dockerUrl"`
	DiskLimit                 *int64    `json:"diskLimit,omitempty" yaml:"diskLimit"`
	DiskDirectory             *string   `json:"diskDirectory,omitempty" yaml:"diskDirectory"`
	MemoryLimit               *int64    `json:"memoryLimit,omitempty" yaml:"memoryLimit"`
	CPULimit                  *int64    `json:"cpuLimit,omitempty" yaml:"cpuLimit"`
	LogLimit                  *int64    `json:"logLimit,omitempty" yaml:"logLimit"`
	LogDirectory              *string   `json:"logDirectory,omitempty" yaml:"logDirectory"`
	LogFileCount              *int64    `json:"logFileCount,omitempty" yaml:"logFileCount"`
	StatusFrequency           *float64  `json:"statusFrequency,omitempty" yaml:"statusFrequency"`
	ChangeFrequency           *float64  `json:"changeFrequency,omitempty" yaml:"changeFrequency"`
	DeviceScanFrequency       *float64  `json:"deviceScanFrequency,omitempty" yaml:"deviceScanFrequency"`
	BluetoothEnabled          *bool     `json:"bluetoothEnabled,omitempty" yaml:"bluetoothEnabled"`
	WatchdogEnabled           *bool     `json:"watchdogEnabled,omitempty" yaml:"watchdogEnabled"`
	AbstractedHardwareEnabled *bool     `json:"abstractedHardwareEnabled,omitempty" yaml:"abstractedHardwareEnabled"`
	IsSystem                  *bool     `json:"isSystem,omitempty" yaml:"-"` // Can't specify system agent using yaml file.
	UpstreamRouters           *[]string `json:"upstreamRouters,omitempty" yaml:"upstreamRouters,omitempty"`
	NetworkRouter             *string   `json:"networkRouter,omitempty" yaml:"networkRouter,omitempty"`
	Host                      *string   `json:"host,omitempty" yaml:"host,omitempty"`
	RouterConfig              `json:",omitempty" yaml:"routerConfig,omitempty"`
	LogLevel                  *string  `json:"logLevel,omitempty" yaml:"logLevel"`
	DockerPruningFrequency    *float64 `json:"dockerPruningFrequency,omitempty" yaml:"dockerPruningFrequency"`
	AvailableDiskThreshold    *float64 `json:"availableDiskThreshold,omitempty" yaml:"availableDiskThreshold"`
	TimeZone                  string   `json:"timeZone,omitempty" yaml:"timeZone"`
}

type AgentInfo

type AgentInfo struct {
	UUID                      string    `json:"uuid" yaml:"uuid"`
	Name                      string    `json:"name" yaml:"name"`
	Host                      string    `json:"host" yaml:"host"`
	Location                  string    `json:"location" yaml:"location"`
	Latitude                  float64   `json:"latitude" yaml:"latitude"`
	Longitude                 float64   `json:"longitude" yaml:"longitude"`
	Description               string    `json:"description" yaml:"description"`
	DockerURL                 string    `json:"dockerUrl" yaml:"dockerUrl"`
	DiskLimit                 int64     `json:"diskLimit" yaml:"diskLimit"`
	DiskDirectory             string    `json:"diskDirectory" yaml:"diskDirectory"`
	MemoryLimit               int64     `json:"memoryLimit" yaml:"memoryLimit"`
	CPULimit                  int64     `json:"cpuLimit" yaml:"cpuLimit"`
	LogLimit                  int64     `json:"logLimit" yaml:"logLimit"`
	LogDirectory              string    `json:"logDirectory" yaml:"logDirectory"`
	LogFileCount              int64     `json:"logFileCount" yaml:"logFileCount"`
	StatusFrequency           float64   `json:"statusFrequency" yaml:"statusFrequency"`
	ChangeFrequency           float64   `json:"changeFrequency" yaml:"changeFrequency"`
	DeviceScanFrequency       float64   `json:"deviceScanFrequency" yaml:"deviceScanFrequency"`
	BluetoothEnabled          bool      `json:"bluetoothEnabled" yaml:"bluetoothEnabled"`
	WatchdogEnabled           bool      `json:"watchdogEnabled" yaml:"watchdogEnabled"`
	AbstractedHardwareEnabled bool      `json:"abstractedHardwareEnabled" yaml:"abstractedHardwareEnabled"`
	CreatedTimeRFC3339        string    `json:"createdAt" yaml:"created"`
	UpdatedTimeRFC3339        string    `json:"updatedAt" yaml:"updated"`
	LastActive                int64     `json:"lastActive" yaml:"lastActive"`
	DaemonStatus              string    `json:"daemonStatus" yaml:"daemonStatus"`
	UptimeMs                  int64     `json:"daemonOperatingDuration" yaml:"uptime"`
	MemoryUsage               float64   `json:"memoryUsage" yaml:"memoryUsage"`
	DiskUsage                 float64   `json:"diskUsage" yaml:"diskUsage"`
	CPUUsage                  float64   `json:"cpuUsage" yaml:"cpuUsage"`
	SystemAvailableMemory     float64   `json:"systemAvailableMemory" yaml:"systemAvailableMemory"`
	SystemAvailableDisk       float64   `json:"systemAvailableDisk" yaml:"systemAvailableDisk"`
	MemoryViolation           string    `json:"memoryViolation" yaml:"memoryViolation"`
	DiskViolation             string    `json:"diskViolation" yaml:"diskViolation"`
	CPUViolation              string    `json:"cpuViolation" yaml:"cpuViolation"`
	MicroserviceStatus        string    `json:"microserviceStatus" yaml:"microserviceStatus"`
	RepositoryCount           int64     `json:"repositoryCount" yaml:"repositoryCount"`
	RepositoryStatus          string    `json:"repositoryStatus" yaml:"repositoryStatus"`
	LastStatusTimeMsUTC       int64     `json:"lastStatusTime" yaml:"lastStatusTime"`
	IPAddress                 string    `json:"ipAddress" yaml:"ipAddress"`
	IPAddressExternal         string    `json:"ipAddressExternal" yaml:"ipAddressExternal"`
	ProcessedMessaged         int64     `json:"processedMessages" yaml:"ProcessedMessages"`
	MicroserviceMessageCount  int64     `json:"microserviceMessageCounts" yaml:"microserviceMessageCount"`
	MessageSpeed              float64   `json:"messageSpeed" yaml:"messageSpeed"`
	LastCommandTimeMsUTC      int64     `json:"lastCommandTime" yaml:"lastCommandTime"`
	NetworkInterface          string    `json:"networkInterface" yaml:"networkInterface"`
	Version                   string    `json:"version" yaml:"version"`
	IsReadyToUpgrade          bool      `json:"isReadyToUpgrade" yaml:"isReadyToUpgrade"`
	IsReadyToRollback         bool      `json:"isReadyToRollback" yaml:"isReadyToRollback"`
	Tunnel                    string    `json:"tunnel" yaml:"tunnel"`
	FogType                   int       `json:"fogTypeId" yaml:"fogTypeId"`
	RouterMode                string    `json:"routerMode" yaml:"routerMode"`
	NetworkRouter             *string   `json:"networkRouter,omitempty" yaml:"networkRouter,omitempty"`
	UpstreamRouters           *[]string `json:"upstreamRouters,omitempty" yaml:"upstreamRouters,omitempty"`
	MessagingPort             *int      `json:"messagingPort,omitempty" yaml:"messagingPort,omitempty"`
	EdgeRouterPort            *int      `json:"edgeRouterPort,omitempty" yaml:"edgeRouterPort,omitempty"`
	InterRouterPort           *int      `json:"interRouterPort,omitempty" yaml:"interRouterPort,omitempty"`
	LogLevel                  *string   `json:"logLevel" yaml:"logLevel"`
	DockerPruningFrequency    *float64  `json:"dockerPruningFrequency" yaml:"dockerPruningFrequency"`
	AvailableDiskThreshold    *float64  `json:"availableDiskThreshold" yaml:"availableDiskThreshold"`
	Tags                      *[]string `json:"tags,omitempty" yaml:"tags,omitempty"`
	TimeZone                  string    `json:"timeZone" yaml:"timeZone"`
}

type AgentListFilter

type AgentListFilter struct {
	Key       string `json:"key"`
	Value     string `json:"value"`
	Condition string `json:"condition"`
}

type AgentUpdateRequest

type AgentUpdateRequest struct {
	UUID        string    `json:"-"`
	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     *int64    `json:"fogType,omitempty" yaml:"agentType"`
	Tags        *[]string `json:"tags,omitempty" yaml:"tags"`
	AgentConfiguration
}

type ApplicationCreateResponse

type ApplicationCreateResponse struct {
	ID int `json:"id"`
}

type ApplicationInfo

type ApplicationInfo struct {
	Name          string             `json:"name"`
	Description   string             `json:"description"`
	IsActivated   bool               `json:"isActivated"`
	IsSystem      bool               `json:"isSystem"`
	UserID        int                `json:"userId"`
	ID            int                `json:"id"`
	Microservices []MicroserviceInfo `json:"microservices"`
	Routes        []Route            `json:"routes"`
}

Applications

type ApplicationListResponse

type ApplicationListResponse struct {
	Applications []ApplicationInfo `json:"applications"`
}

type ApplicationPatchRequest

type ApplicationPatchRequest struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
	IsActivated *bool   `json:"isActivated,omitempty"`
	IsSystem    *bool   `json:"isSystem,omitempty"`
}

type ApplicationRouteCreateRequest

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

type ApplicationTemplate

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

Application Templates

type ApplicationTemplateCreateRequest

type ApplicationTemplateCreateRequest = ApplicationTemplate

type ApplicationTemplateCreateResponse

type ApplicationTemplateCreateResponse struct {
	Name string `json:"name"`
	ID   int    `json:"id"`
}

type ApplicationTemplateInfo

type ApplicationTemplateInfo struct {
	Microservices []interface{} `json:"microservices"`
	Routes        []interface{} `json:"routes"`
}

type ApplicationTemplateListResponse

type ApplicationTemplateListResponse struct {
	ApplicationTemplates []ApplicationTemplate
}

type ApplicationTemplateMetadataUpdateRequest

type ApplicationTemplateMetadataUpdateRequest struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

type ApplicationTemplateUpdateResponse

type ApplicationTemplateUpdateResponse = ApplicationTemplateCreateResponse

type CatalogImage

type CatalogImage struct {
	ContainerImage string `json:"containerImage"`
	AgentTypeID    int    `json:"fogTypeId"`
}

type CatalogItemCreateRequest

type CatalogItemCreateRequest struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Images      []CatalogImage `json:"images"`
	RegistryID  int            `json:"registryId"`
}

type CatalogItemCreateResponse

type CatalogItemCreateResponse struct {
	ID int `json:"id"`
}

type CatalogItemInfo

type CatalogItemInfo struct {
	ID          int            `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Images      []CatalogImage `json:"images"`
	RegistryID  int            `json:"registryId"`
	Category    string         `json:"category"`
}

type CatalogItemUpdateRequest

type CatalogItemUpdateRequest struct {
	ID          int
	Name        string         `json:"name,omitempty"`
	Description string         `json:"description,omitempty"`
	Images      []CatalogImage `json:"images,omitempty"`
	RegistryID  int            `json:"registryId,omitempty"`
}

type CatalogListResponse

type CatalogListResponse struct {
	CatalogItems []CatalogItemInfo `json:"catalogItems"`
}

type Client

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

func New

func New(opt Options) *Client

func NewAndLogin

func NewAndLogin(opt Options, email, password string) (clt *Client, err error)

func NewWithToken

func NewWithToken(opt Options, token string) (clt *Client, err error)

func RefreshUserSubscriptionKey added in v3.3.7

func RefreshUserSubscriptionKey(opt Options, email, password string) (clt *Client, err error, userResponse string)

func (*Client) CreateAgent

func (clt *Client) CreateAgent(request *CreateAgentRequest) (response CreateAgentResponse, err error)

CreateAgent creates an ioFog Agent using Controller REST API

func (*Client) CreateApplicationFromYAML

func (clt *Client) CreateApplicationFromYAML(file io.Reader) (*ApplicationInfo, error)

CreateApplicationFromYAML creates a new application using the Controller REST API It sends the yaml file to Controller REST API

func (*Client) CreateApplicationTemplateFromYAML

func (clt *Client) CreateApplicationTemplateFromYAML(file io.Reader) (*ApplicationTemplate, error)

CreateApplicationTemplateFromYAML creates a new application template using the Controller REST API It sends the yaml file to Controller REST API

func (*Client) CreateCatalogItem

func (clt *Client) CreateCatalogItem(request *CatalogItemCreateRequest) (*CatalogItemInfo, error)

CreateCatalogItem creates one catalog item using Controller REST API

func (*Client) CreateFlow

func (clt *Client) CreateFlow(name, description string) (*FlowInfo, error)

CreateFlow creates a new flow using the Controller REST API

func (*Client) CreateHTTPEdgeResource

func (clt *Client) CreateHTTPEdgeResource(request *EdgeResourceMetadata) error

CreateHttpEdgeResource creates an Edge Resource using Controller REST API

func (*Client) CreateMicroserviceFromYAML

func (clt *Client) CreateMicroserviceFromYAML(file io.Reader) (*MicroserviceInfo, error)

CreateMicroserviceFromYAML creates a new microservice using the Controller REST API It sends the yaml file to Controller REST API

func (*Client) CreateMicroservicePortMapping

func (clt *Client) CreateMicroservicePortMapping(uuid string, portMapping *MicroservicePortMappingInfo) (err error)

CreateMicroservicePortMapping creates a microservice port mapping using Controller REST API

func (*Client) CreateMicroserviceRoute

func (clt *Client) CreateMicroserviceRoute(uuid, destUUID string) (err error)

CreateMicroserviceRoute creates a microservice route using Controller REST API

func (*Client) CreateRegistry

func (clt *Client) CreateRegistry(request *RegistryCreateRequest) (int, error)

CreateRegistry creates a new registry using the Controller REST API

func (*Client) CreateRoute

func (clt *Client) CreateRoute(route *Route) (err error)

func (*Client) CreateUser

func (clt *Client) CreateUser(request User) error

create user can be removed!!

func (*Client) DeleteAgent

func (clt *Client) DeleteAgent(uuid string) error

DeleteAgent removes an ioFog Agent from the Controller using Controller REST API

func (*Client) DeleteApplication

func (clt *Client) DeleteApplication(name string) (err error)

DeleteApplication deletes an application using the Controller REST API

func (*Client) DeleteApplicationTemplate

func (clt *Client) DeleteApplicationTemplate(name string) error

func (*Client) DeleteCatalogItem

func (clt *Client) DeleteCatalogItem(id int) (err error)

DeleteCatalogItem deletes one catalog item using Controller REST API

func (*Client) DeleteEdgeResource

func (clt *Client) DeleteEdgeResource(name, version string) error

ListEdgeResources list all Edge Resources using Controller REST API

func (*Client) DeleteFlow

func (clt *Client) DeleteFlow(id int) (err error)

DeleteFlow deletes a flow using the Controller REST API

func (*Client) DeleteMicroservice

func (clt *Client) DeleteMicroservice(uuid string) (err error)

DeleteMicroservice deletes a microservice using Controller REST API

func (*Client) DeleteMicroservicePortMapping

func (clt *Client) DeleteMicroservicePortMapping(uuid string, portMapping *MicroservicePortMappingInfo) (err error)

DeleteMicroservicePortMapping deletes a microservice port mapping using Controller REST API

func (*Client) DeleteMicroserviceRoute

func (clt *Client) DeleteMicroserviceRoute(uuid, destUUID string) (err error)

DeleteMicroserviceRoute deletes a microservice route using Controller REST API

func (*Client) DeleteRegistry

func (clt *Client) DeleteRegistry(id int) (err error)

DeleteRegistry deletes a registry using the Controller REST API

func (*Client) DeleteRoute

func (clt *Client) DeleteRoute(appName, name string) (err error)

func (*Client) GetAccessToken

func (clt *Client) GetAccessToken() string

func (*Client) GetAgentByID

func (clt *Client) GetAgentByID(uuid string) (response *AgentInfo, err error)

GetAgentByID returns an ioFog Agent information using Controller REST API

func (*Client) GetAgentByName

func (clt *Client) GetAgentByName(name string, system bool) (*AgentInfo, error)

GetAgentByName retrieve the agent information by getting all agents then searching for the first occurance in the list

func (*Client) GetAgentProvisionKey

func (clt *Client) GetAgentProvisionKey(uuid string) (response GetAgentProvisionKeyResponse, err error)

GetAgentProvisionKey get a provisioning key for an ioFog Agent using Controller REST API

func (*Client) GetAllApplications

func (clt *Client) GetAllApplications() (response *ApplicationListResponse, err error)

GetAllApplications retrieve all flows information from the Controller REST API

func (*Client) GetAllFlows

func (clt *Client) GetAllFlows() (response *FlowListResponse, err error)

GetAllFlows retrieve all flows information from the Controller REST API

func (*Client) GetAllMicroservicePublicPorts

func (clt *Client) GetAllMicroservicePublicPorts() (response []MicroservicePublicPort, err error)

func (*Client) GetAllMicroservices

func (clt *Client) GetAllMicroservices() (response *MicroserviceListResponse, err error)

func (*Client) GetApplicationByName

func (clt *Client) GetApplicationByName(name string) (application *ApplicationInfo, err error)

GetApplicationByName retrieve application information using the Controller REST API

func (*Client) GetApplicationTemplate

func (clt *Client) GetApplicationTemplate(name string) (*ApplicationTemplate, error)

func (*Client) GetBaseURL

func (clt *Client) GetBaseURL() string

func (*Client) GetCatalog

func (clt *Client) GetCatalog() (response *CatalogListResponse, err error)

GetCatalog retrieves all catalog items using Controller REST API

func (*Client) GetCatalogItem

func (clt *Client) GetCatalogItem(id int) (response *CatalogItemInfo, err error)

GetCatalogItem retrieves one catalog item using Controller REST API

func (*Client) GetCatalogItemByName

func (clt *Client) GetCatalogItemByName(name string) (*CatalogItemInfo, error)

GetCatalogItemByName returns a catalog item by listing all catalog items and returning the first occurence of the specified name

func (*Client) GetDefaultRouter

func (clt *Client) GetDefaultRouter() (router Router, err error)

func (*Client) GetFlowByID

func (clt *Client) GetFlowByID(id int) (flow *FlowInfo, err error)

GetFlowByID retrieve flow information using the Controller REST API

func (*Client) GetFlowByName

func (clt *Client) GetFlowByName(name string) (_ *FlowInfo, err error)

GetFlowByName retrieve the flow information by getting all flows then searching for the first occurance in the list

func (*Client) GetHTTPEdgeResourceByName

func (clt *Client) GetHTTPEdgeResourceByName(name, version string) (response EdgeResourceMetadata, err error)

GetHttpEdgeResourceByName gets an Edge Resource using Controller REST API

func (*Client) GetMicroserviceByID

func (clt *Client) GetMicroserviceByID(uuid string) (response *MicroserviceInfo, err error)

GetMicroserviceByID retrieves a microservice information using Controller REST API

func (*Client) GetMicroserviceByName

func (clt *Client) GetMicroserviceByName(appName, name string) (response *MicroserviceInfo, err error)

GetMicroserviceByName retrieves a microservice information using Controller REST API

func (*Client) GetMicroservicePortMapping

func (clt *Client) GetMicroservicePortMapping(uuid string) (response *MicroservicePortMappingListResponse, err error)

GetMicroservicePortMapping retrieves a microservice port mappings using Controller REST API

func (*Client) GetMicroservicesByApplication

func (clt *Client) GetMicroservicesByApplication(application string) (response *MicroserviceListResponse, err error)

GetMicroservicesByApplication returns a list of microservices in a specific application using Controller REST API

func (*Client) GetMicroservicesPerFlow

func (clt *Client) GetMicroservicesPerFlow(flowID int) (response *MicroserviceListResponse, err error)

GetMicroservicesPerFlow (DEPRECATED) returns a list of microservices in a specific flow using Controller REST API

func (*Client) GetRetries

func (clt *Client) GetRetries() Retries

func (*Client) GetRoute

func (clt *Client) GetRoute(appName, name string) (route Route, err error)

func (*Client) GetStatus

func (clt *Client) GetStatus() (status ControllerStatus, err error)

func (*Client) GetVersion

func (clt *Client) GetVersion() string

func (*Client) GetVersionNumbers

func (clt *Client) GetVersionNumbers() (major, minor, patch int, err error)

func (*Client) IsApplicationTemplateCapable

func (clt *Client) IsApplicationTemplateCapable() error

func (*Client) IsEdgeResourceCapable

func (clt *Client) IsEdgeResourceCapable() error

func (*Client) LinkEdgeResource

func (clt *Client) LinkEdgeResource(request LinkEdgeResourceRequest) error

LinkEdgeResource links an Edge Resource to an Agent using Controller REST API

func (*Client) ListAgents

func (clt *Client) ListAgents(request ListAgentsRequest) (response ListAgentsResponse, err error)

ListAgents returns all ioFog Agents information using Controller REST API

func (*Client) ListApplicationTemplates

func (clt *Client) ListApplicationTemplates() (*ApplicationTemplateListResponse, error)

func (*Client) ListEdgeResources

func (clt *Client) ListEdgeResources() (response ListEdgeResourceResponse, err error)

ListEdgeResources list all Edge Resources using Controller REST API

func (*Client) ListRegistries

func (clt *Client) ListRegistries() (response RegistryListResponse, err error)

ListRegistries retrieve all registries information from the Controller REST API

func (*Client) ListRoutes

func (clt *Client) ListRoutes() (response RouteListResponse, err error)

func (*Client) Login

func (clt *Client) Login(request LoginRequest) (err error)

func (*Client) PatchApplication

func (clt *Client) PatchApplication(name string, request *ApplicationPatchRequest) (*ApplicationInfo, error)

UpdateApplication patches an application using the Controller REST API

func (*Client) PatchRoute

func (clt *Client) PatchRoute(appName, name string, route *Route) (err error)

func (*Client) PruneAgent

func (clt *Client) PruneAgent(uuid string) (err error)

PruneAgent prunes an ioFog Agent using Controller REST API

func (*Client) PutDefaultProxy

func (clt *Client) PutDefaultProxy(address string) (err error)

func (*Client) PutDefaultRouter

func (clt *Client) PutDefaultRouter(router Router) (err error)

func (*Client) PutPublicPortHost

func (clt *Client) PutPublicPortHost(protocol Protocol, host string) (err error)

func (*Client) RebootAgent

func (clt *Client) RebootAgent(uuid string) (err error)

RebootAgent reboots an ioFog Agent using Controller REST API

func (*Client) RefreshUserSubscriptionKeyCtl added in v3.3.7

func (clt *Client) RefreshUserSubscriptionKeyCtl(request LoginRequest) (err error, userSubscriptionKey string)

func (*Client) RollbackAgent

func (clt *Client) RollbackAgent(name string) error

func (*Client) SetAccessToken

func (clt *Client) SetAccessToken(token string)

func (*Client) SetRetries

func (clt *Client) SetRetries(retries Retries)

func (*Client) StartApplication

func (clt *Client) StartApplication(name string) (*ApplicationInfo, error)

StartApplication set the application as active using the Controller REST API

func (*Client) StartFlow

func (clt *Client) StartFlow(id int) (*FlowInfo, error)

StartFlow set the flow as active using the Controller REST API

func (*Client) StopApplication

func (clt *Client) StopApplication(name string) (*ApplicationInfo, error)

StopApplication set the application as inactive using the Controller REST API

func (*Client) StopFlow

func (clt *Client) StopFlow(id int) (*FlowInfo, error)

StopFlow set the flow as inactive using the Controller REST API

func (*Client) UnlinkEdgeResource

func (clt *Client) UnlinkEdgeResource(request LinkEdgeResourceRequest) error

UnlinkEdgeResource unlinks an Edge Resource from an Agent using Controller REST API

func (*Client) UpdateAgent

func (clt *Client) UpdateAgent(request *AgentUpdateRequest) (*AgentInfo, error)

UpdateAgent patches an ioFog Agent using Controller REST API

func (*Client) UpdateApplicationFromYAML

func (clt *Client) UpdateApplicationFromYAML(name string, file io.Reader) (*ApplicationInfo, error)

UpdateApplicationFromYAML updates an application using the Controller REST API It sends the yaml file to Controller REST API

func (*Client) UpdateApplicationTemplateFromYAML

func (clt *Client) UpdateApplicationTemplateFromYAML(name string, file io.Reader) (*ApplicationTemplate, error)

UpdateApplicationTemplateFromYAML updates an application template using the Controller REST API It sends the yaml file to Controller REST API

func (*Client) UpdateApplicationTemplateMetadata

func (clt *Client) UpdateApplicationTemplateMetadata(name string, newMeta *ApplicationTemplateMetadataUpdateRequest) error

func (*Client) UpdateCatalogItem

func (clt *Client) UpdateCatalogItem(request *CatalogItemUpdateRequest) (*CatalogItemInfo, error)

UpdateCatalogItem updates one catalog item using Controller REST API

func (*Client) UpdateFlow

func (clt *Client) UpdateFlow(request *FlowUpdateRequest) (*FlowInfo, error)

UpdateFlow patches a flow using the Controller REST API

func (*Client) UpdateHTTPEdgeResource

func (clt *Client) UpdateHTTPEdgeResource(name string, request *EdgeResourceMetadata) error

UpdateHttpEdgeResource updates an HTTP Based Edge Resources using Controller REST API

func (*Client) UpdateMicroserviceFromYAML

func (clt *Client) UpdateMicroserviceFromYAML(uuid string, file io.Reader) (*MicroserviceInfo, error)

UpdateMicroserviceFromYAML updates a microservice using the Controller REST API It sends the yaml file to Controller REST API

func (*Client) UpdateMicroserviceRoutes

func (clt *Client) UpdateMicroserviceRoutes(uuid string, currentRoutes, newRoutes []string) (err error)

func (*Client) UpdateRegistry

func (clt *Client) UpdateRegistry(request RegistryUpdateRequest) error

UpdateRegistry patches a registry using the Controller REST API

func (*Client) UpdateRoute

func (clt *Client) UpdateRoute(route *Route) (err error)

func (*Client) UpdateUserPassword

func (clt *Client) UpdateUserPassword(request UpdateUserPasswordRequest) (err error)

func (*Client) UpgradeAgent

func (clt *Client) UpgradeAgent(name string) error

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 ControllerStatus

type ControllerStatus struct {
	Status        string             `json:"status"`
	UptimeSeconds float64            `json:"uptimeSec"`
	Versions      ControllerVersions `json:"versions"`
}

type ControllerVersions

type ControllerVersions struct {
	Controller string `json:"controller"`
	EcnViewer  string `json:"ecnViewer"`
}

type CreateAgentRequest

type CreateAgentRequest struct {
	AgentUpdateRequest `json:",inline"`
}

type CreateAgentResponse

type CreateAgentResponse struct {
	UUID string
}

type EdgeResourceDisplay

type EdgeResourceDisplay struct {
	Name  string `json:"name,omitempty"`
	Icon  string `json:"icon,omitempty"`
	Color string `json:"color,omitempty"`
}

type EdgeResourceMetadata

type EdgeResourceMetadata struct {
	Name              string                 `json:"name,omitempty"`
	Description       string                 `json:"description,omitempty"`
	Version           string                 `json:"version,omitempty"`
	InterfaceProtocol string                 `json:"interfaceProtocol,omitempty"`
	Display           *EdgeResourceDisplay   `json:"display,omitempty"`
	Interface         HTTPEdgeResource       `json:"interface,omitempty"` // TODO: Make this generic
	OrchestrationTags []string               `json:"orchestrationTags,omitempty"`
	Custom            map[string]interface{} `json:"custom,omitempty"`
}

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 FlowCreateRequest

type FlowCreateRequest struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

type FlowCreateResponse

type FlowCreateResponse struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type FlowInfo

type FlowInfo struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	IsActivated bool   `json:"isActivated"`
	IsSystem    bool   `json:"isSystem"`
	UserID      int    `json:"userId"`
	ID          int    `json:"id"`
}

Flows - Keep for legacy

type FlowListResponse

type FlowListResponse struct {
	Flows []FlowInfo `json:"flows"`
}

type FlowUpdateRequest

type FlowUpdateRequest struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
	IsActivated *bool   `json:"isActivated,omitempty"`
	IsSystem    *bool   `json:"isSystem,omitempty"`
	ID          int     `json:"-"`
}

type GetAgentProvisionKeyResponse

type GetAgentProvisionKeyResponse struct {
	Key             string `json:"key"`
	ExpireTimeMsUTC int64  `json:"expirationTime"`
}

type HTTPEdgeResource

type HTTPEdgeResource struct {
	Endpoints []HTTPEndpoint `json:"endpoints,omitempty"`
}

type HTTPEndpoint

type HTTPEndpoint struct {
	Name   string `json:"name,omitempty"`
	Method string `json:"method,omitempty"`
	URL    string `json:"url,omitempty"`
}

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 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 LinkEdgeResourceRequest

type LinkEdgeResourceRequest struct {
	AgentUUID           string `json:"uuid"`
	EdgeResourceName    string `json:"-"`
	EdgeResourceVersion string `json:"-"`
}

type ListAgentsRequest

type ListAgentsRequest struct {
	System  bool              `json:"system"`
	Filters []AgentListFilter `json:"filters"`
}

type ListAgentsResponse

type ListAgentsResponse struct {
	Agents []AgentInfo `json:"fogs"`
}

type ListEdgeResourceResponse

type ListEdgeResourceResponse struct {
	EdgeResources []EdgeResourceMetadata `json:"edgeResources"`
}

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Totp     string `json:"totp"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken string `json:"accessToken"`
}

type MicroserviceCreateResponse

type MicroserviceCreateResponse struct {
	UUID string `json:"uuid"`
}

type MicroserviceEnvironmentInfo

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

type MicroserviceExtraHost

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

type MicroserviceInfo

type MicroserviceInfo struct {
	UUID              string                          `json:"uuid"`
	Config            string                          `json:"config"`
	Name              string                          `json:"name"`
	RootHostAccess    bool                            `json:"rootHostAccess"`
	Runtime           string                          `json:"runtime,omitempty"`
	Platform          string                          `json:"platform,omitempty"`
	RunAsUser         string                          `json:"runAsUser,omitempty"`
	CdiDevices        []string                        `json:"cdiDevices,omitempty"`
	LogSize           int                             `json:"logSize"`
	Delete            bool                            `json:"delete"`
	DeleteWithCleanup bool                            `json:"deleteWithCleanup"`
	FlowID            int                             `json:"flowId"`
	ApplicationID     int                             `json:"applicationID"`
	Application       string                          `json:"application"`
	CatalogItemID     int                             `json:"catalogItemId"`
	AgentUUID         string                          `json:"iofogUuid"`
	UserID            int                             `json:"userId"`
	RegistryID        int                             `json:"registryId"`
	Ports             []MicroservicePortMappingInfo   `json:"ports"`
	Volumes           []MicroserviceVolumeMappingInfo `json:"volumeMappings"`
	Commands          []string                        `json:"cmd"`
	Env               []MicroserviceEnvironmentInfo   `json:"env"`
	ExtraHosts        []MicroserviceExtraHost         `json:"extraHosts"`
	Status            MicroserviceStatusInfo          `json:"status"`
	Images            []CatalogImage                  `json:"images"`
}

type MicroserviceListResponse

type MicroserviceListResponse struct {
	Microservices []MicroserviceInfo
}

type MicroservicePortMappingInfo

type MicroservicePortMappingInfo struct {
	Internal int64                       `json:"internal"`
	External int64                       `json:"external"`
	Public   *MicroservicePublicPortInfo `json:"public,omitempty"`
	Proxy    *MicroserviceProxyPortInfo  `json:"proxy,omitempty"`
	Protocol string                      `json:"protocol,omitempty"`
}

type MicroservicePortMappingListResponse

type MicroservicePortMappingListResponse struct {
	PortMappings []MicroservicePortMappingInfo `json:"ports"`
}

type MicroserviceProxyPortInfo

type MicroserviceProxyPortInfo struct {
	Host     string `json:"host"`
	Port     int64  `json:"port"`
	Protocol string `json:"protocol"`
}

type MicroservicePublicPort

type MicroservicePublicPort struct {
	MicroserviceUUID string     `json:"microserviceUuid"`
	PublicPort       PublicPort `json:"publicPort"`
}

type MicroservicePublicPortInfo

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

type MicroservicePublicPortRouterInfo

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

type MicroserviceStatusInfo

type MicroserviceStatusInfo struct {
	Status            string  `json:"status"`
	StartTime         int64   `json:"startTime"`
	OperatingDuration int64   `json:"operatingDuration"`
	MemoryUsage       float64 `json:"memoryUsage"`
	CPUUsage          float64 `json:"cpuUsage"`
	ContainerID       string  `json:"containerId"`
	Percentage        float64 `json:"percentage"`
	ErrorMessage      string  `json:"errorMessage"`
}

type MicroserviceVolumeMappingInfo

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

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 NotSupportedError

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

NotSupported export

func NewNotSupportedError

func NewNotSupportedError(capability string) (err *NotSupportedError)

NewNotSupported export

func (*NotSupportedError) Error

func (err *NotSupportedError) Error() string

Error export

type Options

type Options struct {
	BaseURL *url.URL
	Retries *Retries
	Timeout int
}

type Protocol

type Protocol = string

type PublicPort

type PublicPort struct {
	Protocol string `json:"protocol"`
	Queue    string `json:"queueName"`
	Port     int    `json:"publicPort"`
}

type RegistryCreateRequest

type RegistryCreateRequest struct {
	URL          string `json:"url"`
	IsPublic     bool   `json:"isPublic"`
	Certificate  string `json:"certificate"`
	RequiresCert bool   `json:"requiresCert"`
	Username     string `json:"username"`
	Email        string `json:"email"`
	Password     string `json:"password"`
}

type RegistryCreateResponse

type RegistryCreateResponse struct {
	ID int `json:"id"`
}

type RegistryInfo

type RegistryInfo struct {
	ID           int    `json:"id"`
	URL          string `json:"url"`
	IsPublic     bool   `json:"isPublic"`
	IsSecure     bool   `json:"isSecure"`
	Certificate  string `json:"certificate"`
	RequiresCert bool   `json:"requiresCert"`
	Username     string `json:"username"`
	Email        string `json:"userEmail"`
}

Registries

type RegistryListResponse

type RegistryListResponse struct {
	Registries []RegistryInfo `json:"registries"`
}

type RegistryUpdateRequest

type RegistryUpdateRequest struct {
	URL          *string `json:"url,omitempty"`
	IsPublic     *bool   `json:"isPublic,omitempty"`
	Certificate  *string `json:"certificate,omitempty"`
	RequiresCert *bool   `json:"requiresCert,omitempty"`
	Username     *string `json:"username,omitempty"`
	Email        *string `json:"email,omitempty"`
	Password     *string `json:"password,omitempty"`
	ID           int     `json:"-"`
}

type Retries

type Retries struct {
	Timeout       int
	CustomMessage map[string]int
}
var GlobalRetriesPolicy Retries

type Route

type Route struct {
	Name                   string `json:"name"`
	Application            string `json:"application"`
	SourceMicroserviceUUID string `json:"sourceMicroserviceUuid,omitempty"`
	DestMicroserviceUUID   string `json:"destMicroserviceUuid,omitempty"`
	From                   string `json:"from"`
	To                     string `json:"to"`
}

Route still has deprecated Dest/SourceUUID for retro compatibility Prefer From and To

type RouteListResponse

type RouteListResponse struct {
	Routes []Route `json:"routes"`
}

type Router

type Router struct {
	RouterConfig
	Host string `json:"host"`
}

type RouterConfig

type RouterConfig struct {
	RouterMode      *string `json:"routerMode,omitempty" yaml:"routerMode,omitempty"`
	MessagingPort   *int    `json:"messagingPort,omitempty" yaml:"messagingPort,omitempty"`
	EdgeRouterPort  *int    `json:"edgeRouterPort,omitempty" yaml:"edgeRouterPort,omitempty"`
	InterRouterPort *int    `json:"interRouterPort,omitempty" yaml:"interRouterPort,omitempty"`
}

type TemplateVariable

type TemplateVariable struct {
	Key          string      `json:"key" yaml:"key,omitempty"`
	Description  string      `json:"description" yaml:"description,omitempty"`
	DefaultValue interface{} `json:"defaultValue,omitempty" yaml:"defaultValue,omitempty"`
	Value        interface{} `json:"value,omitempty" yaml:"value,omitempty"`
}

type UpdateConfigRequest

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

type UpdateUserPasswordRequest

type UpdateUserPasswordRequest struct {
	OldPassword string `json:"oldPassword"`
	NewPassword string `json:"newPassword"`
}

type User

type User struct {
	Name            string `json:"firstName"`
	Surname         string `json:"lastName"`
	Email           string `json:"email"`
	Password        string `json:"password"`
	SubscriptionKey string `json:"subscriptionKey"`
}

type UserResponse added in v3.3.6

type UserResponse struct {
	Name            string `json:"firstName"`
	Surname         string `json:"lastName"`
	Email           string `json:"email"`
	SubscriptionKey string `json:"subscriptionKey"`
}

Jump to

Keyboard shortcuts

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