Skip to content
psanders edited this page May 11, 2020 · 10 revisions

AppManager ⇐ FonosService

Use Fonos AppManager, a capability of Fonos Systems Manager, to create, manage, and deploy an applications. Fonos AppManager requires of a running Fonos deployment.

Kind: global class
Extends: FonosService
See: module:core:FonosService

new AppManager()

Constructs a new AppManager Object.

Example

const Fonos = require('@fonos/sdk')
const appManager = new Fonos.AppManager()

appManager.deployApp('/path/to/app')
.then(result => {
  console.log(result)             // successful response
}).catch(e => console.error(e))   // an error occurred

appManager.deployApp(path) β‡’ Promise.<App>

Deploys an application to Fonos.

Kind: instance method of AppManager
Returns: Promise.<App> - The application just created
Throws:

  • if path to application does not exist or is not a directory
  • the file package.json does not exist inside de application path
  • the file package.json is missing the name or description

Todo

  • if the file uploading fails the state of the application should change to UNKNOWN.
Param Type Description
path string path to the application

Example

const path = '/path/to/project'

appManager.deployApp(path)
.then(result => {
  console.log(result)            // returns the app object
}).catch(e => console.error(e))   // an error occurred

appManager.getApp(name) β‡’ Promise.<App>

Retrives an application by name.

Kind: instance method of AppManager
Returns: Promise.<App> - The application
Throws:

  • if name is null or application does not exist
Param Type Description
name string The name of the application

Example

appManager.getApp(name)
.then(result => {
  console.log(result)             // returns the app object
}).catch(e => console.error(e))   // an error occurred

appManager.deleteApp(name) β‡’ Promise.<App>

Deletes an application already registered in Fonos.

Kind: instance method of AppManager
Returns: Promise.<App> - The application to remove
Throws:

  • if the application is not found
Param Type Description
name string The name of the application

Example

appManager.deleteApp(name)
.then(() => {
  console.log('finished')        // returns an empty object
}).catch(e => console.error(e))  // an error occurred

appManager.listApps(request) β‡’ Promise.<ListAppsResponse>

List the applications registered in Fonos.

Kind: instance method of AppManager
Returns: Promise.<ListAppsResponse> - List of applications

Param Type Description
request Object
request.pageSize number Number of element per page (defaults to 20)
request.pageToken string The next_page_token value returned from a previous List request, if any

Example

const request = {
   pageSize: 20,
   pageToken: 2
}

appManager.listApps(request)
.then(result => {
  console.log(result)            // returns a ListAppsResponse
}).catch(e => console.error(e))  // an error occurred