Properties

apiUrl: any
balena: BalenaSDK
logger: {
    info: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    };
    log: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    };
    status: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    };
}

Type declaration

  • info: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    }
      • (...data): void
      • Parameters

        • Rest...data: any[]

        Returns void

      • (message?, ...optionalParams): void
      • Prints to stdout with newline.

        Parameters

        • Optionalmessage: any
        • Rest...optionalParams: any[]

        Returns void

  • log: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    }
      • (...data): void
      • Parameters

        • Rest...data: any[]

        Returns void

      • (message?, ...optionalParams): void
      • Prints to stdout with newline.

        Parameters

        • Optionalmessage: any
        • Rest...optionalParams: any[]

        Returns void

  • status: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    }
      • (...data): void
      • Parameters

        • Rest...data: any[]

        Returns void

      • (message?, ...optionalParams): void
      • Prints to stdout with newline.

        Parameters

        • Optionalmessage: any
        • Rest...optionalParams: any[]

        Returns void

pine: Pine
sshConfig: {
    host: any;
    port: any;
}

Methods - helper

  • Parameters

    • uuid: string

      The UUID of the target device

    • contains: string

      The string to look for in the logs

    • _start: number = null

      (optional) start the search from this log

    • _end: number = null

      (optional) end the search at this log

    Returns boolean

    If device logs contain the string

  • Creates application for a devicetype with the required config

    Parameters

    • name: string

      Name of the application that needs to be created

    • deviceType: string

      The device type for which application needs to be created

    • appConfig: object

      specify configuration needed for the application

    Returns Promise<void>

  • Executes the command in the targetted container of a device

    Parameters

    • command: string

      The command to be executed

    • containerName: string

      The name of the service/container to run the command in

    • uuid: string

      The UUID of the target device

    Returns string

    output of the command that is executed on the targetted container of the device

  • Executes command-line operations in the host OS of the DUT. Assuming the DUT is a managed device.

    Parameters

    • command: string

      command to be executed on the DUT

    • device: string

      local UUID of the DUT, example:${UUID}.local

    • timeout: {
          interval: number;
          tries: number;
      } = ...

      object containing details of how many times the command needs to be retried and the intervals between each command execution

      • interval: number
      • tries: number

    Returns string

    Output of the command that was exected on hostOS of the DUT

  • Downloads provided version of balenaOS for the provided deviceType using balenaSDK

    Parameters

    • versionOrRange: string = 'latest'

      The semver compatible balenaOS version that will be downloaded, example: 2.80.3+rev1. Default value: latest where latest development variant of balenaOS will be downloaded.

    • deviceType: any

      The device type for which balenaOS needs to be downloaded

    • imageType: string = ''

      Can be one of 'flasher', 'raw' or an empty string / null / undefined if wanting to use the default artifact

    • osType: string = 'default'

      Can be one of 'default', 'esr' or null to include all types

    Returns Promise<any>

    Stores the downloaded image in leviathan.downloads directory,

    Rejects promise if download fails. Retries thrice to download an image before giving up.

  • Parameters

    • uuid: string

      UUID of the device

    Returns Promise<string>

    Returns the supervisor version on a device

  • Pushes a release to an application from a given directory for managed devices

    Parameters

    • application: string

      The balena application name to push the release to

    • directory: string

      The path to the directory containing the docker-compose/Dockerfile for the application and the source files

    Returns string

    returns release commit after balena push is complete

  • Removes SSH key from balenaCloud account

    Parameters

    • label: string

      SSH key label

    Returns Promise<string | void>

  • Waits until all given services are running on the device on the provided commit

    Parameters

    • uuid: string

      The UUID of the device

    • services: any

      An array of the service names

    • commit: string

      The release commit hash that services should be on

    • retries: number = 50

      (optional) The number of attempts to retry. Retries are spaced 30s apart

    Returns boolean

    returns true if all services in the release commit are running on the device